render.ml updated to support newer ImageMagick and relative filepaths
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
index af30777..88cd478 100644 (file)
@@ -1,12 +1,15 @@
-<?
-include_once( "SpecialRecentchanges.php" );
+<?php
+require_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 ) {
@@ -28,6 +37,7 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
        $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
 
+       $hideminor = ($hideminor ? 1 : 0);
        if ( $hideminor ) {
                $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
                  WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
@@ -43,13 +53,13 @@ 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 );
 
+       $wgOut->addHTML("&lt; ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
        $note = wfMsg( "rcnote", $limit, $days );
-       $wgOut->addHTML( "<hr>\n{$note}\n<br>" );
+       $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
 
        $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
                                  "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
@@ -59,22 +69,16 @@ function wfSpecialRecentchangeslinked( $par = NULL )
 
        $s = $sk->beginRecentChangesList();
        $count = wfNumRows( $res );
-
+       
+       $counter = 1;
        while ( $limit ) {
                if ( 0 == $count ) { break; }
                $obj = wfFetchObject( $res );
                --$count;
 
-               $ts = $obj->cur_timestamp;
-               $u = $obj->cur_user;
-               $ut = $obj->cur_user_text;
-               $ns = $obj->cur_namespace;
-               $ttl = $obj->cur_title;
-               $com = $obj->cur_comment;
-               $me = ( $obj->cur_minor_edit > 0 );
-               $new = ( $obj->cur_is_new > 0 );
-
-               $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new );
+               $rc = RecentChange::newFromCurRow( $obj );
+               $rc->counter = $counter++;
+               $s .= $sk->recentChangesLine( $rc );
                --$limit;
        }
        $s .= $sk->endRecentChangesList();