/** * 设置layer */ function __construct() { parent::__construct(); //安全管理的module $this->SEC = new SecurityModule(); //AdminModule $this->ADMIN = new AdminModule(); }
function __construct() { parent::__construct(); //处理$argv传递过来的参数 //params1=value1 params2=value2 ... paramsN=valueN $params = array(); foreach ($this->params as $p) { if (strpos($p, '=') === false) { continue; } list($p_key, $p_value) = explode('=', $p); if ($p_key && $p_value) { $params[trim(trim($p_key, '-'))] = trim($p_value); } } $this->params = $params; }
/** * url加密 参数解密 */ function makeEncryptLinkAndDecryptParams() { $params = $this->params; $link_type = $this->params['link_type']; $dot = $this->params['dot']; $ext = $this->params['ext']; $this->view->cleanLinkCache(); $this->config->set('url', array('rewrite' => false, 'ext' => $ext, 'dot' => $dot, 'type' => $link_type)); $this->view->setLinkBase(''); $link = $this->view->slink('Main:getUrlSecurityParams', array('p1' => $params['p1'], 'p2' => $params['p2'], 'p3' => $params['p3'])); $url_start = 0; switch ($link_type) { case 1: case 3: $url_start = 2; $index_file_name = $this->config->get('url', 'index'); if (strcasecmp($index_file_name, 'index.php') != 0) { $url_start += strlen($index_file_name); } else { $url_start += 1; } break; case 2: case 4: case 5: $url_start = strlen($this->config->get('url', 'index')) + 2; break; } $router = new Router(parent::getConfig()); $r = $router->setRouterParams(explode($dot, substr($link, $url_start)))->getRouter(); $result = $this->sParams($r->getParams()); $this->display($result); }
function __construct() { parent::__construct(); $this->view = new ApiView(); }
function __construct() { parent::__construct(); $this->u = $_SESSION['u']; $this->ACL = new AclModule(); $this->ADMIN = new AdminModule(); /** * 查询登录用户信息 */ $user_info = $this->ADMIN->getAdminInfo(array('name' => $this->u)); $role_id = $user_info['rid']; /** * 导航菜单 */ $nav_menu_data = $this->ACL->getMenu(); $controller = lcfirst($this->controller); /** * 菜单icon */ $icon = Loader::read(Loader::getFilePath('::config/menu_icon.config.php')); $tpl_dir_name = $this->config->get('sys', 'default_tpl_dir'); $icon_config = array(); if (isset($icon[$tpl_dir_name])) { $icon_config = $icon[$tpl_dir_name]; } /** * 判断是否是超级管理员 */ if ($role_id == 0) { /** * 设置view导航数据 */ $this->view->setNavMenu($nav_menu_data); $all_menu = $this->ACL->getNavChildMenu($nav_menu_data); $child_menu = array(); if (isset($nav_menu_data[$controller])) { $child_menu = $all_menu[$controller]['child_menu']; } $this->view->setMenu($child_menu); $this->view->setAllMenu($all_menu, $icon_config); } else { /** * 查询所属管理角色 */ $role_info = $this->ACL->getRoleInfo(array('id' => $role_id)); /** * 角色允许的方法 */ $accept_behavior = explode(',', $role_info['behavior']); /** * 只保留允许访问的菜单 */ foreach ($nav_menu_data as $k => $nav) { if (!in_array($nav['id'], $accept_behavior)) { unset($nav_menu_data[$k]); } } /** * 设置view导航数据 */ $this->view->setNavMenu($nav_menu_data); $all_menu = $this->ACL->getNavChildMenu($nav_menu_data); $this->view->setAllMenu($all_menu, $icon_config); $child_menu = array(); if (isset($nav_menu_data[$controller])) { $child_menu = $all_menu[$controller]['child_menu']; } else { //如果没有访问权限 使用有权限的第一个菜单 $accept_menus = array_keys($nav_menu_data); if (!empty($accept_menus)) { $this->to($accept_menus[0]); } $this->to(); } $accept_action = array(); foreach ($child_menu as $c_key => $c_value) { //过滤无权限的菜单 if (!in_array($c_value['id'], $accept_behavior)) { unset($child_menu[$c_key]); } else { $accept_action[] = $c_value['link']; } } $this->view->setMenu($child_menu); //都没有权限执行action时,跳转到第一个有权限的action if (!in_array($this->action, $accept_action)) { if ($this->is_ajax_request()) { $this->dieJson($this->getStatus(100030)); } else { $this->view->notice(100030); exit(0); } } } }