With &debugmsg=1, PHP output a warning because the link trail no longer
[lhc/web/wiklou.git] / includes / Skin.php
index 17ddf6e..8e087ce 100644 (file)
@@ -439,13 +439,13 @@ class Skin {
                $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
                return $printfooter . $this->doAfterContent();
        }
-       
+
        function printSource() {
                global $wgTitle;
                $url = htmlspecialchars( $wgTitle->getFullURL() );
                return wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" );
        }
-       
+
        function printFooter() {
                return "<p>" .  $this->printSource() .
                        "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
@@ -2250,7 +2250,7 @@ class Skin {
 
        function recentChangesLineOld( &$rc, $watched = false )
        {
-               global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
+               global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
 
                # Extract DB fields into local scope
                extract( $rc->mAttribs );
@@ -2265,7 +2265,9 @@ class Skin {
                        $this->lastdate = $date;
                        $this->rclistOpen = true;
                }
-               $s .= '<li> ';
+
+               # If this edit has not yet been patrolled, make it stick out
+               $s .= ( ! $wgUseRCPatrol || $rc_patrolled ) ? '<li> ' : '<li class="not_patrolled"> ';
 
                if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        # Diff
@@ -2275,11 +2277,7 @@ class Skin {
                                ') . . ';
 
                        # "[[x]] moved to [[y]]"
-                       if ( $rc_type == RC_MOVE ) {
-                               $msg = '1movedto2';
-                       } else {
-                               $msg = '1movedto2_redir';
-                       }
+                       $msg = ( $rc_type == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
                        $s .= wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                                $this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
                } else {
@@ -2287,8 +2285,14 @@ class Skin {
                        if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) {
                                $diffLink = wfMsg( 'diff' );
                        } else {
+                               if ( $wgUseRCPatrol && $rc_patrolled == 0 && $wgUser->getID() != 0 &&
+                                    ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
+                                       $rcidparam = "&rcid={$rc_id}";
+                               else
+                                       $rcidparam = "";
                                $diffLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( 'diff' ),
-                                 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid  ,'' ,'' , ' tabindex="'.$rc->counter.'"');
+                                 "{$curIdEq}&diff={$rc_this_oldid}&oldid={$rc_last_oldid}{$rcidparam}",
+                                 '', '', ' tabindex="'.$rc->counter.'"');
                        }
                        $s .= '('.$diffLink.') (';
 
@@ -2303,7 +2307,13 @@ class Skin {
                        if ( $rc_type == RC_NEW ) { $s .= '<strong>'.$N.'</strong>'; }
 
                        # Article link
-                       $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '' );
+                       # If it's a new article, there is no diff link, but if it hasn't been
+                       # patrolled yet, we need to give users a way to do so
+                       if ( $wgUseRCPatrol && $rc_type == RC_NEW && $rc_patrolled == 0 &&
+                            $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
+                               $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
+                       else
+                               $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '' );
 
                        if ( $watched ) {
                                $articleLink = '<strong>'.$articleLink.'</strong>';
@@ -2356,7 +2366,6 @@ class Skin {
                return $s;
        }
 
-#      function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
        function recentChangesLineNew( &$baseRC, $watched = false )
        {
                global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
@@ -2370,7 +2379,7 @@ class Skin {
 
                # If it's a new day, add the headline and flush the cache
                $date = $wgLang->date( $rc_timestamp, true);
-               $ret = '' ;
+               $ret = '';
                if ( $date != $this->lastdate ) {
                        # Process current cache
                        $ret = $this->recentChangesBlock () ;
@@ -2381,11 +2390,7 @@ class Skin {
 
                # Make article link
                if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
-                       if ( $rc_type == RC_MOVE ) {
-                               $msg = "1movedto2";
-                       } else {
-                               $msg = "1movedto2_redir";
-                       }
+                       $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
                        $clink = wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                          $this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
                } else {
@@ -2418,7 +2423,7 @@ class Skin {
                }
 
                # Make user link (or user contributions for unregistered users)
-               if ( 0 == $rc_user ) {
+               if ( $rc_user == 0 ) {
                        $userLink = $this->makeKnownLink( $wgLang->specialPage( 'Contributions' ),
                        $rc_user_text, 'target=' . $rc_user_text );
                } else {
@@ -2426,12 +2431,11 @@ class Skin {
                          Namespace::getUser() ) . ':'.$rc_user_text, $rc_user_text );
                }
 
-               $rc->userlink = $userLink ;
-               $rc->lastlink = $lastLink ;
-               $rc->curlink = $curLink ;
+               $rc->userlink = $userLink;
+               $rc->lastlink = $lastLink;
+               $rc->curlink  = $curLink;
                $rc->difflink = $diffLink;
 
-
                # Make user talk link
                $utns=$wgLang->getNsText(NS_USER_TALK);
                $talkname=$wgLang->getNsText(NS_TALK); # use the shorter name