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


PHP PMA_Util::clearUserCache方法代码示例

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


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

示例1: testClearUserCache

 /**
  * Test clearing user cache
  *
  * @return void
  */
 public function testClearUserCache()
 {
     $GLOBALS['server'] = 'server';
     PMA_Util::cacheSet('is_superuser', 'yes', true);
     $this->assertEquals('yes', $_SESSION['cache']['server_server']['is_superuser']);
     PMA_Util::clearUserCache();
     $this->assertArrayNotHasKey('is_superuser', $_SESSION['cache']['server_server']);
 }
开发者ID:kfjihailong,项目名称:phpMyAdmin,代码行数:13,代码来源:PMA_cache_test.php

示例2: storeUserCredentials

 /**
  * Stores user credentials after successful login.
  *
  * @return void|bool
  */
 public function storeUserCredentials()
 {
     global $cfg;
     $this->createIV();
     // Name and password cookies need to be refreshed each time
     // Duration = one month for username
     $this->storeUsernameCookie($cfg['Server']['user']);
     // Duration = as configured
     $this->storePasswordCookie($cfg['Server']['password']);
     // Set server cookies if required (once per session) and, in this case,
     // force reload to ensure the client accepts cookies
     if (!$GLOBALS['from_cookie']) {
         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
             if (!empty($GLOBALS['pma_auth_server'])) {
                 // Duration = one month for servername
                 $GLOBALS['PMA_Config']->setCookie('pmaServer-' . $GLOBALS['server'], $cfg['Server']['host']);
             } else {
                 // Delete servername cookie
                 $GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $GLOBALS['server']);
             }
         }
         // URL where to go:
         $redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
         // any parameters to pass?
         $url_params = array();
         if (mb_strlen($GLOBALS['db'])) {
             $url_params['db'] = $GLOBALS['db'];
         }
         if (mb_strlen($GLOBALS['table'])) {
             $url_params['table'] = $GLOBALS['table'];
         }
         // any target to pass?
         if (!empty($GLOBALS['target']) && $GLOBALS['target'] != 'index.php') {
             $url_params['target'] = $GLOBALS['target'];
         }
         /**
          * Clear user cache.
          */
         PMA_Util::clearUserCache();
         PMA_Response::getInstance()->disable();
         PMA_sendHeaderLocation($redirect_url . PMA_URL_getCommon($url_params, 'text'), true);
         if (!defined('TESTSUITE')) {
             exit;
         } else {
             return false;
         }
     }
     // end if
     return true;
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:55,代码来源:AuthenticationCookie.class.php

