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


PHP CacheManager::getUser方法代码示例

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


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

示例1: __construct

 public function __construct($request, $response)
 {
     parent::__construct($request, $response);
     //$this->checkAllowIP();
     $role_id = $this->isAdmin();
     if ($role_id < 1) {
         return $this->redirect('admin/login/index');
     }
     if ($GLOBALS['user_id'] > 0) {
         $user = CacheManager::getUser();
         $uri = addslashes(@$_SERVER['REQUEST_URI']);
         if (Util::filterOnlineUrl($uri)) {
             $update_time = 0;
             $key = 'last_time_' . $GLOBALS['user_id'];
             $time = CacheManager::cache_get($key, 0);
             if ($time > 0) {
                 $update_time = TIMESTAMP - $time;
             }
             if ($update_time < 0) {
                 $update_time = 0;
             }
             Model::factory('App')->updateAdminOnline($GLOBALS['user_id'], $uri, Util::getIP(), $update_time, addslashes(json_encode(@$_REQUEST)));
             CacheManager::cache_set($key, TIMESTAMP);
         }
     }
 }
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:26,代码来源:AdminController.php

示例2: login

 public function login($user_id)
 {
     $user = CacheManager::getUser($user_id);
     if ($user) {
         $GLOBALS['user_id'] = $user_id;
         Cookie::set('user_id', $user_id);
     }
     return $user;
 }
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:9,代码来源:BaseController.php

示例3: initApp

 public function initApp(&$obj)
 {
     $sessionKey = $obj->req('sessionKey');
     $obj->income = Util::up_decode($sessionKey);
     if ($obj->income && $obj->income['u'] > 0) {
         $obj->uid = $obj->income['u'];
         $obj->user = CacheManager::getUser($obj->uid);
         if (!isset($obj->income['l'])) {
             $obj->income['l'] = $obj->user->locale;
         }
         $obj->locale = $obj->getLocale($obj->income['l']);
         $obj->lang = $obj->getLang($obj->locale);
         $obj->mobile = $obj->income['m'] == 1 ? true : false;
         $obj->login($obj->uid);
     } else {
         if ($GLOBALS['user_id'] > 0) {
             $obj->uid = $GLOBALS['user_id'];
             $obj->user = CacheManager::getUser($obj->uid);
             if (!$obj->user) {
                 $GLOBALS['user_id'] = 0;
                 $obj->uid = 0;
                 $obj->locale = $obj->getLocale(Util::determineLang());
                 $obj->lang = $obj->getLang($obj->locale);
             } else {
                 $obj->locale = $obj->getLocale($obj->user->locale);
                 $obj->lang = $obj->getLang($obj->locale);
             }
         } else {
             $obj->locale = $obj->getLocale(Util::determineLang());
             $obj->lang = $obj->getLang($obj->locale);
         }
     }
     if ($obj->uid > 0) {
         $uri = addslashes(@$_SERVER['REQUEST_URI']);
         if (Util::filterOnlineUrl($uri)) {
             $update_time = 0;
             $key = 'last_time_' . $obj->uid;
             $time = CacheManager::cache_get($key, 0);
             if ($time > 0) {
                 $update_time = TIMESTAMP - $time;
             }
             if ($update_time < 0) {
                 $update_time = 0;
             }
             Model::factory('App')->updateUserOnline($obj->uid, $uri, Util::getIP(), $update_time);
             CacheManager::cache_set($key, TIMESTAMP);
         }
     }
 }
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:49,代码来源:AppController.php

示例4: action_user_post

 public function action_user_post()
 {
     $user_id = intval($this->request->query('uid'));
     $user = $this->request->post('user');
     $password = $this->request->post('password');
     if ($user_id < 1) {
         //添加
         $this->checkFunction('UserManage', "add");
         if (!empty($password)) {
             $salt = substr(uniqid(rand()), -6);
             $user['deviceid'] = $user['username'];
             $user['user_salt'] = $salt;
             $user['password'] = Util::password($password, $salt);
         }
         $user['login_ip'] = Util::getIP();
         $user['login_times'] = TIMESTAMP;
         $result = Model::factory('Sys')->insertUser($user);
     } else {
         //修改
         $this->checkFunction('UserManage', "edit");
         $u = CacheManager::getUser($user_id);
         if (!empty($password)) {
             $user['password'] = Util::password($password, $u->user_salt);
         }
         Model::factory('Sys')->updateUser($user_id, $user);
     }
     CacheManager::removeUser($user_id);
     $DATA = array();
     $DATA['uid'] = $user_id;
     $DATA['user'] = CacheManager::getUser($user_id);
     $DATA['user_right'] = $this->funcOp('UserManage');
     View::set_global('title', $user_id > 0 ? '修改用户' : '添加用户');
     return $this->iframeView('admin/sys/user_op', $DATA);
 }
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:34,代码来源:Sys.php

示例5:

echo RESOURCE;
?>
images/t.gif" /> 关闭所有选项卡</a>
				<i></i>
				<a href="#" class="cancel"><img src="<?php 
echo RESOURCE;
?>
images/t.gif" /> 取消操作</a>
			</div>
			<div class="mheader miniheader clearfix">
				<div class="header-nav">
					<img src="<?php 
echo RESOURCE;
?>
images/ico/admin.gif" width="16px" height="16px" /> <?php 
echo CacheManager::getUser()->nickname;
?>
 
					<a href="<?php 
echo BASEURI;
?>
admin/login/logout"><img src="<?php 
echo RESOURCE;
?>
images/ico/exit.png" /> 退出系統</a>
				</div>
				<div class="header-logo"><img src="<?php 
echo RESOURCE;
?>
images/t.gif" height="35px" alt="LOGO" class="logo" /></div>
			</div>
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:31,代码来源:main.php


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