本文整理汇总了PHP中Current_User::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::init方法的具体用法?PHP Current_User::init怎么用?PHP Current_User::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PHPWS_User
<?php
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id: runtime.php 7776 2010-06-11 13:52:58Z jtickle $
*/
if (!class_exists('PHPWS_User')) {
include '../../core/conf/404.html';
exit;
}
if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'users' && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset')) {
$_SESSION['User'] = new PHPWS_User();
} elseif (!isset($_SESSION['User'])) {
Current_User::init();
if (Current_User::allowRememberMe()) {
if (PHPWS_Settings::get('users', 'allow_remember')) {
Current_User::rememberLogin();
}
}
}
Current_User::loadAuthorization($_SESSION['User']);
Current_User::getLogin();
if (Current_User::isLogged() && PHPWS_Settings::get('users', 'session_warning')) {
$lifetime = ini_get('session.gc_maxlifetime');
$path = PHPWS_SOURCE_HTTP . 'mod/users/javascript/session_check/script.min.js';
$timeout = floor($lifetime / 60);
$warning_minutes = $timeout - 5;
javascript('jquery');
\Layout::addJSHeader("<script type='text/javascript'>var sess_expirationMinutes = {$timeout};var sess_warningMinutes = {$warning_minutes};</script>" . "<script type='text/javascript' src='{$path}'></script>");
}
示例2: getLogin
public static function getLogin()
{
$user = $_SESSION['User'];
$auth = Current_User::getAuthorization();
if (empty($auth)) {
throw new Exception(t('Failed to retrieve the current authorization: %s', $_SESSION['User']->auth_script));
}
// If the current user is not verified then
// either force to authentication page or clear the user session
if (!$auth->verify()) {
// reset user session is set
if ($user->id) {
Current_User::init();
}
// if they are force login, the below will send them there
// and we will end getLogin
// if not forced, then we just continue;
$auth->forceLogin();
}
PHPWS_Core::initModClass('users', 'User_Form.php');
$login = User_Form::logBox();
if (!empty($login)) {
Layout::set($login, 'users', 'login_box', false);
}
}