r57271 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57270‎ | r57271 | r57272 >
Date:04:12, 2 October 2009
Author:aaron
Status:ok
Tags:
Comment:
* Refactor error messages
* Fixed notices on fail
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -73,8 +73,13 @@
7474 }
7575
7676 // Show form or submit...
77 - if( $this->isAllowed && $isValid && $confirm && $this->submit() ) {
78 - $wgOut->redirect( $this->page->getFullUrl( $query ) );
 77+ if( $this->isAllowed && $isValid && $confirm ) {
 78+ $status = $this->submit();
 79+ if( $status === true ) {
 80+ $wgOut->redirect( $this->page->getFullUrl( $query ) );
 81+ } else {
 82+ $this->showSettings( wfMsg($status) );
 83+ }
7984 } else {
8085 $this->showSettings();
8186 }
@@ -91,17 +96,18 @@
9297 if( is_null($this->page) ) {
9398 return false; // can't continue
9499 }
 100+ # Get old config
 101+ $this->config = FlaggedRevs::getPageVisibilitySettings( $this->page, true );
 102+ # Make user readable date for GET requests
 103+ $this->oldExpiry = $this->config['expiry'] !== 'infinity' ?
 104+ wfTimestamp( TS_RFC2822, $this->config['expiry'] ) : 'infinite';
95105 # If not posted, then fill in existing values/defaults
96106 if( !$this->wasPosted ) {
97107 # Get visiblity settings...
98 - $this->config = FlaggedRevs::getPageVisibilitySettings( $this->page, true );
99108 $this->select = $this->config['select'];
100109 $this->override = $this->config['override'];
101110 # Get autoreview restrictions...
102111 $this->autoreview = $this->config['autoreview'];
103 - # Make user readable date for GET requests
104 - $this->oldExpiry = $this->config['expiry'] !== 'infinity' ?
105 - wfTimestamp( TS_RFC2822, $this->config['expiry'] ) : 'infinite';
106112 # Handle submission data
107113 } else {
108114 // Custom expiry takes precedence
@@ -356,13 +362,11 @@
357363 # Convert GNU-style date, on error returns -1 for PHP <5.1 and false for PHP >=5.1
358364 $expiry = strtotime( $this->expiry );
359365 if( $expiry < 0 || $expiry === false ) {
360 - $this->showSettings( wfMsg( 'stabilize_expiry_invalid' ) );
361 - return false;
 366+ return 'stabilize_expiry_invalid';
362367 }
363368 $expiry = wfTimestamp( TS_MW, $expiry );
364369 if( $expiry < wfTimestampNow() ) {
365 - $this->showSettings( wfMsg( 'stabilize_expiry_old' ) );
366 - return false;
 370+ return 'stabilize_expiry_old';
367371 }
368372 }
369373

Status & tagging log