コード例 #1
0
ファイル: control.php プロジェクト: dyp8848/chanzhieps
 /**
  * The board page.
  * 
  * @param int    $boardID       the board id
  * @param int    $pageID        the current page id
  * @access public
  * @return void
  */
 public function board($boardID = 0, $pageID = 1)
 {
     $board = $this->loadModel('tree')->getByID($boardID, 'forum');
     if (!$board) {
         die(js::locate('back'));
     }
     if ($board->link) {
         helper::header301($board->link);
     }
     /* Get common threads. */
     $recPerPage = !empty($this->config->site->forumRec) ? $this->config->site->forumRec : $this->config->forum->recPerPage;
     $this->app->loadClass('pager', $static = true);
     $pager = new pager(0, $recPerPage, $pageID);
     $threads = $this->loadModel('thread')->getList($board->id, $orderBy = 'repliedDate_desc', $pager);
     $this->view->title = $board->name;
     $this->view->keywords = $board->keywords . '' . $this->config->site->keywords;
     $this->view->desc = strip_tags($board->desc);
     $this->view->board = $board;
     $this->view->sticks = $this->thread->getSticks($board->id);
     $this->view->threads = $threads;
     $this->view->pager = $pager;
     $this->view->mobileURL = helper::createLink('forum', 'board', "borderID={$boardID}&pageID={$pageID}", "category={$board->alias}", 'mhtml');
     $this->view->desktopURL = helper::createLink('forum', 'board', "borderID={$boardID}&pageID={$pageID}", "category={$board->alias}", 'html');
     $this->display();
 }
コード例 #2
0
ファイル: control.php プロジェクト: peirancao/chanzhieps
 /**
  * View an article.
  * 
  * @param int $articleID 
  * @param int $currentCategory 
  * @access public
  * @return void
  */
 public function view($articleID, $currentCategory = 0)
 {
     $article = $this->loadModel('article')->getByID($articleID);
     if (!$article) {
         die($this->fetch('error', 'index'));
     }
     if ($article->link) {
         helper::header301($article->link);
     }
     /* fetch category for display. */
     $category = array_slice($article->categories, 0, 1);
     $category = $category[0]->id;
     $currentCategory = $this->session->articleCategory;
     if ($currentCategory > 0 && isset($article->categories[$currentCategory])) {
         $category = $currentCategory;
     }
     $category = $this->loadModel('tree')->getByID($category);
     $title = $article->title . ' - ' . $category->name;
     $keywords = $article->keywords . ' ' . $category->keywords . ' ' . $this->config->site->keywords;
     $desc = strip_tags($article->summary);
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->article = $article;
     $this->view->prevAndNext = $this->loadModel('article')->getPrevAndNext($article->id, $category->id);
     $this->view->category = $category;
     $this->view->contact = $this->loadModel('company')->getContact();
     $this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($articleID)->exec(false);
     $this->display();
 }
コード例 #3
0
ファイル: control.php プロジェクト: mustafakarali/b2c-1
 /** 
  * Browse product in front.
  * 
  * @param int    $categoryID   the category id
  * @param int    $pageID       current page id
  * @access public
  * @return void
  */
 public function browse($categoryID = 0, $pageID = 1)
 {
     $category = $this->loadModel('tree')->getByID($categoryID, 'product');
     if ($category && $category->link) {
         helper::header301($category->link);
     }
     $this->app->loadClass('pager', $static = true);
     $pager = new pager(0, $this->config->product->recPerPage, $pageID);
     $categoryID = is_numeric($categoryID) ? $categoryID : $category->id;
     $products = $this->product->getList($this->tree->getFamily($categoryID), '`order` desc', $pager);
     if (!$category and $categoryID != 0) {
         die($this->fetch('error', 'index'));
     }
     if ($categoryID == 0) {
         $category = new stdclass();
         $category->id = 0;
         $category->name = $this->lang->product->home;
         $category->alias = '';
         $category->keywords = '';
         $category->desc = '';
     }
     $title = $category->name;
     $keywords = trim($category->keywords . ' ' . $this->config->site->keywords);
     $desc = strip_tags($category->desc) . ' ';
     $this->session->set('productCategory', $category->id);
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->category = $category;
     $this->view->products = $products;
     $this->view->pager = $pager;
     $this->view->contact = $this->loadModel('company')->getContact();
     $this->display();
 }
