示例#1
0
 function __construct($swoole)
 {
     session();
     //$this->swoole->db->debug = true;
     App\Content::$php = $swoole;
     parent::__construct($swoole);
     if (isset($_GET['prid'])) {
         $this->project_id = intval($_GET['prid']);
         if (!isset($_COOKIE['wiki_project_id']) or $_COOKIE['wiki_project_id'] != $this->project_id) {
             Swoole\Cookie::set('wiki_project_id', $this->project_id, 86400 * 30);
         }
     } elseif (isset($_COOKIE['wiki_project_id'])) {
         $this->project_id = intval($_COOKIE['wiki_project_id']);
     } else {
         $this->project_id = 1;
     }
     //未登陆用户
     if (!isset($_SESSION['user_id'])) {
         Swoole::$php->http->redirect('/page/login/');
         Swoole::$php->http->finish();
     }
     $this->project = createModel('WikiProject')->get($this->project_id);
     $this->swoole->tpl->assign("project_id", $this->project_id);
     $this->swoole->tpl->assign("project", $this->project);
     //非管理员不允许登陆
     if ($this->ifDeny()) {
         Swoole\JS::js_goto('您没有编辑权限', '/wiki/index/');
         Swoole::$php->http->finish();
     }
 }
示例#2
0
 function __construct($swoole)
 {
     App\Content::$php = $swoole;
     parent::__construct($swoole);
 }