This was moved to an extension a while ago
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 25 Feb 2005 09:18:46 +0000 (09:18 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 25 Feb 2005 09:18:46 +0000 (09:18 +0000)
includes/SpecialForum.php [deleted file]

diff --git a/includes/SpecialForum.php b/includes/SpecialForum.php
deleted file mode 100644 (file)
index 80d8edc..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/**
- *
- * @package MediaWiki
- * @subpackage SpecialPage
- */
-
-/**
- * constructor
- */
-function wfSpecialForum() 
-{
-   $forum = new Forum( $isbn );
-   echo $forum->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 .= "<!-- This page was generated by forum.php -->\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 .= "<h1>[[$t|". $tab[$cnt]->title ."]]</h1>\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