Removed hardcodes for Zh-conversion
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
index 5b56a91..f1df7c2 100644 (file)
@@ -1,10 +1,22 @@
 <?php
-require_once( "SpecialRecentchanges.php" );
+/**
+ * This is to display changes made to all articles linked in an article.
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 
-function wfSpecialRecentchangeslinked( $par = NULL )
-{
+/**
+ *
+ */
+require_once( 'SpecialRecentchanges.php' );
+
+/**
+ * Entrypoint
+ * @param string $par parent page we will look at
+ */
+function wfSpecialRecentchangeslinked( $par = NULL ) {
        global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
-       $fname = "wfSpecialRecentchangeslinked";
+       $fname = 'wfSpecialRecentchangeslinked';
 
        $days = $wgRequest->getInt( 'days' );
        $target = $wgRequest->getText( 'target' );
@@ -16,33 +28,33 @@ function wfSpecialRecentchangeslinked( $par = NULL )
        if( $par ) {
                $target = $par;
        }
-       if ( "" == $target ) {
-               $wgOut->errorpage( "notargettitle", "notargettext" );
+       if ( $target == '') {
+               $wgOut->errorpage( 'notargettitle', 'notargettext' );
                return;
        }
        $nt = Title::newFromURL( $target );
        if( !$nt ) {
-               $wgOut->errorpage( "notargettitle", "notargettext" );
+               $wgOut->errorpage( 'notargettitle', 'notargettext' );
                return;
        }
        $id = $nt->getArticleId();
        
-       $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
+       $wgOut->setSubtitle( wfMsg( 'rclsub', $nt->getPrefixedText() ) );
 
        if ( ! $days ) {
-               $days = $wgUser->getOption( "rcdays" );
+               $days = $wgUser->getOption( 'rcdays' );
                if ( ! $days ) { $days = 7; }
        }
        $days = (int)$days;
-       list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
+       list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
 
        $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=" . htmlspecialchars( $nt->getPrefixedURL() ) .
+               $mlink = $sk->makeKnownLink( $wgLang->specialPage( 'Recentchangeslinked' ),
+                 WfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
                  "&days={$days}&limit={$limit}&hideminor=0" );
        } else {
                $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
@@ -50,15 +62,16 @@ function wfSpecialRecentchangeslinked( $par = NULL )
                  "&days={$days}&limit={$limit}&hideminor=1" );
        }
        if ( $hideminor ) {
-               $cmq = "AND cur_minor_edit=0";
-       } else { $cmq = ""; }
+               $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 " .
          "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " .
-      "GROUP BY cur_id ORDER BY inverse_timestamp LIMIT {$limit}";
+          "GROUP BY cur_id,cur_namespace,cur_title,cur_user,cur_comment,cur_user_text," .
+         "cur_timestamp,cur_minor_edit,cur_is_new,inverse_timestamp ORDER BY inverse_timestamp LIMIT {$limit}";
        $res = $dbr->query( $sql, $fname );
 
        $wgOut->addHTML("&lt; ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
@@ -69,7 +82,7 @@ function wfSpecialRecentchangeslinked( $par = NULL )
                                  "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
                                  false, $mlink );
 
-       $wgOut->addHTML( "{$note}\n" );
+       $wgOut->addHTML( $note."\n" );
 
        $s = $sk->beginRecentChangesList();
        $count = $dbr->numRows( $res );