r61245 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61244‎ | r61245 | r61246 >
Date:08:47, 19 January 2010
Author:aaron
Status:ok
Tags:
Comment:
Don't show empty edit box for invalid sections requested by users who cannot edit
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -121,6 +121,7 @@
122122
123123 /**
124124 * Fetch initial editing page content.
 125+ * @returns mixed string on success, $def_text for invalid sections
125126 * @private
126127 */
127128 function getContent( $def_text = '' ) {
@@ -204,6 +205,7 @@
205206 if ( $section == 'new' ) {
206207 $text = $this->getPreloadedText( $preload );
207208 } else {
 209+ // Get section edit text (returns $def_text for invalid sections)
208210 $text = $wgParser->getSection( $text, $section, $def_text );
209211 }
210212 }
@@ -403,7 +405,7 @@
404406 $permErrors = $this->getEditPermissionErrors();
405407 if ( $permErrors ) {
406408 wfDebug( __METHOD__ . ": User can't edit\n" );
407 - $this->readOnlyPage( $this->getContent(), true, $permErrors, 'edit' );
 409+ $this->readOnlyPage( $this->getContent( false ), true, $permErrors, 'edit' );
408410 wfProfileOut( __METHOD__ );
409411 return;
410412 } else {
@@ -1183,6 +1185,7 @@
11841186 /**
11851187 * Initialise form fields in the object
11861188 * Called on the first invocation, e.g. when a user clicks an edit link
 1189+ * @returns bool -- if the requested section is valid
11871190 */
11881191 function initialiseForm() {
11891192 global $wgUser;

Status & tagging log