Fix retarded mistake in 57997, move break to within the if block or it defeats the...
[lhc/web/wiklou.git] / includes / HistoryPage.php
index 81ab58b..6103a93 100644 (file)
@@ -50,8 +50,9 @@ class HistoryPage {
        function preCacheMessages() {
                // Precache various messages
                if( !isset( $this->message ) ) {
-                       foreach( explode(' ', 'cur last rev-delundel' ) as $msg ) {
-                               $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
+                       $msgs = array( 'cur', 'last', 'rev-delundel', 'pipe-separator' );
+                       foreach( $msgs as $msg ) {
+                               $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities') );
                        }
                }
        }
@@ -106,11 +107,16 @@ class HistoryPage {
                if( !$this->title->exists() ) {
                        $wgOut->addWikiMsg( 'nohistory' );
                        # show deletion/move log if there is an entry
-                       LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->title->getPrefixedText(), '',
+                       LogEventsList::showLogExtract(
+                               $wgOut,
+                               array( 'delete', 'move' ),
+                               $this->title->getPrefixedText(),
+                               '',
                                array(  'lim' => 10,
                                        'conds' => array( "log_action != 'revision'" ),
                                        'showIfEmpty' => false,
-                                       'msgKey' => array( 'moveddeleted-notice' ) ) 
+                                       'msgKey' => array( 'moveddeleted-notice' )
+                               )
                        );
                        wfProfileOut( __METHOD__ );
                        return;
@@ -127,7 +133,11 @@ class HistoryPage {
                $action = htmlspecialchars( $wgScript );
                $wgOut->addHTML(
                        "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
-                       Xml::fieldset( wfMsg( 'history-fieldset-title' ), false, array( 'id' => 'mw-history-search' ) ) .
+                       Xml::fieldset(
+                               wfMsg( 'history-fieldset-title' ),
+                               false,
+                               array( 'id' => 'mw-history-search' )
+                       ) .
                        Xml::hidden( 'title', $this->title->getPrefixedDBKey() ) . "\n" .
                        Xml::hidden( 'action', 'history' ) . "\n" .
                        xml::dateMenu( $year, $month ) . '&nbsp;' .
@@ -175,7 +185,7 @@ class HistoryPage {
                        Revision::selectFields(),
                        array_merge(array("rev_page=$page_id"), $offsets),
                        __METHOD__,
-                       array( 'ORDER BY' => "rev_timestamp $dirs", 
+                       array( 'ORDER BY' => "rev_timestamp $dirs",
                                'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit)
                );
        }
@@ -191,10 +201,11 @@ class HistoryPage {
                }
 
                $feed = new $wgFeedClasses[$type](
-               $this->title->getPrefixedText() . ' - ' .
-               wfMsgForContent( 'history-feed-title' ),
-               wfMsgForContent( 'history-feed-description' ),
-               $this->title->getFullUrl( 'action=history' ) );
+                       $this->title->getPrefixedText() . ' - ' .
+                       wfMsgForContent( 'history-feed-title' ),
+                       wfMsgForContent( 'history-feed-description' ),
+                       $this->title->getFullUrl( 'action=history' )
+               );
 
                // Get a limit on number of feed entries. Provide a sane default
                // of 10 if none is defined (but limit to $wgFeedLimit max)
@@ -248,10 +259,15 @@ class HistoryPage {
                if( $rev->getComment() == '' ) {
                        global $wgContLang;
                        $title = wfMsgForContent( 'history-feed-item-nocomment',
-                       $rev->getUserText(),
-                       $wgContLang->timeanddate( $rev->getTimestamp() ) );
+                               $rev->getUserText(),
+                               $wgContLang->timeanddate( $rev->getTimestamp() ),
+                               $wgContLang->date( $rev->getTimestamp() ),
+                               $wgContLang->time( $rev->getTimestamp() )
+                       );
                } else {
-                       $title = $rev->getUserText() . wfMsgForContent( 'colon-separator' ) . FeedItem::stripComment( $rev->getComment() );
+                       $title = $rev->getUserText() .
+                       wfMsgForContent( 'colon-separator' ) .
+                       FeedItem::stripComment( $rev->getComment() );
                }
                return new FeedItem(
                        $title,
@@ -264,7 +280,6 @@ class HistoryPage {
        }
 }
 
-
 /**
  * @ingroup Pager
  */
@@ -279,7 +294,7 @@ class HistoryPager extends ReverseChronologicalPager {
                $this->tagFilter = $tagFilter;
                $this->getDateCond( $year, $month );
        }
-       
+
        // For hook compatibility...
        function getArticle() {
                return $this->historyPage->getArticle();
@@ -293,12 +308,14 @@ class HistoryPager extends ReverseChronologicalPager {
                        'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ),
                        'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
                );
-               ChangeTags::modifyDisplayQuery( $queryInfo['tables'],
-                                                                               $queryInfo['fields'],
-                                                                               $queryInfo['conds'],
-                                                                               $queryInfo['join_conds'],
-                                                                               $queryInfo['options'],
-                                                                               $this->tagFilter );
+               ChangeTags::modifyDisplayQuery(
+                       $queryInfo['tables'],
+                       $queryInfo['fields'],
+                       $queryInfo['conds'],
+                       $queryInfo['join_conds'],
+                       $queryInfo['options'],
+                       $this->tagFilter
+               );
                wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) );
                return $queryInfo;
        }
@@ -326,7 +343,7 @@ class HistoryPager extends ReverseChronologicalPager {
         * @return string HTML output
         */
        function getStartBody() {
-               global $wgScript, $wgEnableHtmlDiff, $wgUser, $wgOut;
+               global $wgScript, $wgEnableHtmlDiff, $wgUser, $wgOut, $wgContLang;
                $this->lastRow = false;
                $this->counter = 1;
                $this->oldIdChecked = 0;
@@ -335,15 +352,19 @@ class HistoryPager extends ReverseChronologicalPager {
                $s = Xml::openElement( 'form', array( 'action' => $wgScript,
                        'id' => 'mw-history-compare' ) ) . "\n";
                $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
+               $s .= Xml::hidden( 'action', 'historysubmit' ) . "\n";
 
                $this->buttons = '<div>';
                if( $wgUser->isAllowed('deleterevision') ) {
-                       $this->buttons .= Xml::element( 'button', 
+                       $float = $wgContLang->alignEnd();
+                       # Note bug #20966, <button> is non-standard in IE<8
+                       $this->buttons .= Xml::element( 'button',
                                array(
                                        'type' => 'submit',
-                                       'name' => 'action',
-                                       'value' => 'revisiondelete',
-                                       'style' => 'float: right',
+                                       'name' => 'revisiondelete',
+                                       'value' => '1',
+                                       'style' => "float: $float;",
+                                       'class' => 'mw-history-revisiondelete-button',
                                ),
                                wfMsg( 'showhideselectedversions' )
                        ) . "\n";
@@ -445,14 +466,22 @@ class HistoryPager extends ReverseChronologicalPager {
                $curlink = $this->curLink( $rev, $latest );
                $lastlink = $this->lastLink( $rev, $next, $counter );
                $diffButtons = $this->diffButtons( $rev, $firstInList, $counter );
+               $histLinks = Html::rawElement(
+                               'span',
+                               array( 'class' => 'mw-history-histlinks' ),
+                               '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') '
+               );
+               $s = $histLinks . $diffButtons;
+
                $link = $this->revLink( $rev );
                $classes = array();
 
-               $s = "($curlink) ($lastlink) $diffButtons";
-
                if( $wgUser->isAllowed( 'deleterevision' ) ) {
+                       // Don't show useless link to people who cannot hide revisions
+                       if( !$rev->getVisibility() && !$wgUser->isAllowed( 'deleterevision' ) ) {
+                               $del = Xml::check( 'deleterevisions', false, array('class' => 'mw-revdelundel-hidden') );
                        // If revision was hidden from sysops
-                       if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
+                       } else if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
                                $del = Xml::check( 'deleterevisions', false, array('disabled' => 'disabled') );
                        // Otherwise, show the link...
                        } else {
@@ -500,7 +529,11 @@ class HistoryPager extends ReverseChronologicalPager {
                                        $this->title,
                                        wfMsgHtml( 'editundo' ),
                                        $undoTooltip,
-                                       array( 'action' => 'edit', 'undoafter' => $next->rev_id, 'undo' => $rev->getId() ),
+                                       array(
+                                               'action' => 'edit',
+                                               'undoafter' => $next->rev_id,
+                                               'undo' => $rev->getId()
+                                       ),
                                        array( 'known', 'noclasses' )
                                );
                                $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
@@ -629,7 +662,7 @@ class HistoryPager extends ReverseChronologicalPager {
                        $radio = array( 'type'  => 'radio', 'value' => $id );
                        /** @todo: move title texts to javascript */
                        if( $firstInList ) {
-                               $first = Xml::element( 'input', 
+                               $first = Xml::element( 'input',
                                        array_merge( $radio, array(
                                                'style' => 'visibility:hidden',
                                                'name'  => 'oldid',
@@ -637,7 +670,7 @@ class HistoryPager extends ReverseChronologicalPager {
                                );
                                $checkmark = array( 'checked' => 'checked' );
                        } else {
-                               # Check visibility of old revisions
+                               # Check ility of old revisions
                                if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
                                        $radio['disabled'] = 'disabled';
                                        $checkmark = array(); // We will check the next possible one
@@ -669,4 +702,3 @@ class HistoryPager extends ReverseChronologicalPager {
  */
 class PageHistory extends HistoryPage {}
 class PageHistoryPager extends HistoryPager {}
-