Added wfAbruptExit() function, to replace exit() calls with.
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
index 6625173..b2c568e 100644 (file)
@@ -1,37 +1,34 @@
 <?
-global $IP;
-include_once( "$IP/SpecialRecentchanges.php" );
+include_once( "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;
        }
        $nt = Title::newFromURL( $target );
-       $sub = str_replace( "$1", $nt->getPrefixedText(), wfMsg( "rclsub" ) );
-       $wgOut->setSubtitle( $sub );
+       $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
 
        if ( ! $days ) {
                $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" );
-       }
+       $hideminor = ($hideminor ? 1 : 0);
        if ( $hideminor ) {
                $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
                  WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
@@ -50,14 +47,15 @@ function wfSpecialRecentchangeslinked()
          "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from='" .
       wfStrencode( $nt->getPrefixedDBkey() ) . "' GROUP BY cur_id " .
          "ORDER BY inverse_timestamp LIMIT {$limit}";
-       $res = wfQuery( $sql, $fname );
+       $res = wfQuery( $sql, DB_READ, $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();
-       $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked", $tu );
+       $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
+                                 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
+                                 false, $mlink );
+
        $wgOut->addHTML( "{$note}\n" );
 
        $s = $sk->beginRecentChangesList();