r98107 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98106‎ | r98107 | r98108 >
Date:02:35, 26 September 2011
Author:aaron
Status:deferred
Tags:
Comment:
Moved requestFromEmailToken() to ConfirmAccount.class.php
Modified paths:
  • /trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php
@@ -119,6 +119,23 @@
120120 }
121121
122122 /**
 123+ * Get a request name from an email confirmation token
 124+ *
 125+ * @param sring $code
 126+ * @returns string|false
 127+ */
 128+ public function requestNameFromEmailToken( $code ) {
 129+ $dbr = wfGetDB( DB_SLAVE );
 130+ return $dbr->selectField( 'account_requests',
 131+ 'acr_name',
 132+ array(
 133+ 'acr_email_token' => md5( $code ),
 134+ 'acr_email_token_expires > ' . $dbr->addQuotes( $dbr->timestamp() ),
 135+ )
 136+ );
 137+ }
 138+
 139+ /**
123140 * Verifies that it's ok to include the uploaded file
124141 *
125142 * @param string $tmpfile the full path of the temporary file to verify
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php
@@ -430,7 +430,7 @@
431431 protected function confirmEmailToken( $code ) {
432432 global $wgUser, $wgOut, $wgConfirmAccountContact, $wgPasswordSender;
433433 # Confirm if this token is in the pending requests
434 - $name = $this->requestFromEmailToken( $code );
 434+ $name = ConfirmAccount::requestNameFromEmailToken( $code );
435435 if ( $name !== false ) {
436436 # Send confirmation email to prospective user
437437 ConfirmAccount::confirmEmail( $name );
@@ -469,20 +469,4 @@
470470 $wgOut->addWikiMsg( 'confirmemail_invalid' );
471471 }
472472 }
473 -
474 - /**
475 - * Get a request name from an emailconfirm token
476 - *
477 - * @param sring $code
478 - * @returns string $name
479 - */
480 - protected function requestFromEmailToken( $code ) {
481 - $dbr = wfGetDB( DB_SLAVE );
482 - $reqID = $dbr->selectField( 'account_requests', 'acr_name',
483 - array( 'acr_email_token' => md5( $code ),
484 - 'acr_email_token_expires > ' . $dbr->addQuotes( $dbr->timestamp() ),
485 - )
486 - );
487 - return $reqID;
488 - }
489473 }

Status & tagging log