本文整理汇总了PHP中CWebUser::data方法的典型用法代码示例。如果您正苦于以下问题:PHP CWebUser::data方法的具体用法?PHP CWebUser::data怎么用?PHP CWebUser::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWebUser
的用法示例。
在下文中一共展示了CWebUser::data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefault
public static function setDefault()
{
self::$data = array('alias' => ZBX_GUEST_USER, 'userid' => 0, 'lang' => 'en_gb', 'type' => '0', 'node' => array('name' => '- unknown -', 'nodeid' => 0));
}
示例2: setDefault
public static function setDefault()
{
self::$data = array('alias' => ZBX_GUEST_USER, 'userid' => 0, 'lang' => 'en_gb', 'type' => '0', 'debug_mode' => false);
}
示例3: checkAuthentication
/**
* Check if session id is authenticated.
*
* @param string $sessionid session id
*
* @return array an array of user data
*/
public function checkAuthentication($sessionid)
{
global $ZBX_LOCALNODEID;
// access DB only once per page load
if (!is_null(self::$userData)) {
return self::$userData;
}
$time = time();
$userInfo = DBfetch(DBselect('SELECT u.userid,u.autologout,s.lastaccess' . ' FROM sessions s,users u' . ' WHERE s.sessionid=' . zbx_dbstr($sessionid) . ' AND s.status=' . ZBX_SESSION_ACTIVE . ' AND s.userid=u.userid' . ' AND (s.lastaccess+u.autologout>' . $time . ' OR u.autologout=0)' . andDbNode('u.userid', $ZBX_LOCALNODEID)));
if (!$userInfo) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('Session terminated, re-login, please.'));
}
// don't check permissions on the same second
if ($time != $userInfo['lastaccess']) {
if (!check_perm2system($userInfo['userid'])) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('No permissions for system access.'));
}
if ($userInfo['autologout'] > 0) {
DBexecute('DELETE FROM sessions WHERE userid=' . $userInfo['userid'] . ' AND lastaccess<' . (time() - $userInfo['autologout']));
}
DBexecute('UPDATE sessions SET lastaccess=' . time() . ' WHERE userid=' . $userInfo['userid'] . ' AND sessionid=' . zbx_dbstr($sessionid));
}
$dbAccess = DBfetch(DBselect('SELECT MAX(g.gui_access) AS gui_access' . ' FROM usrgrp g,users_groups ug' . ' WHERE ug.userid=' . $userInfo['userid'] . ' AND g.usrgrpid=ug.usrgrpid'));
if (!zbx_empty($dbAccess['gui_access'])) {
$guiAccess = $dbAccess['gui_access'];
} else {
$guiAccess = GROUP_GUI_ACCESS_SYSTEM;
}
$userData = $this->_getUserData($userInfo['userid']);
$userData['sessionid'] = $sessionid;
$userData['gui_access'] = $guiAccess;
CWebUser::$data = self::$userData = $userData;
return $userData;
}