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


PHP jAuth::config方法代码示例

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


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

示例1: loadConfig

 /**
  * Load the configuration of authentification, stored in the auth plugin config
  * @return array
  * @since 1.2.10
  */
 public static function loadConfig($newconfig = null)
 {
     if (self::$config === null || $newconfig) {
         if (!$newconfig) {
             $plugin = jApp::coord()->getPlugin('auth');
             if ($plugin === null) {
                 throw new jException('jelix~auth.error.plugin.missing');
             }
             $config =& $plugin->config;
         } else {
             $config = $newconfig;
         }
         if (!isset($config['session_name']) || $config['session_name'] == '') {
             $config['session_name'] = 'JELIX_USER';
         }
         if (!isset($config['persistant_cookie_path']) || $config['persistant_cookie_path'] == '') {
             if (jApp::config()) {
                 $config['persistant_cookie_path'] = jApp::urlBasePath();
             } else {
                 $config['persistant_cookie_path'] = '/';
             }
         }
         if (!isset($config['persistant_encryption_key'])) {
             if (isset(jApp::config()->coordplugin_auth) && isset(jApp::config()->coordplugin_auth['persistant_crypt_key'])) {
                 $config['persistant_crypt_key'] = trim(jApp::config()->coordplugin_auth['persistant_crypt_key']);
             } else {
                 $config['persistant_crypt_key'] = '';
             }
         }
         if (!isset($config['persistant_cookie_name'])) {
             $config['persistant_cookie_name'] = 'jauthSession';
         }
         // Read hash method configuration. If not empty, cryptPassword will use
         // the new API of PHP 5.5 (password_verify and so on...)
         $password_hash_method = isset($config['password_hash_method']) ? $config['password_hash_method'] : 0;
         if ($password_hash_method === '' || !is_numeric($password_hash_method)) {
             $password_hash_method = 0;
         } else {
             $password_hash_method = intval($password_hash_method);
         }
         if ($password_hash_method > 0) {
             require_once __DIR__ . '/password.php';
             if (!can_use_password_API()) {
                 $password_hash_method = 0;
             }
         }
         require_once __DIR__ . '/hash_equals.php';
         $password_hash_options = isset($config['password_hash_options']) ? $config['password_hash_options'] : '';
         if ($password_hash_options != '') {
             $list = '{"' . str_replace(array('=', ';'), array('":"', '","'), $config['password_hash_options']) . '"}';
             $json = new jJson(SERVICES_JSON_LOOSE_TYPE);
             $password_hash_options = @$json->decode($list);
             if (!$password_hash_options) {
                 $password_hash_options = array();
             }
         } else {
             $password_hash_options = array();
         }
         $config['password_hash_method'] = $password_hash_method;
         $config['password_hash_options'] = $password_hash_options;
         $config[$config['driver']]['password_hash_method'] = $password_hash_method;
         $config[$config['driver']]['password_hash_options'] = $password_hash_options;
         self::$config = $config;
     }
     return self::$config;
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:71,代码来源:jAuth.class.php


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