示例#1
0
文件: Reply.php 项目: sinfocol/gwf3
 private function getReplyTitle()
 {
     $title = $this->replyThread === true ? $this->thread->getVar('thread_title') : $this->post->getVar('post_title');
     if (!Common::startsWith($title, 'RE: ')) {
         $title = 'RE: ' . $title;
     }
     return $title;
     #return GWF_HTML::display($title);
 }
示例#2
0
 public function execute()
 {
     GWF_ForumBoard::init(true);
     if (false !== ($error = $this->sanitize())) {
         return $error;
     }
     GWF_Website::addJavascript(GWF_WEB_ROOT . 'js/module/Forum/gwf_forum.js');
     if ($this->module->cfgUseGTranslate()) {
         GWF_Website::addJavascript(Common::getProtocol() . '://www.google.com/jsapi');
         GWF_Website::addJavascriptInline('google.load("language", "1");');
     }
     GWF_Website::setPageTitle($this->module->lang('pt_thread', array($this->thread->getBoard()->getVar('board_title'), $this->thread->getVar('thread_title'))));
     return $this->templateThread();
 }
示例#3
0
文件: IRC.php 项目: sinfocol/gwf3
 private function getLastPosterName(GWF_ForumThread $thread)
 {
     $posts = GDO::table('GWF_ForumPost');
     # posts table
     $date = $thread->getVar('thread_lastdate');
     # last date
     # Check if a post was made at this date.
     if (false !== ($username = $posts->selectVar('user_name', "post_date='{$date}'", '', array('post_uid')))) {
         return $username;
     }
     # Check if an edit was made at this date.
     if (false !== ($username = $posts->selectVar('post_eusername', "post_edate='{$date}'"))) {
         return $username;
     }
     # Should not get here (race condition) but works as a fallback.
     return $thread->getVar('thread_lastposter');
 }
示例#4
0
 private function onMerge(GWF_ForumThread $first, GWF_ForumThread $last)
 {
     // Delete thread
     if (false === $last->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     // Sum counters
     if (false === $first->saveVar('thread_postcount', $first->getPostCount() + $last->getPostCount())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $first->saveVar('thread_viewcount', $first->getVar('thread_viewcount') + $last->getVar('thread_viewcount'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $first->saveVar('thread_thanks', $first->getVar('thread_thanks') + $last->getVar('thread_thanks'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $first->saveVar('thread_votes_up', $first->getVar('thread_votes_up') + $last->getVar('thread_votes_up'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $first->saveVar('thread_votes_down', $first->getVar('thread_votes_down') + $last->getVar('thread_votes_down'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     // -1 thread
     if (false === $first->getBoard()->adjustCounters(-1, 0)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     // change threadid's
     $t1id = $first->getID();
     $t2id = $last->getID();
     if (false === GDO::table('GWF_ForumPost')->update("post_tid={$t1id}", "post_tid={$t2id}")) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     // Done
     return $this->module->message('msg_merged');
 }