summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialConfirmemail.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes/specials/SpecialConfirmemail.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'includes/specials/SpecialConfirmemail.php')
-rw-r--r--includes/specials/SpecialConfirmemail.php46
1 files changed, 40 insertions, 6 deletions
diff --git a/includes/specials/SpecialConfirmemail.php b/includes/specials/SpecialConfirmemail.php
index 372a574c..e556a60b 100644
--- a/includes/specials/SpecialConfirmemail.php
+++ b/includes/specials/SpecialConfirmemail.php
@@ -1,4 +1,25 @@
<?php
+/**
+ * Implements Special:Confirmemail and Special:Invalidateemail
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
+ */
/**
* Special page allows users to request email confirmation message, and handles
@@ -25,6 +46,12 @@ class EmailConfirmation extends UnlistedSpecialPage {
function execute( $code ) {
global $wgUser, $wgOut;
$this->setHeaders();
+
+ if ( wfReadOnly() ) {
+ $wgOut->readOnlyPage();
+ return;
+ }
+
if( empty( $code ) ) {
if( $wgUser->isLoggedIn() ) {
if( User::isValidEmailAddr( $wgUser->getEmail() ) ) {
@@ -54,11 +81,11 @@ class EmailConfirmation extends UnlistedSpecialPage {
function showRequestForm() {
global $wgOut, $wgUser, $wgLang, $wgRequest;
if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getText( 'token' ) ) ) {
- $ok = $wgUser->sendConfirmationMail();
- if ( WikiError::isError( $ok ) ) {
- $wgOut->addWikiMsg( 'confirmemail_sendfailed', $ok->toString() );
- } else {
+ $status = $wgUser->sendConfirmationMail();
+ if ( $status->isGood() ) {
$wgOut->addWikiMsg( 'confirmemail_sent' );
+ } else {
+ $wgOut->addWikiText( $status->getWikiText( 'confirmemail_sendfailed' ) );
}
} else {
if( $wgUser->isEmailConfirmed() ) {
@@ -71,11 +98,11 @@ class EmailConfirmation extends UnlistedSpecialPage {
$wgOut->addWikiMsg( 'emailauthenticated', $time, $d, $t );
}
if( $wgUser->isEmailConfirmationPending() ) {
- $wgOut->wrapWikiMsg( "<div class=\"error mw-confirmemail-pending\">\n$1</div>", 'confirmemail_pending' );
+ $wgOut->wrapWikiMsg( "<div class=\"error mw-confirmemail-pending\">\n$1\n</div>", 'confirmemail_pending' );
}
$wgOut->addWikiMsg( 'confirmemail_text' );
$form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalUrl() ) );
- $form .= Xml::hidden( 'token', $wgUser->editToken() );
+ $form .= Html::hidden( 'token', $wgUser->editToken() );
$form .= Xml::submitButton( wfMsg( 'confirmemail_send' ) );
$form .= Xml::closeElement( 'form' );
$wgOut->addHTML( $form );
@@ -121,6 +148,13 @@ class EmailInvalidation extends UnlistedSpecialPage {
function execute( $code ) {
$this->setHeaders();
+
+ if ( wfReadOnly() ) {
+ global $wgOut;
+ $wgOut->readOnlyPage();
+ return;
+ }
+
$this->attemptInvalidate( $code );
}