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


PHP role::get_manager方法代码示例

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


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

示例1: __construct

 /**
  * Template loading and setup routine.
  */
 public function __construct()
 {
     parent::__construct();
     // checke request is ajax
     $this->ajax_request = request::is_ajax();
     // Load the template
     $this->template = new View($this->template);
     if ($this->auto_render == TRUE) {
         Event::add('system.post_controller', array($this, '_render'));
     }
     /**
      * 判断用户登录情况
      */
     if (isset($_REQUEST['session_id'])) {
         $session = Session::instance($_REQUEST['session_id']);
         $manager = role::get_manager($_REQUEST['session_id']);
     } else {
         $session = Session::instance();
         $manager = role::get_manager();
     }
     /* 当前请求的URL */
     $current_url = urlencode(url::current(TRUE));
     //当前用户管理的站点的ID
     $this->site_id = site::id();
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:28,代码来源:kc_template.php

示例2: index

 function index()
 {
     //判断用户是否是已经登录状态
     $data = role::get_manager();
     if ($data['id'] > 0) {
         $data['success'] = 'true';
         $data['msg'] = 1;
     } else {
         $data['success'] = 'false';
         $data['msg'] = 1;
     }
     $username = $this->input->post('username');
     $password = $this->input->post('password');
     $secode = $this->input->post('secode');
     $remember = $this->input->post('remember');
     $data['success'] = 'false';
     //验证登录
     $manager = role::log_in($username, $password);
     if (isset($manager['username'])) {
         //判断普通账号的状态、权限
         if (!role::is_root($manager['username'])) {
             if ($manager['active'] != 1) {
                 ulog::login($manager['id'], 1);
                 $data['msg'] = Kohana::lang('o_global.account_was_locked');
             }
             $actions = role::manager_actions($manager['id'], TRUE);
             if (count($actions) < 1) {
                 ulog::login($manager['id'], 2);
                 $data['msg'] = Kohana::lang('o_global.account_permission_enough');
             }
         }
         //是否记录用户名
         if ($remember == 1) {
             cookie::set('opococ_username', $username);
         } else {
             cookie::delete('opococ_username');
         }
         //清除记录登录错误记录
         //Session::instance()->delete('login_error_count');
         //记入SESSION
         role::set_manager_session($manager);
         //记录日志
         ulog::login($manager['id']);
         $data['success'] = 'true';
         $data['msg'] = 1;
         /*if(empty($request_url))
         		{
         			remind::set(Kohana::lang('o_global.login_success'), '/index', 'success');
         		}
                    else
                    {
         			$request_url = url::base() . urldecode($request_url);
         			remind::set(Kohana::lang('o_global.login_success'), $request_url, 'success');
         		}*/
     }
     die(json_encode($data));
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:57,代码来源:user_login.php

示例3: __construct

 /**
  * Template loading and setup routine.
  */
 public function __construct()
 {
     parent::__construct();
     // checke request is ajax
     $this->ajax_request = request::is_ajax();
     // Load the template
     $this->template = new View($this->template);
     if ($this->auto_render == TRUE) {
         Event::add('system.post_controller', array($this, '_render'));
     }
     /**
      * 判断用户登录情况
      */
     if (isset($_REQUEST['session_id'])) {
         $session = Session::instance($_REQUEST['session_id']);
         $manager = role::get_manager($_REQUEST['session_id']);
     } else {
         $session = Session::instance();
         $manager = role::get_manager();
     }
     /* 当前请求的URL */
     $current_url = urlencode(url::current(TRUE));
     //zhu
     if (isset($manager['id'])) {
         $active_time = $session->get('Opococ_manager_active_time');
         //用户最后操作时间
         $session->set('Opococ_manager_active_time', time());
         //用户最后操作时间
         $login_ip = $session->get('Opococ_manager_login_ip');
         //用户登录的IP
         //操作超时
         if (time() - $active_time > Kohana::config('login.time_out')) {
             $session->delete('Opococ_manager');
             $session->delete('Opococ_manager_active_time');
             $session->delete('Opococ_manager_login_ip');
             remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
         }
         //用户IP(登录状态更换IP需要重新登录)
         $ip = tool::get_long_ip();
         if ($ip != $login_ip) {
             remind::set(Kohana::lang('o_global.login_again'), 'login?request_url=' . $current_url);
         }
         $this->manager = $manager;
         $this->manager_id = $manager['id'];
         $this->manager_name = $manager['name'];
         $this->manager_is_admin = role::is_root($manager['name']) ? 1 : $manager['is_admin'];
         $this->template->manager_data = $manager;
     } else {
         remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:54,代码来源:template.php

示例4: acl_init

 /**
  * 用户 acl对象初始化
  * @return acl
  */
 public static function acl_init()
 {
     /* 用户详情 */
     $manager = role::get_manager();
     $username = $manager["username"];
     $action_resourses = role::get_action_resources();
     // Role 权限注册表
     $acl = Acl::instance();
     $acl->add_role($username);
     for ($i = 0; $i < count($action_resourses); $i++) {
         $acl->allow($username, null, $action_resourses[$i]);
     }
     self::_cache($acl);
     return $acl;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:19,代码来源:acltool.php

示例5: change_password

 /**
  * change password
  */
 public function change_password()
 {
     if ($_POST) {
         $password = $this->input->post('password');
         $password1 = $this->input->post('password1');
         $password2 = $this->input->post('password2');
         $data = role::get_manager();
         //判断SESSION中的数据是否存在
         if ($data['id'] > 0) {
             if (strlen($password1) < 6) {
                 remind::set(Kohana::lang('o_manage.password_length_error'), 'manage/manager/change_password');
             }
             if ($password1 != $password2) {
                 remind::set(Kohana::lang('o_manage.two_pwd_not_valid'), 'manage/manager/change_password');
             } else {
                 $manager = Mymanager::instance($data['id'])->get();
                 if ($manager['password'] == md5($password)) {
                     $update_data = array();
                     $update_data['password'] = md5($password1);
                     $manager = Mymanager::instance($data['id'])->update($update_data);
                     $is_remember = isset($manager['is_remember']) ? $manager['is_remember'] : 0;
                     //验证是否记住状态
                     $manager['is_remember'] = $is_remember;
                     role::set_manager_session($manager);
                     //记录用户修改密码日志
                     ulog::change_password($this->manager_id, 1);
                     remind::set(Kohana::lang('o_global.update_success'), 'manage/manager/change_password', 'success');
                 } else {
                     //记录用户修改密码日志
                     ulog::change_password($this->manager_id);
                     remind::set(Kohana::lang('o_manage.pwd_is_incorrect'), 'manage/manager/change_password');
                 }
             }
         } else {
             remind::set(Kohana::lang('o_global.login_first'), 'login');
         }
     }
     $this->template->content = new View("manage/manager_change_password");
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:42,代码来源:manager.php

示例6: check_time_out

 protected function check_time_out()
 {
     /**
      * 判断用户登录情况
      */
     if (isset($_REQUEST['session_id'])) {
         $session = Session::instance($_REQUEST['session_id']);
         $manager = role::get_manager($_REQUEST['session_id']);
     } else {
         $session = Session::instance();
         $manager = role::get_manager();
     }
     if ($manager) {
         $active_time = $session->get('Opococ_manager_active_time');
         //用户最后操作时间
         $session->set('Opococ_manager_active_time', time());
         //用户最后操作时间
         $login_ip = $session->get('Opococ_manager_login_ip');
         //用户登录的IP
         //操作超时
         if (time() - $active_time > Kohana::config('login.time_out')) {
             $session->delete('Opococ_manager');
             $session->delete('Opococ_manager_active_time');
             $session->delete('Opococ_manager_login_ip');
             return false;
         }
         //用户IP(登录状态更换IP需要重新登录)
         $ip = tool::get_long_ip();
         if ($ip != $login_ip) {
             return false;
         }
         $this->manager = $manager;
         $this->manager_id = $manager['id'];
         $this->manager_name = $manager['name'];
         $this->manager_is_admin = $manager['is_admin'];
         $this->template->manager_data = $manager;
     } else {
         return false;
     }
     return true;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:41,代码来源:kc_browser.php

示例7: index

 /**
  * log in
  */
 function index()
 {
     $this->logout(FALSE);
     /* 原请求页面 */
     $request_url = $this->input->get('request_url');
     //用户名和密码输入错误三次后就需要输入验证码
     $login_error_count = Session::instance()->get('login_error_count');
     if (!$login_error_count) {
         $login_error_count = 1;
         Session::instance()->set('login_error_count', $login_error_count);
     }
     //判断用户是否是已经登录状态
     $data = role::get_manager();
     //D($data);
     if ($data['id'] > 0) {
         remind::set(Kohana::lang('o_global.current_status_login'), '/', 'success');
     }
     //验证码KEY
     secoder::$seKey = 'opococ.secoder';
     //错误信息
     $message = remind::get_message();
     if (empty($message)) {
         $error_display = "none";
         $error = "";
     } else {
         $error_display = "";
         $error = $message;
     }
     //登录
     if ($_POST) {
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $secode = $this->input->post('secode');
         $remember = $this->input->post('remember');
         //验证验证码
         if ($login_error_count > 3 && !secoder::check($secode)) {
             remind::set(Kohana::lang('o_global.code_input_error'), 'login');
         }
         //验证登录
         $manager = role::log_in($username, $password);
         if (isset($manager['username'])) {
             //判断普通账号的状态、权限
             if (!role::is_root($manager['username'])) {
                 if ($manager['active'] != 1) {
                     ulog::login($manager['id'], 1);
                     remind::set(Kohana::lang('o_global.account_was_locked'), 'login');
                 }
                 $actions = role::manager_actions($manager['id'], TRUE);
                 if (count($actions) < 1) {
                     ulog::login($manager['id'], 2);
                     remind::set(Kohana::lang('o_global.account_permission_enough'), 'login');
                 }
             }
             /* 是否记录用户名 */
             if ($remember == 1) {
                 cookie::set('opococ_username', $username);
             } else {
                 cookie::delete('opococ_username');
             }
             //清除记录登录错误记录
             Session::instance()->delete('login_error_count');
             //记入SESSION
             role::set_manager_session($manager);
             //记录日志
             ulog::login($manager['id']);
             if (empty($request_url)) {
                 remind::set(Kohana::lang('o_global.login_success'), '/index', 'success');
             } else {
                 $request_url = url::base() . urldecode($request_url);
                 remind::set(Kohana::lang('o_global.login_success'), $request_url, 'success');
             }
         } else {
             ulog::login();
             $login_error_count++;
             Session::instance()->set('login_error_count', $login_error_count);
             remind::set(Kohana::lang('o_global.user_and_password_error'), 'login');
         }
     }
     /* 浏览器记录的用户名 */
     $username = cookie::get('opococ_username');
     $this->template = new View('login');
     $this->template->login_error_count = $login_error_count;
     $this->template->error = $error;
     $this->template->error_display = $error_display;
     $this->template->username = $username;
     $this->template->render(TRUE);
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:90,代码来源:login.php


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