• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP role类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: add

 /**
  * 添加
  */
 public function add()
 {
     $this->site_ids = role::check('role_edit');
     if ($_POST) {
         //标签过滤
         tool::filter_strip_tags($_POST);
         $name = $this->input->post('name');
         $role = Myrole::instance()->get_by_name($name);
         $parent_id = $this->input->post('parent_id');
         if ($role['id']) {
             remind::set(Kohana::lang('o_manage.group_has_exist'), 'manage/role/add');
         }
         if ($parent_id > 0) {
             $role = Myrole::instance($parent_id)->get();
             //zhu add
             if ($role['type'] != $this->input->post('type')) {
                 remind::set(Kohana::lang('o_manage.parent_group_type_not_match'), 'manage/role/add');
             }
             $_POST['level_depth'] = $role['level_depth'] + 1;
         } else {
             $_POST['level_depth'] = 1;
         }
         if (Myrole::instance()->add($_POST)) {
             remind::set(Kohana::lang('o_global.add_success'), 'manage/role', 'success');
         } else {
             remind::set(Kohana::lang('o_global.add_error'), 'manage/role/add');
         }
     }
     $roles = Myrole::instance()->roles();
     $this->template->content = new View("manage/role_add");
     $this->template->content->roles = $roles;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:35,代码来源:role.php


示例2: do_active

 /**
  * 改变状态
  */
 function do_active($id)
 {
     //权限验证
     role::check('user_charge');
     if (!$id) {
         remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
     }
     $db = Database::instance();
     $data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false));
     if ($data['id'] <= 0 || $data['status'] > 0) {
         remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
     }
     $logodata = array();
     $logodata['manager_id'] = $this->manager_id;
     $logodata['ip'] = tool::get_str_ip();
     $logodata['user_log_type'] = 27;
     $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()';
     $logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money'];
     $sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' ";
     if ($db->query($sql)) {
         //充值用户Money
         $sql_reward = "UPDATE users \r\n                            SET user_money = user_money+" . $data['price'] . "\r\n                            WHERE id='" . $data['user_id'] . "'\r\n                          ";
         $db->query($sql_reward);
         //操作log
         ulog::add($logodata);
         remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success');
     } else {
         //操作log
         ulog::add($logodata, 1);
         remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:35,代码来源:user_charge.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));
     //当前用户管理的站点的ID
     $this->site_id = site::id();
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:28,代码来源:kc_template.php


示例4: index

 public function index()
 {
     role::check('user_charge_orders');
     /* 初始化默认查询条件 */
     $user_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => "DESC"), 'limit' => array('per_page' => 20, 'offset' => 0));
     /* 用户列表模板 */
     $this->template->content = new View("user/user_charge_orders");
     /* 搜索功能 */
     $search_arr = array('order_num');
     $search_value = $this->input->get('search_value');
     $where_view = array();
     $user_query_struct['like']['order_num'] = $search_value;
     //$user_query_struct['like']['ret_order_num'] = $search_value;
     $where_view['search_value'] = $search_value;
     /* 每页显示条数 */
     $per_page = controller_tool::per_page();
     $user_query_struct['limit']['per_page'] = $per_page;
     /* 调用分页 */
     $this->pagination = new Pagination(array('total_items' => User_chargeService::get_instance()->query_count($user_query_struct), 'items_per_page' => $per_page));
     //d($this->pagination->sql_offset);
     $user_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $users = User_chargeService::get_instance()->lists($user_query_struct);
     $userobj = user::get_instance();
     foreach ($users as $key => $rowuser) {
         $users[$key]['userinfo'] = $userobj->get($rowuser['user_id']);
     }
     /* 调用列表 */
     $this->template->content->user_list = $users;
     $this->template->content->where = $where_view;
     $this->template->content->pay_banks = Kohana::config('pay_banks');
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:31,代码来源:user_charge_orders.php


示例5: __construct

 public function __construct()
 {
     role::check('site_seo');
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:8,代码来源:seo_manage.php


示例6: __construct

 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request()) {
         $this->template = new View('layout/default_json');
     }
     role::check('order_edit');
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:8,代码来源:order_product.php


示例7: 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


