Ejemplo n.º 1
0
 private function _bCheckPriority()
 {
     $cur_uri = KShequ_Func::sGetDirUriName();
     if (in_array($cur_uri, $this->unCheckPages) || false !== strpos('ajax', $cur_uri)) {
         return true;
     }
     $cur_menu = $this->_aGetCurrentMenu();
     if (!empty($cur_menu)) {
         $this->currentMenuId = $cur_menu['id'];
     }
     if ($this->is_admin) {
         return true;
     }
     $tree_api = new KShequ_Menu_TreeApi();
     $role_api = new KShequ_Menu_roleApi();
     $this->aPriMenuIds = $role_api->aGetMenuIdByAdminUid($_SESSION['admin']['id']);
     if (empty($this->aPriMenuIds) || !is_array($this->aPriMenuIds) || !$cur_uri) {
         return false;
     }
     //文件不在目录树中看是否有此路径的顶级权限
     if (empty($cur_menu)) {
         $menu_api = new KShequ_Menu_Api();
         $cur_menus = $menu_api->aGetByUri(dirname($cur_uri));
         $top_menu = current($cur_menus);
         if (is_int($top_menu['id'])) {
             //判断是否为一级节点
             $tree_api = new KShequ_Menu_TreeApi();
             $top_menus = $tree_api->aGetParent($top_menu['id']);
             if (isset($top_menus[0]) && $top_menus[0] == 0 && in_array($top_menu['id'], $this->aPriMenuIds)) {
                 return true;
             }
         }
         return false;
     }
     $parent_tree = $tree_api->aGetParent($cur_menu['id'], 0);
     if (is_array($parent_tree) && !empty($parent_tree)) {
         unset($parent_tree[count($parent_tree) - 1]);
         $parent_tree = array_values($parent_tree);
     }
     array_unshift($parent_tree, $cur_menu['id']);
     if (count(array_intersect($parent_tree, $this->aPriMenuIds)) == 0) {
         return false;
     }
     return true;
 }