Index: trunk/extensions/CentralAuth/ApiQueryGlobalUserInfo.php |
— | — | @@ -34,12 +34,10 @@ |
35 | 35 | } |
36 | 36 | |
37 | 37 | public function execute() { |
38 | | - global $wgUser; |
39 | | - |
40 | 38 | $params = $this->extractRequestParams(); |
41 | 39 | $prop = array_flip( (array)$params['prop'] ); |
42 | 40 | if ( is_null( $params['user'] ) ) { |
43 | | - $params['user'] = $wgUser->getName(); |
| 41 | + $params['user'] = $this->getUser()->getName(); |
44 | 42 | } |
45 | 43 | $user = new CentralAuthUser( $params['user'] ); |
46 | 44 | |
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalGroupMembership.php |
— | — | @@ -11,8 +11,7 @@ |
12 | 12 | function __construct() { |
13 | 13 | SpecialPage::__construct( 'GlobalGroupMembership' ); |
14 | 14 | |
15 | | - global $wgUser; |
16 | | - $this->mGlobalUser = CentralAuthUser::getInstance( $wgUser ); |
| 15 | + $this->mGlobalUser = CentralAuthUser::getInstance( $this->getUser() ); |
17 | 16 | } |
18 | 17 | |
19 | 18 | /** |
— | — | @@ -28,9 +27,9 @@ |
29 | 28 | * Output a form to allow searching for a user |
30 | 29 | */ |
31 | 30 | function switchForm() { |
32 | | - global $wgOut, $wgScript, $wgRequest; |
| 31 | + global $wgScript; |
33 | 32 | |
34 | | - $knownwiki = $wgRequest->getVal( 'wpKnownWiki' ); |
| 33 | + $knownwiki = $this->getRequest()->getVal( 'wpKnownWiki' ); |
35 | 34 | $knownwiki = $knownwiki ? $knownwiki : wfWikiId(); |
36 | 35 | |
37 | 36 | // Generate wiki selector |
— | — | @@ -40,8 +39,8 @@ |
41 | 40 | $selector->addOption( $wiki ); |
42 | 41 | } |
43 | 42 | |
44 | | - $wgOut->addModuleStyles( 'mediawiki.special' ); |
45 | | - $wgOut->addHTML( |
| 43 | + $this->getOutput()->addModuleStyles( 'mediawiki.special' ); |
| 44 | + $this->getOutput()->addHTML( |
46 | 45 | Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1' ) ) . |
47 | 46 | Html::hidden( 'title', $this->getTitle() ) . |
48 | 47 | Xml::openElement( 'fieldset' ) . |
— | — | @@ -80,15 +79,13 @@ |
81 | 80 | * @return Status |
82 | 81 | */ |
83 | 82 | function fetchUser( $username ) { |
84 | | - global $wgRequest; |
| 83 | + $knownwiki = $this->getRequest()->getVal( 'wpKnownWiki' ); |
85 | 84 | |
86 | | - $knownwiki = $wgRequest->getVal( 'wpKnownWiki' ); |
87 | | - |
88 | 85 | $user = CentralAuthGroupMembershipProxy::newFromName( $username ); |
89 | 86 | |
90 | 87 | if ( !$user ) { |
91 | 88 | return Status::newFatal( 'nosuchusershort', $username ); |
92 | | - } elseif ( !$wgRequest->getCheck( 'saveusergroups' ) && !$user->attachedOn( $knownwiki ) ) { |
| 89 | + } elseif ( !$this->getRequest()->getCheck( 'saveusergroups' ) && !$user->attachedOn( $knownwiki ) ) { |
93 | 90 | return Status::newFatal( 'centralauth-globalgroupmembership-badknownwiki', |
94 | 91 | $username, $knownwiki ); |
95 | 92 | } |
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalGroupPermissions.php |
— | — | @@ -45,23 +45,21 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | function execute( $subpage ) { |
49 | | - global $wgRequest, $wgOut, $wgUser; |
50 | | - |
51 | | - if ( !$this->userCanExecute( $wgUser ) ) { |
| 49 | + if ( !$this->userCanExecute( $this->getUser() ) ) { |
52 | 50 | $this->displayRestrictionError(); |
53 | 51 | return; |
54 | 52 | } |
55 | 53 | |
56 | | - $wgOut->setPageTitle( wfMsg( 'globalgrouppermissions' ) ); |
57 | | - $wgOut->setRobotPolicy( "noindex,nofollow" ); |
58 | | - $wgOut->setArticleRelated( false ); |
59 | | - $wgOut->enableClientCache( false ); |
| 54 | + $this->getOutput()->setPageTitle( wfMsg( 'globalgrouppermissions' ) ); |
| 55 | + $this->getOutput()->setRobotPolicy( "noindex,nofollow" ); |
| 56 | + $this->getOutput()->setArticleRelated( false ); |
| 57 | + $this->getOutput()->enableClientCache( false ); |
60 | 58 | |
61 | 59 | if ( $subpage == '' ) { |
62 | | - $subpage = $wgRequest->getVal( 'wpGroup' ); |
| 60 | + $subpage = $this->getRequest()->getVal( 'wpGroup' ); |
63 | 61 | } |
64 | 62 | |
65 | | - if ( $subpage != '' && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 63 | + if ( $subpage != '' && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
66 | 64 | $this->doSubmit( $subpage ); |
67 | 65 | } elseif ( $subpage != '' ) { |
68 | 66 | $this->buildGroupView( $subpage ); |
— | — | @@ -71,31 +69,31 @@ |
72 | 70 | } |
73 | 71 | |
74 | 72 | function buildMainView() { |
75 | | - global $wgOut, $wgUser, $wgScript; |
| 73 | + global $wgScript; |
76 | 74 | |
77 | 75 | $groups = CentralAuthUser::availableGlobalGroups(); |
78 | 76 | |
79 | 77 | // Existing groups |
80 | 78 | $html = Xml::fieldset( wfMsg( 'centralauth-existinggroup-legend' ) ); |
81 | 79 | |
82 | | - $wgOut->addHTML( $html ); |
| 80 | + $this->getOutput()->addHTML( $html ); |
83 | 81 | |
84 | 82 | if ( count( $groups ) ) { |
85 | | - $wgOut->addWikiMsg( 'centralauth-globalgroupperms-grouplist' ); |
86 | | - $wgOut->addHTML( '<ul>' ); |
| 83 | + $this->getOutput()->addWikiMsg( 'centralauth-globalgroupperms-grouplist' ); |
| 84 | + $this->getOutput()->addHTML( '<ul>' ); |
87 | 85 | |
88 | 86 | foreach ( $groups as $group ) { |
89 | 87 | $text = wfMsgExt( 'centralauth-globalgroupperms-grouplistitem', array( 'parseinline' ), User::getGroupName( $group ), $group, '<span class="centralauth-globalgroupperms-groupname">' . $group . '</span>' ); |
90 | 88 | |
91 | | - $wgOut->addHTML( "<li> $text </li>" ); |
| 89 | + $this->getOutput()->addHTML( "<li> $text </li>" ); |
92 | 90 | } |
93 | 91 | } else { |
94 | | - $wgOut->addWikiMsg( 'centralauth-globalgroupperms-nogroups' ); |
| 92 | + $this->getOutput()->addWikiMsg( 'centralauth-globalgroupperms-nogroups' ); |
95 | 93 | } |
96 | 94 | |
97 | | - $wgOut->addHTML( Xml::closeElement( 'ul' ) . Xml::closeElement( 'fieldset' ) ); |
| 95 | + $this->getOutput()->addHTML( Xml::closeElement( 'ul' ) . Xml::closeElement( 'fieldset' ) ); |
98 | 96 | |
99 | | - if ( $this->userCanEdit( $wgUser ) ) { |
| 97 | + if ( $this->userCanEdit( $this->getUser() ) ) { |
100 | 98 | // "Create a group" prompt |
101 | 99 | $html = Xml::fieldset( wfMsg( 'centralauth-newgroup-legend' ) ); |
102 | 100 | $html .= wfMsgExt( 'centralauth-newgroup-intro', array( 'parse' ) ); |
— | — | @@ -108,7 +106,7 @@ |
109 | 107 | $html .= Xml::closeElement( 'form' ); |
110 | 108 | $html .= Xml::closeElement( 'fieldset' ); |
111 | 109 | |
112 | | - $wgOut->addHTML( $html ); |
| 110 | + $this->getOutput()->addHTML( $html ); |
113 | 111 | } |
114 | 112 | } |
115 | 113 | |
— | — | @@ -116,18 +114,16 @@ |
117 | 115 | * @param $group |
118 | 116 | */ |
119 | 117 | function buildGroupView( $group ) { |
120 | | - global $wgOut, $wgUser; |
| 118 | + $editable = $this->userCanEdit( $this->getUser() ); |
121 | 119 | |
122 | | - $editable = $this->userCanEdit( $wgUser ); |
| 120 | + $this->getOutput()->setSubtitle( wfMsg( 'centralauth-editgroup-subtitle', $group ) ); |
123 | 121 | |
124 | | - $wgOut->setSubtitle( wfMsg( 'centralauth-editgroup-subtitle', $group ) ); |
125 | | - |
126 | 122 | $html = Xml::fieldset( wfMsg( 'centralauth-editgroup-fieldset', $group ) ); |
127 | 123 | |
128 | 124 | if ( $editable ) { |
129 | 125 | $html .= Xml::openElement( 'form', array( 'method' => 'post', 'action' => SpecialPage::getTitleFor( 'GlobalGroupPermissions', $group )->getLocalUrl(), 'name' => 'centralauth-globalgroups-newgroup' ) ); |
130 | 126 | $html .= Html::hidden( 'wpGroup', $group ); |
131 | | - $html .= Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 127 | + $html .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() ); |
132 | 128 | } |
133 | 129 | |
134 | 130 | $fields = array(); |
— | — | @@ -150,9 +146,9 @@ |
151 | 147 | |
152 | 148 | $html .= Xml::closeElement( 'fieldset' ); |
153 | 149 | |
154 | | - $wgOut->addHTML( $html ); |
| 150 | + $this->getOutput()->addHTML( $html ); |
155 | 151 | |
156 | | - $this->showLogFragment( $group, $wgOut ); |
| 152 | + $this->showLogFragment( $group, $this->getOutput() ); |
157 | 153 | } |
158 | 154 | |
159 | 155 | /** |
— | — | @@ -163,8 +159,7 @@ |
164 | 160 | $sets = WikiSet::getAllWikiSets(); |
165 | 161 | $default = WikiSet::getWikiSetForGroup( $group ); |
166 | 162 | |
167 | | - global $wgUser; |
168 | | - if ( !$this->userCanEdit( $wgUser ) ) |
| 163 | + if ( !$this->userCanEdit( $this->getUser() ) ) |
169 | 164 | return htmlspecialchars( $default ); |
170 | 165 | |
171 | 166 | $select = new XmlSelect( 'set', 'wikiset', $default ); |
— | — | @@ -182,10 +177,8 @@ |
183 | 178 | * @return string |
184 | 179 | */ |
185 | 180 | function buildCheckboxes( $group ) { |
186 | | - global $wgUser, $wgOut; |
| 181 | + $editable = $this->userCanEdit( $this->getUser() ); |
187 | 182 | |
188 | | - $editable = $this->userCanEdit( $wgUser ); |
189 | | - |
190 | 183 | $rights = User::getAllRights(); |
191 | 184 | $assignedRights = $this->getAssignedRights( $group ); |
192 | 185 | |
— | — | @@ -202,7 +195,7 @@ |
203 | 196 | # Build a checkbox. |
204 | 197 | $checked = in_array( $right, $assignedRights ); |
205 | 198 | |
206 | | - $desc = $wgOut->parseInline( User::getRightDescription( $right ) ) . ' ' . |
| 199 | + $desc = $this->getOutput()->parseInline( User::getRightDescription( $right ) ) . ' ' . |
207 | 200 | Xml::element( 'tt', null, wfMsg( 'parentheses', $right ) ); |
208 | 201 | |
209 | 202 | $checkbox = Xml::check( "wpRightAssigned-$right", $checked, |
— | — | @@ -246,10 +239,8 @@ |
247 | 240 | } |
248 | 241 | |
249 | 242 | function doSubmit( $group ) { |
250 | | - global $wgRequest, $wgOut, $wgUser; |
251 | | - |
252 | 243 | // Paranoia -- the edit token shouldn't match anyway |
253 | | - if ( !$this->userCanEdit( $wgUser ) ) |
| 244 | + if ( !$this->userCanEdit( $this->getUser() ) ) |
254 | 245 | return; |
255 | 246 | |
256 | 247 | $newRights = array(); |
— | — | @@ -258,18 +249,18 @@ |
259 | 250 | $oldRights = $this->getAssignedRights( $group ); |
260 | 251 | $allRights = User::getAllRights(); |
261 | 252 | |
262 | | - $reason = $wgRequest->getVal( 'wpReason', '' ); |
| 253 | + $reason = $this->getRequest()->getVal( 'wpReason', '' ); |
263 | 254 | |
264 | 255 | foreach ( $allRights as $right ) { |
265 | 256 | $alreadyAssigned = in_array( $right, $oldRights ); |
266 | 257 | |
267 | | - if ( $wgRequest->getCheck( "wpRightAssigned-$right" ) ) { |
| 258 | + if ( $this->getRequest()->getCheck( "wpRightAssigned-$right" ) ) { |
268 | 259 | $newRights[] = $right; |
269 | 260 | } |
270 | 261 | |
271 | | - if ( !$alreadyAssigned && $wgRequest->getCheck( "wpRightAssigned-$right" ) ) { |
| 262 | + if ( !$alreadyAssigned && $this->getRequest()->getCheck( "wpRightAssigned-$right" ) ) { |
272 | 263 | $addRights[] = $right; |
273 | | - } elseif ( $alreadyAssigned && !$wgRequest->getCheck( "wpRightAssigned-$right" ) ) { |
| 264 | + } elseif ( $alreadyAssigned && !$this->getRequest()->getCheck( "wpRightAssigned-$right" ) ) { |
274 | 265 | $removeRights[] = $right; |
275 | 266 | } # Otherwise, do nothing. |
276 | 267 | } |
— | — | @@ -286,7 +277,7 @@ |
287 | 278 | |
288 | 279 | // Change set |
289 | 280 | $current = WikiSet::getWikiSetForGroup( $group ); |
290 | | - $new = $wgRequest->getVal( 'set' ); |
| 281 | + $new = $this->getRequest()->getVal( 'set' ); |
291 | 282 | if ( $current != $new ) { |
292 | 283 | $this->setRestrictions( $group, $new ); |
293 | 284 | $this->addLogEntry2( $group, $current, $new, $reason ); |
— | — | @@ -295,8 +286,8 @@ |
296 | 287 | $this->invalidateRightsCache( $group ); |
297 | 288 | |
298 | 289 | // Display success |
299 | | - $wgOut->setSubTitle( wfMsg( 'centralauth-editgroup-success' ) ); |
300 | | - $wgOut->addWikiMsg( 'centralauth-editgroup-success-text', $group ); |
| 290 | + $this->getOutput()->setSubTitle( wfMsg( 'centralauth-editgroup-success' ) ); |
| 291 | + $this->getOutput()->addWikiMsg( 'centralauth-editgroup-success-text', $group ); |
301 | 292 | } |
302 | 293 | |
303 | 294 | /** |
Index: trunk/extensions/CentralAuth/specials/SpecialCentralAuth.php |
— | — | @@ -16,29 +16,28 @@ |
17 | 17 | } |
18 | 18 | |
19 | 19 | function execute( $subpage ) { |
20 | | - global $wgOut; |
21 | | - global $wgUser, $wgRequest, $wgContLang; |
| 20 | + global $wgContLang; |
22 | 21 | $this->setHeaders(); |
23 | 22 | |
24 | | - $this->mCanUnmerge = $wgUser->isAllowed( 'centralauth-unmerge' ); |
25 | | - $this->mCanLock = $wgUser->isAllowed( 'centralauth-lock' ); |
26 | | - $this->mCanOversight = $wgUser->isAllowed( 'centralauth-oversight' ); |
| 23 | + $this->mCanUnmerge = $this->getUser()->isAllowed( 'centralauth-unmerge' ); |
| 24 | + $this->mCanLock = $this->getUser()->isAllowed( 'centralauth-lock' ); |
| 25 | + $this->mCanOversight = $this->getUser()->isAllowed( 'centralauth-oversight' ); |
27 | 26 | $this->mCanEdit = $this->mCanUnmerge || $this->mCanLock || $this->mCanOversight; |
28 | 27 | |
29 | | - $wgOut->addModules( 'ext.centralauth' ); |
30 | | - $wgOut->addModuleStyles( 'ext.centralauth.noflash' ); |
| 28 | + $this->getOutput()->addModules( 'ext.centralauth' ); |
| 29 | + $this->getOutput()->addModuleStyles( 'ext.centralauth.noflash' ); |
31 | 30 | $this->addMergeMethodDescriptions(); |
32 | 31 | |
33 | 32 | $this->mUserName = |
34 | 33 | trim( |
35 | 34 | str_replace( '_', ' ', |
36 | | - $wgRequest->getText( 'target', $subpage ) ) ); |
| 35 | + $this->getRequest()->getText( 'target', $subpage ) ) ); |
37 | 36 | |
38 | 37 | $this->mUserName = $wgContLang->ucfirst( $this->mUserName ); |
39 | 38 | |
40 | | - $this->mPosted = $wgRequest->wasPosted(); |
41 | | - $this->mMethod = $wgRequest->getVal( 'wpMethod' ); |
42 | | - $this->mWikis = (array)$wgRequest->getArray( 'wpWikis' ); |
| 39 | + $this->mPosted = $this->getRequest()->wasPosted(); |
| 40 | + $this->mMethod = $this->getRequest()->getVal( 'wpMethod' ); |
| 41 | + $this->mWikis = (array)$this->getRequest()->getArray( 'wpWikis' ); |
43 | 42 | |
44 | 43 | // Possible demo states |
45 | 44 | |
— | — | @@ -53,7 +52,7 @@ |
54 | 53 | |
55 | 54 | if ( $this->mUserName === '' ) { |
56 | 55 | # First time through |
57 | | - $wgOut->addWikiMsg( 'centralauth-admin-intro' ); |
| 56 | + $this->getOutput()->addWikiMsg( 'centralauth-admin-intro' ); |
58 | 57 | $this->showUsernameForm(); |
59 | 58 | return; |
60 | 59 | } |
— | — | @@ -97,8 +96,8 @@ |
98 | 97 | function doSubmit() { |
99 | 98 | $deleted = false; |
100 | 99 | $globalUser = $this->mGlobalUser; |
101 | | - global $wgUser, $wgRequest; |
102 | | - if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 100 | + |
| 101 | + if ( !$this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
103 | 102 | $this->showError( 'centralauth-token-mismatch' ); |
104 | 103 | } elseif ( $this->mMethod == 'unmerge' && $this->mCanUnmerge ) { |
105 | 104 | $status = $globalUser->adminUnattach( $this->mWikis ); |
— | — | @@ -117,11 +116,11 @@ |
118 | 117 | } else { |
119 | 118 | $this->showSuccess( 'centralauth-admin-delete-success', $this->mUserName ); |
120 | 119 | $deleted = true; |
121 | | - $this->logAction( 'delete', $this->mUserName, $wgRequest->getVal( 'reason' ) ); |
| 120 | + $this->logAction( 'delete', $this->mUserName, $this->getRequest()->getVal( 'reason' ) ); |
122 | 121 | } |
123 | 122 | } elseif ( $this->mMethod == 'set-status' && $this->mCanLock ) { |
124 | | - $setLocked = $wgRequest->getBool( 'wpStatusLocked' ); |
125 | | - $setHidden = $wgRequest->getVal( 'wpStatusHidden' ); |
| 123 | + $setLocked = $this->getRequest()->getBool( 'wpStatusLocked' ); |
| 124 | + $setHidden = $this->getRequest()->getVal( 'wpStatusHidden' ); |
126 | 125 | $isLocked = $globalUser->isLocked(); |
127 | 126 | $oldHiddenLevel = $globalUser->getHiddenLevel(); |
128 | 127 | $lockStatus = $hideStatus = null; |
— | — | @@ -144,8 +143,8 @@ |
145 | 144 | $removed[] = wfMsgForContent( 'centralauth-log-status-locked' ); |
146 | 145 | } |
147 | 146 | |
148 | | - $reason = $wgRequest->getText( 'wpReasonList' ); |
149 | | - $reasonDetail = $wgRequest->getText( 'wpReason' ); |
| 147 | + $reason = $this->getRequest()->getText( 'wpReasonList' ); |
| 148 | + $reasonDetail = $this->getRequest()->getText( 'wpReason' ); |
150 | 149 | if ( $reason == 'other' ) { |
151 | 150 | $reason = $reasonDetail; |
152 | 151 | } elseif ( $reasonDetail ) { |
— | — | @@ -215,29 +214,26 @@ |
216 | 215 | * @param $wikitext string |
217 | 216 | */ |
218 | 217 | function showStatusError( $wikitext ) { |
219 | | - global $wgOut; |
220 | 218 | $wrap = Xml::tags( 'div', array( 'class' => 'error' ), $wikitext ); |
221 | | - $wgOut->addHTML( $wgOut->parse( $wrap, /*linestart*/true, /*uilang*/true ) ); |
| 219 | + $this->getOutput()->addHTML( $this->getOutput()->parse( $wrap, /*linestart*/true, /*uilang*/true ) ); |
222 | 220 | } |
223 | 221 | |
224 | 222 | function showError( /* varargs */ ) { |
225 | | - global $wgOut; |
226 | 223 | $args = func_get_args(); |
227 | | - $wgOut->wrapWikiMsg( '<div class="error">$1</div>', $args ); |
| 224 | + $this->getOutput()->wrapWikiMsg( '<div class="error">$1</div>', $args ); |
228 | 225 | } |
229 | 226 | |
230 | 227 | function showSuccess( /* varargs */ ) { |
231 | | - global $wgOut; |
232 | 228 | $args = func_get_args(); |
233 | | - $wgOut->wrapWikiMsg( '<div class="success">$1</div>', $args ); |
| 229 | + $this->getOutput()->wrapWikiMsg( '<div class="success">$1</div>', $args ); |
234 | 230 | } |
235 | 231 | |
236 | 232 | function showUsernameForm() { |
237 | | - global $wgOut, $wgScript; |
| 233 | + global $wgScript; |
238 | 234 | $lookup = $this->mCanEdit ? |
239 | 235 | wfMsg( 'centralauth-admin-lookup-rw' ) : |
240 | 236 | wfMsg( 'centralauth-admin-lookup-ro' ); |
241 | | - $wgOut->addHTML( |
| 237 | + $this->getOutput()->addHTML( |
242 | 238 | Xml::openElement( 'form', array( |
243 | 239 | 'method' => 'get', |
244 | 240 | 'action' => $wgScript ) ) . |
— | — | @@ -284,7 +280,7 @@ |
285 | 281 | function showInfo() { |
286 | 282 | $globalUser = $this->mGlobalUser; |
287 | 283 | |
288 | | - global $wgOut, $wgLang; |
| 284 | + global $wgLang; |
289 | 285 | $reg = $globalUser->getRegistration(); |
290 | 286 | $age = $this->prettyTimespan( wfTimestamp( TS_UNIX ) - wfTimestamp( TS_UNIX, $reg ) ); |
291 | 287 | $attribs = array( |
— | — | @@ -302,11 +298,10 @@ |
303 | 299 | $data . '</li>'; |
304 | 300 | } |
305 | 301 | $out .= '</ul></fieldset>'; |
306 | | - $wgOut->addHTML( $out ); |
| 302 | + $this->getOutput()->addHTML( $out ); |
307 | 303 | } |
308 | 304 | |
309 | 305 | function showWikiLists() { |
310 | | - global $wgOut; |
311 | 306 | $merged = $this->mAttachedLocalAccounts; |
312 | 307 | $remainder = $this->mUnattachedLocalAccounts; |
313 | 308 | |
— | — | @@ -314,21 +309,20 @@ |
315 | 310 | wfMsgHtml( 'centralauth-admin-list-legend-rw' ) : |
316 | 311 | wfMsgHtml( 'centralauth-admin-list-legend-ro' ); |
317 | 312 | |
318 | | - $wgOut->addHTML( "<fieldset><legend>{$legend}</legend>" ); |
319 | | - $wgOut->addHTML( $this->listHeader() ); |
320 | | - $wgOut->addHTML( $this->listMerged( $merged ) ); |
| 313 | + $this->getOutput()->addHTML( "<fieldset><legend>{$legend}</legend>" ); |
| 314 | + $this->getOutput()->addHTML( $this->listHeader() ); |
| 315 | + $this->getOutput()->addHTML( $this->listMerged( $merged ) ); |
321 | 316 | if ( $remainder ) { |
322 | | - $wgOut->addHTML( $this->listRemainder( $remainder ) ); |
| 317 | + $this->getOutput()->addHTML( $this->listRemainder( $remainder ) ); |
323 | 318 | } |
324 | | - $wgOut->addHTML( $this->listFooter() ); |
325 | | - $wgOut->addHTML( '</fieldset>' ); |
| 319 | + $this->getOutput()->addHTML( $this->listFooter() ); |
| 320 | + $this->getOutput()->addHTML( '</fieldset>' ); |
326 | 321 | } |
327 | 322 | |
328 | 323 | /** |
329 | 324 | * @return string |
330 | 325 | */ |
331 | 326 | function listHeader() { |
332 | | - global $wgUser; |
333 | 327 | return |
334 | 328 | Xml::openElement( 'form', |
335 | 329 | array( |
— | — | @@ -337,7 +331,7 @@ |
338 | 332 | $this->getTitle( $this->mUserName )->getLocalUrl( 'action=submit' ), |
339 | 333 | 'id' => 'mw-centralauth-merged' ) ) . |
340 | 334 | Html::hidden( 'wpMethod', 'unmerge' ) . |
341 | | - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
| 335 | + Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . |
342 | 336 | Xml::openElement( 'table', array( 'class' => 'wikitable sortable mw-centralauth-wikislist' ) ) . "\n" . |
343 | 337 | '<thead><tr>' . |
344 | 338 | ( $this->mCanUnmerge ? '<th></th>' : '' ) . |
— | — | @@ -573,8 +567,7 @@ |
574 | 568 | * @param $action String: Only 'delete' supported |
575 | 569 | */ |
576 | 570 | function showActionForm( $action ) { |
577 | | - global $wgOut, $wgUser; |
578 | | - $wgOut->addHTML( |
| 571 | + $this->getOutput()->addHTML( |
579 | 572 | # to be able to find messages: centralauth-admin-delete-title, |
580 | 573 | # centralauth-admin-delete-description, centralauth-admin-delete-button |
581 | 574 | Xml::fieldset( wfMsg( "centralauth-admin-{$action}-title" ) ) . |
— | — | @@ -583,7 +576,7 @@ |
584 | 577 | 'action' => $this->getTitle()->getFullUrl( 'target=' . urlencode( $this->mUserName ) ), |
585 | 578 | 'id' => "mw-centralauth-$action" ) ) . |
586 | 579 | Html::hidden( 'wpMethod', $action ) . |
587 | | - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
| 580 | + Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . |
588 | 581 | wfMsgExt( "centralauth-admin-{$action}-description", 'parse' ) . |
589 | 582 | Xml::buildForm( |
590 | 583 | array( 'centralauth-admin-reason' => Xml::input( 'reason', |
— | — | @@ -595,11 +588,10 @@ |
596 | 589 | |
597 | 590 | function showStatusForm() { |
598 | 591 | // Allows locking, hiding, locking and hiding. |
599 | | - global $wgUser, $wgOut; |
600 | 592 | $form = ''; |
601 | 593 | $form .= Xml::fieldset( wfMsg( 'centralauth-admin-status' ) ); |
602 | 594 | $form .= Html::hidden( 'wpMethod', 'set-status' ); |
603 | | - $form .= Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 595 | + $form .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() ); |
604 | 596 | $form .= wfMsgExt( 'centralauth-admin-status-intro', 'parse' ); |
605 | 597 | |
606 | 598 | // Radio buttons |
— | — | @@ -670,14 +662,13 @@ |
671 | 663 | ), |
672 | 664 | $form |
673 | 665 | ); |
674 | | - $wgOut->addHTML( $form ); |
| 666 | + $this->getOutput()->addHTML( $form ); |
675 | 667 | } |
676 | 668 | |
677 | 669 | /** |
678 | 670 | * |
679 | 671 | */ |
680 | 672 | function showLogExtract() { |
681 | | - global $wgOut; |
682 | 673 | $user = $this->mGlobalUser->getName(); |
683 | 674 | $text = ''; |
684 | 675 | $numRows = LogEventsList::showLogExtract( |
— | — | @@ -687,7 +678,7 @@ |
688 | 679 | '', |
689 | 680 | array( 'showIfEmpty' => true ) ); |
690 | 681 | if ( $numRows ) { |
691 | | - $wgOut->addHTML( Xml::fieldset( wfMsg( 'centralauth-admin-logsnippet' ), $text ) ); |
| 682 | + $this->getOutput()->addHTML( Xml::fieldset( wfMsg( 'centralauth-admin-logsnippet' ), $text ) ); |
692 | 683 | } |
693 | 684 | } |
694 | 685 | |
— | — | @@ -717,7 +708,7 @@ |
718 | 709 | } |
719 | 710 | |
720 | 711 | function addMergeMethodDescriptions() { |
721 | | - global $wgOut, $wgLang; |
| 712 | + global $wgLang; |
722 | 713 | $js = "wgMergeMethodDescriptions = {\n"; |
723 | 714 | foreach ( array( 'primary', 'new', 'empty', 'password', 'mail', 'admin', 'login' ) as $method ) { |
724 | 715 | $short = Xml::encodeJsVar( $wgLang->ucfirst( wfMsgHtml( "centralauth-merge-method-{$method}" ) ) ); |
— | — | @@ -725,7 +716,7 @@ |
726 | 717 | $js .= "\t'{$method}' : { 'short' : {$short}, 'desc' : {$desc} },\n"; |
727 | 718 | } |
728 | 719 | $js .= "}"; |
729 | | - $wgOut->addInlineScript( $js ); |
| 720 | + $this->getOutput()->addInlineScript( $js ); |
730 | 721 | } |
731 | 722 | |
732 | 723 | /** |
Index: trunk/extensions/CentralAuth/specials/SpecialMergeAccount.php |
— | — | @@ -8,40 +8,39 @@ |
9 | 9 | } |
10 | 10 | |
11 | 11 | function execute( $subpage ) { |
12 | | - global $wgOut, $wgUser; |
| 12 | + global $wgUser; |
13 | 13 | $this->setHeaders(); |
14 | 14 | |
15 | 15 | if ( !$this->userCanExecute( $wgUser ) ) { |
16 | | - $wgOut->addWikiMsg( 'centralauth-merge-denied' ); |
17 | | - $wgOut->addWikiMsg( 'centralauth-readmore-text' ); |
| 16 | + $this->getOutput()->addWikiMsg( 'centralauth-merge-denied' ); |
| 17 | + $this->getOutput()->addWikiMsg( 'centralauth-readmore-text' ); |
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | | - if ( !$wgUser->isLoggedIn() ) { |
| 21 | + if ( !$this->getUser()->isLoggedIn() ) { |
22 | 22 | $loginpage = SpecialPage::getTitleFor( 'Userlogin' ); |
23 | 23 | $loginurl = $loginpage->getFullUrl( array( 'returnto' => $this->getTitle()->getPrefixedText() ) ); |
24 | | - $wgOut->addWikiMsg( 'centralauth-merge-notlogged', $loginurl ); |
25 | | - $wgOut->addWikiMsg( 'centralauth-readmore-text' ); |
| 24 | + $this->getOutput()->addWikiMsg( 'centralauth-merge-notlogged', $loginurl ); |
| 25 | + $this->getOutput()->addWikiMsg( 'centralauth-readmore-text' ); |
26 | 26 | |
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
30 | 30 | if ( wfReadOnly() ) { |
31 | | - $wgOut->setPagetitle( wfMsg( 'readonly' ) ); |
32 | | - $wgOut->addWikiMsg( 'readonlytext', wfReadOnlyReason() ); |
| 31 | + $this->getOutput()->setPagetitle( wfMsg( 'readonly' ) ); |
| 32 | + $this->getOutput()->addWikiMsg( 'readonlytext', wfReadOnlyReason() ); |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | | - global $wgRequest; |
37 | | - $this->mUserName = $wgUser->getName(); |
| 36 | + $this->mUserName = $this->getUser()->getName(); |
38 | 37 | |
39 | | - $this->mAttemptMerge = $wgRequest->wasPosted(); |
| 38 | + $this->mAttemptMerge = $this->getRequest()->wasPosted(); |
40 | 39 | |
41 | | - $this->mMergeAction = $wgRequest->getVal( 'wpMergeAction' ); |
42 | | - $this->mPassword = $wgRequest->getVal( 'wpPassword' ); |
43 | | - $this->mWikiIDs = $wgRequest->getArray( 'wpWikis' ); |
44 | | - $this->mSessionToken = $wgRequest->getVal( 'wpMergeSessionToken' ); |
45 | | - $this->mSessionKey = pack( "H*", $wgRequest->getVal( 'wpMergeSessionKey' ) ); |
| 40 | + $this->mMergeAction = $this->getRequest()->getVal( 'wpMergeAction' ); |
| 41 | + $this->mPassword = $this->getRequest()->getVal( 'wpPassword' ); |
| 42 | + $this->mWikiIDs = $this->getRequest()->getArray( 'wpWikis' ); |
| 43 | + $this->mSessionToken = $this->getRequest()->getVal( 'wpMergeSessionToken' ); |
| 44 | + $this->mSessionKey = pack( "H*", $this->getRequest()->getVal( 'wpMergeSessionKey' ) ); |
46 | 45 | |
47 | 46 | // Possible demo states |
48 | 47 | |
— | — | @@ -96,7 +95,7 @@ |
97 | 96 | */ |
98 | 97 | private function initSession() { |
99 | 98 | global $wgUser; |
100 | | - $this->mSessionToken = $wgUser->generateToken(); |
| 99 | + $this->mSessionToken = $this->getUser()->generateToken(); |
101 | 100 | |
102 | 101 | // Generate a random binary string |
103 | 102 | $key = ''; |
— | — | @@ -161,18 +160,18 @@ |
162 | 161 | } |
163 | 162 | |
164 | 163 | function doDryRunMerge() { |
165 | | - global $wgUser, $wgRequest, $wgOut, $wgCentralAuthDryRun; |
166 | | - $globalUser = new CentralAuthUser( $wgUser->getName() ); |
| 164 | + global $wgCentralAuthDryRun; |
| 165 | + $globalUser = new CentralAuthUser( $this->getUser()->getName() ); |
167 | 166 | |
168 | 167 | if ( $globalUser->exists() ) { |
169 | 168 | throw new MWException( "Already exists -- race condition" ); |
170 | 169 | } |
171 | 170 | |
172 | 171 | if ( $wgCentralAuthDryRun ) { |
173 | | - $wgOut->addWikiMsg( 'centralauth-notice-dryrun' ); |
| 172 | + $this->getOutput()->addWikiMsg( 'centralauth-notice-dryrun' ); |
174 | 173 | } |
175 | 174 | |
176 | | - $password = $wgRequest->getVal( 'wpPassword' ); |
| 175 | + $password = $this->getRequest()->getVal( 'wpPassword' ); |
177 | 176 | $this->addWorkingPassword( $password ); |
178 | 177 | $passwords = $this->getWorkingPasswords(); |
179 | 178 | |
— | — | @@ -186,23 +185,23 @@ |
187 | 186 | // This is the global account or matched it |
188 | 187 | if ( count( $unattached ) == 0 ) { |
189 | 188 | // Everything matched -- very convenient! |
190 | | - $wgOut->addWikiMsg( 'centralauth-merge-dryrun-complete' ); |
| 189 | + $this->getOutput()->addWikiMsg( 'centralauth-merge-dryrun-complete' ); |
191 | 190 | } else { |
192 | | - $wgOut->addWikiMsg( 'centralauth-merge-dryrun-incomplete' ); |
| 191 | + $this->getOutput()->addWikiMsg( 'centralauth-merge-dryrun-incomplete' ); |
193 | 192 | } |
194 | 193 | |
195 | 194 | if ( count( $unattached ) > 0 ) { |
196 | | - $wgOut->addHTML( $this->step2PasswordForm( $unattached ) ); |
197 | | - $wgOut->addWikiMsg( 'centralauth-merge-dryrun-or' ); |
| 195 | + $this->getOutput()->addHTML( $this->step2PasswordForm( $unattached ) ); |
| 196 | + $this->getOutput()->addWikiMsg( 'centralauth-merge-dryrun-or' ); |
198 | 197 | } |
199 | 198 | |
200 | 199 | $subAttached = array_diff( $attached, array( $home ) ); |
201 | | - $wgOut->addHTML( $this->step3ActionForm( $home, $subAttached, $methods ) ); |
| 200 | + $this->getOutput()->addHTML( $this->step3ActionForm( $home, $subAttached, $methods ) ); |
202 | 201 | } else { |
203 | 202 | // Show error message from status |
204 | | - $wgOut->addHTML( '<div class="errorbox" style="float:none;">' ); |
205 | | - $wgOut->addWikiText( $status->getWikiText() ); |
206 | | - $wgOut->addHTML( '</div>' ); |
| 203 | + $this->getOutput()->addHTML( '<div class="errorbox" style="float:none;">' ); |
| 204 | + $this->getOutput()->addWikiText( $status->getWikiText() ); |
| 205 | + $this->getOutput()->addHTML( '</div>' ); |
207 | 206 | |
208 | 207 | // Show wiki list if required |
209 | 208 | if ( $status->hasMessage( 'centralauth-blocked-text' ) |
— | — | @@ -211,17 +210,17 @@ |
212 | 211 | $out = '<h2>' . wfMsgHtml( 'centralauth-list-home-title' ) . '</h2>'; |
213 | 212 | $out .= wfMsgExt( 'centralauth-list-home-dryrun', 'parse' ); |
214 | 213 | $out .= $this->listAttached( array( $home ), array( $home => 'primary' ) ); |
215 | | - $wgOut->addHTML( $out ); |
| 214 | + $this->getOutput()->addHTML( $out ); |
216 | 215 | } |
217 | 216 | |
218 | 217 | // Show password box |
219 | | - $wgOut->addHTML( $this->step1PasswordForm() ); |
| 218 | + $this->getOutput()->addHTML( $this->step1PasswordForm() ); |
220 | 219 | } |
221 | 220 | } |
222 | 221 | |
223 | 222 | function doInitialMerge() { |
224 | 223 | global $wgUser, $wgCentralAuthDryRun; |
225 | | - $globalUser = new CentralAuthUser( $wgUser->getName() ); |
| 224 | + $globalUser = new CentralAuthUser( $this->getUser()->getName() ); |
226 | 225 | |
227 | 226 | if ( $wgCentralAuthDryRun ) { |
228 | 227 | $this->dryRunError(); |
— | — | @@ -244,8 +243,8 @@ |
245 | 244 | } |
246 | 245 | |
247 | 246 | function doCleanupMerge() { |
248 | | - global $wgUser, $wgRequest, $wgOut, $wgCentralAuthDryRun; |
249 | | - $globalUser = new CentralAuthUser( $wgUser->getName() ); |
| 247 | + global $wgCentralAuthDryRun; |
| 248 | + $globalUser = new CentralAuthUser( $this->getUser()->getName() ); |
250 | 249 | |
251 | 250 | if ( !$globalUser->exists() ) { |
252 | 251 | throw new MWException( "User doesn't exist -- race condition?" ); |
— | — | @@ -259,7 +258,7 @@ |
260 | 259 | $this->dryRunError(); |
261 | 260 | return; |
262 | 261 | } |
263 | | - $password = $wgRequest->getText( 'wpPassword' ); |
| 262 | + $password = $this->getRequest()->getText( 'wpPassword' ); |
264 | 263 | |
265 | 264 | $attached = array(); |
266 | 265 | $unattached = array(); |
— | — | @@ -268,17 +267,17 @@ |
269 | 268 | |
270 | 269 | if ( !$ok ) { |
271 | 270 | if ( empty( $attached ) ) { |
272 | | - $wgOut->addWikiMsg( 'centralauth-finish-noconfirms' ); |
| 271 | + $this->getOutput()->addWikiMsg( 'centralauth-finish-noconfirms' ); |
273 | 272 | } else { |
274 | | - $wgOut->addWikiMsg( 'centralauth-finish-incomplete' ); |
| 273 | + $this->getOutput()->addWikiMsg( 'centralauth-finish-incomplete' ); |
275 | 274 | } |
276 | 275 | } |
277 | 276 | $this->showCleanupForm(); |
278 | 277 | } |
279 | 278 | |
280 | 279 | function doAttachMerge() { |
281 | | - global $wgUser, $wgRequest, $wgOut, $wgCentralAuthDryRun; |
282 | | - $globalUser = new CentralAuthUser( $wgUser->getName() ); |
| 280 | + global $wgCentralAuthDryRun; |
| 281 | + $globalUser = new CentralAuthUser( $this->getUser()->getName() ); |
283 | 282 | |
284 | 283 | if ( !$globalUser->exists() ) { |
285 | 284 | throw new MWException( "User doesn't exist -- race condition?" ); |
— | — | @@ -292,13 +291,13 @@ |
293 | 292 | $this->dryRunError(); |
294 | 293 | return; |
295 | 294 | } |
296 | | - $password = $wgRequest->getText( 'wpPassword' ); |
| 295 | + $password = $this->getRequest()->getText( 'wpPassword' ); |
297 | 296 | if ( $globalUser->authenticate( $password ) == 'ok' ) { |
298 | 297 | $globalUser->attach( wfWikiID(), 'password' ); |
299 | | - $wgOut->addWikiMsg( 'centralauth-attach-success' ); |
| 298 | + $this->getOutput()->addWikiMsg( 'centralauth-attach-success' ); |
300 | 299 | $this->showCleanupForm(); |
301 | 300 | } else { |
302 | | - $wgOut->addHTML( |
| 301 | + $this->getOutput()->addHTML( |
303 | 302 | '<div class="errorbox">' . |
304 | 303 | wfMsg( 'wrongpassword' ) . |
305 | 304 | '</div>' . |
— | — | @@ -307,17 +306,17 @@ |
308 | 307 | } |
309 | 308 | |
310 | 309 | private function showWelcomeForm() { |
311 | | - global $wgOut, $wgCentralAuthDryRun; |
| 310 | + global $wgCentralAuthDryRun; |
312 | 311 | |
313 | 312 | if ( $wgCentralAuthDryRun ) { |
314 | | - $wgOut->addWikiMsg( 'centralauth-notice-dryrun' ); |
| 313 | + $this->getOutput()->addWikiMsg( 'centralauth-notice-dryrun' ); |
315 | 314 | } |
316 | 315 | |
317 | | - $wgOut->addWikiMsg( 'centralauth-merge-welcome' ); |
318 | | - $wgOut->addWikiMsg( 'centralauth-readmore-text' ); |
| 316 | + $this->getOutput()->addWikiMsg( 'centralauth-merge-welcome' ); |
| 317 | + $this->getOutput()->addWikiMsg( 'centralauth-readmore-text' ); |
319 | 318 | |
320 | 319 | $this->initSession(); |
321 | | - $wgOut->addHTML( |
| 320 | + $this->getOutput()->addHTML( |
322 | 321 | $this->passwordForm( |
323 | 322 | 'dryrun', |
324 | 323 | wfMsg( 'centralauth-merge-step1-title' ), |
— | — | @@ -328,7 +327,7 @@ |
329 | 328 | |
330 | 329 | function showCleanupForm() { |
331 | 330 | global $wgUser; |
332 | | - $globalUser = new CentralAuthUser( $wgUser->getName() ); |
| 331 | + $globalUser = new CentralAuthUser( $this->getUser()->getName() ); |
333 | 332 | |
334 | 333 | $merged = $globalUser->listAttached(); |
335 | 334 | $remainder = $globalUser->listUnattached(); |
— | — | @@ -336,12 +335,11 @@ |
337 | 336 | } |
338 | 337 | |
339 | 338 | function showAttachForm() { |
340 | | - global $wgOut, $wgUser; |
341 | | - $globalUser = new CentralAuthUser( $wgUser->getName() ); |
| 339 | + $globalUser = new CentralAuthUser( $this->getUser()->getName() ); |
342 | 340 | $merged = $globalUser->listAttached(); |
343 | | - $wgOut->addWikiMsg( 'centralauth-attach-list-attached', $this->mUserName ); |
344 | | - $wgOut->addHTML( $this->listAttached( $merged ) ); |
345 | | - $wgOut->addHTML( $this->attachActionForm() ); |
| 341 | + $this->getOutput()->addWikiMsg( 'centralauth-attach-list-attached', $this->mUserName ); |
| 342 | + $this->getOutput()->addHTML( $this->listAttached( $merged ) ); |
| 343 | + $this->getOutput()->addHTML( $this->attachActionForm() ); |
346 | 344 | } |
347 | 345 | |
348 | 346 | /** |
— | — | @@ -349,32 +347,30 @@ |
350 | 348 | * @param $remainder |
351 | 349 | */ |
352 | 350 | function showStatus( $merged, $remainder ) { |
353 | | - global $wgOut; |
354 | | - |
355 | 351 | if ( count( $remainder ) > 0 ) { |
356 | | - $wgOut->setPageTitle( wfMsg( 'centralauth-incomplete' ) ); |
357 | | - $wgOut->addWikiMsg( 'centralauth-incomplete-text' ); |
| 352 | + $this->getOutput()->setPageTitle( wfMsg( 'centralauth-incomplete' ) ); |
| 353 | + $this->getOutput()->addWikiMsg( 'centralauth-incomplete-text' ); |
358 | 354 | } else { |
359 | | - $wgOut->setPageTitle( wfMsg( 'centralauth-complete' ) ); |
360 | | - $wgOut->addWikiMsg( 'centralauth-complete-text' ); |
| 355 | + $this->getOutput()->setPageTitle( wfMsg( 'centralauth-complete' ) ); |
| 356 | + $this->getOutput()->addWikiMsg( 'centralauth-complete-text' ); |
361 | 357 | } |
362 | | - $wgOut->addWikiMsg( 'centralauth-readmore-text' ); |
| 358 | + $this->getOutput()->addWikiMsg( 'centralauth-readmore-text' ); |
363 | 359 | |
364 | 360 | if ( $merged ) { |
365 | | - $wgOut->addHTML( '<hr />' ); |
366 | | - $wgOut->addWikiMsg( 'centralauth-list-attached', |
| 361 | + $this->getOutput()->addHTML( '<hr />' ); |
| 362 | + $this->getOutput()->addWikiMsg( 'centralauth-list-attached', |
367 | 363 | $this->mUserName ); |
368 | | - $wgOut->addHTML( $this->listAttached( $merged ) ); |
| 364 | + $this->getOutput()->addHTML( $this->listAttached( $merged ) ); |
369 | 365 | } |
370 | 366 | |
371 | 367 | if ( $remainder ) { |
372 | | - $wgOut->addHTML( '<hr />' ); |
373 | | - $wgOut->addWikiMsg( 'centralauth-list-unattached', |
| 368 | + $this->getOutput()->addHTML( '<hr />' ); |
| 369 | + $this->getOutput()->addWikiMsg( 'centralauth-list-unattached', |
374 | 370 | $this->mUserName ); |
375 | | - $wgOut->addHTML( $this->listUnattached( $remainder ) ); |
| 371 | + $this->getOutput()->addHTML( $this->listUnattached( $remainder ) ); |
376 | 372 | |
377 | 373 | // Try the password form! |
378 | | - $wgOut->addHTML( $this->passwordForm( |
| 374 | + $this->getOutput()->addHTML( $this->passwordForm( |
379 | 375 | 'cleanup', |
380 | 376 | wfMsg( 'centralauth-finish-title' ), |
381 | 377 | wfMsgExt( 'centralauth-finish-text', array( 'parse' ) ), |
— | — | @@ -479,7 +475,7 @@ |
480 | 476 | 'method' => 'post', |
481 | 477 | 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ) ) ) . |
482 | 478 | Xml::element( 'h2', array(), $title ) . |
483 | | - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
| 479 | + Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . |
484 | 480 | Html::hidden( 'wpMergeAction', $action ) . |
485 | 481 | Html::hidden( 'wpMergeSessionToken', $this->mSessionToken ) . |
486 | 482 | Html::hidden( 'wpMergeSessionKey', bin2hex( $this->mSessionKey ) ) . |
— | — | @@ -550,7 +546,7 @@ |
551 | 547 | return $this->passwordForm( |
552 | 548 | 'dryrun', |
553 | 549 | wfMsg( 'centralauth-merge-step2-title' ), |
554 | | - wfMsgExt( 'centralauth-merge-step2-detail', 'parse', $wgUser->getName() ) . |
| 550 | + wfMsgExt( 'centralauth-merge-step2-detail', 'parse', $this->getUser()->getName() ) . |
555 | 551 | $this->listUnattached( $unattached ), |
556 | 552 | wfMsg( 'centralauth-merge-step2-submit' ) ); |
557 | 553 | } |
— | — | @@ -566,13 +562,13 @@ |
567 | 563 | return $this->actionForm( |
568 | 564 | 'initial', |
569 | 565 | wfMsg( 'centralauth-merge-step3-title' ), |
570 | | - wfMsgExt( 'centralauth-merge-step3-detail', 'parse', $wgUser->getName() ) . |
| 566 | + wfMsgExt( 'centralauth-merge-step3-detail', 'parse', $this->getUser()->getName() ) . |
571 | 567 | '<h3>' . wfMsgHtml( 'centralauth-list-home-title' ) . '</h3>' . |
572 | 568 | wfMsgExt( 'centralauth-list-home-dryrun', 'parse' ) . |
573 | 569 | $this->listAttached( array( $home ), $methods ) . |
574 | 570 | ( count( $attached ) |
575 | 571 | ? ( '<h3>' . wfMsgHtml( 'centralauth-list-attached-title' ) . '</h3>' . |
576 | | - wfMsgExt( 'centralauth-list-attached-dryrun', 'parse', $wgUser->getName() ) ) |
| 572 | + wfMsgExt( 'centralauth-list-attached-dryrun', 'parse', $this->getUser()->getName() ) ) |
577 | 573 | : '' ) . |
578 | 574 | $this->listAttached( $attached, $methods ) . |
579 | 575 | '<p>' . |
— | — | @@ -594,7 +590,6 @@ |
595 | 591 | } |
596 | 592 | |
597 | 593 | private function dryRunError() { |
598 | | - global $wgOut; |
599 | | - $wgOut->addWikiMsg( 'centralauth-disabled-dryrun' ); |
| 594 | + $this->getOutput()->addWikiMsg( 'centralauth-disabled-dryrun' ); |
600 | 595 | } |
601 | 596 | } |
Index: trunk/extensions/CentralAuth/specials/SpecialAutoLogin.php |
— | — | @@ -14,17 +14,17 @@ |
15 | 15 | } |
16 | 16 | |
17 | 17 | function execute( $par ) { |
18 | | - global $wgRequest, $wgOut, $wgMemc; |
| 18 | + global $wgMemc; |
19 | 19 | |
20 | | - $tempToken = $wgRequest->getVal( 'token' ); |
21 | | - $logout = $wgRequest->getBool( 'logout' ); |
| 20 | + $tempToken = $this->getRequest()->getVal( 'token' ); |
| 21 | + $logout = $this->getRequest()->getBool( 'logout' ); |
22 | 22 | |
23 | 23 | # Don't cache error messages |
24 | | - $wgOut->enableClientCache( false ); |
| 24 | + $this->getOutput()->enableClientCache( false ); |
25 | 25 | |
26 | 26 | if ( strlen( $tempToken ) == 0 ) { |
27 | 27 | $this->setHeaders(); |
28 | | - $wgOut->addWikiMsg( 'centralauth-autologin-desc' ); |
| 28 | + $this->getOutput()->addWikiMsg( 'centralauth-autologin-desc' ); |
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | $msg = 'Token is invalid or has expired'; |
38 | 38 | wfDebug( __METHOD__ . ": $msg\n" ); |
39 | 39 | $this->setHeaders(); |
40 | | - $wgOut->addWikiText( $msg ); |
| 40 | + $this->getOutput()->addWikiText( $msg ); |
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | $msg = 'Bad token (wrong wiki)'; |
50 | 50 | wfDebug( __METHOD__ . ": $msg\n" ); |
51 | 51 | $this->setHeaders(); |
52 | | - $wgOut->addWikiText( $msg ); |
| 52 | + $this->getOutput()->addWikiText( $msg ); |
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | $msg = "Bad token: $loginResult"; |
61 | 61 | wfDebug( __METHOD__ . ": $msg\n" ); |
62 | 62 | $this->setHeaders(); |
63 | | - $wgOut->addWikiText( $msg ); |
| 63 | + $this->getOutput()->addWikiText( $msg ); |
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $centralUser->setGlobalCookies( $remember ); |
72 | 72 | } |
73 | 73 | |
74 | | - $wgOut->disable(); |
| 74 | + $this->getOutput()->disable(); |
75 | 75 | |
76 | 76 | wfResetOutputBuffers(); |
77 | 77 | header( 'Cache-Control: no-cache' ); |
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalUsers.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | } |
8 | 8 | |
9 | 9 | function execute( $par ) { |
10 | | - global $wgOut, $wgRequest, $wgContLang; |
| 10 | + global $wgContLang; |
11 | 11 | $this->setHeaders(); |
12 | 12 | |
13 | 13 | $pg = new GlobalUsersPager( $this->getContext(), $par ); |
— | — | @@ -14,19 +14,19 @@ |
15 | 15 | if ( $par ) { |
16 | 16 | $pg->setGroup( $par ); |
17 | 17 | } |
18 | | - $rqGroup = $wgRequest->getVal( 'group' ); |
| 18 | + $rqGroup = $this->getRequest()->getVal( 'group' ); |
19 | 19 | if ( $rqGroup ) { |
20 | 20 | $pg->setGroup( $rqGroup ); |
21 | 21 | } |
22 | | - $rqUsername = $wgContLang->ucfirst( $wgRequest->getVal( 'username' ) ); |
| 22 | + $rqUsername = $wgContLang->ucfirst( $this->getRequest()->getVal( 'username' ) ); |
23 | 23 | if ( $rqUsername ) { |
24 | 24 | $pg->setUsername( $rqUsername ); |
25 | 25 | } |
26 | 26 | |
27 | | - $wgOut->addHTML( $pg->getPageHeader() ); |
28 | | - $wgOut->addHTML( $pg->getNavigationBar() ); |
29 | | - $wgOut->addHTML( '<ul>' . $pg->getBody() . '</ul>' ); |
30 | | - $wgOut->addHTML( $pg->getNavigationBar() ); |
| 27 | + $this->getOutput()->addHTML( $pg->getPageHeader() ); |
| 28 | + $this->getOutput()->addHTML( $pg->getNavigationBar() ); |
| 29 | + $this->getOutput()->addHTML( '<ul>' . $pg->getBody() . '</ul>' ); |
| 30 | + $this->getOutput()->addHTML( $pg->getNavigationBar() ); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
Index: trunk/extensions/CentralAuth/specials/SpecialWikiSets.php |
— | — | @@ -27,16 +27,14 @@ |
28 | 28 | } |
29 | 29 | |
30 | 30 | function execute( $subpage ) { |
31 | | - global $wgRequest, $wgOut, $wgUser; |
| 31 | + $this->mCanEdit = $this->getUser()->isAllowed( 'globalgrouppermissions' ); |
32 | 32 | |
33 | | - $this->mCanEdit = $wgUser->isAllowed( 'globalgrouppermissions' ); |
34 | | - |
35 | 33 | $this->setHeaders(); |
36 | 34 | |
37 | 35 | if ( strpos( $subpage, 'delete/' ) === 0 && $this->mCanEdit ) { |
38 | 36 | $subpage = substr( $subpage, 7 ); // Remove delete/ part |
39 | 37 | if ( is_numeric( $subpage ) ) { |
40 | | - if ( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 38 | + if ( $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
41 | 39 | $this->doDelete( $subpage ); |
42 | 40 | } else { |
43 | 41 | $this->buildDeleteView( $subpage ); |
— | — | @@ -51,14 +49,14 @@ |
52 | 50 | if ( $set ) { |
53 | 51 | $subpage = $set->getID(); |
54 | 52 | } else { |
55 | | - $wgOut->setPageTitle( wfMsg( 'error' ) ); |
| 53 | + $this->getOutput()->setPageTitle( wfMsg( 'error' ) ); |
56 | 54 | $error = wfMsgExt( 'centralauth-editset-notfound', array( 'escapenoentities' ), $subpage ); |
57 | 55 | $this->buildMainView( "<strong class='error'>{$error}</strong>" ); |
58 | 56 | return; |
59 | 57 | } |
60 | 58 | } |
61 | 59 | |
62 | | - if ( ( $subpage || $newPage ) && $this->mCanEdit && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 60 | + if ( ( $subpage || $newPage ) && $this->mCanEdit && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
63 | 61 | $this->doSubmit( $subpage ); |
64 | 62 | } elseif ( ( $subpage || $newPage ) && is_numeric( $subpage ) ) { |
65 | 63 | $this->buildSetView( $subpage ); |
— | — | @@ -72,29 +70,27 @@ |
73 | 71 | * @param string $msg |
74 | 72 | */ |
75 | 73 | function buildMainView( $msg = '' ) { |
76 | | - global $wgOut; |
77 | | - |
78 | 74 | $msgPostfix = $this->mCanEdit ? 'rw' : 'ro'; |
79 | 75 | $legend = wfMsg( "centralauth-editset-legend-{$msgPostfix}" ); |
80 | | - $wgOut->addHTML( "<fieldset><legend>{$legend}</legend>" ); |
| 76 | + $this->getOutput()->addHTML( "<fieldset><legend>{$legend}</legend>" ); |
81 | 77 | if ( $msg ) |
82 | | - $wgOut->addHTML( $msg ); |
83 | | - $wgOut->addWikiMsg( "centralauth-editset-intro-{$msgPostfix}" ); |
84 | | - $wgOut->addHTML( '<ul>' ); |
| 78 | + $this->getOutput()->addHTML( $msg ); |
| 79 | + $this->getOutput()->addWikiMsg( "centralauth-editset-intro-{$msgPostfix}" ); |
| 80 | + $this->getOutput()->addHTML( '<ul>' ); |
85 | 81 | |
86 | 82 | $sets = WikiSet::getAllWikiSets(); |
87 | 83 | foreach ( $sets as $set ) { |
88 | 84 | $text = wfMsgExt( "centralauth-editset-item-{$msgPostfix}", array( 'parseinline' ), $set->getName(), $set->getID() ); |
89 | | - $wgOut->addHTML( "<li>{$text}</li>" ); |
| 85 | + $this->getOutput()->addHTML( "<li>{$text}</li>" ); |
90 | 86 | } |
91 | 87 | |
92 | 88 | if ( $this->mCanEdit ) { |
93 | 89 | $target = SpecialPage::getTitleFor( 'WikiSets', '0' ); |
94 | 90 | $newlink = Linker::makeLinkObj( $target, wfMsgHtml( 'centralauth-editset-new' ) ); |
95 | | - $wgOut->addHTML( "<li>{$newlink}</li>" ); |
| 91 | + $this->getOutput()->addHTML( "<li>{$newlink}</li>" ); |
96 | 92 | } |
97 | 93 | |
98 | | - $wgOut->addHTML( '</ul></fieldset>' ); |
| 94 | + $this->getOutput()->addHTML( '</ul></fieldset>' ); |
99 | 95 | } |
100 | 96 | |
101 | 97 | /** |
— | — | @@ -106,9 +102,9 @@ |
107 | 103 | * @param $reason |
108 | 104 | */ |
109 | 105 | function buildSetView( $subpage, $error = false, $name = null, $type = null, $wikis = null, $reason = null ) { |
110 | | - global $wgOut, $wgUser, $wgLocalDatabases; |
| 106 | + global $wgLocalDatabases; |
111 | 107 | |
112 | | - $wgOut->setSubtitle( wfMsgExt( 'centralauth-editset-subtitle', 'parseinline' ) ); |
| 108 | + $this->getOutput()->setSubtitle( wfMsgExt( 'centralauth-editset-subtitle', 'parseinline' ) ); |
113 | 109 | |
114 | 110 | $set = ( $subpage || $subpage === '0' ) ? WikiSet::newFromID( $subpage ) : null; |
115 | 111 | |
— | — | @@ -123,7 +119,7 @@ |
124 | 120 | $legend = wfMsgHtml( 'centralauth-editset-legend-view', $name ); |
125 | 121 | } |
126 | 122 | |
127 | | - $wgOut->addHTML( "<fieldset><legend>{$legend}</legend>" ); |
| 123 | + $this->getOutput()->addHTML( "<fieldset><legend>{$legend}</legend>" ); |
128 | 124 | |
129 | 125 | if ( $set ) { |
130 | 126 | $groups = $set->getRestrictedGroups(); |
— | — | @@ -154,9 +150,9 @@ |
155 | 151 | |
156 | 152 | if ( $this->mCanEdit ) { |
157 | 153 | if ( $error ) { |
158 | | - $wgOut->addHTML( "<strong class='error'>{$error}</strong>" ); |
| 154 | + $this->getOutput()->addHTML( "<strong class='error'>{$error}</strong>" ); |
159 | 155 | } |
160 | | - $wgOut->addHTML( "<form action='{$url}' method='post'>" ); |
| 156 | + $this->getOutput()->addHTML( "<form action='{$url}' method='post'>" ); |
161 | 157 | |
162 | 158 | $form = array(); |
163 | 159 | $form['centralauth-editset-name'] = Xml::input( 'wpName', false, $name ); |
— | — | @@ -169,10 +165,10 @@ |
170 | 166 | implode( "\n", $restWikis ), 40, 5, array( 'readonly' => true ) ); |
171 | 167 | $form['centralauth-editset-reason'] = Xml::input( 'wpReason', 50, $reason ); |
172 | 168 | |
173 | | - $wgOut->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit' ) ); |
| 169 | + $this->getOutput()->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit' ) ); |
174 | 170 | |
175 | | - $edittoken = Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
176 | | - $wgOut->addHTML( "<p>{$edittoken}</p></form></fieldset>" ); |
| 171 | + $edittoken = Html::hidden( 'wpEditToken', $this->getUser()->editToken() ); |
| 172 | + $this->getOutput()->addHTML( "<p>{$edittoken}</p></form></fieldset>" ); |
177 | 173 | } else { |
178 | 174 | $form = array(); |
179 | 175 | $form['centralauth-editset-name'] = htmlspecialchars( $name ); |
— | — | @@ -181,7 +177,7 @@ |
182 | 178 | $form['centralauth-editset-wikis'] = self::buildTableByList( $sortedWikis, 3, array( 'width' => '100%' ) ); |
183 | 179 | $form['centralauth-editset-restwikis'] = self::buildTableByList( $restWikis, 3, array( 'width' => '100%' ) ); |
184 | 180 | |
185 | | - $wgOut->addHTML( Xml::buildForm( $form ) ); |
| 181 | + $this->getOutput()->addHTML( Xml::buildForm( $form ) ); |
186 | 182 | } |
187 | 183 | } |
188 | 184 | |
— | — | @@ -243,8 +239,7 @@ |
244 | 240 | * @return mixed |
245 | 241 | */ |
246 | 242 | function buildDeleteView( $subpage ) { |
247 | | - global $wgOut, $wgUser; |
248 | | - $wgOut->setSubtitle( wfMsgExt( 'centralauth-editset-subtitle', 'parseinline' ) ); |
| 243 | + $this->getOutput()->setSubtitle( wfMsgExt( 'centralauth-editset-subtitle', 'parseinline' ) ); |
249 | 244 | |
250 | 245 | $set = WikiSet::newFromID( $subpage ); |
251 | 246 | if ( !$set ) { |
— | — | @@ -255,11 +250,11 @@ |
256 | 251 | $legend = wfMsgHtml( 'centralauth-editset-legend-delete', $set->getName() ); |
257 | 252 | $form = array( 'centralauth-editset-reason' => Xml::input( 'wpReason' ) ); |
258 | 253 | $url = htmlspecialchars( SpecialPage::getTitleFor( 'WikiSets', "delete/{$subpage}" )->getLocalUrl() ); |
259 | | - $edittoken = Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 254 | + $edittoken = Html::hidden( 'wpEditToken', $this->getUser()->editToken() ); |
260 | 255 | |
261 | | - $wgOut->addHTML( "<fieldset><legend>{$legend}</legend><form action='{$url}' method='post'>" ); |
262 | | - $wgOut->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit-delete' ) ); |
263 | | - $wgOut->addHTML( "<p>{$edittoken}</p></form></fieldset>" ); |
| 256 | + $this->getOutput()->addHTML( "<fieldset><legend>{$legend}</legend><form action='{$url}' method='post'>" ); |
| 257 | + $this->getOutput()->addHTML( Xml::buildForm( $form, 'centralauth-editset-submit-delete' ) ); |
| 258 | + $this->getOutput()->addHTML( "<p>{$edittoken}</p></form></fieldset>" ); |
264 | 259 | } |
265 | 260 | |
266 | 261 | /** |
— | — | @@ -267,12 +262,12 @@ |
268 | 263 | * @return mixed |
269 | 264 | */ |
270 | 265 | function doSubmit( $id ) { |
271 | | - global $wgRequest, $wgContLang; |
| 266 | + global $wgContLang; |
272 | 267 | |
273 | | - $name = $wgContLang->ucfirst( $wgRequest->getVal( 'wpName' ) ); |
274 | | - $type = $wgRequest->getVal( 'wpType' ); |
275 | | - $wikis = array_unique( preg_split( '/(\s+|\s*\W\s*)/', $wgRequest->getVal( 'wpWikis' ), -1, PREG_SPLIT_NO_EMPTY ) ); |
276 | | - $reason = $wgRequest->getVal( 'wpReason' ); |
| 268 | + $name = $wgContLang->ucfirst( $this->getRequest()->getVal( 'wpName' ) ); |
| 269 | + $type = $this->getRequest()->getVal( 'wpType' ); |
| 270 | + $wikis = array_unique( preg_split( '/(\s+|\s*\W\s*)/', $this->getRequest()->getVal( 'wpWikis' ), -1, PREG_SPLIT_NO_EMPTY ) ); |
| 271 | + $reason = $this->getRequest()->getVal( 'wpReason' ); |
277 | 272 | $set = WikiSet::newFromId( $id ); |
278 | 273 | |
279 | 274 | if ( !Title::newFromText( $name ) ) { |
— | — | @@ -337,10 +332,9 @@ |
338 | 333 | } |
339 | 334 | } |
340 | 335 | |
341 | | - global $wgOut; |
342 | 336 | $returnLink = Linker::makeKnownLinkObj( $this->getTitle(), wfMsg( 'centralauth-editset-return' ) ); |
343 | 337 | |
344 | | - $wgOut->addHTML( '<strong class="success">' . wfMsgHtml( 'centralauth-editset-success' ) . '</strong> <p>' . $returnLink . '</p>' ); |
| 338 | + $this->getOutput()->addHTML( '<strong class="success">' . wfMsgHtml( 'centralauth-editset-success' ) . '</strong> <p>' . $returnLink . '</p>' ); |
345 | 339 | } |
346 | 340 | |
347 | 341 | /** |
— | — | @@ -348,15 +342,13 @@ |
349 | 343 | * @return mixed |
350 | 344 | */ |
351 | 345 | function doDelete( $set ) { |
352 | | - global $wgRequest; |
353 | | - |
354 | 346 | $set = WikiSet::newFromID( $set ); |
355 | 347 | if ( !$set ) { |
356 | 348 | $this->buildMainView( '<strong class="error">' . wfMsgHtml( 'centralauth-editset-notfound', $set ) . '</strong>' ); |
357 | 349 | return; |
358 | 350 | } |
359 | 351 | |
360 | | - $reason = $wgRequest->getVal( 'wpReason' ); |
| 352 | + $reason = $this->getRequest()->getVal( 'wpReason' ); |
361 | 353 | $name = $set->getName(); |
362 | 354 | $set->delete(); |
363 | 355 | |