r47270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47269‎ | r47270 | r47271 >
Date:17:09, 14 February 2009
Author:ialex
Status:ok (Comments)
Tags:todo 
Comment:
* Removed "global $action;" from SkinTemplate::outputPage(), getting it from $wgRequest instead (like for r46810)
* Changed "$action = $wgRequest->getText( 'action' )" to "$action = $wgRequest->getVal( 'action', 'view' )" as we do on index.php
Modified paths:
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -138,7 +138,7 @@
139139 global $wgScript, $wgStylePath, $wgContLanguageCode;
140140 global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
141141 global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
142 - global $wgDisableCounters, $wgLogo, $action, $wgHideInterlanguageLinks;
 142+ global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
143143 global $wgMaxCredits, $wgShowCreditsIfMax;
144144 global $wgPageShowWatchingUsers;
145145 global $wgUseTrackbacks, $wgUseSiteJs;
@@ -148,6 +148,7 @@
149149
150150 $oldid = $wgRequest->getVal( 'oldid' );
151151 $diff = $wgRequest->getVal( 'diff' );
 152+ $action = $wgRequest->getVal( 'action', 'view' );
152153
153154 wfProfileIn( __METHOD__."-init" );
154155 $this->initPage( $out );
@@ -647,12 +648,12 @@
648649 * @private
649650 */
650651 function buildContentActionUrls() {
651 - global $wgContLang, $wgLang, $wgOut;
 652+ global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest;
 653+
652654 wfProfileIn( __METHOD__ );
653655
654 - global $wgUser, $wgRequest;
655 - $action = $wgRequest->getText( 'action' );
656 - $section = $wgRequest->getText( 'section' );
 656+ $action = $wgRequest->getVal( 'action', 'view' );
 657+ $section = $wgRequest->getVal( 'section' );
657658 $content_actions = array();
658659
659660 $prevent_active_tabs = false ;
@@ -849,7 +850,7 @@
850851
851852 wfProfileIn( __METHOD__ );
852853
853 - $action = $wgRequest->getText( 'action' );
 854+ $action = $wgRequest->getVal( 'action', 'view' );
854855
855856 $nav_urls = array();
856857 $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() );
@@ -872,7 +873,7 @@
873874
874875 // A print stylesheet is attached to all pages, but nobody ever
875876 // figures that out. :) Add a link...
876 - if( $this->iscontent && ($action == '' || $action == 'view' || $action == 'purge' ) ) {
 877+ if( $this->iscontent && ( $action == 'view' || $action == 'purge' ) ) {
877878 $nav_urls['print'] = array(
878879 'text' => wfMsg( 'printableversion' ),
879880 'href' => $wgRequest->appendQuery( 'printable=yes' )
@@ -966,10 +967,11 @@
967968 * @private
968969 */
969970 function setupUserJs( $allowUserJs ) {
 971+ global $wgRequest, $wgJsMimeType;
 972+
970973 wfProfileIn( __METHOD__ );
971974
972 - global $wgRequest, $wgJsMimeType;
973 - $action = $wgRequest->getText('action');
 975+ $action = $wgRequest->getVal( 'action', 'view' );
974976
975977 if( $allowUserJs && $this->loggedin ) {
976978 if( $this->mTitle->isJsSubpage() and $this->userCanPreview( $action ) ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r46810Removed check for empty( $action ), seems to be old register_globals code, bu...ialex19:43, 4 February 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   22:10, 17 February 2009

This does duplicate code, however, which ain't ideal.

Status & tagging log