コード例 #4
0
ファイル: control.php プロジェクト: eric0614/chanzhieps
 /**
  * View an page.
  * 
  * @param  int      $pageID 
  * @access public
  * @return void
  */
 public function view($pageID)
 {
     $page = $this->loadModel('article')->getPageByID($pageID);
     if ($page->link) {
         $this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($pageID)->exec();
         helper::header301($page->link);
     }
     $title = $page->title;
     $keywords = $page->keywords . ' ' . $this->config->site->keywords;
     $desc = $page->summary;
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->page = $page;
     $this->view->mobileURL = helper::createLink('page', 'view', "pageID={$pageID}", "name={$page->alias}", 'mhtml');
     $this->view->desktopURL = helper::createLink('page', 'view', "pageID={$pageID}", "name={$page->alias}", 'html');
     $this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($page->id)->exec();
     $this->display();
 }
コード例 #5
0
ファイル: control.php プロジェクト: mustafakarali/b2c-1
 /**
  * The board page.
  * 
  * @param int    $boardID       the board id
  * @param int    $pageID        the current page id
  * @access public
  * @return void
  */
 public function board($boardID = 0, $pageID = 1)
 {
     $board = $this->loadModel('tree')->getByID($boardID, 'forum');
     if (!$board) {
         die(js::locate('back'));
     }
     if ($board->link) {
         helper::header301($board->link);
     }
     /* Get common threads. */
     $this->app->loadClass('pager', $static = true);
     $pager = new pager(0, $this->config->forum->recPerPage, $pageID);
     $threads = $this->loadModel('thread')->getList($board->id, $orderBy = 'repliedDate_desc', $pager);
     $this->view->title = $board->name;
     $this->view->keywords = $board->keywords . '' . $this->config->site->keywords;
     $this->view->desc = strip_tags($board->desc);
     $this->view->board = $board;
     $this->view->sticks = $this->thread->getSticks($board->id);
     $this->view->threads = $threads;
     $this->view->pager = $pager;
     $this->display();
 }
コード例 #6
0
ファイル: control.php プロジェクト: hansen1416/eastsoft
 /**
  * View an article.
  * 
  * @param int $articleID 
  * @param int $currentCategory 
  * @access public
  * @return void
  */
 public function view($articleID, $currentCategory = 0)
 {
     $article = $this->loadModel('article')->getByID($articleID);
     if (!$article) {
         die($this->fetch('error', 'index'));
     }
     if ($article->link) {
         helper::header301($article->link);
     }
     /* fetch category for display. */
     $category = array_slice($article->categories, 0, 1);
     $category = $category[0]->id;
     $currentCategory = $this->session->articleCategory;
     if ($currentCategory > 0 && isset($article->categories[$currentCategory])) {
         $category = $currentCategory;
     }
     $category = $this->loadModel('tree')->getByID($category);
     $title = $article->title . ' - ' . $category->name;
     $keywords = $article->keywords . ' ' . $category->keywords . ' ' . $this->config->site->keywords;
     $desc = strip_tags($article->summary);
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->article = $article;
     $this->view->prevAndNext = $this->loadModel('article')->getPrevAndNext($article->id, $category->id);
     $this->view->category = $category;
     $this->view->contact = $this->loadModel('company')->getContact();
     $this->view->mobileURL = helper::createLink('blog', 'view', "articleID={$articleID}&currentCategory={$currentCategory}", "category={$category->alias}&name={$article->alias}", 'mhtml');
     $this->view->desktopURL = helper::createLink('blog', 'view', "articleID={$articleID}&currentCategory={$currentCategory}", "category={$category->alias}&name={$article->alias}", 'html');
     if ($article->source == 'article') {
         $copyArticle = $this->article->getByID($article->copyURL);
         $copyArticleCategory = current(array_slice($copyArticle->categories, 0, 1));
         $this->view->sourceURL = helper::createLink('article', 'view', "articleID={$copyArticle->id}&categoryID={$copyArticleCategory->id}", "category={$copyArticleCategory->alias}&name={$copyArticle->alias}", 'html');
     }
     $this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($articleID)->exec();
     $this->display();
 }
