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


PHP Current_User::init方法代码示例

本文整理汇总了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>");
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:30,代码来源:runtime.php

示例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);
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:25,代码来源:Current_User.php


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