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


PHP admin_tools::VersionsAndCheckTime方法代码示例

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


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

示例1: start

 /**
  * Determine if $session_id represents a valid session and if so start the session
  *
  */
 static function start($session_id, $sessions = false)
 {
     global $langmessage, $dataDir, $wbMessageBuffer;
     static $locked_message = false;
     //get the session file
     if (!$sessions) {
         $sessions = self::GetSessionIds();
         if (!isset($sessions[$session_id])) {
             msg('hmm: ' . gp_session_cookie);
             self::cookie(gp_session_cookie);
             //make sure the cookie is deleted
             msg($langmessage['Session Expired'] . ' (timeout)');
             return false;
         }
     }
     $sess_info = $sessions[$session_id];
     //check ~ip, ~user agent ...
     if (gp_browser_auth && !empty($sess_info['uid'])) {
         $auth_uid = self::auth_browseruid();
         $auth_uid_legacy = self::auth_browseruid(true);
         //legacy option added to prevent logging users out, added 2.0b2
         if ($sess_info['uid'] != $auth_uid && $sess_info['uid'] != $auth_uid_legacy) {
             self::cookie(gp_session_cookie);
             //make sure the cookie is deleted
             msg($langmessage['Session Expired'] . ' (browser auth)');
             return false;
         }
     }
     $session_file = $dataDir . '/data/_sessions/' . $sess_info['file_name'];
     if ($session_file === false || !gpFiles::Exists($session_file)) {
         self::cookie(gp_session_cookie);
         //make sure the cookie is deleted
         msg($langmessage['Session Expired'] . ' (invalid)');
         return false;
     }
     //prevent browser caching when editing
     Header('Last-Modified: ' . gmdate('D, j M Y H:i:s') . ' GMT');
     Header('Expires: ' . gmdate('D, j M Y H:i:s', time()) . ' GMT');
     Header('Cache-Control: no-store, no-cache, must-revalidate');
     // HTTP/1.1
     Header('Cache-Control: post-check=0, pre-check=0', false);
     Header('Pragma: no-cache');
     // HTTP/1.0
     $GLOBALS['gpAdmin'] = self::SessionData($session_file, $checksum);
     //lock to prevent conflicting edits
     if (gp_lock_time > 0 && (!empty($GLOBALS['gpAdmin']['editing']) || !empty($GLOBALS['gpAdmin']['granted']))) {
         $expires = gp_lock_time;
         if (!gpFiles::Lock('admin', sha1(sha1($session_id)), $expires)) {
             msg($langmessage['site_locked'] . ' ' . sprintf($langmessage['lock_expires_in'], ceil($expires / 60)));
             $locked_message = true;
         } else {
             unset($GLOBALS['gpAdmin']['locked']);
         }
     }
     //extend cookie?
     if (isset($GLOBALS['gpAdmin']['remember'])) {
         $elapsed = time() - $GLOBALS['gpAdmin']['remember'];
         if ($elapsed > 604800) {
             //7 days
             $GLOBALS['gpAdmin']['remember'] = time();
             self::cookie(gp_session_cookie, $session_id);
         }
     }
     register_shutdown_function(array('gpsession', 'close'), $session_file, $checksum);
     self::SaveSetting();
     //make sure forms have admin nonce
     ob_start(array('gpsession', 'AdminBuffer'));
     gpOutput::$lang_values += array('cancel' => 'ca', 'update' => 'up', 'caption' => 'cp', 'Width' => 'Width', 'Height' => 'Height');
     common::LoadComponents('sortable,autocomplete,gp-admin,gp-admin-css');
     admin_tools::VersionsAndCheckTime();
     gpOutput::$inline_vars += array('gpRem' => admin_tools::CanRemoteInstall());
     //prepend messages from message buffer
     if (isset($GLOBALS['gpAdmin']['message_buffer']) && count($GLOBALS['gpAdmin']['message_buffer'])) {
         $wbMessageBuffer = array_merge($GLOBALS['gpAdmin']['message_buffer'], $wbMessageBuffer);
         unset($GLOBALS['gpAdmin']['message_buffer']);
     }
     //alias
     if (isset($_COOKIE['gp_alias'])) {
         $GLOBALS['gpAdmin']['useralias'] = $_COOKIE['gp_alias'];
     } else {
         $GLOBALS['gpAdmin']['useralias'] = $GLOBALS['gpAdmin']['username'];
     }
     return true;
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:88,代码来源:sessions.php


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