コード例 #7
0
ファイル: control.php プロジェクト: jnan77/chanzhieps
 /**
  * Login.
  * 
  * @param string $referer 
  * @access public
  * @return void
  */
 public function login($referer = '')
 {
     $this->setReferer($referer);
     /* Load mail config for reset password. */
     $this->app->loadConfig('mail');
     $loginLink = $this->createLink('user', 'login');
     $denyLink = $this->createLink('user', 'deny');
     $regLink = $this->createLink('user', 'register');
     /* If the user logon already, goto the pre page. */
     if ($this->user->isLogon()) {
         if (helper::isAjaxRequest()) {
             if ($this->referer and strpos($loginLink . $denyLink . $regLink, $this->referer) === false and strpos($this->referer, $loginLink) === false) {
                 $this->send(array('result' => 'success', 'locate' => $this->referer));
             }
             $this->send(array('result' => 'success', 'locate' => $this->createLink($this->config->default->module)));
         }
         if ($this->referer and strpos($loginLink . $denyLink . $regLink, $this->referer) === false and strpos($this->referer, $loginLink) === false) {
             $this->locate($this->referer);
         }
         $this->locate($this->createLink($this->config->default->module));
         exit;
     }
     /* If the user sumbit post, check the user and then authorize him. */
     if (!empty($_POST)) {
         $user = $this->user->getByAccount($this->post->account);
         /* check client ip and location if login is admin. */
         if (RUN_MODE == 'admin') {
             $checkIP = $this->user->checkIP();
             $checkLocation = $this->user->checkLocation();
             if ($user and (!$checkIP or !$checkLocation)) {
                 $error = $checkIP ? '' : $this->lang->user->ipDenied;
                 $error .= $checkLocation ? '' : $this->lang->user->locationDenied;
                 $pass = $this->loadModel('mail')->checkVerify();
                 $captchaUrl = $this->createLink('mail', 'captcha', "url=&target=modal&account={$this->post->account}");
                 if (!$pass) {
                     $this->send(array('result' => 'fail', 'reason' => 'captcha', 'message' => $error, 'url' => $captchaUrl));
                 }
             }
         }
         if (!$this->user->login($this->post->account, $this->post->password)) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->user->loginFailed));
         }
         if (RUN_MODE == 'front') {
             if (isset($this->config->site->checkEmail) and $this->config->site->checkEmail == 'open' and $this->config->mail->turnon and !$user->emailCertified) {
                 $referer = helper::safe64Encode($this->post->referer);
                 if (!helper::isAjaxRequest()) {
                     helper::header301("http://" . $_SERVER['HTTP_HOST'] . inlink('checkEmail', "referer={$referer}"));
                 }
                 $this->send(array('result' => 'success', 'locate' => inlink('checkEmail', "referer={$referer}")));
             }
         }
         /* Goto the referer or to the default module */
         if ($this->post->referer != false and strpos($loginLink . $denyLink . $regLink, $this->post->referer) === false) {
             if (!helper::isAjaxRequest()) {
                 helper::header301(urldecode($this->post->referer));
             }
             $this->send(array('result' => 'success', 'locate' => urldecode($this->post->referer)));
         } else {
             $default = $this->config->user->default;
             if (!helper::isAjaxRequest()) {
                 helper::header301("http://" . $_SERVER['HTTP_HOST'] . $this->createLink($default->module, $default->method));
             }
             $this->send(array('result' => 'success', 'locate' => $this->createLink($default->module, $default->method)));
         }
     }
     if (!$this->session->random) {
         $this->session->set('random', md5(time() . mt_rand()));
     }
     $this->view->title = $this->lang->user->login->common;
     $this->view->referer = $this->referer;
     if (RUN_MODE == 'front') {
         $this->view->mobileURL = helper::createLink('user', 'login', "referer={$referer}", '', 'mhtml');
         $this->view->desktopURL = helper::createLink('user', 'login', "referer={$referer}", '', 'html');
     }
     $this->display();
 }
