From c22d3444242af24061c58c75fb03794895680aad Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 25 Feb 2005 09:18:46 +0000 Subject: [PATCH] This was moved to an extension a while ago --- includes/SpecialForum.php | 153 -------------------------------------- 1 file changed, 153 deletions(-) delete mode 100644 includes/SpecialForum.php diff --git a/includes/SpecialForum.php b/includes/SpecialForum.php deleted file mode 100644 index 80d8edc29b..0000000000 --- a/includes/SpecialForum.php +++ /dev/null @@ -1,153 +0,0 @@ -Generate(); -} - -/** - * - * @package MediaWiki - * @subpackage SpecialPage - */ -class Thread { - var $title; - var $comment; - var $user; - var $timestamp; - var $count; -} - -/** - * - * @package MediaWiki - * @subpackage SpecialPage - */ -class Forum { - var $mMainPage; - var $mMaxThread; - var $mMaxFullText; - var $mSumLength; - - /** @todo document */ - function Forum() { - $this->SetMainPage( "Forum" ); - $this->mMaxThread = 50; - $this->mMaxFullText = 10; - $this->mSumLength = 30; - } - - /** @todo document */ - function SetMainPage( $mp ) { - global $wgLang; - $this->mMainPage = $wgLang->getNsText( NS_WIKIPEDIA ) . ":$mp"; - } - - function Generate() { - global $wgLang, $wgServer; - - $fname = 'Forum::generate'; - - // Get last X modified thread - wfDebug("FORUM - START GENERATE\n"); - $dbr =& wfGetDB( DB_SLAVE ); - $cur = $dbr->tableName( 'cur' ); - $sql = "SELECT cur_title, cur_comment, cur_user_text, cur_timestamp, cur_counter FROM $cur". - "WHERE cur_namespace = ".NS_THREAD. - "AND cur_is_redirect = 0". - "ORDER BY cur_timestamp DESC". - "LIMIT $this->mMaxThread"; - $res = $dbr->query( $sql, $fname ) ; - $num = mysql_num_rows( $res ); - - // Generate forum's text - $text = ''; - $text .= "\n"; - $text .= "__NOEDITSECTION__\n"; - - $tab = array(); - $cnt = 0; - - while( $x = mysql_fetch_array( $res ) ) { - $cnt++; - $tab[$num-$cnt] = new Thread; - $tab[$num-$cnt]->title = $x['cur_title']; - $tab[$num-$cnt]->comment = $x['cur_comment']; - $tab[$num-$cnt]->user = $x['cur_user_text']; - $tab[$num-$cnt]->timestamp = $x['cur_timestamp']; - $tab[$num-$cnt]->count = $x['cur_counter']; - if(strlen($tab[$num-$cnt]->comment) > $this->mSumLength) { - $tab[$num-$cnt]->comment = substr($tab[$num-$cnt]->comment, 0, $this->mSumLength) . "..."; - } - } - - // FIXME !! Use database abastraction layer - mysql_free_result( $res ); - - $summary = $num - $this->mMaxFullText; - - if($summary > 0) { - //$text .= "==Last thread==\n"; - $text .= "{| border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"border:1px solid black;\"\n"; - $text .= "|- bgcolor=\"#D0D0D0\"\n"; - $text .= "! Thread !! Cnt !! Last user !! Last comment !! Time\n"; - } - - for( $cnt=0; $cnt<$num; $cnt++ ) { - $t = $wgLang->getNsText( NS_THREAD ); - if ( $t != '' ) { $t .= ':' ; } - $t .= $tab[$cnt]->title; - - $title = Title::newFromText( $t ); - - if($cnt < $summary) { - if($cnt & 1) { - $text .= "|- bgcolor=\"#F0F0F0\"\n"; - } else { - $text .= "|- bgcolor=\"#FFFFFF\"\n"; - } - $text .= "| [[$t|". $tab[$cnt]->title ."]] || ". $tab[$cnt]->count ." || [[". - $wgLang->getNsText( NS_USER ) .":". $tab[$cnt]->user ."|" .$tab[$cnt]->user. "]] || ". $tab[$cnt]->comment ." || ". - $wgLang->timeanddate($tab[$cnt]->timestamp) ."\n"; - } else { - $text .= "

[[$t|". $tab[$cnt]->title ."]]

\n"; - $text .= "{{{$t}}}\n\n"; - $text .= "'''> [$wgServer" . $title->getEditUrl() ." Add a message]'''\n\n"; - } - - if($cnt == $summary-1) { - if($summary > 0) { - $text .= "|}\n\n"; - } - } - } - - $text .= "\n'''[[Create a new thread]]'''"; - - wfDebug( $text ); -/* - // Generate forum's main page - wfDebug("FORUM - CREATE PAGE <$this->mMainPage>\n"); - $title = Title::newFromText( $this->mMainPage ); - $article = new Article( $title ); - $ok = $article->updateArticle($text, "Upade forum", true, false); - if($ok) - wfDebug("FORUM - UPDATE SUCCED\n"); - else - wfDebug("FORUM - UPDATE FAILED\n"); -*/ - wfDebug("FORUM - END GENERATE\n"); - - return $text; - } -} -?> \ No newline at end of file -- 2.20.1