Enhances special page links; allow some parameters to be passed via wikilinks to...
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
index 6625173..cb5f69e 100644 (file)
@@ -2,15 +2,18 @@
 global $IP;
 include_once( "$IP/SpecialRecentchanges.php" );
 
-function wfSpecialRecentchangeslinked()
+function wfSpecialRecentchangeslinked( $par = NULL )
 {
        global $wgUser, $wgOut, $wgLang, $wgTitle;
-       global $days, $limit, $target, $hideminor; # From query string
+       global $days, $target, $hideminor; # From query string
        $fname = "wfSpecialRecentchangeslinked";
 
        $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
        $sk = $wgUser->getSkin();
 
+       if( $par ) {
+               $target = $par;
+       }
        if ( "" == $target ) {
                $wgOut->errorpage( "notargettitle", "notargettext" );
                return;
@@ -23,11 +26,9 @@ function wfSpecialRecentchangeslinked()
                $days = $wgUser->getOption( "rcdays" );
                if ( ! $days ) { $days = 7; }
        }
-       if ( ! $limit ) {
-               $limit = $wgUser->getOption( "rclimit" );
-               if ( ! $limit ) { $limit = 100; }
-       }
-       $cutoff = date( "YmdHis", time() - ( $days * 86400 ) );
+       $days = (int)$days;
+       list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
+       $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
 
        if ( ! isset( $hideminor ) ) {
                $hideminor = $wgUser->getOption( "hideminor" );
@@ -52,8 +53,7 @@ function wfSpecialRecentchangeslinked()
          "ORDER BY inverse_timestamp LIMIT {$limit}";
        $res = wfQuery( $sql, $fname );
 
-       $note = str_replace( "$1", $limit, wfMsg( "rcnote" ) );
-       $note = str_replace( "$2", $days, $note );
+       $note = wfMsg( "rcnote", $limit, $days );
        $wgOut->addHTML( "<hr>\n{$note}\n<br>" );
 
        $tu = "target=" . $nt->getPrefixedURL();