Index: trunk/phase3/includes/specials/SpecialEmailuser.php |
— | — | @@ -34,14 +34,13 @@ |
35 | 35 | } |
36 | 36 | |
37 | 37 | protected function getFormFields() { |
38 | | - global $wgUser; |
39 | 38 | return array( |
40 | 39 | 'From' => array( |
41 | 40 | 'type' => 'info', |
42 | 41 | 'raw' => 1, |
43 | | - 'default' => $this->getSkin()->link( |
44 | | - $wgUser->getUserPage(), |
45 | | - htmlspecialchars( $wgUser->getName() ) |
| 42 | + 'default' => Linker::link( |
| 43 | + $this->getUser()->getUserPage(), |
| 44 | + htmlspecialchars( $this->getUser()->getName() ) |
46 | 45 | ), |
47 | 46 | 'label-message' => 'emailfrom', |
48 | 47 | 'id' => 'mw-emailuser-sender', |
— | — | @@ -49,7 +48,7 @@ |
50 | 49 | 'To' => array( |
51 | 50 | 'type' => 'info', |
52 | 51 | 'raw' => 1, |
53 | | - 'default' => $this->getSkin()->link( |
| 52 | + 'default' => Linker::link( |
54 | 53 | $this->mTargetObj->getUserPage(), |
55 | 54 | htmlspecialchars( $this->mTargetObj->getName() ) |
56 | 55 | ), |
— | — | @@ -78,53 +77,47 @@ |
79 | 78 | 'CCMe' => array( |
80 | 79 | 'type' => 'check', |
81 | 80 | 'label-message' => 'emailccme', |
82 | | - 'default' => $wgUser->getBoolOption( 'ccmeonemails' ), |
| 81 | + 'default' => $this->getUser()->getBoolOption( 'ccmeonemails' ), |
83 | 82 | ), |
84 | 83 | ); |
85 | 84 | } |
86 | 85 | |
87 | 86 | public function execute( $par ) { |
88 | | - global $wgRequest, $wgOut, $wgUser; |
89 | | - |
90 | 87 | $this->setHeaders(); |
91 | 88 | $this->outputHeader(); |
92 | | - $wgOut->addModuleStyles( 'mediawiki.special' ); |
| 89 | + $out = $this->getOutput(); |
| 90 | + $out->addModuleStyles( 'mediawiki.special' ); |
93 | 91 | $this->mTarget = is_null( $par ) |
94 | | - ? $wgRequest->getVal( 'wpTarget', $wgRequest->getVal( 'target', '' ) ) |
| 92 | + ? $this->getRequest()->getVal( 'wpTarget', $this->getRequest()->getVal( 'target', '' ) ) |
95 | 93 | : $par; |
96 | 94 | // error out if sending user cannot do this |
97 | | - $error = self::getPermissionsError( $wgUser, $wgRequest->getVal( 'wpEditToken' ) ); |
| 95 | + $error = self::getPermissionsError( $this->getUser(), $this->getRequest()->getVal( 'wpEditToken' ) ); |
98 | 96 | switch ( $error ) { |
99 | 97 | case null: |
100 | 98 | # Wahey! |
101 | 99 | break; |
102 | 100 | case 'badaccess': |
103 | | - $wgOut->permissionRequired( 'sendemail' ); |
104 | | - return; |
| 101 | + throw new PermissionsError( 'sendemail' ); |
105 | 102 | case 'blockedemailuser': |
106 | | - $wgOut->blockedPage(); |
107 | | - return; |
| 103 | + throw new UserBlockedError( $this->getUser()->mBlock ); |
108 | 104 | case 'actionthrottledtext': |
109 | | - $wgOut->rateLimited(); |
110 | | - return; |
| 105 | + throw new ThrottledError; |
111 | 106 | case 'mailnologin': |
112 | 107 | case 'usermaildisabled': |
113 | | - $wgOut->showErrorPage( $error, "{$error}text" ); |
114 | | - return; |
| 108 | + throw new ErrorPageError( $error, "{$error}text" ); |
115 | 109 | default: |
116 | 110 | # It's a hook error |
117 | 111 | list( $title, $msg, $params ) = $error; |
118 | | - $wgOut->showErrorPage( $title, $msg, $params ); |
119 | | - return; |
| 112 | + throw new ErrorPageError( $title, $msg, $params ); |
120 | 113 | } |
121 | 114 | // Got a valid target user name? Else ask for one. |
122 | 115 | $ret = self::getTarget( $this->mTarget ); |
123 | 116 | if( !$ret instanceof User ) { |
124 | 117 | if( $this->mTarget != '' ) { |
125 | 118 | $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' ); |
126 | | - $wgOut->addHTML( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' ); |
| 119 | + $out->addHTML( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' ); |
127 | 120 | } |
128 | | - $wgOut->addHTML( self::userForm( $this->mTarget ) ); |
| 121 | + $out->addHTML( self::userForm( $this->mTarget ) ); |
129 | 122 | return false; |
130 | 123 | } |
131 | 124 | |
— | — | @@ -142,13 +135,13 @@ |
143 | 136 | return false; |
144 | 137 | } |
145 | 138 | |
146 | | - $wgOut->setPageTitle( wfMsg( 'emailpage' ) ); |
| 139 | + $out->setPageTitle( wfMsg( 'emailpage' ) ); |
147 | 140 | $result = $form->show(); |
148 | 141 | |
149 | 142 | if( $result === true || ( $result instanceof Status && $result->isGood() ) ) { |
150 | | - $wgOut->setPageTitle( wfMsg( 'emailsent' ) ); |
151 | | - $wgOut->addWikiMsg( 'emailsenttext' ); |
152 | | - $wgOut->returnToMain( false, $this->mTargetObj->getUserPage() ); |
| 143 | + $out->setPageTitle( wfMsg( 'emailsent' ) ); |
| 144 | + $out->addWikiMsg( 'emailsenttext' ); |
| 145 | + $out->returnToMain( false, $this->mTargetObj->getUserPage() ); |
153 | 146 | } |
154 | 147 | } |
155 | 148 | |