示例3: authSetUser

 /**
  * Set the user and password after last checkings if required
  *
  * @return boolean always true
  */
 public function authSetUser()
 {
     global $cfg;
     // Ensures valid authentication mode, 'only_db', bookmark database and
     // table names and relation table name are used
     if ($cfg['Server']['user'] != $GLOBALS['PHP_AUTH_USER']) {
         foreach ($cfg['Servers'] as $idx => $current) {
             if ($current['host'] == $cfg['Server']['host'] && $current['port'] == $cfg['Server']['port'] && $current['socket'] == $cfg['Server']['socket'] && $current['ssl'] == $cfg['Server']['ssl'] && $current['connect_type'] == $cfg['Server']['connect_type'] && $current['user'] == $GLOBALS['PHP_AUTH_USER']) {
                 $GLOBALS['server'] = $idx;
                 $cfg['Server'] = $current;
                 break;
             }
         }
         // end foreach
     }
     // end if
     if ($GLOBALS['cfg']['AllowArbitraryServer'] && !empty($GLOBALS['pma_auth_server'])) {
         /* Allow to specify 'host port' */
         $parts = explode(' ', $GLOBALS['pma_auth_server']);
         if (count($parts) == 2) {
             $tmp_host = $parts[0];
             $tmp_port = $parts[1];
         } else {
             $tmp_host = $GLOBALS['pma_auth_server'];
             $tmp_port = '';
         }
         if ($cfg['Server']['host'] != $GLOBALS['pma_auth_server']) {
             $cfg['Server']['host'] = $tmp_host;
             if (!empty($tmp_port)) {
                 $cfg['Server']['port'] = $tmp_port;
             }
         }
         unset($tmp_host, $tmp_port, $parts);
     }
     $cfg['Server']['user'] = $GLOBALS['PHP_AUTH_USER'];
     $cfg['Server']['password'] = $GLOBALS['PHP_AUTH_PW'];
     // Avoid showing the password in phpinfo()'s output
     unset($GLOBALS['PHP_AUTH_PW']);
     unset($_SERVER['PHP_AUTH_PW']);
     $_SESSION['last_access_time'] = time();
     $this->createBlowfishIV();
     // Name and password cookies need to be refreshed each time
     // Duration = one month for username
     $GLOBALS['PMA_Config']->setCookie('pmaUser-' . $GLOBALS['server'], $this->blowfishEncrypt($cfg['Server']['user'], $this->_getBlowfishSecret()));
     // Duration = as configured
     $GLOBALS['PMA_Config']->setCookie('pmaPass-' . $GLOBALS['server'], $this->blowfishEncrypt(!empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "ÿ(blank)", $this->_getBlowfishSecret()), null, $GLOBALS['cfg']['LoginCookieStore']);
     // Set server cookies if required (once per session) and, in this case,
     // force reload to ensure the client accepts cookies
     if (!$GLOBALS['from_cookie']) {
         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
             if (!empty($GLOBALS['pma_auth_server'])) {
                 // Duration = one month for servername
                 $GLOBALS['PMA_Config']->setCookie('pmaServer-' . $GLOBALS['server'], $cfg['Server']['host']);
             } else {
                 // Delete servername cookie
                 $GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $GLOBALS['server']);
             }
         }
         // URL where to go:
         $redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
         // any parameters to pass?
         $url_params = array();
         if (strlen($GLOBALS['db'])) {
             $url_params['db'] = $GLOBALS['db'];
         }
         if (strlen($GLOBALS['table'])) {
             $url_params['table'] = $GLOBALS['table'];
         }
         // any target to pass?
         if (!empty($GLOBALS['target']) && $GLOBALS['target'] != 'index.php') {
             $url_params['target'] = $GLOBALS['target'];
         }
         /**
          * Clear user cache.
          */
         PMA_Util::clearUserCache();
         PMA_Response::getInstance()->disable();
         PMA_sendHeaderLocation($redirect_url . PMA_URL_getCommon($url_params, '&'), true);
         if (!defined('TESTSUITE')) {
             exit;
         } else {
             return false;
         }
     }
     // end if
     return true;
 }
开发者ID:amigobv,项目名称:chat,代码行数:92,代码来源:AuthenticationCookie.class.php

示例4: authCheck


