示例#1
0
文件: Forum.php 项目: sinfocol/gwf3
 public function templateForum()
 {
     $by = urlencode(Common::getGetString('tby', 'thread_lastdate'));
     $dir = urlencode(Common::getGetString('tdir', 'DESC'));
     $bby = urlencode(Common::getGetString('bby', 'board_pos'));
     $bdir = urlencode(Common::getGetString('bdir', 'ASC'));
     $orderby = GDO::table('GWF_ForumThread')->getMultiOrderby($by, $dir);
     $bid = $this->board->getVar('board_bid');
     $bt = $this->board->urlencodeSEO('board_title');
     $tVars = array('boards' => $this->board->getBoardPage($this->bPage, $this->tpp), 'board' => $this->board, 'pagemenu_boards' => GWF_PageMenu::display($this->bPage, $this->nBPages, sprintf(GWF_WEB_ROOT . 'forum-b%s/bby/%s/%s/%s-p%%PAGE%%.html', $bid, $bby, $bdir, $bt)), 'threads' => $this->board->getThreads($this->tpp, $this->page, $orderby), 'pagemenu_threads' => GWF_PageMenu::display($this->page, $this->nPages, sprintf(GWF_WEB_ROOT . 'forum-b%s/tby/%s/%s/%s-p%%PAGE%%.html', $bid, $by, $dir, $bt)), 'new_thread_allowed' => $this->board->isNewThreadAllowed(), 'unread_threads' => GWF_ForumThread::getUnreadThreadCount(GWF_Session::getUser()), 'latest_threads' => GWF_ForumThread::getLatestThreads($this->module->getNumLatestThreads()), 'href_options' => GWF_WEB_ROOT . 'forum/options', 'href_unread' => $this->module->getMethodURL('Unread'), 'href_search' => GWF_WEB_ROOT . 'forum/search', 'board_sort_url' => GWF_WEB_ROOT . sprintf('forum-b%s/bby/%%BY%%/%%DIR%%/%s-p1.html', $bid, $bt), 'thread_sort_url' => GWF_WEB_ROOT . sprintf('forum-b%s/bby/%s/%s/bp-%d/tby/%%BY%%/%%DIR%%/%s-p1.html', $bid, $bby, $bdir, $this->bPage, $bt), 'href_polls' => GWF_WEB_ROOT . 'poll_overview');
     return $this->module->templatePHP('forum.php', $tVars);
 }
示例#2
0
文件: PT_Menu.php 项目: sinfocol/gwf3
 private static function displayMenuForum(Module_PoolTool $module)
 {
     $sel = Common::getGet('mo') === 'Forum';
     $sel = $sel ? ' class="menu_sel"' : '';
     $href = GWF_WEB_ROOT . 'forum';
     $app = '';
     if (false !== ($user = GWF_Session::getUser())) {
         require_once GWF_CORE_PATH . 'module/Forum/GWF_ForumThread.php';
         $count = GWF_ForumThread::getUnreadThreadCount($user);
         if ($count > 0) {
             $app = " [{$count}]";
         }
     }
     return sprintf('<a %shref="%s">%s</a>', $sel, $href, $module->lang('menu_forum') . $app);
 }
示例#3
0
 public function execute()
 {
     $user = GWF_Session::getUser();
     $cnt = GWF_ForumThread::getUnreadThreadCount($user);
     // Save stamp
     $data = $user->getUserData();
     $data[GWF_ForumThread::STAMP_NAME] = GWF_Time::getDate(GWF_Date::LEN_SECOND);
     if (false === $user->saveUserData($data)) {
         return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
     }
     // Clean thread table
     $threads = GDO::table('GWF_ForumThread');
     $uid = $user->getVar('user_id');
     if (false === $threads->update("thread_unread=REPLACE(thread_unread, ':{$uid}:', ':'), thread_force_unread=REPLACE(thread_force_unread, ':{$uid}:', ':')")) {
         return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
     }
     // 		$cnt = $threads->affectedRows(); # As we mark all read it's easier to assume it works :D
     return $this->module->message('msg_mark_aread', array($cnt));
 }