Browse Source

增加页面权限判断

star7th 10 years ago
parent
commit
acd0d840ab
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Application/Home/Controller/PageController.class.php

+ 5 - 0
Application/Home/Controller/PageController.class.php

@@ -8,6 +8,11 @@ class PageController extends BaseController {
         import("Vendor.Parsedown.Parsedown");
         $page_id = I("page_id");
         $page = D("Page")->where(" page_id = '$page_id' ")->find();
+        $login_user = $this->checkLogin(false);
+        if (!$this->checkItemVisit($login_user['uid'] , $page['item_id'])) {
+            $this->message("你无权限");
+            return;
+        }
         $Parsedown = new \Parsedown();
         $page['page_content'] = $Parsedown->text(htmlspecialchars_decode($page['page_content']));
         $this->assign("page" , $page);