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(); } }
function __construct() { parent::__construct(Swoole::$php); $this->session->start(); if (empty($_SESSION['username']) || empty($_SESSION['password'])) { header('Location: /user/login'); } }
function __construct($swoole) { parent::__construct($swoole); if (isset($_POST["PHPSESSID"])) { $_COOKIE['PHPSESSID'] = $_POST["PHPSESSID"]; session_id($_COOKIE['PHPSESSID']); } Swoole::$php->session->start(); Swoole\Auth::$login_url = '/page/login/?'; if (Swoole\Auth::login_require() === false) { return $this->swoole->http->finish(); } $this->uid = $_SESSION['user_id']; }
function __construct(\Swoole $swoole) { parent::__construct($swoole); $swoole->session->start(); if (!$this->user->isLogin()) { if (!empty($_SERVER['QUERY_STRING'])) { $this->swoole->http->redirect($this->swoole->config['user']['login_url'] . "?refer=" . base64_encode($_SERVER['REQUEST_URI'])); } else { $this->swoole->http->redirect($this->swoole->config['user']['login_url']); } $this->swoole->http->finish(); } else { $this->uid = $this->user->getUid(); $this->userinfo = $_SESSION['userinfo']; } /** * 可参与的项目 */ $project_ids = $this->userinfo['project_id']; if ($project_ids) { $projects = table('project')->getMap(array('in' => array('id', $project_ids))); } else { $projects = table('project')->getMap(array('limit' => 100)); } $this->assign('_projects', $projects); //从GET参数中获取ProjectId if (!empty($_GET['project'])) { $this->projectId = intval($_GET['project']); //此用户受限访问某几个项目,传入GET参数Project不在被允许的范围内 if ($project_ids and !isset($projects[$this->projectId])) { goto first_project; } else { $_SESSION['project'] = $this->projectId; } } elseif (!empty($_SESSION['project'])) { $this->projectId = intval($_SESSION['project']); } else { first_project: $this->projectId = array_keys($projects)[0]; } //修改Session记录中的project if (!empty($_SESSION['project']) and $this->projectId != $_SESSION['project']) { $_SESSION['project'] = $this->projectId; } $this->projectInfo = $projects[$this->projectId]; $this->assign('_project_id', $this->projectId); $this->assign('_project_info', $this->projectInfo); }
function __construct($swoole) { App\Content::$php = $swoole; parent::__construct($swoole); }
function __construct($swoole) { parent::__construct($swoole); $this->session->start(); $this->model = model('Directory'); }
function __construct($swoole) { parent::__construct($swoole); $this->model = model('Document'); }
/** * 加入认证 * @param Swoole $swoole */ function __construct(Swoole $swoole) { parent::__construct($swoole); Swoole::$php->session->start(); Swoole\Auth::login_require(); }
function __construct($swoole) { parent::__construct($swoole); }
function __construct(\Swoole $swoole) { parent::__construct($swoole); $this->is_ajax = true; }
public function __construct($swoole) { parent::__construct($swoole); $this->model = model('User'); }
function __construct($swoole) { parent::__construct($swoole); $this->model = model('Section'); }
function __construct() { parent::__construct(Swoole::$php); header("Content-type: text/html; charset=utf-8"); }