use of $wgRequest
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
index ddb66ac..afe39ce 100644 (file)
@@ -3,10 +3,13 @@ include_once( "SpecialRecentchanges.php" );
 
 function wfSpecialRecentchangeslinked( $par = NULL )
 {
-       global $wgUser, $wgOut, $wgLang, $wgTitle;
-       global $days, $target, $hideminor; # From query string
+       global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
        $fname = "wfSpecialRecentchangeslinked";
 
+       $days = $wgRequest->getInt( 'days' );
+       $target = $wgRequest->getText( 'target' );
+       $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
+       
        $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
        $sk = $wgUser->getSkin();
 
@@ -18,6 +21,12 @@ function wfSpecialRecentchangeslinked( $par = NULL )
                return;
        }
        $nt = Title::newFromURL( $target );
+       if( !$nt ) {
+               $wgOut->errorpage( "notargettitle", "notargettext" );
+               return;
+       }
+       $id = $nt->getArticleId();
+       
        $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
 
        if ( ! $days ) {
@@ -44,9 +53,8 @@ function wfSpecialRecentchangeslinked( $par = NULL )
 
        $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
          "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM links, cur " .
-         "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}";
+         "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " .
+      "GROUP BY cur_id ORDER BY inverse_timestamp LIMIT {$limit}";
        $res = wfQuery( $sql, DB_READ, $fname );
 
        $note = wfMsg( "rcnote", $limit, $days );