예제 #1
0
 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();
 }
예제 #2
0
 private function showLoginForm($signMsg = '', array $signErrArr = array())
 {
     $urlHandler = $this->getApp()->getUrlHandler();
     $doLoginUrl = $urlHandler->createUrl('web/SignIn', 'do', array());
     $resetPassUrl = $urlHandler->createUrl('web/Forgot', 'index', array());
     $captchaUrl = $urlHandler->createUrl('web/Captcha', 'index', array());
     $captchaUrlT = $urlHandler->createUrl('web/Captcha', '--rand--', array(), false);
     if (!empty($_POST['url'])) {
         $url = $_POST['url'];
     } elseif (!empty($_SERVER['HTTP_REFERER'])) {
         $url = $_SERVER['HTTP_REFERER'];
     } else {
         $url = '';
     }
     if (!empty($_POST['username'])) {
         $username = $_POST['username'];
     } else {
         $username = '';
     }
     $siteInfoM = new SiteModel($this);
     $siteInfo = $siteInfoM->getSiteInfo(array('sitename'));
     $title = $siteInfo['sitename'] . ' › 登录';
     Templatel::tplStart();
     include Templatel::view('/login.html');
     Templatel::tplEnd();
 }
예제 #3
0
 public function indexAction()
 {
     $this->forceInstall();
     $siteInfoM = new SiteModel($this);
     $siteInfo = $siteInfoM->getSiteInfo(array('sitename'));
     $title = $siteInfo['sitename'] . ' › 测试页面';
     $session = new USession($this);
     $user = new UserModel($this);
     Templatel::tplStart();
     include Templatel::view('/index.html');
     Templatel::tplEnd();
 }
예제 #4
0
 public function indexAction()
 {
     $this->forceInstall();
     $urlHandler = $this->getApp()->getUrlHandler();
     $doResetUrl = $urlHandler->createUrl('web/Forgot', 'do', array());
     $siteInfoM = new SiteModel($this);
     $siteInfo = $siteInfoM->getSiteInfo(array('sitename'));
     $title = $siteInfo['sitename'] . ' › 找回密码';
     Templatel::tplStart();
     include Templatel::view('/forgot.html');
     Templatel::tplEnd();
 }
예제 #5
0
 public function postNewAction()
 {
     $this->forceInstall();
     $session = new USession($this);
     $uid = $session->getUid();
     if ($uid == 0) {
         $urlHandler = $this->getApp()->getUrlHandler();
         $signInUrl = $urlHandler->createUrl('web/SignIn', 'index', array());
         header('Location: ' . $signInUrl);
         return;
     }
     $siteInfoM = new SiteModel($this);
     $siteInfo = $siteInfoM->getSiteInfo(array('sitename'));
     $title = $siteInfo['sitename'] . ' › 创建新主题';
     $user = new UserModel($this);
     Templatel::tplStart();
     include Templatel::view('/postnew.html');
     Templatel::tplEnd();
 }
예제 #6
0
 public function indexAction()
 {
     $this->forceInstall();
     $urlData = $this->getApp()->getUrlHandler()->getUrlData();
     $session = new USession($this);
     $sessionRand = $session->getSessionData()->get('rand', '');
     $urlRand = $urlData->get('rand', '');
     if (empty($sessionRand) || empty($urlRand)) {
         $loginOutOk = false;
     } else {
         $loginOutOk = $sessionRand == $urlRand;
     }
     if ($loginOutOk) {
         $session->destroy();
     }
     $siteInfoM = new SiteModel($this);
     $siteInfo = $siteInfoM->getSiteInfo(array('sitename'));
     $title = $siteInfo['sitename'] . ' › 登出';
     Templatel::tplStart();
     include Templatel::view('/logout.html');
     Templatel::tplEnd();
 }
예제 #7
0
 /**
  * 注册成功提示
  * 
  * @param int $uid
  */
 private function showRegOk($uid)
 {
     $urlHandler = $this->getApp()->getUrlHandler();
     $loginUrl = $urlHandler->createUrl('web/SignIn', 'index', array());
     $siteInfoM = new SiteModel($this);
     $siteInfo = $siteInfoM->getSiteInfo(array('sitename'));
     $title = $siteInfo['sitename'] . ' › 注册';
     Templatel::tplStart();
     include Templatel::view('/regok.html');
     Templatel::tplEnd();
 }
예제 #8
0
 /**
  * 处理异步提交过来的站点配置的修改
  * 
  * @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);
 }
예제 #9
0
 /**
  * 返回json格式的网站配置设置
  *
  * @return void
  */
 public function siteSetsAction()
 {
     $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;
     }
     $siteInfoM = new SiteModel($this);
     $result = $siteInfoM->getSiteInfo(array());
     $result['create_time'] = date('Y-m-d H:i:s P', $result['create_time']);
     $this->jsonReturn($result);
 }