fixup database timestamps
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
index 8c2f3ff..5b56a91 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-include_once( "SpecialRecentchanges.php" );
+require_once( "SpecialRecentchanges.php" );
 
 function wfSpecialRecentchangeslinked( $par = NULL )
 {
@@ -35,27 +35,31 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        }
        $days = (int)$days;
        list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
-       $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
+
+       $dbr =& wfGetDB( DB_SLAVE );
+       $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
 
        $hideminor = ($hideminor ? 1 : 0);
        if ( $hideminor ) {
                $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
-                 WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+                 WfMsg( "show" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
                  "&days={$days}&limit={$limit}&hideminor=0" );
        } else {
                $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
-                 WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+                 WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
                  "&days={$days}&limit={$limit}&hideminor=1" );
        }
        if ( $hideminor ) {
                $cmq = "AND cur_minor_edit=0";
        } else { $cmq = ""; }
 
+       extract( $dbr->tableNames( 'cur', 'links' ) );
+
        $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 " .
+         "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=$id " .
       "GROUP BY cur_id ORDER BY inverse_timestamp LIMIT {$limit}";
-       $res = wfQuery( $sql, DB_READ, $fname );
+       $res = $dbr->query( $sql, $fname );
 
        $wgOut->addHTML("&lt; ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
        $note = wfMsg( "rcnote", $limit, $days );
@@ -68,12 +72,12 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        $wgOut->addHTML( "{$note}\n" );
 
        $s = $sk->beginRecentChangesList();
-       $count = wfNumRows( $res );
+       $count = $dbr->numRows( $res );
        
        $counter = 1;
        while ( $limit ) {
                if ( 0 == $count ) { break; }
-               $obj = wfFetchObject( $res );
+               $obj = $dbr->fetchObject( $res );
                --$count;
 
                $rc = RecentChange::newFromCurRow( $obj );
@@ -83,7 +87,7 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        }
        $s .= $sk->endRecentChangesList();
 
-       wfFreeResult( $res );
+       $dbr->freeResult( $res );
        $wgOut->addHTML( $s );
 }