fix synxtax
[lhc/web/wiklou.git] / includes / SpecialRandomredirect.php
index b7aa3e4..ccf5cbc 100644 (file)
@@ -7,27 +7,14 @@
  * @author Rob Church <robchur@gmail.com>, Ilmari Karonen
  * @license GNU General Public Licence 2.0 or later
  */
-
-/**
- * Main execution point
- * @param $par Namespace to select the redirect from
- */
-function wfSpecialRandomredirect( $par = null ) {
-       global $wgOut, $wgContLang;
-
-       $rnd = new RandomPage();
-       $rnd->setNamespace( $wgContLang->getNsIndex( $par ) );
-       $rnd->setRedirect( true );
-
-       $title = $rnd->getRandomTitle();
-
-       if( is_null( $title ) ) {
-               $wgOut->addWikiText( wfMsg( 'randomredirect-nopages' ) );
-               return;
+class SpecialRandomredirect extends RandomPage {
+       function __construct(){
+               parent::__construct( 'Randomredirect' );        
        }
 
-       $wgOut->reportTime();
-       $wgOut->redirect( $title->getFullUrl( 'redirect=no' ) );
+       // Override parent::isRedirect()
+       public function isRedirect(){
+               return true;
+       }
 }
 
-