Beispiel #1
0
 function baseThreadIndex($action, $order, $title = "")
 {
     $page = $this->intVal(3);
     if ($page == 1) {
         header("HTTP/1.1 301 Moved Permanently");
         header("location: /thread/");
         die;
     }
     if ($page == 0) {
         $page = 1;
     }
     $threadModel = new ThreadModel();
     $threadPageSize = 40;
     $threadCount = $threadModel->threadCount();
     $threads = $threadModel->threads($page, $threadPageSize, $order);
     $pageControl = ToolModel::pageControl($page, $threadCount, $threadPageSize, "<a href='/thread/{$action}/#page#/'>");
     $object["threads"] = $threads;
     $object["pageControl"] = $pageControl;
     $content = $this->doTemplate("Module", "thread", $object);
     $this->_mainContent->assign("content", $content);
     $newthreads = $threadModel->threads(1, 20);
     $this->_mainContent->assign("newthreads", $newthreads);
     $toplistModel = new ToplistModel();
     $toplist = $toplistModel->toplist();
     $this->_mainContent->assign("toplist", $toplist);
     $this->_mainContent->assign("threadtitle", $title);
     if ($page == 1) {
         $this->setTitle("讨论区 {$title}");
     } else {
         $this->setTitle("讨论区 {$title} 第 {$page} 页");
     }
     $this->viewFile = "Thread/index.html";
     $this->display();
 }
Beispiel #2
0
 public function indexAction()
 {
     header('Pragma: ');
     header("cache-control: s-maxage=600");
     $allModel = new AllModel();
     $page = $this->intVal(3);
     if ($page == 0) {
         $page = 1;
     }
     $size = 30;
     $cacheModel = new FilecacheModel();
     $thread = new ThreadModel();
     $threadCount = $thread->threadCount();
     $threadPageSize = 40;
     $threads = $thread->threads(1, $threadPageSize);
     $pageControl = ToolModel::pageControl(1, $threadCount, $threadPageSize, "<a href='/thread/index/#page#/'>", 0);
     $object["threads"] = $threads;
     $object["pageControl"] = $pageControl;
     $content = $this->doTemplate("Module", "thread", $object);
     $this->_mainContent->assign("content", $content);
     $users = $cacheModel->getCache("topusers", "home");
     if (!$users) {
         $userModel = new UserModel();
         $users = $userModel->users(1, 10);
         $cacheModel->createCache("topusers", "home", $users);
     }
     $this->_mainContent->assign("users", $users);
     $threadModel = new ThreadModel();
     $this->_mainContent->assign("pageControl", $pageControl);
     $this->_mainContent->assign("threads", $threads);
     $this->_mainContent->assign("userid", $this->userid);
     //experiment02
     $isBot = ToolModel::isBot();
     if ($this->userid == 0 && !$isBot) {
         if (rand(0, 1) == 0) {
             $experiment002 = "origin";
         } else {
             $experiment002 = "_blank";
         }
         $this->_view->assign("experiment002", $experiment002);
         $this->_mainContent->assign("experiment002", $experiment002);
     }
     $this->viewFile = "Home/index.html";
     if ($page > 1) {
         $this->setTitle("本站新闻 第" . $page . "页");
     }
     $this->display();
 }