(bug 32434) API allows reblocking the user without reblock parameter.
[lhc/web/wiklou.git] / includes / ChangesList.php
index e7395c0..0bd16f7 100644 (file)
@@ -383,13 +383,20 @@ class ChangesList extends ContextSource {
                $s .= " $articlelink";
        }
 
+       /**
+        * @param $rc RecentChange
+        */
+       public function getTimestamp( $rc ) {
+               return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
+                       $this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
+       }
+
        /**
         * @param $s
         * @param $rc RecentChange
         */
        public function insertTimestamp( &$s, $rc ) {
-               $s .= $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
-                       $this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
+               $s .= $this->getTimestamp( $rc );
        }
 
        /**
@@ -435,6 +442,7 @@ class ChangesList extends ContextSource {
                                return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
                        }
                }
+               return '';
        }
 
        /**
@@ -514,12 +522,12 @@ class ChangesList extends ContextSource {
                        if ( $this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] )
                        {
                                $rev = new Revision( array(
+                                       'title'     => $page,
                                        'id'        => $rc->mAttribs['rc_this_oldid'],
                                        'user'      => $rc->mAttribs['rc_user'],
                                        'user_text' => $rc->mAttribs['rc_user_text'],
                                        'deleted'   => $rc->mAttribs['rc_deleted']
                                ) );
-                               $rev->setTitle( $page );
                                $s .= ' '.Linker::generateRollback( $rev, $this->getContext() );
                        }
                }
@@ -862,6 +870,8 @@ class EnhancedChangesList extends ChangesList {
                # Other properties
                $unpatrolled = false;
                $isnew = false;
+               $allBots = true;
+               $allMinors = true;
                $curId = $currentRevision = 0;
                # Some catalyst variables...
                $namehidden = true;
@@ -895,7 +905,13 @@ class EnhancedChangesList extends ChangesList {
                                $currentRevision = $rcObj->mAttribs['rc_this_oldid'];
                        }
 
-                       $bot = $rcObj->mAttribs['rc_bot'];
+                       if( !$rcObj->mAttribs['rc_bot'] ) {
+                               $allBots = false;
+                       }
+                       if( !$rcObj->mAttribs['rc_minor'] ) {
+                               $allMinors = false;
+                       }
+
                        $userlinks[$u]++;
                }
 
@@ -922,10 +938,10 @@ class EnhancedChangesList extends ChangesList {
 
                # Main line
                $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
-                       'newpage' => $isnew,
-                       'minor' => false,
-                       'unpatrolled' => $unpatrolled,
-                       'bot' => $bot ,
+                       'newpage' => $isnew, # show, when one have this flag
+                       'minor' => $allMinors, # show only, when all have this flag
+                       'unpatrolled' => $unpatrolled, # show, when one have this flag
+                       'bot' => $allBots, # show only, when all have this flag
                ) );
 
                # Timestamp