Exemplo n.º 1
0
 public function init()
 {
     parent::init();
     // ---------------- 判断登录 --------------------------------------
     $admin = '';
     $relogin = false;
     // 判断session
     $admin = Tools_help::getSession('admin');
     if (empty($admin)) {
         // 判断cookie
         $admin = Tools_help::getCookie('admin');
         if (empty($admin)) {
             $this->redirect('/backend/Login/index');
         } else {
             $relogin = true;
         }
     }
     // cookie重新验证
     if ($admin && $relogin) {
         $adminModel = new AdminModel();
         $data = $adminModel->getAdminById($admin['id']);
         if (empty($data) || $data['roleid'] != 1 || $data['password'] != $admin['password']) {
             $this->redirect('/backend/Login/index');
         }
         $adminModel->reMemberMe($data);
         $admin = $data;
     }
     // E
     $this->_view->assign("curr_admin", $admin);
     // 用户权限判断
     /*$checkTitle = strtolower($this->moduleName.'_'.$this->controllerName.'_'.$this->actionName);
       $pid = Rbac_Core::getPermissions()->returnId($checkTitle);
       if($pid) {
           if($admin['id']!=1){
               if(!Rbac_Core::getInstance()->check($pid, $admin['id'])) {
                   exit('您没有权限访问该网页1!<a href="javascript:window.history.back();">返回</a> ');
               }
           }
       } else {
           Rbac_Core::getPermissions()->add($checkTitle, $checkTitle);
           //exit('您没有权限访问该网页2!<a href="javascript:window.history.back();">返回</a> ');
       }*/
     $purview = null;
     // 后台菜单数组 S
     $backendMenu = new \Core_CBackendMenu(ConstDefine::$backendMenu, $this->controllerName, $this->actionName, $purview);
     $menustr = $backendMenu->get();
     $this->_view->assign('backendMenu', $menustr);
     // E
 }
Exemplo n.º 2
0
 public function init()
 {
     parent::init();
     // ---------------- 判断登录 --------------------------------------
     $admin = '';
     $relogin = false;
     // 判断session
     $admin = Tools_help::getSession('admin');
     if (empty($admin)) {
         // 判断cookie
         $admin = Tools_help::getCookie('admin');
         if (empty($admin)) {
             $this->redirect('/backend/Login/index');
         } else {
             $relogin = true;
         }
     }
     // cookie重新验证
     if ($admin && $relogin) {
         $adminModel = new AdminModel();
         $data = $adminModel->getAdminById($admin['id']);
         if (empty($data) || $data['roleid'] != 1 || $data['password'] != $admin['password']) {
             $this->redirect('/backend/Login/index');
         }
         $adminModel->reMemberMe($data);
         $admin = $data;
     }
     // E
     $this->_view->assign("curr_admin", $admin);
     $this->admin = $admin;
     $rbac = new Rbac_Core();
     if ($admin['rid']) {
         $checkTitle = strtolower($this->moduleName . '/' . $this->controllerName . '/' . $this->actionName);
         $pid = $rbac->check($admin['rid'], $checkTitle);
         if (empty($pid)) {
             exit('您没有权限访问该网页!<a href="javascript:window.history.back();">返回</a> ');
         }
     }
     $menu = $rbac->getMenu($admin['rid'], false);
     // 后台菜单数组 S
     $menustr = new \Core_CBackendMenu($menu, $this->controllerName, $this->actionName);
     $this->_view->assign('backendMenu', $menustr);
     // E
 }
Exemplo n.º 3
0
 private function getBlogerInfo($blogerId)
 {
     //实例化Model
     $adminModel = new AdminModel();
     //博主
     //博主个人信息
     $blogerInfo = $adminModel->getAdminById($blogerId);
     return $blogerInfo;
 }
Exemplo n.º 4
0
 private function getAdmin($adminId)
 {
     $admin = new AdminModel();
     $admins = $admin->getAdminById($adminId);
     return $admins['userName'];
 }