Fix for r41837 -- apply HTML stripping to explicit alt text as well as implicit.
[lhc/web/wiklou.git] / includes / ChangesList.php
index fb013e8..41d2039 100644 (file)
@@ -75,38 +75,17 @@ class ChangesList {
         * @param bool $patrolled
         * @param string $nothing, string to use for empty space
         * @param bool $bot
-        * @param bool $newbie
         * @return string
         */
-       protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false, $newbie = false ) {
+       protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) {
                $f = $new ? '<span class="newpage">' . $this->message['newpageletter'] . '</span>'
                                : $nothing;
                $f .= $minor ? '<span class="minor">' . $this->message['minoreditletter'] . '</span>'
                                : $nothing;
                $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
                $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
-               $f .= $newbie ? '<span class="newuser">*</span>' : $nothing;
                return $f;
        }
-       
-       protected static function userIsNew( Array $attribs ) {
-               global $wgAutoConfirmCount, $wgAutoConfirmAge;
-               if( !array_key_exists('user_editcount',$attribs) || !array_key_exists('user_registration',$attribs) ) {
-                       return false; // missing input!
-               }
-               static $time;
-               $time = time();
-               $edits = $attribs['user_editcount'];
-               $age = $attribs['user_registration'];
-               if( $wgAutoConfirmCount && !$edits || $wgAutoConfirmAge && !$age ) {
-                       return true;
-               } else if( $wgAutoConfirmCount && $edits < $wgAutoConfirmCount ) {
-                       return true;
-               } else if( $wgAutoConfirmAge && ($time - wfTimestampOrNull(TS_UNIX,$age)) < $wgAutoConfirmAge ) {
-                       return true;
-               }
-               return false;
-       }
 
        /**
         * Returns text for the start of the tabular part of RC
@@ -342,7 +321,7 @@ class OldChangesList extends ChangesList {
                $dateheader = ""; // $s now contains only <li>...</li>, for hooks' convenience.
                $this->insertDateHeader($dateheader,$rc_timestamp);
 
-               $s = '<li>';
+               $s = '';
 
                // Moved pages
                if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
@@ -364,10 +343,9 @@ class OldChangesList extends ChangesList {
                        wfProfileIn($fname.'-page');
 
                        $this->insertDiffHist($s, $rc, $unpatrolled);
+
                        # M, N, b and ! (minor, new, bot and unpatrolled)
-                       $newbie = self::userIsNew( $rc->mAttribs );
-                       $s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', 
-                               $rc_bot, $newbie );
+                       $s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
                        $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
 
                        wfProfileOut($fname.'-page');
@@ -394,9 +372,9 @@ class OldChangesList extends ChangesList {
                        $s .= ' ' . wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($rc->numberofWatchingusers));
                }
 
-               $s .= "</li>\n";
-
-               wfRunHooks('OldChangesListRecentChangesLine', array(&$this, &$s, &$rc));
+               wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) );
+               
+               $s = "<li>$s</li>\n";
 
                wfProfileOut( $fname.'-rest' );
 
@@ -564,14 +542,15 @@ class EnhancedChangesList extends ChangesList {
                # Collate list of users
                $userlinks = array();
                # Other properties
-               $unpatrolled = $isnew = $newbie = false;
+               $unpatrolled = false;
+               $isnew = false;
                $curId = $currentRevision = 0;
                # Some catalyst variables...
                $namehidden = true;
                $alllogs = true;
                foreach( $block as $rcObj ) {
                        $oldid = $rcObj->mAttribs['rc_last_oldid'];
-                       if( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
+                       if( $rcObj->mAttribs['rc_new'] ) {
                                $isnew = true;
                        }
                        // If all log actions to this page were hidden, then don't
@@ -589,9 +568,6 @@ class EnhancedChangesList extends ChangesList {
                        if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
                                $alllogs = false;
                        }
-                       if( self::userIsNew( $rcObj->mAttribs ) ) {
-                               $newbie = true;
-                       }
                        # Get the latest entry with a page_id and oldid
                        # since logs may not have these.
                        if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
@@ -630,7 +606,7 @@ class EnhancedChangesList extends ChangesList {
                $r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.'&nbsp;';
 
                # Main line
-               $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot, $newbie );
+               $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
 
                # Timestamp
                $r .= '&nbsp;'.$block[0]->timestamp.'&nbsp;</tt></td><td>';
@@ -713,8 +689,7 @@ class EnhancedChangesList extends ChangesList {
                        #$r .= '<tr><td valign="top">'.$this->spacerArrow();
                        $r .= '<tr><td valign="top">';
                        $r .= '<tt>'.$this->spacerIndent() . $this->spacerIndent();
-                       $newbie = self::userIsNew( $rcObj->mAttribs );
-                       $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot, $newbie );
+                       $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
                        $r .= '&nbsp;</tt></td><td valign="top">';
 
                        $o = '';
@@ -840,15 +815,14 @@ class EnhancedChangesList extends ChangesList {
                $curIdEq = 'curid='.$rc_cur_id;
 
                $r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
+
                $r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . '&nbsp;';
 
                # Flag and Timestamp
                if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        $r .= '&nbsp;&nbsp;&nbsp;&nbsp;'; // 4 flags -> 4 spaces
                } else {
-                       $newbie = self::userIsNew( $rcObj->mAttribs );
-                       $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, 
-                               '&nbsp;', $rc_bot, $newbie );
+                       $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
                }
                $r .= '&nbsp;'.$rcObj->timestamp.'&nbsp;</tt></td><td>';
 
@@ -864,7 +838,7 @@ class EnhancedChangesList extends ChangesList {
                }
 
                # Diff and hist links
-               if( $rc_type != RC_LOG ) {
+               if ( $rc_type != RC_LOG ) {
                   $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
                   $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
                }