//.........这里部分代码省略.........
     /* Session name */
     $session_name = $GLOBALS['cfg']['Server']['SignonSession'];
     /* Login URL */
     $signon_url = $GLOBALS['cfg']['Server']['SignonURL'];
     /* Current host */
     $single_signon_host = $GLOBALS['cfg']['Server']['host'];
     /* Current port */
     $single_signon_port = $GLOBALS['cfg']['Server']['port'];
     /* No configuration updates */
     $single_signon_cfgupdate = array();
     /* Are we requested to do logout? */
     $do_logout = !empty($_REQUEST['old_usr']);
     /* Handle script based auth */
     if (!empty($script_name)) {
         if (!file_exists($script_name)) {
             PMA_fatalError(__('Can not find signon authentication script:') . ' ' . $script_name);
         }
         include $script_name;
         list($PHP_AUTH_USER, $PHP_AUTH_PW) = get_login_credentials($GLOBALS['cfg']['Server']['user']);
     } elseif (isset($_COOKIE[$session_name])) {
         /* Does session exist? */
         /* End current session */
         $old_session = session_name();
         $old_id = session_id();
         if (!defined('TESTSUITE')) {
             session_write_close();
         }
         /* Load single signon session */
         session_name($session_name);
         session_id($_COOKIE[$session_name]);
         if (!defined('TESTSUITE')) {
             session_start();
         }
         /* Clear error message */
         unset($_SESSION['PMA_single_signon_error_message']);
         /* Grab credentials if they exist */
         if (isset($_SESSION['PMA_single_signon_user'])) {
             if ($do_logout) {
                 $PHP_AUTH_USER = '';
             } else {
                 $PHP_AUTH_USER = $_SESSION['PMA_single_signon_user'];
             }
         }
         if (isset($_SESSION['PMA_single_signon_password'])) {
             if ($do_logout) {
                 $PHP_AUTH_PW = '';
             } else {
                 $PHP_AUTH_PW = $_SESSION['PMA_single_signon_password'];
             }
         }
         if (isset($_SESSION['PMA_single_signon_host'])) {
             $single_signon_host = $_SESSION['PMA_single_signon_host'];
         }
         if (isset($_SESSION['PMA_single_signon_port'])) {
             $single_signon_port = $_SESSION['PMA_single_signon_port'];
         }
         if (isset($_SESSION['PMA_single_signon_cfgupdate'])) {
             $single_signon_cfgupdate = $_SESSION['PMA_single_signon_cfgupdate'];
         }
         /* Also get token as it is needed to access subpages */
         if (isset($_SESSION['PMA_single_signon_token'])) {
             /* No need to care about token on logout */
             $pma_token = $_SESSION['PMA_single_signon_token'];
         }
         /* End single signon session */
         if (!defined('TESTSUITE')) {
             session_write_close();
         }
         /* Restart phpMyAdmin session */
         session_name($old_session);
         if (!empty($old_id)) {
             session_id($old_id);
         }
         if (!defined('TESTSUITE')) {
             session_start();
         }
         /* Set the single signon host */
         $GLOBALS['cfg']['Server']['host'] = $single_signon_host;
         /* Set the single signon port */
         $GLOBALS['cfg']['Server']['port'] = $single_signon_port;
         /* Configuration update */
         $GLOBALS['cfg']['Server'] = array_merge($GLOBALS['cfg']['Server'], $single_signon_cfgupdate);
         /* Restore our token */
         if (!empty($pma_token)) {
             $_SESSION[' PMA_token '] = $pma_token;
         }
         /**
          * Clear user cache.
          */
         PMA_Util::clearUserCache();
     }
     // Returns whether we get authentication settings or not
     if (empty($PHP_AUTH_USER)) {
         unset($_SESSION['LAST_SIGNON_URL']);
         return false;
     } else {
         $_SESSION['LAST_SIGNON_URL'] = $GLOBALS['cfg']['Server']['SignonURL'];
         return true;
     }
 }
开发者ID:TheBlackBloodyUnicorn,项目名称:pico_wanderblog,代码行数:101,代码来源:AuthenticationSignon.class.php

示例5: storeUserCredentials

 /**
  * Stores user credentials after successful login.
  *
  * @return void
  */
 public function storeUserCredentials()
 {
     global $cfg;
     // Name and password cookies need to be refreshed each time
     // Duration = one month for username
     $GLOBALS['PMA_Config']->setCookie('pmaUser-' . $GLOBALS['server'], $this->blowfishEncrypt($cfg['Server']['user'], $this->_getBlowfishSecret()));
     // Duration = as configured
     $GLOBALS['PMA_Config']->setCookie('pmaPass-' . $GLOBALS['server'], $this->blowfishEncrypt(!empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "ÿ(blank)", $this->_getBlowfishSecret()), null, $GLOBALS['cfg']['LoginCookieStore']);
     // Set server cookies if required (once per session) and, in this case,
     // force reload to ensure the client accepts cookies
     if (!$GLOBALS['from_cookie']) {
         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
             if (!empty($GLOBALS['pma_auth_server'])) {
                 // Duration = one month for servername
                 $GLOBALS['PMA_Config']->setCookie('pmaServer-' . $GLOBALS['server'], $cfg['Server']['host']);
             } else {
                 // Delete servername cookie
                 $GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $GLOBALS['server']);
             }
         }
         // URL where to go:
         $redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
         // any parameters to pass?
         $url_params = array();
         if (strlen($GLOBALS['db'])) {
             $url_params['db'] = $GLOBALS['db'];
         }
         if (strlen($GLOBALS['table'])) {
             $url_params['table'] = $GLOBALS['table'];
         }
         // any target to pass?
         if (!empty($GLOBALS['target']) && $GLOBALS['target'] != 'index.php') {
             $url_params['target'] = $GLOBALS['target'];
         }
         /**
          * Clear user cache.
          */
         PMA_Util::clearUserCache();
         PMA_Response::getInstance()->disable();
         PMA_sendHeaderLocation($redirect_url . PMA_generate_common_url($url_params, '&'), true);
         exit;
     }
     // end if
     return true;
 }
开发者ID:JohanArmando,项目名称:MaxCorpMedia,代码行数:50,代码来源:AuthenticationCookie.class.php


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