public function applenewsAction()
 {
     $filter = $this->strVal(3);
     $page = $this->intVal(4);
     if ($filter == "") {
         $filter = "all";
     }
     if ($page < 1) {
         $page = 1;
     }
     $size = 10;
     $newscenter = new NewscenterModel();
     $count = $newscenter->count($filter);
     $news = $newscenter->news($page, $size, $filter);
     $nnews = array();
     if (count($news) > 0) {
         foreach ($news as $item) {
             $item["content"] = mb_substr(strip_tags($item["content"]), 0, 250);
             $nnews[] = $item;
         }
     }
     $news = $nnews;
     $pageControl = ToolModel::pageControl($page, $count, $size, "<a href='/homeadmin/applenews/{$filter}/#page#/'>");
     $this->_mainContent->assign("filter", $filter);
     $this->_mainContent->assign("page", $page);
     $this->_mainContent->assign("count", $count);
     $this->_mainContent->assign("news", $news);
     $this->_mainContent->assign("pageControl", $pageControl);
     $this->display();
 }
Exemple #2
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();
 }
Exemple #3
0
 public function recentAction()
 {
     $page = $this->intVal(3);
     if ($page == 0) {
         $page = 1;
     }
     $size = 30;
     $userModel = new UserModel();
     $count = $userModel->count();
     $users = $userModel->users($page, $size, "date");
     $this->_mainContent->assign("users", $users);
     $pageControl = ToolModel::pageControl($page, $count, $size, "<a href='/user/recent/#page#/'>", 0);
     $this->_mainContent->assign("pageControl", $pageControl);
     $this->display();
 }
Exemple #4
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();
 }
Exemple #5
0
 public function nameAction()
 {
     $tag = urldecode($this->strVal(3));
     $page = $this->intVal(4);
     if ($page == 0) {
         $page = 1;
     }
     $threadModel = new ThreadModel();
     $threadCount = $threadModel->threadsCountByTag($tag);
     $threadPageSize = 40;
     $threads = $threadModel->threadsByTag($tag, $page, $threadPageSize);
     $pageControl = ToolModel::pageControl($page, $threadCount, $threadPageSize, "<a href='/tag/name/{$tag}/#page#/'>", 0);
     $object["threads"] = $threads;
     $object["pageControl"] = $pageControl;
     $content = $this->doTemplate("Module", "thread", $object);
     $this->_mainContent->assign("content", $content);
     $relatedTags = $threadModel->relatedTags($tag);
     $this->_mainContent->assign("relatedTags", $relatedTags);
     $this->_mainContent->assign("tag", $tag);
     $this->display();
 }
Exemple #6
0
 public function qAction()
 {
     $q = urldecode($this->strVal(3));
     $page = $this->intVal(4);
     if ($page == 0) {
         $page = 1;
     }
     $size = 10;
     $begin = ($page - 1) * $size;
     $searchModel = new SearchModel();
     $ret = $searchModel->search($q, $begin, $size);
     $retArray = json_decode($ret, true);
     $count = $retArray["hits"]["total"];
     $pageControl = ToolModel::pageControl($page, $count, $size, "<a href='/search/q/{$q}/#page#/'>");
     $this->_mainContent->assign("pageControl", $pageControl);
     $this->_mainContent->assign("results", $retArray);
     $this->_mainContent->assign("search", $retArray);
     $this->_view->assign("search_q", $q);
     $this->_mainContent->assign("search_q", $q);
     $this->display();
     //var_dump($retArray);
 }