当前位置: 首页>>代码示例>>PHP>>正文


PHP Preferences::getInstance方法代码示例

本文整理汇总了PHP中Preferences::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::getInstance方法的具体用法?PHP Preferences::getInstance怎么用?PHP Preferences::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Preferences的用法示例。


在下文中一共展示了Preferences::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_login

 public function get_login()
 {
     $userDB = UserDB::getInstance();
     if (!is_object($userDB)) {
         return NULL;
     }
     $prefs = Preferences::getInstance();
     $config = $prefs->get('AuthMethod', 'Auto');
     if (array_key_exists('login', $_POST) && array_key_exists('uselogin', $config) && $config['uselogin'] == '1') {
         $this->login = $_POST['login'];
     } else {
         $this->login = 'u' . gen_unique_string();
     }
     $u = new User();
     $u->setAttribute('login', $this->login);
     $u->setAttribute('password', $u->getAttribute('login'));
     $u->setAttribute('displayname', 'user ' . $u->getAttribute('login'));
     if ($userDB->add($u)) {
         $user = $userDB->import($u->getAttribute('login'));
     } else {
         Logger::error('main', 'AuthMethod::Auto::get_login failed to add user ' . $u->getAttribute('login'));
         return NULL;
     }
     if (!is_object($user)) {
         return NULL;
     }
     $this->login = $user->getAttribute('login');
     return $this->login;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:29,代码来源:Auto.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $a_pref = $prefs->get('UserGroupDB', 'activedirectory');
     if (is_array($a_pref)) {
         foreach ($a_pref as $k => $v) {
             $this->preferences[$k] = $v;
         }
     }
     // Generate parent (ldap) settings
     $this->preferences['filter'] = '(objectClass=group)';
     $this->preferences['match'] = array('name' => 'name', 'description' => 'description');
     $this->preferences['group_match_user'] = array('user_field', 'group_field');
     $this->preferences['user_field'] = 'memberOf';
     $this->preferences['user_field_type'] = 'group_dn';
     $this->preferences['group_field'] = 'member';
     $this->preferences['group_field_type'] = 'user_dn';
     $this->preferences['ou'] = '';
     if (array_key_exists('use_child_group', $this->preferences)) {
         if (in_array($this->preferences['use_child_group'], array(1, '1'))) {
             $this->preferences['user_field'] .= ':1.2.840.113556.1.4.1941:';
             $this->preferences['group_field'] .= ':1.2.840.113556.1.4.1941:';
         }
     }
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:29,代码来源:activedirectory.php

示例3: callMethod

 public static function callMethod($method_name_, $type_, $element_ = NULL, $group_ = NULL)
 {
     Logger::debug('main', "Abstract_Liaison::callMethod ('{$method_name_}', '{$type_}', '{$element_}', '{$group_}')");
     if ($type_ != 'UsersGroup') {
         $method_to_call = array('Abstract_Liaison_sql', $method_name_);
         $class_to_use = 'Abstract_Liaison_sql';
     } else {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             Logger::error('main', 'Abstract_Liaison::load get Preferences failed');
             return NULL;
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserGroupDB', $mods_enable)) {
             Logger::error('main', 'Abstract_Liaison::load UserGroupDB module must be enabled');
             return NULL;
         }
         $mod_usergroup_name = 'UserGroupDB_' . $prefs->get('UserGroupDB', 'enable');
         $liaison_type = call_user_func(array($mod_usergroup_name, 'liaisonType'));
         $method_to_call = array('Abstract_Liaison_' . $liaison_type, $method_name_);
         $class_to_use = 'Abstract_Liaison_' . $liaison_type;
     }
     if (!method_exists($class_to_use, $method_name_)) {
         Logger::error('main', "Abstract_Liaison::callMethod method '{$method_to_call}' does not exist");
         return NULL;
     }
     return call_user_func($method_to_call, $type_, $element_, $group_);
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:28,代码来源:Abstract_Liaison.class.php

示例4: __construct

 public function __construct()
 {
     $this->prefs = Preferences::getInstance();
     if (!$this->prefs) {
         Logger::critical('main', 'SessionManagement::__construct - get Preferences failed');
         throw_response(INTERNAL_ERROR);
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:8,代码来源:SessionManagement.php

示例5: __construct

 public function __construct()
 {
     $prefs = Preferences::getInstance();
     $sql_conf = $prefs->get('general', 'sql');
     if (is_array($sql_conf)) {
         $this->table = $sql_conf['prefix'] . 'user';
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:8,代码来源:sql.php

示例6: __construct

 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $this->config = $prefs->get('UserDB', 'ldap');
     $this->cache_users = array();
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:9,代码来源:ldap.php

示例7: __construct

 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $this->config = $prefs->get('UserGroupDB', 'sql_external');
     } else {
         die_error('USERGROUPDB::MYSQL_external::construct get Prefs failed', __FILE__, __LINE__);
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:9,代码来源:sql_external.php

示例8: __construct

 public function __construct($array_env)
 {
     $this->search_item = '';
     $this->search_fields = array('login');
     if (array_keys_exists_not_empty(array('search_item'), $array_env) && isset($array_env['search_fields'])) {
         $this->search_item = $array_env['search_item'];
         $this->search_fields = $array_env['search_fields'];
     }
     $prefs = Preferences::getInstance();
     $this->search_limit = $prefs->get('general', 'max_items_per_page');
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:11,代码来源:UsersList.class.php

示例9: send_alert_mail

function send_alert_mail($subject_, $message_)
{
    $prefs = Preferences::getInstance();
    if (!$prefs) {
        die_error('get Preferences failed', __FILE__, __LINE__);
    }
    $tos = $prefs->get('events', 'mail_to');
    foreach ($tos as $to) {
        sendamail($to, $subject_, $message_);
    }
}
开发者ID:bloveing,项目名称:openulteo,代码行数:11,代码来源:mail.inc.php

示例10: __construct

 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $sql_conf = $prefs->get('general', 'sql');
         if (is_array($sql_conf)) {
             $this->table = $sql_conf['prefix'] . UserGroupDBDynamicCached_internal::$tablename;
         } else {
             $this->table = NULL;
         }
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:12,代码来源:internal.php

示例11: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
             return false;
         }
         $sql_conf = $prefs->get('general', 'sql');
         self::newInstance($sql_conf);
     }
     return self::$instance;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:13,代码来源:SQL.class.php

示例12: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserDB', $mods_enable)) {
             die_error(_('UserDB module must be enabled'), __FILE__, __LINE__);
         }
         $mod_app_name = 'UserDB_' . $prefs->get('UserDB', 'enable');
         self::$instance = new $mod_app_name();
     }
     return self::$instance;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:16,代码来源:UserDB.php

示例13: get_domain

function get_domain()
{
    $prefs = Preferences::getInstance();
    $buf = $prefs->get('UserDB', 'enable');
    if ($buf == 'activedirectory') {
        $buf = $prefs->get('UserDB', 'activedirectory');
        return $buf['domain'];
    }
    if ($buf == 'ldap') {
        $buf = $prefs->get('UserDB', 'ldap');
        if (isset($buf['ad']) && $buf['ad'] == 1) {
            return $buf['host'];
        }
    }
    return NULL;
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:16,代码来源:domain.php

示例14: toConfigElement

 public function toConfigElement()
 {
     $prefs = Preferences::getInstance();
     $settings = $prefs->getElements($this->key, $this->container);
     if (is_array($settings) == false) {
         Logger::error('main', 'User_Preferences::toConfigElement prefs(' . $this->key . ',' . $this->container . ') is not an array');
         return null;
     }
     if (array_key_exists($this->element_id, $settings) == false) {
         Logger::error('main', 'User_Preferences::toConfigElement \'' . $this->element_id . '\' not in prefs(' . $this->key . ',' . $this->container . ') is not an array');
         return null;
     }
     $a_setting = clone $settings[$this->element_id];
     $a_setting->content = $this->value;
     return $a_setting;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:16,代码来源:User_Preferences.class.php

示例15: __construct

 public function __construct($id_, $name_, $description_, $url_)
 {
     Logger::debug('main', "Application_weblink::construct('{$id_}','{$name_}','{$description_}','{$url_}')");
     parent::__construct($id_, $name_, $description_, 'weblink', $url_, NULL, NULL, NULL, true, $name_ . '.weblink');
     // executable_path <=> url;
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $mods_enable = $prefs->get('general', 'module_enable');
     if (!in_array('ApplicationDB', $mods_enable)) {
         die_error('Module ApplicationDB must be enabled', __FILE__, __LINE__);
     }
     $default_browser = $prefs->get('general', 'default_browser');
     if (!is_array($default_browser)) {
         Logger::error('main', 'Application_weblink::construct failed to get default_browser preferences');
     }
     $this->default_browser = $default_browser;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:19,代码来源:Application_weblink.class.php


注:本文中的Preferences::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。