Index: trunk/phase3/includes/revisiondelete/RevisionDelete.php |
— | — | @@ -170,12 +170,11 @@ |
171 | 171 | * Overridden by RevDel_ArchiveItem. |
172 | 172 | */ |
173 | 173 | protected function getRevisionLink() { |
174 | | - global $wgLang; |
175 | | - $date = $wgLang->timeanddate( $this->revision->getTimestamp(), true ); |
| 174 | + $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true ); |
176 | 175 | if ( $this->isDeleted() && !$this->canViewContent() ) { |
177 | 176 | return $date; |
178 | 177 | } |
179 | | - return $this->special->skin->link( |
| 178 | + return Linker::link( |
180 | 179 | $this->list->title, |
181 | 180 | $date, |
182 | 181 | array(), |
— | — | @@ -195,7 +194,7 @@ |
196 | 195 | return wfMsgHtml('diff'); |
197 | 196 | } else { |
198 | 197 | return |
199 | | - $this->special->skin->link( |
| 198 | + Linker::link( |
200 | 199 | $this->list->title, |
201 | 200 | wfMsgHtml('diff'), |
202 | 201 | array(), |
— | — | @@ -215,8 +214,8 @@ |
216 | 215 | public function getHTML() { |
217 | 216 | $difflink = $this->getDiffLink(); |
218 | 217 | $revlink = $this->getRevisionLink(); |
219 | | - $userlink = $this->special->skin->revUserLink( $this->revision ); |
220 | | - $comment = $this->special->skin->revComment( $this->revision ); |
| 218 | + $userlink = Linker::revUserLink( $this->revision ); |
| 219 | + $comment = Linker::revComment( $this->revision ); |
221 | 220 | if ( $this->isDeleted() ) { |
222 | 221 | $revlink = "<span class=\"history-deleted\">$revlink</span>"; |
223 | 222 | } |
— | — | @@ -298,13 +297,12 @@ |
299 | 298 | } |
300 | 299 | |
301 | 300 | protected function getRevisionLink() { |
302 | | - global $wgLang; |
303 | 301 | $undelete = SpecialPage::getTitleFor( 'Undelete' ); |
304 | | - $date = $wgLang->timeanddate( $this->revision->getTimestamp(), true ); |
| 302 | + $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true ); |
305 | 303 | if ( $this->isDeleted() && !$this->canViewContent() ) { |
306 | 304 | return $date; |
307 | 305 | } |
308 | | - return $this->special->skin->link( $undelete, $date, array(), |
| 306 | + return Linker::link( $undelete, $date, array(), |
309 | 307 | array( |
310 | 308 | 'target' => $this->list->title->getPrefixedText(), |
311 | 309 | 'timestamp' => $this->revision->getTimestamp() |
— | — | @@ -316,7 +314,7 @@ |
317 | 315 | return wfMsgHtml( 'diff' ); |
318 | 316 | } |
319 | 317 | $undelete = SpecialPage::getTitleFor( 'Undelete' ); |
320 | | - return $this->special->skin->link( $undelete, wfMsgHtml('diff'), array(), |
| 318 | + return Linker::link( $undelete, wfMsgHtml('diff'), array(), |
321 | 319 | array( |
322 | 320 | 'target' => $this->list->title->getPrefixedText(), |
323 | 321 | 'diff' => 'prev', |
— | — | @@ -508,20 +506,19 @@ |
509 | 507 | * Overridden by RevDel_ArchivedFileItem. |
510 | 508 | */ |
511 | 509 | protected function getLink() { |
512 | | - global $wgLang, $wgUser; |
513 | | - $date = $wgLang->timeanddate( $this->file->getTimestamp(), true ); |
| 510 | + $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true ); |
514 | 511 | if ( $this->isDeleted() ) { |
515 | 512 | # Hidden files... |
516 | 513 | if ( !$this->canViewContent() ) { |
517 | 514 | $link = $date; |
518 | 515 | } else { |
519 | | - $link = $this->special->skin->link( |
| 516 | + $link = Linker::link( |
520 | 517 | $this->special->getTitle(), |
521 | 518 | $date, array(), |
522 | 519 | array( |
523 | 520 | 'target' => $this->list->title->getPrefixedText(), |
524 | 521 | 'file' => $this->file->getArchiveName(), |
525 | | - 'token' => $wgUser->editToken( $this->file->getArchiveName() ) |
| 522 | + 'token' => $this->getUser()->editToken( $this->file->getArchiveName() ) |
526 | 523 | ) |
527 | 524 | ); |
528 | 525 | } |
— | — | @@ -537,8 +534,8 @@ |
538 | 535 | */ |
539 | 536 | protected function getUserTools() { |
540 | 537 | if( $this->file->userCan( Revision::DELETED_USER ) ) { |
541 | | - $link = $this->special->skin->userLink( $this->file->user, $this->file->user_text ) . |
542 | | - $this->special->skin->userToolLinks( $this->file->user, $this->file->user_text ); |
| 538 | + $link = Linker::userLink( $this->file->user, $this->file->user_text ) . |
| 539 | + Linker::userToolLinks( $this->file->user, $this->file->user_text ); |
543 | 540 | } else { |
544 | 541 | $link = wfMsgHtml( 'rev-deleted-user' ); |
545 | 542 | } |
— | — | @@ -556,7 +553,7 @@ |
557 | 554 | */ |
558 | 555 | protected function getComment() { |
559 | 556 | if( $this->file->userCan( File::DELETED_COMMENT ) ) { |
560 | | - $block = $this->special->skin->commentBlock( $this->file->description ); |
| 557 | + $block = Linker::commentBlock( $this->file->description ); |
561 | 558 | } else { |
562 | 559 | $block = ' ' . wfMsgHtml( 'rev-deleted-comment' ); |
563 | 560 | } |
— | — | @@ -567,15 +564,14 @@ |
568 | 565 | } |
569 | 566 | |
570 | 567 | public function getHTML() { |
571 | | - global $wgLang; |
572 | 568 | $data = |
573 | 569 | wfMsg( |
574 | 570 | 'widthheight', |
575 | | - $wgLang->formatNum( $this->file->getWidth() ), |
576 | | - $wgLang->formatNum( $this->file->getHeight() ) |
| 571 | + $this->getLang()->formatNum( $this->file->getWidth() ), |
| 572 | + $this->getLang()->formatNum( $this->file->getHeight() ) |
577 | 573 | ) . |
578 | 574 | ' (' . |
579 | | - wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file->getSize() ) ) . |
| 575 | + wfMsgExt( 'nbytes', 'parsemag', $this->getLang()->formatNum( $this->file->getSize() ) ) . |
580 | 576 | ')'; |
581 | 577 | |
582 | 578 | return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' . |
— | — | @@ -641,19 +637,18 @@ |
642 | 638 | } |
643 | 639 | |
644 | 640 | protected function getLink() { |
645 | | - global $wgLang, $wgUser; |
646 | | - $date = $wgLang->timeanddate( $this->file->getTimestamp(), true ); |
| 641 | + $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true ); |
647 | 642 | $undelete = SpecialPage::getTitleFor( 'Undelete' ); |
648 | 643 | $key = $this->file->getKey(); |
649 | 644 | # Hidden files... |
650 | 645 | if( !$this->canViewContent() ) { |
651 | 646 | $link = $date; |
652 | 647 | } else { |
653 | | - $link = $this->special->skin->link( $undelete, $date, array(), |
| 648 | + $link = Linker::link( $undelete, $date, array(), |
654 | 649 | array( |
655 | 650 | 'target' => $this->list->title->getPrefixedText(), |
656 | 651 | 'file' => $key, |
657 | | - 'token' => $wgUser->editToken( $key ) |
| 652 | + 'token' => $this->getUser()->editToken( $key ) |
658 | 653 | ) |
659 | 654 | ); |
660 | 655 | } |
— | — | @@ -749,14 +744,12 @@ |
750 | 745 | } |
751 | 746 | |
752 | 747 | public function getHTML() { |
753 | | - global $wgLang; |
754 | | - |
755 | | - $date = htmlspecialchars( $wgLang->timeanddate( $this->row->log_timestamp ) ); |
| 748 | + $date = htmlspecialchars( $this->getLang()->timeanddate( $this->row->log_timestamp ) ); |
756 | 749 | $paramArray = LogPage::extractParams( $this->row->log_params ); |
757 | 750 | $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title ); |
758 | 751 | |
759 | 752 | // Log link for this page |
760 | | - $loglink = $this->special->skin->link( |
| 753 | + $loglink = Linker::link( |
761 | 754 | SpecialPage::getTitleFor( 'Log' ), |
762 | 755 | wfMsgHtml( 'log' ), |
763 | 756 | array(), |
— | — | @@ -767,18 +760,18 @@ |
768 | 761 | $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>'; |
769 | 762 | } else { |
770 | 763 | $action = LogPage::actionText( $this->row->log_type, $this->row->log_action, $title, |
771 | | - $this->special->skin, $paramArray, true, true ); |
| 764 | + $this->special->getSkin(), $paramArray, true, true ); |
772 | 765 | if( $this->row->log_deleted & LogPage::DELETED_ACTION ) |
773 | 766 | $action = '<span class="history-deleted">' . $action . '</span>'; |
774 | 767 | } |
775 | 768 | // User links |
776 | | - $userLink = $this->special->skin->userLink( $this->row->log_user, |
| 769 | + $userLink = Linker::userLink( $this->row->log_user, |
777 | 770 | User::WhoIs( $this->row->log_user ) ); |
778 | 771 | if( LogEventsList::isDeleted($this->row,LogPage::DELETED_USER) ) { |
779 | 772 | $userLink = '<span class="history-deleted">' . $userLink . '</span>'; |
780 | 773 | } |
781 | 774 | // Comment |
782 | | - $comment = $wgLang->getDirMark() . $this->special->skin->commentBlock( $this->row->log_comment ); |
| 775 | + $comment = $this->getLang()->getDirMark() . Linker::commentBlock( $this->row->log_comment ); |
783 | 776 | if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) { |
784 | 777 | $comment = '<span class="history-deleted">' . $comment . '</span>'; |
785 | 778 | } |
Index: trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php |
— | — | @@ -331,6 +331,24 @@ |
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
| 335 | + * Get the user doing the action |
| 336 | + * |
| 337 | + * @return User object |
| 338 | + */ |
| 339 | + public function getUser() { |
| 340 | + return $this->special->getUser(); |
| 341 | + } |
| 342 | + |
| 343 | + /** |
| 344 | + * Get the language of the user doing the action |
| 345 | + * |
| 346 | + * @return Language object |
| 347 | + */ |
| 348 | + public function getLang() { |
| 349 | + return $this->special->getLang(); |
| 350 | + } |
| 351 | + |
| 352 | + /** |
335 | 353 | * Create an item object from a DB result row |
336 | 354 | * @param $row stdclass |
337 | 355 | */ |
— | — | @@ -429,6 +447,24 @@ |
430 | 448 | } |
431 | 449 | |
432 | 450 | /** |
| 451 | + * Get the user doing the action |
| 452 | + * |
| 453 | + * @return User object |
| 454 | + */ |
| 455 | + public function getUser() { |
| 456 | + return $this->special->getUser(); |
| 457 | + } |
| 458 | + |
| 459 | + /** |
| 460 | + * Get the language of the user doing the action |
| 461 | + * |
| 462 | + * @return Language object |
| 463 | + */ |
| 464 | + public function getLang() { |
| 465 | + return $this->special->getLang(); |
| 466 | + } |
| 467 | + |
| 468 | + /** |
433 | 469 | * Returns true if the current user can view the item |
434 | 470 | */ |
435 | 471 | abstract public function canView(); |
Index: trunk/phase3/includes/actions/RevisiondeleteAction.php |
— | — | @@ -0,0 +1,53 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * An action that just pass the request to Special:RevisionDelete |
| 5 | + * |
| 6 | + * Copyright © 2011 Alexandre Emsenhuber |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + * @author Alexandre Emsenhuber |
| 25 | + */ |
| 26 | + |
| 27 | +class RevisiondeleteAction extends FormlessAction { |
| 28 | + |
| 29 | + public function getName() { |
| 30 | + return 'revisiondelete'; |
| 31 | + } |
| 32 | + |
| 33 | + public function getRestriction() { |
| 34 | + return null; |
| 35 | + } |
| 36 | + |
| 37 | + public function requiresUnblock() { |
| 38 | + return false; |
| 39 | + } |
| 40 | + |
| 41 | + public function getDescription() { |
| 42 | + return ''; |
| 43 | + } |
| 44 | + |
| 45 | + public function onView() { |
| 46 | + return ''; |
| 47 | + } |
| 48 | + |
| 49 | + public function show() { |
| 50 | + $special = SpecialPageFactory::getPage( 'Revisiondelete' ); |
| 51 | + $special->setContext( $this->getContext() ); |
| 52 | + $special->execute( '' ); |
| 53 | + } |
| 54 | +} |
Property changes on: trunk/phase3/includes/actions/RevisiondeleteAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 55 | + native |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -250,6 +250,7 @@ |
251 | 251 | # includes/actions |
252 | 252 | 'CreditsAction' => 'includes/actions/CreditsAction.php', |
253 | 253 | 'PurgeAction' => 'includes/actions/PurgeAction.php', |
| 254 | + 'RevisiondeleteAction' => 'includes/actions/RevisiondeleteAction.php', |
254 | 255 | 'UnwatchAction' => 'includes/actions/WatchAction.php', |
255 | 256 | 'WatchAction' => 'includes/actions/WatchAction.php', |
256 | 257 | |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -465,11 +465,6 @@ |
466 | 466 | $history = new HistoryPage( $article ); |
467 | 467 | $history->history(); |
468 | 468 | break; |
469 | | - case 'revisiondelete': |
470 | | - // For show/hide submission from history page |
471 | | - $special = SpecialPageFactory::getPage( 'Revisiondelete' ); |
472 | | - $special->execute( '' ); |
473 | | - break; |
474 | 469 | default: |
475 | 470 | if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) { |
476 | 471 | $this->context->output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -5030,6 +5030,7 @@ |
5031 | 5031 | */ |
5032 | 5032 | $wgActions = array( |
5033 | 5033 | 'credits' => true, |
| 5034 | + 'revisiondelete' => true, |
5034 | 5035 | 'purge' => true, |
5035 | 5036 | 'unwatch' => true, |
5036 | 5037 | 'watch' => true, |
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php |
— | — | @@ -28,9 +28,6 @@ |
29 | 29 | * @ingroup SpecialPage |
30 | 30 | */ |
31 | 31 | class SpecialRevisionDelete extends UnlistedSpecialPage { |
32 | | - /** Skin object */ |
33 | | - var $skin; |
34 | | - |
35 | 32 | /** True if the submit button was clicked, and the form was posted */ |
36 | 33 | var $submitClicked; |
37 | 34 | |
— | — | @@ -114,43 +111,46 @@ |
115 | 112 | } |
116 | 113 | |
117 | 114 | public function execute( $par ) { |
118 | | - global $wgOut, $wgUser, $wgRequest; |
119 | | - if( !$wgUser->isAllowed( 'deletedhistory' ) ) { |
120 | | - $wgOut->permissionRequired( 'deletedhistory' ); |
| 115 | + $output = $this->getOutput(); |
| 116 | + $user = $this->getUser(); |
| 117 | + if( !$user->isAllowed( 'deletedhistory' ) ) { |
| 118 | + $output->permissionRequired( 'deletedhistory' ); |
121 | 119 | return; |
122 | 120 | } else if( wfReadOnly() ) { |
123 | | - $wgOut->readOnlyPage(); |
| 121 | + $output->readOnlyPage(); |
124 | 122 | return; |
125 | 123 | } |
126 | | - $this->mIsAllowed = $wgUser->isAllowed('deleterevision'); // for changes |
127 | | - $this->skin = $wgUser->getSkin(); |
| 124 | + $this->mIsAllowed = $user->isAllowed('deleterevision'); // for changes |
128 | 125 | $this->setHeaders(); |
129 | 126 | $this->outputHeader(); |
130 | | - $this->submitClicked = $wgRequest->wasPosted() && $wgRequest->getBool( 'wpSubmit' ); |
| 127 | + $request = $this->getRequest(); |
| 128 | + $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' ); |
131 | 129 | # Handle our many different possible input types. |
132 | | - $ids = $wgRequest->getVal( 'ids' ); |
| 130 | + $ids = $request->getVal( 'ids' ); |
133 | 131 | if ( !is_null( $ids ) ) { |
134 | 132 | # Allow CSV, for backwards compatibility, or a single ID for show/hide links |
135 | 133 | $this->ids = explode( ',', $ids ); |
136 | 134 | } else { |
137 | 135 | # Array input |
138 | | - $this->ids = array_keys( $wgRequest->getArray('ids',array()) ); |
| 136 | + $this->ids = array_keys( $request->getArray('ids',array()) ); |
139 | 137 | } |
140 | 138 | // $this->ids = array_map( 'intval', $this->ids ); |
141 | 139 | $this->ids = array_unique( array_filter( $this->ids ) ); |
142 | 140 | |
143 | | - if ( $wgRequest->getVal( 'action' ) == 'historysubmit' ) { |
144 | | - # For show/hide form submission from history page |
145 | | - $this->targetObj = $GLOBALS['wgTitle']; |
| 141 | + if ( $request->getVal( 'action' ) == 'historysubmit' ) { |
| 142 | + // For show/hide form submission from history page |
| 143 | + // Since we are access through index.php?title=XXX&action=historysubmit |
| 144 | + // getFullTitle() will contain the target title and not our title |
| 145 | + $this->targetObj = $this->getFullTitle(); |
146 | 146 | $this->typeName = 'revision'; |
147 | 147 | } else { |
148 | | - $this->typeName = $wgRequest->getVal( 'type' ); |
149 | | - $this->targetObj = Title::newFromText( $wgRequest->getText( 'target' ) ); |
| 148 | + $this->typeName = $request->getVal( 'type' ); |
| 149 | + $this->targetObj = Title::newFromText( $request->getText( 'target' ) ); |
150 | 150 | } |
151 | 151 | |
152 | 152 | # For reviewing deleted files... |
153 | | - $this->archiveName = $wgRequest->getVal( 'file' ); |
154 | | - $this->token = $wgRequest->getVal( 'token' ); |
| 153 | + $this->archiveName = $request->getVal( 'file' ); |
| 154 | + $this->token = $request->getVal( 'token' ); |
155 | 155 | if ( $this->archiveName && $this->targetObj ) { |
156 | 156 | $this->tryShowFile( $this->archiveName ); |
157 | 157 | return; |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | |
164 | 164 | # No targets? |
165 | 165 | if( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) { |
166 | | - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
| 166 | + $output->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
167 | 167 | return; |
168 | 168 | } |
169 | 169 | $this->typeInfo = self::$allowedTypes[$this->typeName]; |
— | — | @@ -175,10 +175,10 @@ |
176 | 176 | $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj; |
177 | 177 | } |
178 | 178 | |
179 | | - $this->otherReason = $wgRequest->getVal( 'wpReason' ); |
| 179 | + $this->otherReason = $request->getVal( 'wpReason' ); |
180 | 180 | # We need a target page! |
181 | 181 | if( is_null($this->targetObj) ) { |
182 | | - $wgOut->addWikiMsg( 'undelete-header' ); |
| 182 | + $output->addWikiMsg( 'undelete-header' ); |
183 | 183 | return; |
184 | 184 | } |
185 | 185 | # Give a link to the logs/hist for this page |
— | — | @@ -190,27 +190,27 @@ |
191 | 191 | array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ), |
192 | 192 | array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ) |
193 | 193 | ); |
194 | | - if( $wgUser->isAllowed('suppressrevision') ) { |
| 194 | + if( $user->isAllowed('suppressrevision') ) { |
195 | 195 | $this->checks[] = array( 'revdelete-hide-restricted', |
196 | 196 | 'wpHideRestricted', Revision::DELETED_RESTRICTED ); |
197 | 197 | } |
198 | 198 | |
199 | 199 | # Either submit or create our form |
200 | 200 | if( $this->mIsAllowed && $this->submitClicked ) { |
201 | | - $this->submit( $wgRequest ); |
| 201 | + $this->submit( $request ); |
202 | 202 | } else { |
203 | 203 | $this->showForm(); |
204 | 204 | } |
205 | 205 | |
206 | 206 | $qc = $this->getLogQueryCond(); |
207 | 207 | # Show relevant lines from the deletion log |
208 | | - $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
209 | | - LogEventsList::showLogExtract( $wgOut, 'delete', |
| 208 | + $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
| 209 | + LogEventsList::showLogExtract( $output, 'delete', |
210 | 210 | $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); |
211 | 211 | # Show relevant lines from the suppression log |
212 | | - if( $wgUser->isAllowed( 'suppressionlog' ) ) { |
213 | | - $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); |
214 | | - LogEventsList::showLogExtract( $wgOut, 'suppress', |
| 212 | + if( $user->isAllowed( 'suppressionlog' ) ) { |
| 213 | + $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); |
| 214 | + LogEventsList::showLogExtract( $output, 'suppress', |
215 | 215 | $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); |
216 | 216 | } |
217 | 217 | } |
— | — | @@ -219,11 +219,10 @@ |
220 | 220 | * Show some useful links in the subtitle |
221 | 221 | */ |
222 | 222 | protected function showConvenienceLinks() { |
223 | | - global $wgOut, $wgUser, $wgLang; |
224 | 223 | # Give a link to the logs/hist for this page |
225 | 224 | if( $this->targetObj ) { |
226 | 225 | $links = array(); |
227 | | - $links[] = $this->skin->linkKnown( |
| 226 | + $links[] = Linker::linkKnown( |
228 | 227 | SpecialPage::getTitleFor( 'Log' ), |
229 | 228 | wfMsgHtml( 'viewpagelogs' ), |
230 | 229 | array(), |
— | — | @@ -231,16 +230,16 @@ |
232 | 231 | ); |
233 | 232 | if ( $this->targetObj->getNamespace() != NS_SPECIAL ) { |
234 | 233 | # Give a link to the page history |
235 | | - $links[] = $this->skin->linkKnown( |
| 234 | + $links[] = Linker::linkKnown( |
236 | 235 | $this->targetObj, |
237 | 236 | wfMsgHtml( 'pagehist' ), |
238 | 237 | array(), |
239 | 238 | array( 'action' => 'history' ) |
240 | 239 | ); |
241 | 240 | # Link to deleted edits |
242 | | - if( $wgUser->isAllowed('undelete') ) { |
| 241 | + if( $this->getUser()->isAllowed('undelete') ) { |
243 | 242 | $undelete = SpecialPage::getTitleFor( 'Undelete' ); |
244 | | - $links[] = $this->skin->linkKnown( |
| 243 | + $links[] = Linker::linkKnown( |
245 | 244 | $undelete, |
246 | 245 | wfMsgHtml( 'deletedhist' ), |
247 | 246 | array(), |
— | — | @@ -249,7 +248,7 @@ |
250 | 249 | } |
251 | 250 | } |
252 | 251 | # Logs themselves don't have histories or archived revisions |
253 | | - $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links ) . '</p>' ); |
| 252 | + $this->getOutput()->setSubtitle( '<p>' . $this->getLang()->pipeList( $links ) . '</p>' ); |
254 | 253 | } |
255 | 254 | } |
256 | 255 | |
— | — | @@ -271,36 +270,34 @@ |
272 | 271 | * TODO Mostly copied from Special:Undelete. Refactor. |
273 | 272 | */ |
274 | 273 | protected function tryShowFile( $archiveName ) { |
275 | | - global $wgOut, $wgRequest, $wgUser, $wgLang; |
276 | | - |
277 | 274 | $repo = RepoGroup::singleton()->getLocalRepo(); |
278 | 275 | $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName ); |
279 | 276 | $oimage->load(); |
280 | 277 | // Check if user is allowed to see this file |
281 | 278 | if ( !$oimage->exists() ) { |
282 | | - $wgOut->addWikiMsg( 'revdelete-no-file' ); |
| 279 | + $this->getOutput()->addWikiMsg( 'revdelete-no-file' ); |
283 | 280 | return; |
284 | 281 | } |
285 | 282 | if( !$oimage->userCan(File::DELETED_FILE) ) { |
286 | 283 | if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) { |
287 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
| 284 | + $this->getOutput()->permissionRequired( 'suppressrevision' ); |
288 | 285 | } else { |
289 | | - $wgOut->permissionRequired( 'deletedtext' ); |
| 286 | + $this->getOutput()->permissionRequired( 'deletedtext' ); |
290 | 287 | } |
291 | 288 | return; |
292 | 289 | } |
293 | | - if ( !$wgUser->matchEditToken( $this->token, $archiveName ) ) { |
294 | | - $wgOut->addWikiMsg( 'revdelete-show-file-confirm', |
| 290 | + if ( !$this->getUser()->matchEditToken( $this->token, $archiveName ) ) { |
| 291 | + $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm', |
295 | 292 | $this->targetObj->getText(), |
296 | | - $wgLang->date( $oimage->getTimestamp() ), |
297 | | - $wgLang->time( $oimage->getTimestamp() ) ); |
298 | | - $wgOut->addHTML( |
| 293 | + $this->getLang()->date( $oimage->getTimestamp() ), |
| 294 | + $this->getLang()->time( $oimage->getTimestamp() ) ); |
| 295 | + $this->getOutput()->addHTML( |
299 | 296 | Xml::openElement( 'form', array( |
300 | 297 | 'method' => 'POST', |
301 | 298 | 'action' => $this->getTitle()->getLocalUrl( |
302 | 299 | 'target=' . urlencode( $oimage->getName() ) . |
303 | 300 | '&file=' . urlencode( $archiveName ) . |
304 | | - '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) ) |
| 301 | + '&token=' . urlencode( $this->getUser()->editToken( $archiveName ) ) ) |
305 | 302 | ) |
306 | 303 | ) . |
307 | 304 | Xml::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) . |
— | — | @@ -308,14 +305,14 @@ |
309 | 306 | ); |
310 | 307 | return; |
311 | 308 | } |
312 | | - $wgOut->disable(); |
| 309 | + $this->getOutput()->disable(); |
313 | 310 | # We mustn't allow the output to be Squid cached, otherwise |
314 | 311 | # if an admin previews a deleted image, and it's cached, then |
315 | 312 | # a user without appropriate permissions can toddle off and |
316 | 313 | # nab the image, and Squid will serve it |
317 | | - $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); |
318 | | - $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); |
319 | | - $wgRequest->response()->header( 'Pragma: no-cache' ); |
| 314 | + $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); |
| 315 | + $this->getRequest()->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); |
| 316 | + $this->getRequest()->response()->header( 'Pragma: no-cache' ); |
320 | 317 | |
321 | 318 | # Stream the file to the client |
322 | 319 | global $IP; |
— | — | @@ -341,17 +338,16 @@ |
342 | 339 | * which will allow the user to choose new visibility settings. |
343 | 340 | */ |
344 | 341 | protected function showForm() { |
345 | | - global $wgOut, $wgUser, $wgLang; |
346 | 342 | $UserAllowed = true; |
347 | 343 | |
348 | 344 | if ( $this->typeName == 'logging' ) { |
349 | | - $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids) ) ); |
| 345 | + $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLang()->formatNum( count($this->ids) ) ); |
350 | 346 | } else { |
351 | | - $wgOut->addWikiMsg( 'revdelete-selected', |
| 347 | + $this->getOutput()->addWikiMsg( 'revdelete-selected', |
352 | 348 | $this->targetObj->getPrefixedText(), count( $this->ids ) ); |
353 | 349 | } |
354 | 350 | |
355 | | - $wgOut->addHTML( "<ul>" ); |
| 351 | + $this->getOutput()->addHTML( "<ul>" ); |
356 | 352 | |
357 | 353 | $numRevisions = 0; |
358 | 354 | // Live revisions... |
— | — | @@ -360,21 +356,21 @@ |
361 | 357 | $item = $list->current(); |
362 | 358 | if ( !$item->canView() ) { |
363 | 359 | if( !$this->submitClicked ) { |
364 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
| 360 | + $this->getOutput()->permissionRequired( 'suppressrevision' ); |
365 | 361 | return; |
366 | 362 | } |
367 | 363 | $UserAllowed = false; |
368 | 364 | } |
369 | 365 | $numRevisions++; |
370 | | - $wgOut->addHTML( $item->getHTML() ); |
| 366 | + $this->getOutput()->addHTML( $item->getHTML() ); |
371 | 367 | } |
372 | 368 | |
373 | 369 | if( !$numRevisions ) { |
374 | | - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
| 370 | + $this->getOutput()->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
375 | 371 | return; |
376 | 372 | } |
377 | 373 | |
378 | | - $wgOut->addHTML( "</ul>" ); |
| 374 | + $this->getOutput()->addHTML( "</ul>" ); |
379 | 375 | // Explanation text |
380 | 376 | $this->addUsageText(); |
381 | 377 | |
— | — | @@ -414,7 +410,7 @@ |
415 | 411 | '</td>' . |
416 | 412 | "</tr>\n" . |
417 | 413 | Xml::closeElement( 'table' ) . |
418 | | - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
| 414 | + Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . |
419 | 415 | Html::hidden( 'target', $this->targetObj->getPrefixedText() ) . |
420 | 416 | Html::hidden( 'type', $this->typeName ) . |
421 | 417 | Html::hidden( 'ids', implode( ',', $this->ids ) ) . |
— | — | @@ -425,9 +421,9 @@ |
426 | 422 | if( $this->mIsAllowed ) { |
427 | 423 | $out .= Xml::closeElement( 'form' ) . "\n"; |
428 | 424 | // Show link to edit the dropdown reasons |
429 | | - if( $wgUser->isAllowed( 'editinterface' ) ) { |
| 425 | + if( $this->getUser()->isAllowed( 'editinterface' ) ) { |
430 | 426 | $title = Title::makeTitle( NS_MEDIAWIKI, 'revdelete-reason-dropdown' ); |
431 | | - $link = $wgUser->getSkin()->link( |
| 427 | + $link = Linker::link( |
432 | 428 | $title, |
433 | 429 | wfMsgHtml( 'revdelete-edit-reasonlist' ), |
434 | 430 | array(), |
— | — | @@ -436,7 +432,7 @@ |
437 | 433 | $out .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n"; |
438 | 434 | } |
439 | 435 | } |
440 | | - $wgOut->addHTML( $out ); |
| 436 | + $this->getOutput()->addHTML( $out ); |
441 | 437 | } |
442 | 438 | |
443 | 439 | /** |
— | — | @@ -444,13 +440,12 @@ |
445 | 441 | * @todo FIXME: Wikimedia-specific policy text |
446 | 442 | */ |
447 | 443 | protected function addUsageText() { |
448 | | - global $wgOut, $wgUser; |
449 | | - $wgOut->addWikiMsg( 'revdelete-text' ); |
450 | | - if( $wgUser->isAllowed( 'suppressrevision' ) ) { |
451 | | - $wgOut->addWikiMsg( 'revdelete-suppress-text' ); |
| 444 | + $this->getOutput()->addWikiMsg( 'revdelete-text' ); |
| 445 | + if( $this->getUser()->isAllowed( 'suppressrevision' ) ) { |
| 446 | + $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' ); |
452 | 447 | } |
453 | 448 | if( $this->mIsAllowed ) { |
454 | | - $wgOut->addWikiMsg( 'revdelete-confirm' ); |
| 449 | + $this->getOutput()->addWikiMsg( 'revdelete-confirm' ); |
455 | 450 | } |
456 | 451 | } |
457 | 452 | |
— | — | @@ -458,8 +453,6 @@ |
459 | 454 | * @return String: HTML |
460 | 455 | */ |
461 | 456 | protected function buildCheckBoxes() { |
462 | | - global $wgRequest; |
463 | | - |
464 | 457 | $html = '<table>'; |
465 | 458 | // If there is just one item, use checkboxes |
466 | 459 | $list = $this->getList(); |
— | — | @@ -467,7 +460,7 @@ |
468 | 461 | $list->reset(); |
469 | 462 | $bitfield = $list->current()->getBits(); // existing field |
470 | 463 | if( $this->submitClicked ) { |
471 | | - $bitfield = $this->extractBitfield( $this->extractBitParams($wgRequest), $bitfield ); |
| 464 | + $bitfield = $this->extractBitfield( $this->extractBitParams(), $bitfield ); |
472 | 465 | } |
473 | 466 | foreach( $this->checks as $item ) { |
474 | 467 | list( $message, $name, $field ) = $item; |
— | — | @@ -488,7 +481,7 @@ |
489 | 482 | list( $message, $name, $field ) = $item; |
490 | 483 | // If there are several items, use third state by default... |
491 | 484 | if( $this->submitClicked ) { |
492 | | - $selected = $wgRequest->getInt( $name, 0 /* unchecked */ ); |
| 485 | + $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); |
493 | 486 | } else { |
494 | 487 | $selected = -1; // use existing field |
495 | 488 | } |
— | — | @@ -510,17 +503,15 @@ |
511 | 504 | |
512 | 505 | /** |
513 | 506 | * UI entry point for form submission. |
514 | | - * @param $request WebRequest |
515 | 507 | */ |
516 | | - protected function submit( $request ) { |
517 | | - global $wgUser, $wgOut; |
| 508 | + protected function submit() { |
518 | 509 | # Check edit token on submission |
519 | | - if( $this->submitClicked && !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) { |
520 | | - $wgOut->addWikiMsg( 'sessionfailure' ); |
| 510 | + if( $this->submitClicked && !$this->getUser()->matchEditToken( $this->getRequest()->getVal('wpEditToken') ) ) { |
| 511 | + $this->getOutput()->addWikiMsg( 'sessionfailure' ); |
521 | 512 | return false; |
522 | 513 | } |
523 | | - $bitParams = $this->extractBitParams( $request ); |
524 | | - $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown |
| 514 | + $bitParams = $this->extractBitParams(); |
| 515 | + $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown |
525 | 516 | $comment = $listReason; |
526 | 517 | if( $comment != 'other' && $this->otherReason != '' ) { |
527 | 518 | // Entry from drop down menu + additional comment |
— | — | @@ -529,8 +520,8 @@ |
530 | 521 | $comment = $this->otherReason; |
531 | 522 | } |
532 | 523 | # Can the user set this field? |
533 | | - if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$wgUser->isAllowed('suppressrevision') ) { |
534 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
| 524 | + if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$this->getUser()->isAllowed('suppressrevision') ) { |
| 525 | + $this->getOutput()->permissionRequired( 'suppressrevision' ); |
535 | 526 | return false; |
536 | 527 | } |
537 | 528 | # If the save went through, go to success message... |
— | — | @@ -549,9 +540,8 @@ |
550 | 541 | * Report that the submit operation succeeded |
551 | 542 | */ |
552 | 543 | protected function success() { |
553 | | - global $wgOut; |
554 | | - $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); |
555 | | - $wgOut->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] ); |
| 544 | + $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) ); |
| 545 | + $this->getOutput()->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] ); |
556 | 546 | $this->list->reloadFromMaster(); |
557 | 547 | $this->showForm(); |
558 | 548 | } |
— | — | @@ -560,22 +550,21 @@ |
561 | 551 | * Report that the submit operation failed |
562 | 552 | */ |
563 | 553 | protected function failure( $status ) { |
564 | | - global $wgOut; |
565 | | - $wgOut->setPagetitle( wfMsg( 'actionfailed' ) ); |
566 | | - $wgOut->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) ); |
| 554 | + $this->getOutput()->setPagetitle( wfMsg( 'actionfailed' ) ); |
| 555 | + $this->getOutput()->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) ); |
567 | 556 | $this->showForm(); |
568 | 557 | } |
569 | 558 | |
570 | 559 | /** |
571 | 560 | * Put together an array that contains -1, 0, or the *_deleted const for each bit |
572 | | - * @param $request WebRequest |
| 561 | + * |
573 | 562 | * @return array |
574 | 563 | */ |
575 | | - protected function extractBitParams( $request ) { |
| 564 | + protected function extractBitParams() { |
576 | 565 | $bitfield = array(); |
577 | 566 | foreach( $this->checks as $item ) { |
578 | 567 | list( /* message */ , $name, $field ) = $item; |
579 | | - $val = $request->getInt( $name, 0 /* unchecked */ ); |
| 568 | + $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); |
580 | 569 | if( $val < -1 || $val > 1) { |
581 | 570 | $val = -1; // -1 for existing value |
582 | 571 | } |