r99648 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99647‎ | r99648 | r99649 >
Date:19:58, 12 October 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
correct handling of session fails on special:mycontests
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialMyContests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -195,6 +195,7 @@
196196 'contest-mycontests-header-contest' => 'Contest',
197197 'contest-mycontests-header-challenge' => 'Challenge',
198198 'contest-mycontests-signup-success' => 'You have successfully signed up for this contest.',
 199+ 'contest-mycontests-sessionfail' => 'Your submission could not be saved due to loss of session data. Please try again.',
199200
200201 'contest-submission-submit' => 'Submit',
201202 'contest-submission-unknown' => 'There is no contest with the provided name.',
Index: trunk/extensions/Contest/specials/SpecialMyContests.php
@@ -36,8 +36,7 @@
3737 return;
3838 }
3939
40 - if ( $this->getRequest()->wasPosted()
41 - && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
 40+ if ( $this->getRequest()->wasPosted() ) {
4241 $contestant = ContestContestant::s()->selectRow( null, array( 'id' => $this->getRequest()->getInt( 'wpcontestant-id' ) ) );
4342 $this->showSubmissionPage( $contestant );
4443 }
@@ -239,6 +238,10 @@
240239 if ( $this->getRequest()->getCheck( 'new' ) ) {
241240 $this->showSuccess( 'contest-mycontests-signup-success' );
242241 }
 242+ else if ( $this->getRequest()->wasPosted()
 243+ && !$this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
 244+ $this->showError( 'contest-mycontests-sessionfail' );
 245+ }
243246
244247 $this->getOutput()->setPageTitle( $contestant->getContest()->getField( 'name' ) );
245248

Status & tagging log