Well-formedness error
[lhc/web/wiklou.git] / includes / SpecialRecentchanges.php
index 46a5707..2fa0bb9 100644 (file)
@@ -6,12 +6,24 @@ function wfSpecialRecentchanges( $par )
 {
        global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgDBname;
        global $wgRequest, $wgSitename, $wgLanguageCode;
-       global $days, $hideminor, $from, $hidebots, $hideliu; # From query string
        $fname = "wfSpecialRecentchanges";
        
+       # Get query parameters
        $feedFormat = $wgRequest->getVal( "feed" );
        $feeding = ( $feedFormat == "rss" );
+
+       $defaultDays = $wgUser->getOption( 'rcdays' );
+       if ( !$defaultDays ) {
+               $defaultDays = 3;
+       }
+       
+       $days = $wgRequest->getInt( 'days', $defaultDays );
+       $hideminor = $wgRequest->getBool( 'hideminor', $wgUser->getOption( 'hideminor' ) ) ? 1 : 0;
+       $from = $wgRequest->getText( 'from' );
+       $hidebots = $wgRequest->getBool( 'hidebots', true ) ? 1 : 0;
+       $hideliu = $wgRequest->getBool( 'hideliu', false ) ? 1 : 0;
        
+       # Get query parameters from path
        if( $par ) {
                $bits = preg_split( '/\s*,\s*/', trim( $par ) );
                if( in_array( "hidebots", $bits ) ) $hidebots = 1;
@@ -41,12 +53,7 @@ function wfSpecialRecentchanges( $par )
        }
        
        $wgOut->addWikiText( $rctext );
-
-       if ( ! $days ) {
-               $days = $wgUser->getOption( "rcdays" );
-               if ( ! $days ) { $days = 3; }
-       }
-       $days = (int)$days;
+       
        list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
        $now = wfTimestampNow();
        $cutoff_unixtime = time() - ( $days * 86400 );
@@ -61,27 +68,16 @@ function wfSpecialRecentchanges( $par )
        $sk = $wgUser->getSkin();
        $showhide = array( wfMsg( "show" ), wfMsg( "hide" ));
        
-       if ( ! isset( $hideminor ) ) {
-               $hideminor = $wgUser->getOption( "hideminor" );
-       }
-       $hideminor = ($hideminor ? 1 : 0);
        if ( $hideminor ) {
                $hidem = "AND rc_minor=0";
        } else {
                $hidem = "";
        }
        
-       if ( !isset( $hidebots ) ) {
-               $hidebots = 1;
-       }
        if( $hidebots ) {
                $hidem .= " AND rc_bot=0";
        }
-       $hidebots = ($hidebots ? 1 : 0);
        
-       if ( !isset( $hideliu ) ) {
-               $hideliu = 0;
-       }
        if ( $hideliu ) {
                $hidem .= " AND rc_user=0";
        }
@@ -115,19 +111,17 @@ function wfSpecialRecentchanges( $par )
        } else {
                $note = wfMsg( "rcnote", $wgLang->formatNum( $limit ), $wgLang->formatNum( $days ) );
        }
-       $wgOut->addHTML( "\n<hr>\n{$note}\n<br>" );
+       $wgOut->addHTML( "\n<hr/>\n{$note}\n<br/>" );
 
        $note = rcDayLimitLinks( $days, $limit, "Recentchanges", $hideparams, false, $minorLink, $botLink, $liuLink );
 
-       $note .= "<br>\n" . wfMsg( "rclistfrom",
+       $note .= "<br/>\n" . wfMsg( "rclistfrom",
          $sk->makeKnownLink( $wgLang->specialPage( "Recentchanges" ),
          $wgLang->timeanddate( $now, true ), "{$hideparams}&from=$now" ) );
 
        $wgOut->addHTML( "{$note}\n" );
 
        if( $feeding ) {
-               $wgOut->disable();
-               
                $feed = new RSSFeed(
                        $wgSitename . " - " . wfMsg( "recentchanges" ) . " [" . $wgLanguageCode . "]",
                        htmlspecialchars( wfMsg( "recentchangestext" ) ),
@@ -147,6 +141,7 @@ function wfSpecialRecentchanges( $par )
        } else {
                $wgOut->setSyndicated( true );
                $s = $sk->beginRecentChangesList();
+               $counter = 1;
                foreach( $rows as $obj ){
                        if( $limit == 0) {
                                break; 
@@ -154,6 +149,7 @@ function wfSpecialRecentchanges( $par )
                        
                        if ( ! ( $hideminor && $obj->rc_minor ) ) {
                                $rc = RecentChange::newFromRow( $obj );
+                               $rc->counter = $counter++;
                                $s .= $sk->recentChangesLine( $rc, !empty( $obj->wl_user ) );
                                --$limit;
                        }