Merge ""Show Changes" on default messages shows now diff against default message...
authorBrion VIBBER <brion@wikimedia.org>
Thu, 5 Apr 2012 23:02:18 +0000 (23:02 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 5 Apr 2012 23:02:18 +0000 (23:02 +0000)
includes/Pager.php
includes/SkinTemplate.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialMovepage.php

index e2c7751..472cb48 100644 (file)
@@ -366,9 +366,10 @@ abstract class IndexPager extends ContextSource implements Pager {
         * @param $text String: text displayed on the link
         * @param $query Array: associative array of paramter to be in the query string
         * @param $type String: value of the "rel" attribute
+        *
         * @return String: HTML fragment
         */
-       function makeLink($text, $query = null, $type=null) {
+       function makeLink( $text, array $query = null, $type = null ) {
                if ( $query === null ) {
                        return $text;
                }
@@ -382,6 +383,7 @@ abstract class IndexPager extends ContextSource implements Pager {
                if( $type ) {
                        $attrs['class'] = "mw-{$type}link";
                }
+
                return Linker::linkKnown(
                        $this->getTitle(),
                        $text,
@@ -526,6 +528,7 @@ abstract class IndexPager extends ContextSource implements Pager {
        function getPagingLinks( $linkTexts, $disabledTexts = array() ) {
                $queries = $this->getPagingQueries();
                $links = array();
+
                foreach ( $queries as $type => $query ) {
                        if ( $query !== false ) {
                                $links[$type] = $this->makeLink(
@@ -539,6 +542,7 @@ abstract class IndexPager extends ContextSource implements Pager {
                                $links[$type] = $linkTexts[$type];
                        }
                }
+
                return $links;
        }
 
@@ -651,7 +655,9 @@ abstract class AlphabeticPager extends IndexPager {
         * @return String HTML
         */
        function getNavigationBar() {
-               if ( !$this->isNavigationBarShown() ) return '';
+               if ( !$this->isNavigationBarShown() ) {
+                       return '';
+               }
 
                if( isset( $this->mNavigationBar ) ) {
                        return $this->mNavigationBar;
@@ -682,10 +688,10 @@ abstract class AlphabeticPager extends IndexPager {
                $this->mNavigationBar = wfMessage( 'parentheses' )->rawParams(
                        $lang->pipeList(
                                array( $pagingLinks['first'],
-                               $pagingLinks['last'] )
+                                       $pagingLinks['last'] )
                        ) )->escaped() . " " .
                        wfMsgHtml( 'viewprevnext', $pagingLinks['prev'],
-                       $pagingLinks['next'], $limits );
+                               $pagingLinks['next'], $limits );
 
                if( !is_array( $this->getIndexField() ) ) {
                        # Early return to avoid undue nesting
@@ -787,9 +793,11 @@ abstract class ReverseChronologicalPager extends IndexPager {
        function getDateCond( $year, $month ) {
                $year = intval( $year );
                $month = intval( $month );
+
                // Basic validity checks
                $this->mYear = $year > 0 ? $year : false;
                $this->mMonth = ( $month > 0 && $month < 13 ) ? $month : false;
+
                // Given an optional year and month, we need to generate a timestamp
                // to use as "WHERE rev_timestamp <= result"
                // Examples: year = 2006 equals < 20070101 (+000000)
@@ -798,6 +806,7 @@ abstract class ReverseChronologicalPager extends IndexPager {
                if ( !$this->mYear && !$this->mMonth ) {
                        return;
                }
+
                if ( $this->mYear ) {
                        $year = $this->mYear;
                } else {
@@ -808,6 +817,7 @@ abstract class ReverseChronologicalPager extends IndexPager {
                                $year--;
                        }
                }
+
                if ( $this->mMonth ) {
                        $month = $this->mMonth + 1;
                        // For December, we want January 1 of the next year
@@ -820,14 +830,18 @@ abstract class ReverseChronologicalPager extends IndexPager {
                        $month = 1;
                        $year++;
                }
+
                // Y2K38 bug
                if ( $year > 2032 ) {
                        $year = 2032;
                }
+
                $ymd = (int)sprintf( "%04d%02d01", $year, $month );
+
                if ( $ymd > 20320101 ) {
                        $ymd = 20320101;
                }
+
                $this->mOffset = $this->mDb->timestamp( "${ymd}000000" );
        }
 }
@@ -895,7 +909,7 @@ abstract class TablePager extends IndexPager {
                                        $image = htmlspecialchars( "$wgStylePath/common/images/$image" );
                                        $link = $this->makeLink(
                                                "<img width=\"12\" height=\"12\" alt=\"$alt\" src=\"$image\" />" .
-                                               htmlspecialchars( $name ), $query );
+                                                       htmlspecialchars( $name ), $query );
                                        $s .= "<th class=\"$sortClass\">$link</th>\n";
                                } else {
                                        $s .= '<th>' . $this->makeLink( htmlspecialchars( $name ), $query ) . "</th>\n";
index 511443f..702ca7e 100644 (file)
@@ -1190,12 +1190,10 @@ class SkinTemplate extends Skin {
                                'href' => self::makeSpecialUrlSubpage( 'Contributions', $rootUser )
                        );
 
-                       if ( $user->isLoggedIn() ) {
-                               $logPage = SpecialPage::getTitleFor( 'Log' );
-                               $nav_urls['log'] = array(
-                                       'href' => $logPage->getLocalUrl( array( 'user' => $rootUser ) )
-                               );
-                       }
+                       $logPage = SpecialPage::getTitleFor( 'Log' );
+                       $nav_urls['log'] = array(
+                               'href' => $logPage->getLocalUrl( array( 'user' => $rootUser ) )
+                       );
 
                        if ( $this->getUser()->isAllowed( 'block' ) ) {
                                $nav_urls['blockip'] = array(
index a6719c8..40856ca 100644 (file)
@@ -294,6 +294,7 @@ class DeletedContributionsPage extends SpecialPage {
                        $out->addHTML( $this->getForm( '' ) );
                        return;
                }
+               $this->getSkin()->setRelevantUser( $userObj );
 
                $target = $userObj->getName();
                $out->addSubtitle( $this->getSubTitle( $userObj ) );
index 393cf7e..6b817d2 100644 (file)
@@ -141,13 +141,13 @@ class MovePageForm extends UnlistedSpecialPage {
                        && $newTitle->quickUserCan( 'delete', $user )
                ) {
                        $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
-                       $movepagebtn = wfMsg( 'delete_and_move' );
+                       $movepagebtn = $this->msg( 'delete_and_move' )->text();
                        $submitVar = 'wpDeleteAndMove';
                        $confirm = "
                                <tr>
                                        <td></td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) .
+                                               Xml::checkLabel( $this->msg( 'delete_and_move_confirm' )->text(), 'wpConfirm', 'wpConfirm' ) .
                                        "</td>
                                </tr>";
                        $err = array();
@@ -157,7 +157,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        }
                        $out->addWikiMsg( $wgFixDoubleRedirects ? 'movepagetext' :
                                'movepagetext-noredirectfixer' );
-                       $movepagebtn = wfMsg( 'movepagebtn' );
+                       $movepagebtn = $this->msg( 'movepagebtn' )->text();
                        $submitVar = 'wpMove';
                        $confirm = false;
                }
@@ -249,11 +249,11 @@ class MovePageForm extends UnlistedSpecialPage {
                $out->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
-                        Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) .
+                        Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) .
                         Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) .
                         "<tr>
                                <td class='mw-label'>" .
-                                       wfMsgHtml( 'movearticle' ) .
+                                       $this->msg( 'movearticle' )->escaped() .
                                "</td>
                                <td class='mw-input'>
                                        <strong>{$oldTitleLink}</strong>
@@ -261,7 +261,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        </tr>
                        <tr>
                                <td class='mw-label'>" .
-                                       Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) .
+                                       Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) .
                                "</td>
                                <td class='mw-input'>" .
                                        Html::namespaceSelector(
@@ -278,7 +278,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        </tr>
                        <tr>
                                <td class='mw-label'>" .
-                                       Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
+                                       Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) .
                                "</td>
                                <td class='mw-input'>" .
                                        Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
@@ -292,7 +292,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                <tr>
                                        <td></td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
+                                               Xml::checkLabel( $this->msg( 'movetalk' )->text(), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
                                        "</td>
                                </tr>"
                        );
@@ -303,7 +303,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                <tr>
                                        <td></td>
                                        <td class='mw-input' >" .
-                                               Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect',
+                                               Xml::checkLabel( $this->msg( 'move-leave-redirect' )->text(), 'wpLeaveRedirect',
                                                        'wpLeaveRedirect', $this->leaveRedirect ) .
                                        "</td>
                                </tr>"
@@ -315,7 +315,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                <tr>
                                        <td></td>
                                        <td class='mw-input' >" .
-                                               Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects',
+                                               Xml::checkLabel( $this->msg( 'fix-double-redirects' )->text(), 'wpFixRedirects',
                                                        'wpFixRedirects', $this->fixRedirects ) .
                                        "</td>
                                </tr>"
@@ -335,15 +335,11 @@ class MovePageForm extends UnlistedSpecialPage {
                                        array( 'id' => 'wpMovesubpages' )
                                ) . '&#160;' .
                                Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ),
-                                       wfMsgExt(
+                                       $this->msg(
                                                ( $this->oldTitle->hasSubpages()
                                                        ? 'move-subpages'
-                                                       : 'move-talk-subpages' ),
-                                               array( 'parseinline' ),
-                                               $this->getLanguage()->formatNum( $wgMaximumMovedPages ),
-                                               # $2 to allow use of PLURAL in message.
-                                               $wgMaximumMovedPages
-                                       )
+                                                       : 'move-talk-subpages' )
+                                               )->numParams( $wgMaximumMovedPages )->params( $wgMaximumMovedPages )->parse()
                                ) .
                                        "</td>
                                </tr>"
@@ -358,7 +354,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        <tr>
                                <td></td>
                                <td class='mw-input'>" .
-                                       Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) .
+                                       Xml::checkLabel( $this->msg( 'move-watch' )->text(), 'wpWatch', 'watch', $watchChecked ) .
                                "</td>
                        </tr>");
                }
@@ -421,7 +417,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                return;
                        }
 
-                       $reason = wfMessage( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
+                       $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
 
                        // Delete an associated image if there is
                        if ( $nt->getNamespace() == NS_FILE ) {
@@ -472,7 +468,7 @@ class MovePageForm extends UnlistedSpecialPage {
                $newText = $nt->getPrefixedText();
 
                $msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect';
-               $out->addHTML( wfMessage( 'movepage-moved' )->rawParams( $oldLink,
+               $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink,
                        $newLink )->params( $oldText, $newText )->parseAsBlock() );
                $out->addWikiMsg( $msgName );
 
@@ -562,15 +558,15 @@ class MovePageForm extends UnlistedSpecialPage {
                        $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
                        if( !$newSubpage ) {
                                $oldLink = Linker::linkKnown( $oldSubpage );
-                               $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
-                                       htmlspecialchars(Title::makeName( $newNs, $newPageName )));
+                               $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink
+                                       )->params( Title::makeName( $newNs, $newPageName ) )->escaped();
                                continue;
                        }
 
                        # This was copy-pasted from Renameuser, bleh.
                        if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
                                $link = Linker::linkKnown( $newSubpage );
-                               $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
+                               $extraOutput []= $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
                        } else {
                                $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
                                if( $success === true ) {
@@ -584,16 +580,16 @@ class MovePageForm extends UnlistedSpecialPage {
                                                array( 'redirect' => 'no' )
                                        );
                                        $newLink = Linker::linkKnown( $newSubpage );
-                                       $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
+                                       $extraOutput []= $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped();
                                        ++$count;
                                        if( $count >= $wgMaximumMovedPages ) {
-                                               $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $wgMaximumMovedPages ) );
+                                               $extraOutput []= $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped();
                                                break;
                                        }
                                } else {
                                        $oldLink = Linker::linkKnown( $oldSubpage );
                                        $newLink = Linker::link( $newSubpage );
-                                       $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
+                                       $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped();
                                }
                        }