示例8: __construct

 public function __construct()
 {
     role::check('product_inquiry');
     $this->package_name = 'product';
     $this->class_name = strtolower(substr(__CLASS__, 0, strpos(__CLASS__, '_')));
     parent::__construct();
     if ($this->is_ajax_request()) {
         $this->template = new View('layout/default_json');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:10,代码来源:productinquiry.php


示例9: __construct

 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
     role::check('orders');
     $this->order_basic_obj = OrderBasic::instance();
     $this->order_detail_obj = OrderDetail::instance();
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:10,代码来源:order.php


示例10: init

 public static function init()
 {
     if (!isset(self::$roles)) {
         $qry = DBFactory::getDBQuery();
         $qry->execute('select rol_id,rol_name, rol_descr from kb3_roles where rol_site=\'' . KB_SITE . "' order by rol_name");
         while ($row = $qry->getRow()) {
             self::$roles['keys'][$row['rol_name']] = $row['rol_descr'];
             self::$roles['hard'][$row['rol_name']] = $row['rol_descr'];
         }
         role::register('admin', 'Basic Admin Role');
     }
 }
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:12,代码来源:class.role.php


示例11: batch_delete

 /**
  * 批量删除支付方式
  */
 public function batch_delete()
 {
     //初始化返回数据
     $return_data = array();
     //请求结构体
     $request_data = array();
     /* 可管理的站点ID列表 */
     role::check('manage_payment_type');
     try {
         $payment_type_ids = $this->input->post('payment_type_id');
         if (is_array($payment_type_ids) && count($payment_type_ids) > 0) {
             /* 初始化默认查询条件 */
             $query_struct = array('where' => array('id' => $payment_type_ids), 'like' => array(), 'limit' => array('per_page' => 300, 'offset' => 0));
             $payment_types = Mypayment_type::instance()->query_assoc($query_struct);
             /* 删除失败的 */
             $failed_payment_type_names = '';
             /* 执行操作 */
             foreach ($payment_types as $key => $payment_type) {
                 if (!Mypayment_type::instance($payment_type['id'])->delete()) {
                     $failed_payment_type_names .= ' | ' . $payment_type['name'];
                 }
             }
             if (empty($failed_payment_type_names)) {
                 throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_success'), 403);
             } else {
                 /* 中转提示页面的停留时间 */
                 $return_struct['action']['time'] = 10;
                 $failed_payment_type_names = trim($failed_payment_type_names, ' | ');
                 throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_error', $failed_payment_type_names), 403);
             }
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403);
         }
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template = new View('layout/empty_html');
             $this->template->content = $return_struct['msg'];
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             /* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             /* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:56,代码来源:payment_type.php


示例12: login

function login($obj)
{
    $name = isset($obj->name) ? $obj->name : '';
    $password = isset($obj->password) ? $obj->password : '';
    $rememberme = isset($obj->rememberme) ? $obj->rememberme : false;
    $user = new user();
    $listUser = $user->getbynameandpassword($name, $password);
    if (count($listUser) > 0) {
        $role = new role();
        $_SESSION['id'] = $listUser[0]->id;
        $_SESSION['name'] = $listUser[0]->name;
        $_SESSION['group_id'] = $listUser[0]->group_id;
        $_SESSION['role'] = $role->getbyid($listUser[0]->group_id);
        if ($rememberme) {
            setcookie("tasktrack", "id=" . $listUser[0]->id, time() + 86400, "/");
        }
        return array("status" => "success", "msg" => "Login Successful");
    } else {
        return array("status" => "warning", "msg" => "Your User name and password is incorrect!");
    }
}
开发者ID:eldianmartin,项目名称:TaskTrack,代码行数:21,代码来源:index.php


示例13: index

 /**
  * 列表
  */
 public function index()
 {
     $this->template->content = new View("manage/action_list");
     $actions = Myaction::instance()->actions();
     //用户可管理权限资源的ID
     $user_action_ids = role::get_action_ids();
     foreach ($actions as $key => $value) {
         if (!in_array($value['id'], $user_action_ids)) {
             unset($actions[$key]);
         }
     }
     $this->template->content->actions = $actions;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:16,代码来源:action.php


示例14: __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


示例15: index

 public function index()
 {
     role::check('card_system_manage');
     $per_page = controller_tool::per_page();
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('order' => 'ASC'), 3 => array('order' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $query_struct = array('where' => array(), 'orderby' => $orderby, 'limit' => array('per_page' => $per_page, 'offset' => 0));
     $total = $this->cardLogDao->count_items_with_condition($query_struct['where']);
     $this->pagination = new Pagination(array('base_url' => url::current(), 'uri_segment' => 'page', 'total_items' => $total, 'items_per_page' => $per_page, 'style' => 'digg'));
     $query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $cardLogList = $this->cardLogDao->lists($query_struct);
     $this->template->content = new View("card/card_log_list");
     $this->template->content->data = $cardLogList;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:14,代码来源:card_log.php


示例16: __construct

 /**
  * 构造方法
  */
 public function __construct()
 {
     $package_name = substr(dirname(__FILE__), strlen(APPPATH . 'controllers/'));
     empty($package_name) && ($package_name = 'default');
     $this->package_name = $package_name;
     $this->class_name = strtolower(substr(__CLASS__, 0, strpos(__CLASS__, '_')));
     $this->phprpc_server = Kohana::config('phprpc.remote.statking.host');
     $this->site_ids = role::get_site_ids();
     $this->site_id = site::id();
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:17,代码来源:fromsite.php


示例17: index

 public function index()
 {
     /* 初始化默认查询条件 */
     $newsletter_query_struct = array('where' => array('user_id' => 0), 'like' => array(), 'orderby' => array(), 'limit' => array('per_page' => 20, 'offset' => 0));
     /* 权限检查 得到所有可管理站点ID列表 */
     $site_id_list = role::check('newsletter');
     /* Newsletter列表模板 */
     $this->template->content = new View("user/newsletter");
     /* 搜索功能 */
     $search_arr = array('email', 'ip');
     $search_value = $this->input->get('search_value');
     $search_type = $this->input->get('search_type');
     $where_view = array();
     if ($search_arr) {
         foreach ($search_arr as $value) {
             if ($search_type == $value && strlen($search_value) > 0) {
                 $newsletter_query_struct['where'][$value] = $search_value;
                 if ($value == 'ip') {
                     $newsletter_query_struct['where'][$value] = tool::myip2long($search_value);
                 }
             }
         }
         $where_view['search_type'] = $search_type;
         $where_view['search_value'] = $search_value;
     }
     //当前切入的站点查询条件
     $site_in = site::current_query_site_ids();
     $where_view['site_id'] = '';
     $newsletter_query_struct['where']['site_id'] = $site_in;
     /* 列表排序 */
     $orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('site_id' => 'ASC'), 3 => array('site_id' => 'DESC'), 4 => array('email' => 'ASC'), 5 => array('email' => 'DESC'), 6 => array('date_add' => 'ASC'), 7 => array('date_add' => 'DESC'), 8 => array('ip' => 'ASC'), 9 => array('ip' => 'DESC'), 10 => array('active' => 'ASC'), 11 => array('active' => 'DESC'));
     $orderby = controller_tool::orderby($orderby_arr);
     $newsletter_query_struct['orderby'] = $orderby;
     /* 每页显示条数 */
     $per_page = controller_tool::per_page();
     $newsletter_query_struct['limit']['per_page'] = $per_page;
     /* 调用分页 */
     $this->pagination = new Pagination(array('total_items' => Mynewsletter::instance()->query_count($newsletter_query_struct), 'items_per_page' => $per_page));
     $newsletter_query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $newsletters = Mynewsletter::instance()->query_assoc($newsletter_query_struct);
     foreach ($newsletters as $key => $value) {
         $site = Mysite::instance($value['site_id'])->get();
         $newsletters[$key]['site'] = $site;
     }
     /* 调用列表 */
     $this->template->content->newsletter_list = $newsletters;
     /* 搜索信息保存 */
     $this->template->content->where = $where_view;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:49,代码来源:newsletter.php


示例18: delete

 public function delete($templateId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('distribution_system_manage');
     $templateDao = Superplaner_Realtime_contract_template::instance();
     $template = $templateDao->get_by_id($templateId);
     if ($template == null) {
         remind::set(Kohana::lang('o_contract.contract_not_exists'), request::referrer(), 'error');
     }
     if (Superplaner_Realtime_contract_template::instance($templateId)->delete()) {
         remind::set(Kohana::lang('o_global.delete_success'), request::referrer(), 'success');
     } else {
         remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:15,代码来源:realtime_contract_template.php


示例19: 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


示例20: open_bill_detail

 public function open_bill_detail($openBillId)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('card_system_manage');
     if ($openBillId == null) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
         return;
     }
     $openBill = $this->issueBillDao->get_by_id($openBillId);
     if ($openBill == null) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
         return;
     }
     $this->template->content = new View("card/open_bill_detail");
     $this->template->content->openBill = $openBill;
     $this->template->content->channelList = $this->salesChannelMap;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:17,代码来源:bill.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP route类代码示例发布时间:2022-05-23
下一篇:
PHP rex_view类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap