Index: trunk/phase3/includes/specials/SpecialChangeEmail.php |
— | — | @@ -35,35 +35,34 @@ |
36 | 36 | * Main execution point |
37 | 37 | */ |
38 | 38 | function execute( $par ) { |
39 | | - global $wgRequest; |
40 | | - |
41 | | - $out = $this->getOutput(); |
42 | 39 | if ( wfReadOnly() ) { |
43 | | - $out->readOnlyPage(); |
44 | | - return; |
| 40 | + throw new ReadOnlyError; |
45 | 41 | } |
46 | 42 | |
47 | | - $user = $this->getUser(); |
| 43 | + $request = $this->getRequest(); |
| 44 | + $this->mPassword = $request->getVal( 'wpPassword' ); |
| 45 | + $this->mNewEmail = $request->getVal( 'wpNewEmail' ); |
48 | 46 | |
49 | | - $this->mPassword = $wgRequest->getVal( 'wpPassword' ); |
50 | | - $this->mNewEmail = $wgRequest->getVal( 'wpNewEmail' ); |
51 | | - |
52 | 47 | $this->setHeaders(); |
53 | 48 | $this->outputHeader(); |
| 49 | + |
| 50 | + $out = $this->getOutput(); |
54 | 51 | $out->disallowUserJs(); |
55 | 52 | |
56 | | - if ( !$wgRequest->wasPosted() && !$user->isLoggedIn() ) { |
| 53 | + $user = $this->getUser(); |
| 54 | + |
| 55 | + if ( !$request->wasPosted() && !$user->isLoggedIn() ) { |
57 | 56 | $this->error( wfMsg( 'changeemail-no-info' ) ); |
58 | 57 | return; |
59 | 58 | } |
60 | 59 | |
61 | | - if ( $wgRequest->wasPosted() && $wgRequest->getBool( 'wpCancel' ) ) { |
| 60 | + if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) { |
62 | 61 | $this->doReturnTo(); |
63 | 62 | return; |
64 | 63 | } |
65 | 64 | |
66 | | - if ( $wgRequest->wasPosted() |
67 | | - && $user->matchEditToken( $wgRequest->getVal( 'token' ) ) ) |
| 65 | + if ( $request->wasPosted() |
| 66 | + && $user->matchEditToken( $request->getVal( 'token' ) ) ) |
68 | 67 | { |
69 | 68 | $info = $this->attemptChange( $user, $this->mPassword, $this->mNewEmail ); |
70 | 69 | if ( $info === true ) { |
— | — | @@ -81,8 +80,7 @@ |
82 | 81 | } |
83 | 82 | |
84 | 83 | protected function doReturnTo( $type = 'hard' ) { |
85 | | - global $wgRequest; |
86 | | - $titleObj = Title::newFromText( $wgRequest->getVal( 'returnto' ) ); |
| 84 | + $titleObj = Title::newFromText( $this->getRequest()->getVal( 'returnto' ) ); |
87 | 85 | if ( !$titleObj instanceof Title ) { |
88 | 86 | $titleObj = Title::newMainPage(); |
89 | 87 | } |
— | — | @@ -98,8 +96,6 @@ |
99 | 97 | } |
100 | 98 | |
101 | 99 | protected function showForm() { |
102 | | - global $wgRequest; |
103 | | - |
104 | 100 | $user = $this->getUser(); |
105 | 101 | |
106 | 102 | $oldEmailText = $user->getEmail() |
— | — | @@ -114,7 +110,7 @@ |
115 | 111 | 'action' => $this->getTitle()->getLocalUrl(), |
116 | 112 | 'id' => 'mw-changeemail-form' ) ) . "\n" . |
117 | 113 | Html::hidden( 'token', $user->editToken() ) . "\n" . |
118 | | - Html::hidden( 'returnto', $wgRequest->getVal( 'returnto' ) ) . "\n" . |
| 114 | + Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" . |
119 | 115 | wfMsgExt( 'changeemail-text', array( 'parse' ) ) . "\n" . |
120 | 116 | Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" . |
121 | 117 | $this->pretty( array( |