本文整理汇总了PHP中Current_User::allowRememberMe方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::allowRememberMe方法的具体用法?PHP Current_User::allowRememberMe怎么用?PHP Current_User::allowRememberMe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::allowRememberMe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userForm
public static function userForm(PHPWS_User $user, $message = NULL)
{
require_once PHPWS_SOURCE_DIR . 'core/class/Time.php';
javascript('jquery');
$form = new PHPWS_Form();
$form->addHidden('module', 'users');
$form->addHidden('action', 'user');
$form->addHidden('command', 'my_page');
$form->addHidden('subcommand', 'postUser');
if (Current_User::allow('users') || $user->display_name == $user->username) {
$form->addText('display_name', $user->display_name);
$form->setClass('display_name', 'form-control');
$form->setLabel('display_name', dgettext('users', 'Display Name'));
} else {
$form->addTplTag('DISPLAY_NAME_LABEL', dgettext('users', 'Display Name'));
$tpl['DISPLAY_NAME'] = javascript('slider', array('link' => $user->display_name, 'id' => 'name-info', 'message' => dgettext('users', 'Once you change your display name, you may not change it again until reset by the site administrator.')));
}
if ($user->canChangePassword()) {
$form->addPassword('password1');
$form->setAutoComplete('password1');
$form->setClass('password1', 'form-control');
$form->addPassword('password2');
$form->setAutoComplete('password2');
$form->setClass('password2', 'form-control');
$form->setTitle('password2', dgettext('users', 'Password confirm'));
$form->setLabel('password1', dgettext('users', 'Password'));
} else {
$tpl['PASSWORD1_LABEL'] = dgettext('users', 'Password');
$tpl['PASSWORD1'] = javascript('slider', array('link' => dgettext('users', 'Why can\'t I change my password?'), 'id' => 'pw-info', 'message' => dgettext('users', 'Your account is authorized external to this site. You will need to update it at the source.')));
}
$form->addText('email', $user->getEmail());
$form->setSize('email', 40);
$form->setLabel('email', dgettext('users', 'Email Address'));
$form->setClass('email', 'form-control');
if (isset($tpl)) {
$form->mergeTemplate($tpl);
}
$tz_list = PHPWS_Time::getTZList();
$timezones['server'] = dgettext('users', '-- Use server\'s time zone --');
foreach ($tz_list as $tz) {
if (!empty($tz['codes'])) {
$timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['codes'][0]);
} elseif (!empty($tz['city'])) {
$timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['city'][0]);
} else {
$timezones[$tz['id']] = $tz['id'];
}
}
if (isset($_REQUEST['timezone'])) {
$user_tz = $_REQUEST['timezone'];
} else {
$user_tz = PHPWS_Cookie::read('user_tz');
}
$form->addSelect('timezone', $timezones);
$form->setLabel('timezone', dgettext('users', 'Time Zone'));
$form->setMatch('timezone', $user_tz);
$form->setClass('timezone', 'form-control');
if (isset($_REQUEST['dst']) && $_REQUEST['timezone'] != 'server') {
$dst = $_REQUEST['dst'];
} else {
$dst = PHPWS_Cookie::read('user_dst');
}
$form->addCheckbox('dst', 1);
$form->setMatch('dst', $dst);
$form->setLabel('dst', dgettext('users', 'Use Daylight Savings Time'));
if (isset($_POST['cp'])) {
$cp = (int) $_POST['cp'];
} else {
$cp = (int) PHPWS_Cookie::read('user_cp');
}
if (Current_User::allowRememberMe()) {
// User must authorize locally
if ($_SESSION['User']->authorize == 1) {
$form->addCheckbox('remember_me', 1);
if (PHPWS_Cookie::read('remember_me')) {
$form->setMatch('remember_me', 1);
}
$form->setLabel('remember_me', dgettext('users', 'Remember me'));
}
}
$form->addHidden('userId', $user->getId());
$form->addSubmit('submit', dgettext('users', 'Update my information'));
$form->setClass('submit', 'btn btn-primary');
if (!DISABLE_TRANSLATION && !FORCE_DEFAULT_LANGUAGE) {
$language_file = PHPWS_Core::getConfigFile('users', 'languages.php');
if ($language_file) {
include $language_file;
$form->addSelect('language', $languages);
$form->setClass('language', 'form-control');
$form->setLabel('language', dgettext('users', 'Language preference'));
if (isset($_COOKIE['phpws_default_language'])) {
$language = preg_replace('/\\W/', '', $_COOKIE['phpws_default_language']);
$form->setMatch('language', $language);
}
}
}
$template = $form->getTemplate();
if (isset($message)) {
foreach ($message as $tag => $error) {
$template[$tag] = $error;
//.........这里部分代码省略.........
示例2: 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>");
}