r83387 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83386‎ | r83387 | r83388 >
Date:16:46, 6 March 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Follow-up r83381: Use $wgRequest->getVal( 'action', 'view' ) instead of the global $action

Using the global variable is bad because it is not always defined (when executing another entry script than index.php or in cli mode)
Modified paths:
  • /trunk/extensions/Commentbox/Commentbox.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Commentbox/Commentbox.php
@@ -35,7 +35,7 @@
3636 $wgHooks['OutputPageBeforeHTML'][] = 'wfExtensionCommentbox_Add';
3737
3838 function wfExtensionCommentbox_Add( &$op, &$text ) {
39 - global $wgUser, $wgRequest, $action,
 39+ global $wgUser, $wgRequest,
4040 $wgCommentboxNamespaces, $wgCommentboxRows,
4141 $wgCommentboxColumns;
4242
@@ -48,7 +48,9 @@
4949 if ( !array_key_exists( $title->getNamespace(), $wgCommentboxNamespaces )
5050 || !$wgCommentboxNamespaces[ $title->getNamespace() ] )
5151 return true;
52 - if ( !( $action == 'view' || $action == 'purge' || $action == 'submit' || $action == '' ) )
 52+
 53+ $action = $wgRequest->getVal( 'action', 'view' );
 54+ if ( !( $action == 'view' || $action == 'purge' || $action == 'submit' ) )
5355 return true;
5456 if ( $wgRequest->getCheck( 'wpPreview' )
5557 || $wgRequest->getCheck( 'wpLivePreview' )
@@ -79,7 +81,7 @@
8082 action="$newaction" enctype="multipart/form-data">
8183 $intro
8284 <textarea tabindex='1' accesskey="," name="wpComment" id="wpComment"
83 - rows='$wgCommentboxRows' cols='$wpCommentboxColumns'
 85+ rows='$wgCommentboxRows' cols='$wgCommentboxColumns'
8486 >$inhalt</textarea>
8587 $name
8688 <br />

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83381Fix bug where Commentbox was only displayed on purged pages, not on normal pa...tbleher11:29, 6 March 2011

Comments

#Comment by Platonides (talk | contribs)   16:48, 6 March 2011

Nothing should be using $action

#Comment by IAlex (talk | contribs)   16:50, 6 March 2011

And forgot to say that this fixed an E_NOTICE about undefined variable "$wpCommentboxColumns".

Status & tagging log