public function indexAction() { $this->forceInstall(); $session = new USession($this); $uid = $session->getUid(); $urlHandler = $this->getApp()->getUrlHandler(); if ($uid == 0) { $signInUrl = $urlHandler->createUrl('web/SignIn', 'index', array()); header('Location: ' . $signInUrl); return; } $user = new UserModel($this); $uid = $session->getUid(); $rand = $session->createNewSid(); $session->getSessionData()->set('rand', $rand); $userInfo = $user->getUidInfo($uid, array('username', 'nickname', 'user_img', 'regtime')); $isAdmin = $user->isSuperAdmin($uid); $session = null; $siteInfoM = new SiteModel($this); $siteInfo = $siteInfoM->getSiteInfo(array('sitename')); $title = $siteInfo['sitename'] . ' › ' . $userInfo['nickname']; Templatel::tplStart(); include Templatel::view('/userindex.html'); Templatel::tplEnd(); }
/** * 处理异步提交过来的站点配置的修改 * * @return void */ public function saveConfAction() { $this->forceInstall(); $session = new USession($this); $uid = $session->getUid(); $urlHandler = $this->getApp()->getUrlHandler(); if ($uid == 0) { $signInUrl = $urlHandler->createUrl('web/SignIn', 'index', array()); header('Location: ' . $signInUrl); return; } $user = new UserModel($this); $isAdmin = $user->isSuperAdmin($uid); if (!$isAdmin) { $this->needAdmin(); return; } $postData = new DataMap($_POST); $sitename = $postData->get('sitename', ''); $noticeOn = $postData->get('notice_on', 0); $noticeText = $postData->get('notice_text', ''); $openCompress = $postData->get('open_compress', 0); $siteM = new SiteModel($this); $newSets = array(); $newSets['sitename'] = $sitename; $newSets['notice_on'] = $noticeOn == 0 ? '0' : '1'; $newSets['notice_text'] = $noticeText; $newSets['open_compress'] = $openCompress == 0 ? '0' : '1'; $siteM->updateSiteInfo($newSets); $ajaxReturn = array('success' => true); $this->jsonReturn($ajaxReturn); }
/** * 添加板块的ajax异步请求 * * @return void */ public function addbkAction() { $this->forceInstall(); $session = new USession($this); $uid = $session->getUid(); $urlHandler = $this->getApp()->getUrlHandler(); if ($uid == 0) { $signInUrl = $urlHandler->createUrl('web/SignIn', 'index', array()); header('Location: ' . $signInUrl); return; } $user = new UserModel($this); $isAdmin = $user->isSuperAdmin($uid); if (!$isAdmin) { $this->needAdmin(); return; } $bkM = new BkModel($this); $postData = new DataMap($_POST); $pid = intval($postData->get('pid', 0)); $bkname = $postData->get('bkname', '新节点'); //判断父节点pid是否存在 if (!$bkM->bkIdExists($pid)) { $arr = array('success' => false); } else { $bkid = $bkM->createBk($pid, $bkname); $arr = array('success' => true); $arr['nodeInfo'] = array('id' => $bkid, 'pId' => $pid, 'isParent' => false, 'name' => $bkname); } $this->jsonReturn($arr); }