public function msg() { //单条显示页面 $tid = intval(I('get.tid', '', false)); $talkDB = M('Talk'); $res = $talkDB->where('tid = ' . $tid)->find(); if (!$res) { $this->index(); } else { $this->commonassign(); if ($this->logincheck() > 0) { $this->assign('ojaccount', \OJLoginInterface::getLoginUser()); } else { $this->assign('url', \OJLoginInterface::getLoginURL()); } $this->assign('tid', $tid); $this->assign('title', htmlspecialchars($res['title'])); $this->assign('introduce', '<p><span class="text-warning"><strong>' . strlen($res['content']) . 'B</strong></span> BY <span class="text-primary"><strong>' . htmlspecialchars($res['ojaccount']) . '</strong></span> @ <span class="text-muted">' . $res['createtime'] . '</span>' . ($res['problemid'] ? ' IN <span class="text-danger"><strong>Problem ' . $res['problemid'] . '</strong></span>' : '') . (time() - strtotime($res['createtime']) <= TalkController::$var_newlogo_second ? ' <span class="label label-warning">New</span>' : '') . '</p>'); if ($res['content']) { $this->assign('content', '<pre style="font-size:16px">' . htmlspecialchars($res['content']) . '</pre>'); } if (intval($res['lft']) + 1 < intval($res['rgt'])) { $this->talk_arr = $this->gettalk(intval($res['tid'])); $this->talk_idx = 0; $son = $this->buildtalk(0); $this->assign('son', $son); } $this->display('msg'); } }
public function index() { $this->commonassign(); if ($this->logincheck() == 0) { $this->assign('notlogin', true); $this->assign('url', \OJLoginInterface::getLoginURL()); } $this->display(); }
public function contacts() { $this->commonassign(); if ($this->logincheck() == 0) { //未登录处理 $this->assign('url', \OJLoginInterface::getLoginURL()); $this->display('nologin'); return; } if ($this->logincheck() == 1) { //无权限处理 $this->display('noallow'); return; } $personDB = M('Person'); $teacher = $personDB->field('chsname, sex, email, phone, introduce')->where('`group` = 2')->order('uid ASC')->select(); $data = $personDB->field('chsname, sex, email, phone, grade, address, introduce')->where('`group` < 2 AND uid > 0')->select(); for ($i = 0; $i < count($teacher); $i++) { $teacher[$i]['email'] = htmlspecialchars($teacher[$i]['email']); $teacher[$i]['introduce'] = htmlspecialchars($teacher[$i]['introduce']); } for ($i = 0; $i < count($data); $i++) { $data[$i]['email'] = htmlspecialchars($data[$i]['email']); $data[$i]['address'] = htmlspecialchars($data[$i]['address']); $data[$i]['introduce'] = htmlspecialchars($data[$i]['introduce']); } $this->assign('teacher', $teacher); $this->assign('data', $data); $this->display('contacts'); }