コード例 #8
0
ファイル: control.php プロジェクト: mustafakarali/b2c-1
 /**
  * View a thread.
  * 
  * @param  int    $threadID 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function view($threadID, $pageID = 1)
 {
     $thread = $this->thread->getByID($threadID);
     if (!$thread) {
         die(js::locate('back'));
     }
     if ($thread->link) {
         $this->thread->plusCounter($threadID);
         helper::header301($thread->link);
     }
     /* Set editor for current user. */
     $this->thread->setEditor($thread->board, 'view');
     /* Get thread board. */
     $board = $this->loadModel('tree')->getById($thread->board);
     /* Get replies. */
     $this->app->loadConfig('reply');
     $this->app->loadClass('pager', $static = true);
     $pager = new pager(0, $this->config->reply->recPerPage, $pageID);
     $replies = $this->loadModel('reply')->getByThread($threadID, $pager);
     /* Get all speakers. */
     $speakers = $this->thread->getSpeakers($thread, $replies);
     $speakers = $this->loadModel('user')->getBasicInfo($speakers);
     foreach ($speakers as $account => $speaker) {
         $speaker->isModerator = strpos(",{$board->moderators},", ",{$account},") !== false;
     }
     /* Set the views counter + 1; */
     $this->thread->plusCounter($threadID);
     $this->view->title = $thread->title . $this->lang->minus . $board->name;
     $this->view->board = $board;
     $this->view->thread = $thread;
     $this->view->replies = $replies;
     $this->view->pager = $pager;
     $this->view->speakers = $speakers;
     $this->display();
 }
コード例 #9
0
ファイル: control.php プロジェクト: peirancao/chanzhieps
 /**
  * Redirect mall of product.
  * 
  * @param  int    $productID 
  * @access public
  * @return void
  */
 public function redirect($productID)
 {
     $product = $this->product->getByID($productID);
     helper::header301(htmlspecialchars_decode($product->mall));
 }
コード例 #10
0
ファイル: control.php プロジェクト: hansen1416/eastsoft
 /**
  * View an article.
  * 
  * @param int $articleID 
  * @access public
  * @return void
  */
 public function view($articleID)
 {
     $article = $this->zhaopin->getByID($articleID);
     if (!$article) {
         die($this->fetch('error', 'index'));
     }
     if ($article->link) {
         $this->dao->update(TABLE_ZHAOPIN)->set('views = views + 1')->where('id')->eq($articleID)->exec();
         helper::header301($article->link);
     }
     //-article和zhaopin相互转换
     $type = $article->categories[$article->path[0]]->type == 'zhaopin' ? 'article' : 'zhaopin';
     $category = $this->dao->select('*')->from('es_category')->where('type')->eq($type)->andWhere('name')->eq($article->categories[$article->path[0]]->name)->fetch();
     //-end
     //如果当前分类不是顶级分类,则寻找当前分类的顶级分类的ID
     $top_id = $this->loadModel('article')->getTop($category);
     $this->view->top_id = $top_id;
     //获取当前分类的顶级分类下的子分类
     $this->view->children = $this->loadModel('article')->getChildren($top_id);
     /* fetch category for display. */
     $category = array_slice($article->categories, 0, 1);
     $category = $category[0]->id;
     $currentCategory = $this->session->articleCategory;
     if ($currentCategory > 0) {
         if (isset($article->categories[$currentCategory])) {
             $category = $currentCategory;
         } else {
             foreach ($article->categories as $articleCategory) {
                 if (strpos($articleCategory->path, $currentCategory)) {
                     $category = $articleCategory->id;
                 }
             }
         }
     }
     $category = $this->loadModel('tree')->getByID($category);
     $this->session->set('articleCategory', $category->id);
     $title = $article->title . ' - ' . $category->name;
     $keywords = $article->keywords . ' ' . $category->keywords . ' ' . $this->config->site->keywords;
     $desc = strip_tags($article->summary);
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->article = $article;
     $this->view->prevAndNext = $this->zhaopin->getPrevAndNext($article->id, $category->id);
     $this->view->category = $category;
     $this->view->contact = $this->loadModel('company')->getContact();
     $this->view->mobileURL = helper::createLink('zhaopin', 'view', "articleID={$article->id}", "category={$category->alias}&name={$article->alias}", 'mhtml');
     $this->view->desktopURL = helper::createLink('zhaopin', 'view', "articleID={$article->id}", "category={$category->alias}&name={$article->alias}", 'html');
     $this->view->region = $this->zhaopin->getRegionsId2Name($article->regions1) . ' ' . $this->zhaopin->getRegionsId2Name($article->regions2) . ' ' . $this->zhaopin->getRegionsId2Name($article->regions3);
     $this->dao->update(TABLE_ZHAOPIN)->set('views = views + 1')->where('id')->eq($articleID)->exec();
     $this->display();
 }