Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -213,6 +213,10 @@ |
214 | 214 | return $this->out->getTitle(); |
215 | 215 | } |
216 | 216 | |
| 217 | + public function getContext() { |
| 218 | + return $this->out->getContext(); |
| 219 | + } |
| 220 | + |
217 | 221 | /** |
218 | 222 | * @param $queryTypes Array |
219 | 223 | * @return String: Formatted HTML |
— | — | @@ -630,7 +634,6 @@ |
631 | 635 | public static function showLogExtract( |
632 | 636 | &$out, $types=array(), $page='', $user='', $param = array() |
633 | 637 | ) { |
634 | | - global $wgUser, $wgOut; |
635 | 638 | $defaultParameters = array( |
636 | 639 | 'lim' => 25, |
637 | 640 | 'conds' => array(), |
— | — | @@ -652,8 +655,15 @@ |
653 | 656 | if ( !is_array( $msgKey ) ) { |
654 | 657 | $msgKey = array( $msgKey ); |
655 | 658 | } |
| 659 | + |
| 660 | + if ( $out instanceof OutputPage ) { |
| 661 | + $context = $out->getContext(); |
| 662 | + } else { |
| 663 | + $context = RequestContext::getMain(); |
| 664 | + } |
| 665 | + |
656 | 666 | # Insert list of top 50 (or top $lim) items |
657 | | - $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, $flags ); |
| 667 | + $loglist = new LogEventsList( $context->getSkin(), $context->getOutput(), $flags ); |
658 | 668 | $pager = new LogPager( $loglist, $types, $user, $page, '', $conds ); |
659 | 669 | if ( isset( $param['offset'] ) ) { # Tell pager to ignore $wgRequest offset |
660 | 670 | $pager->setOffset( $param['offset'] ); |
— | — | @@ -769,7 +779,7 @@ |
770 | 780 | * @ingroup Pager |
771 | 781 | */ |
772 | 782 | class LogPager extends ReverseChronologicalPager { |
773 | | - private $types = array(), $user = '', $title = '', $pattern = ''; |
| 783 | + private $types = array(), $author = '', $title = '', $pattern = ''; |
774 | 784 | private $typeCGI = ''; |
775 | 785 | public $mLogEventsList; |
776 | 786 | |
— | — | @@ -778,7 +788,7 @@ |
779 | 789 | * |
780 | 790 | * @param $list LogEventsList |
781 | 791 | * @param $types String or Array: log types to show |
782 | | - * @param $user String: the user who made the log entries |
| 792 | + * @param $author String: the user who made the log entries |
783 | 793 | * @param $title String: the page title the log entries are for |
784 | 794 | * @param $pattern String: do a prefix search rather than an exact title match |
785 | 795 | * @param $conds Array: extra conditions for the query |
— | — | @@ -786,15 +796,15 @@ |
787 | 797 | * @param $month Integer: the month to start from |
788 | 798 | * @param $tagFilter String: tag |
789 | 799 | */ |
790 | | - public function __construct( $list, $types = array(), $user = '', $title = '', $pattern = '', |
| 800 | + public function __construct( $list, $types = array(), $author = '', $title = '', $pattern = '', |
791 | 801 | $conds = array(), $year = false, $month = false, $tagFilter = '' ) { |
792 | | - parent::__construct(); |
| 802 | + parent::__construct( $list->getContext() ); |
793 | 803 | $this->mConds = $conds; |
794 | 804 | |
795 | 805 | $this->mLogEventsList = $list; |
796 | 806 | |
797 | 807 | $this->limitType( $types ); // also excludes hidden types |
798 | | - $this->limitUser( $user ); |
| 808 | + $this->limitAuthor( $author ); |
799 | 809 | $this->limitTitle( $title, $pattern ); |
800 | 810 | $this->getDateCond( $year, $month ); |
801 | 811 | $this->mTagFilter = $tagFilter; |
— | — | @@ -803,19 +813,12 @@ |
804 | 814 | public function getDefaultQuery() { |
805 | 815 | $query = parent::getDefaultQuery(); |
806 | 816 | $query['type'] = $this->typeCGI; // arrays won't work here |
807 | | - $query['user'] = $this->user; |
| 817 | + $query['user'] = $this->author; |
808 | 818 | $query['month'] = $this->mMonth; |
809 | 819 | $query['year'] = $this->mYear; |
810 | 820 | return $query; |
811 | 821 | } |
812 | 822 | |
813 | | - /** |
814 | | - * @return Title |
815 | | - */ |
816 | | - function getTitle() { |
817 | | - return $this->mLogEventsList->getDisplayTitle(); |
818 | | - } |
819 | | - |
820 | 823 | // Call ONLY after calling $this->limitType() already! |
821 | 824 | public function getFilterParams() { |
822 | 825 | global $wgFilterLogTypes, $wgUser, $wgRequest; |
— | — | @@ -874,7 +877,7 @@ |
875 | 878 | * |
876 | 879 | * @param $name String: (In)valid user name |
877 | 880 | */ |
878 | | - private function limitUser( $name ) { |
| 881 | + private function limitAuthor( $name ) { |
879 | 882 | if( $name == '' ) { |
880 | 883 | return false; |
881 | 884 | } |
— | — | @@ -898,7 +901,7 @@ |
899 | 902 | $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) . |
900 | 903 | ' != ' . LogPage::SUPPRESSED_USER; |
901 | 904 | } |
902 | | - $this->user = $usertitle->getText(); |
| 905 | + $this->author = $usertitle->getText(); |
903 | 906 | } |
904 | 907 | } |
905 | 908 | |
— | — | @@ -982,7 +985,7 @@ |
983 | 986 | # Avoid usage of the wrong index by limiting |
984 | 987 | # the choices of available indexes. This mainly |
985 | 988 | # avoids site-breaking filesorts. |
986 | | - } elseif( $this->title || $this->pattern || $this->user ) { |
| 989 | + } elseif( $this->title || $this->pattern || $this->author ) { |
987 | 990 | $index['logging'] = array( 'page_time', 'user_time' ); |
988 | 991 | if( count($this->types) == 1 ) { |
989 | 992 | $index['logging'][] = 'log_user_type_time'; |
— | — | @@ -1053,8 +1056,8 @@ |
1054 | 1057 | /** |
1055 | 1058 | * @return string |
1056 | 1059 | */ |
1057 | | - public function getUser() { |
1058 | | - return $this->user; |
| 1060 | + public function getAuthor() { |
| 1061 | + return $this->author; |
1059 | 1062 | } |
1060 | 1063 | |
1061 | 1064 | /** |
Index: trunk/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -103,14 +103,14 @@ |
104 | 104 | public $custom; |
105 | 105 | |
106 | 106 | function __construct( $page, $conds, $langObj = null ) { |
107 | | - parent::__construct(); |
| 107 | + parent::__construct( $page->getContext() ); |
108 | 108 | $this->mIndexField = 'am_title'; |
109 | 109 | $this->mPage = $page; |
110 | 110 | $this->mConds = $conds; |
111 | 111 | $this->mDefaultDirection = true; // always sort ascending |
112 | 112 | $this->mLimitsShown = array( 20, 50, 100, 250, 500, 5000 ); |
113 | 113 | |
114 | | - global $wgLang, $wgContLang, $wgRequest; |
| 114 | + global $wgContLang; |
115 | 115 | |
116 | 116 | $this->talk = htmlspecialchars( wfMsg( 'talkpagelinktext' ) ); |
117 | 117 | |
— | — | @@ -118,14 +118,16 @@ |
119 | 119 | $this->langcode = $this->lang->getCode(); |
120 | 120 | $this->foreign = $this->langcode != $wgContLang->getCode(); |
121 | 121 | |
122 | | - if( $wgRequest->getVal( 'filter', 'all' ) === 'all' ){ |
| 122 | + $request = $this->getRequest(); |
| 123 | + |
| 124 | + if( $request->getVal( 'filter', 'all' ) === 'all' ){ |
123 | 125 | $this->custom = null; // So won't match in either case |
124 | 126 | } else { |
125 | | - $this->custom = ($wgRequest->getVal( 'filter' ) == 'unmodified'); |
| 127 | + $this->custom = ($request->getVal( 'filter' ) == 'unmodified'); |
126 | 128 | } |
127 | 129 | |
128 | | - $prefix = $wgLang->ucfirst( $wgRequest->getVal( 'prefix', '' ) ); |
129 | | - $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $wgRequest->getVal( 'prefix', null ) ) : null; |
| 130 | + $prefix = $this->getLang()->ucfirst( $request->getVal( 'prefix', '' ) ); |
| 131 | + $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $request->getVal( 'prefix', null ) ) : null; |
130 | 132 | if( $prefix !== null ){ |
131 | 133 | $this->displayPrefix = $prefix->getDBkey(); |
132 | 134 | $this->prefix = '/^' . preg_quote( $this->displayPrefix ) . '/i'; |
— | — | @@ -337,7 +339,6 @@ |
338 | 340 | } |
339 | 341 | |
340 | 342 | function formatValue( $field, $value ){ |
341 | | - global $wgLang; |
342 | 343 | switch( $field ){ |
343 | 344 | |
344 | 345 | case 'am_title' : |
— | — | @@ -346,11 +347,11 @@ |
347 | 348 | $talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix ); |
348 | 349 | |
349 | 350 | if( $this->mCurrentRow->am_customised ){ |
350 | | - $title = Linker::linkKnown( $title, $wgLang->lcfirst( $value ) ); |
| 351 | + $title = Linker::linkKnown( $title, $this->getLang()->lcfirst( $value ) ); |
351 | 352 | } else { |
352 | 353 | $title = Linker::link( |
353 | 354 | $title, |
354 | | - $wgLang->lcfirst( $value ), |
| 355 | + $this->getLang()->lcfirst( $value ), |
355 | 356 | array(), |
356 | 357 | array(), |
357 | 358 | array( 'broken' ) |
— | — | @@ -395,12 +396,11 @@ |
396 | 397 | |
397 | 398 | function getRowAttrs( $row, $isSecond = false ){ |
398 | 399 | $arr = array(); |
399 | | - global $wgLang; |
400 | 400 | if( $row->am_customised ){ |
401 | 401 | $arr['class'] = 'allmessages-customised'; |
402 | 402 | } |
403 | 403 | if( !$isSecond ){ |
404 | | - $arr['id'] = Sanitizer::escapeId( 'msg_' . $wgLang->lcfirst( $row->am_title ) ); |
| 404 | + $arr['id'] = Sanitizer::escapeId( 'msg_' . $this->getLang()->lcfirst( $row->am_title ) ); |
405 | 405 | } |
406 | 406 | return $arr; |
407 | 407 | } |
Index: trunk/phase3/includes/specials/SpecialNewpages.php |
— | — | @@ -194,7 +194,7 @@ |
195 | 195 | $self = $this->getTitle(); |
196 | 196 | foreach ( $filters as $key => $msg ) { |
197 | 197 | $onoff = 1 - $this->opts->getValue( $key ); |
198 | | - $link = $this->getSkin()->link( $self, $showhide[$onoff], array(), |
| 198 | + $link = Linker::link( $self, $showhide[$onoff], array(), |
199 | 199 | array( $key => $onoff ) + $changed |
200 | 200 | ); |
201 | 201 | $links[$key] = wfMsgHtml( $msg, $link ); |
— | — | @@ -315,14 +315,14 @@ |
316 | 316 | $query['rcid'] = $result->rc_id; |
317 | 317 | } |
318 | 318 | |
319 | | - $plink = $this->getSkin()->linkKnown( |
| 319 | + $plink = Linker::linkKnown( |
320 | 320 | $title, |
321 | 321 | null, |
322 | 322 | array( 'class' => 'mw-newpages-pagename' ), |
323 | 323 | $query, |
324 | 324 | array( 'known' ) // Set explicitly to avoid the default of 'known','noclasses'. This breaks the colouration for stubs |
325 | 325 | ); |
326 | | - $histLink = $this->getSkin()->linkKnown( |
| 326 | + $histLink = Linker::linkKnown( |
327 | 327 | $title, |
328 | 328 | wfMsgHtml( 'hist' ), |
329 | 329 | array(), |
— | — | @@ -335,8 +335,8 @@ |
336 | 336 | ']' |
337 | 337 | ); |
338 | 338 | |
339 | | - $ulink = $this->getSkin()->revUserTools( $rev ); |
340 | | - $comment = $this->getSkin()->revComment( $rev ); |
| 339 | + $ulink = Linker::revUserTools( $rev ); |
| 340 | + $comment = Linker::revComment( $rev ); |
341 | 341 | |
342 | 342 | if ( $this->patrollable( $result ) ) { |
343 | 343 | $classes[] = 'not-patrolled'; |
— | — | @@ -461,33 +461,11 @@ |
462 | 462 | protected $mForm; |
463 | 463 | |
464 | 464 | function __construct( $form, FormOptions $opts ) { |
465 | | - parent::__construct(); |
| 465 | + parent::__construct( $form->getContext() ); |
466 | 466 | $this->mForm = $form; |
467 | 467 | $this->opts = $opts; |
468 | 468 | } |
469 | 469 | |
470 | | - /** |
471 | | - * @return Title |
472 | | - */ |
473 | | - function getTitle() { |
474 | | - static $title = null; |
475 | | - if ( $title === null ) { |
476 | | - $title = $this->mForm->getTitle(); |
477 | | - } |
478 | | - return $title; |
479 | | - } |
480 | | - |
481 | | - /** |
482 | | - * @return User |
483 | | - */ |
484 | | - function getUser() { |
485 | | - static $user = null; |
486 | | - if ( $user === null ) { |
487 | | - $user = $this->mForm->getUser(); |
488 | | - } |
489 | | - return $user; |
490 | | - } |
491 | | - |
492 | 470 | function getQueryInfo() { |
493 | 471 | global $wgEnableNewpagesUserFilter, $wgGroupPermissions; |
494 | 472 | $conds = array(); |
Index: trunk/phase3/includes/specials/SpecialLog.php |
— | — | @@ -35,8 +35,6 @@ |
36 | 36 | } |
37 | 37 | |
38 | 38 | public function execute( $par ) { |
39 | | - global $wgRequest; |
40 | | - |
41 | 39 | $this->setHeaders(); |
42 | 40 | $this->outputHeader(); |
43 | 41 | |
— | — | @@ -53,7 +51,7 @@ |
54 | 52 | $opts->add( 'offender', '' ); |
55 | 53 | |
56 | 54 | // Set values |
57 | | - $opts->fetchValuesFromRequest( $wgRequest ); |
| 55 | + $opts->fetchValuesFromRequest( $this->getRequest() ); |
58 | 56 | if ( $par ) { |
59 | 57 | $this->parseParams( $opts, (string)$par ); |
60 | 58 | } |
— | — | @@ -99,10 +97,8 @@ |
100 | 98 | } |
101 | 99 | |
102 | 100 | private function show( FormOptions $opts, array $extraConds ) { |
103 | | - global $wgOut; |
104 | | - |
105 | 101 | # Create a LogPager item to get the results and a LogEventsList item to format them... |
106 | | - $loglist = new LogEventsList( $this->getSkin(), $wgOut, 0 ); |
| 102 | + $loglist = new LogEventsList( $this->getSkin(), $this->getOutput(), 0 ); |
107 | 103 | $pager = new LogPager( $loglist, $opts->getValue( 'type' ), $opts->getValue( 'user' ), |
108 | 104 | $opts->getValue( 'page' ), $opts->getValue( 'pattern' ), $extraConds, $opts->getValue( 'year' ), |
109 | 105 | $opts->getValue( 'month' ), $opts->getValue( 'tagfilter' ) ); |
— | — | @@ -110,18 +106,18 @@ |
111 | 107 | $this->addHeader( $opts->getValue( 'type' ) ); |
112 | 108 | |
113 | 109 | # Set relevant user |
114 | | - if ( $pager->getUser() ) { |
115 | | - $this->getSkin()->setRelevantUser( User::newFromName( $pager->getUser() ) ); |
| 110 | + if ( $pager->getAuthor() ) { |
| 111 | + $this->getSkin()->setRelevantUser( User::newFromName( $pager->getAuthor() ) ); |
116 | 112 | } |
117 | 113 | |
118 | 114 | # Show form options |
119 | | - $loglist->showOptions( $pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), |
| 115 | + $loglist->showOptions( $pager->getType(), $pager->getAuthor(), $pager->getPage(), $pager->getPattern(), |
120 | 116 | $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue( 'tagfilter' ) ); |
121 | 117 | |
122 | 118 | # Insert list |
123 | 119 | $logBody = $pager->getBody(); |
124 | 120 | if ( $logBody ) { |
125 | | - $wgOut->addHTML( |
| 121 | + $this->getOutput()->addHTML( |
126 | 122 | $pager->getNavigationBar() . |
127 | 123 | $loglist->beginLogEventsList() . |
128 | 124 | $logBody . |
— | — | @@ -129,7 +125,7 @@ |
130 | 126 | $pager->getNavigationBar() |
131 | 127 | ); |
132 | 128 | } else { |
133 | | - $wgOut->addWikiMsg( 'logempty' ); |
| 129 | + $this->getOutput()->addWikiMsg( 'logempty' ); |
134 | 130 | } |
135 | 131 | } |
136 | 132 | |
Index: trunk/phase3/includes/specials/SpecialCategories.php |
— | — | @@ -31,18 +31,16 @@ |
32 | 32 | } |
33 | 33 | |
34 | 34 | function execute( $par ) { |
35 | | - global $wgOut, $wgRequest; |
36 | | - |
37 | 35 | $this->setHeaders(); |
38 | 36 | $this->outputHeader(); |
39 | | - $wgOut->allowClickjacking(); |
| 37 | + $this->getOutput()->allowClickjacking(); |
40 | 38 | |
41 | | - $from = $wgRequest->getText( 'from', $par ); |
| 39 | + $from = $this->getRequest()->getText( 'from', $par ); |
42 | 40 | |
43 | | - $cap = new CategoryPager( $from ); |
| 41 | + $cap = new CategoryPager( $this->getContext(), $from ); |
44 | 42 | $cap->doQuery(); |
45 | 43 | |
46 | | - $wgOut->addHTML( |
| 44 | + $this->getOutput()->addHTML( |
47 | 45 | Html::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) . |
48 | 46 | wfMsgExt( 'categoriespagetext', array( 'parse' ), $cap->getNumRows() ) . |
49 | 47 | $cap->getStartForm( $from ) . |
— | — | @@ -61,8 +59,8 @@ |
62 | 60 | * @ingroup SpecialPage Pager |
63 | 61 | */ |
64 | 62 | class CategoryPager extends AlphabeticPager { |
65 | | - function __construct( $from ) { |
66 | | - parent::__construct(); |
| 63 | + function __construct( RequestContext $context, $from ) { |
| 64 | + parent::__construct( $context ); |
67 | 65 | $from = str_replace( ' ', '_', $from ); |
68 | 66 | if( $from !== '' ) { |
69 | 67 | $from = Title::capitalize( $from, NS_CATEGORY ); |
— | — | @@ -79,10 +77,6 @@ |
80 | 78 | ); |
81 | 79 | } |
82 | 80 | |
83 | | - function getTitle() { |
84 | | - return SpecialPage::getTitleFor( 'Categories' ); |
85 | | - } |
86 | | - |
87 | 81 | function getIndexField() { |
88 | 82 | # return array( 'abc' => 'cat_title', 'count' => 'cat_pages' ); |
89 | 83 | return 'cat_title'; |
— | — | @@ -118,11 +112,10 @@ |
119 | 113 | } |
120 | 114 | |
121 | 115 | function formatRow($result) { |
122 | | - global $wgLang; |
123 | 116 | $title = Title::makeTitle( NS_CATEGORY, $result->cat_title ); |
124 | 117 | $titleText = Linker::link( $title, htmlspecialchars( $title->getText() ) ); |
125 | 118 | $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ), |
126 | | - $wgLang->formatNum( $result->cat_pages ) ); |
| 119 | + $this->getLang()->formatNum( $result->cat_pages ) ); |
127 | 120 | return Xml::tags('li', null, wfSpecialList( $titleText, $count ) ) . "\n"; |
128 | 121 | } |
129 | 122 | |
Index: trunk/phase3/includes/specials/SpecialBlockList.php |
— | — | @@ -40,24 +40,24 @@ |
41 | 41 | * @param $par String title fragment |
42 | 42 | */ |
43 | 43 | public function execute( $par ) { |
44 | | - global $wgOut, $wgRequest; |
45 | | - |
46 | 44 | $this->setHeaders(); |
47 | 45 | $this->outputHeader(); |
48 | | - $wgOut->setPageTitle( wfMsg( 'ipblocklist' ) ); |
49 | | - $wgOut->addModuleStyles( 'mediawiki.special' ); |
| 46 | + $out = $this->getOutput(); |
| 47 | + $out->setPageTitle( wfMsg( 'ipblocklist' ) ); |
| 48 | + $out->addModuleStyles( 'mediawiki.special' ); |
50 | 49 | |
51 | | - $par = $wgRequest->getVal( 'ip', $par ); |
52 | | - $this->target = trim( $wgRequest->getVal( 'wpTarget', $par ) ); |
| 50 | + $request = $this->getRequest(); |
| 51 | + $par = $request->getVal( 'ip', $par ); |
| 52 | + $this->target = trim( $request->getVal( 'wpTarget', $par ) ); |
53 | 53 | |
54 | | - $this->options = $wgRequest->getArray( 'wpOptions', array() ); |
| 54 | + $this->options = $request->getArray( 'wpOptions', array() ); |
55 | 55 | |
56 | | - $action = $wgRequest->getText( 'action' ); |
| 56 | + $action = $request->getText( 'action' ); |
57 | 57 | |
58 | | - if( $action == 'unblock' || $action == 'submit' && $wgRequest->wasPosted() ) { |
| 58 | + if( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) { |
59 | 59 | # B/C @since 1.18: Unblock interface is now at Special:Unblock |
60 | 60 | $title = SpecialPage::getTitleFor( 'Unblock', $this->target ); |
61 | | - $wgOut->redirect( $title->getFullUrl() ); |
| 61 | + $out->redirect( $title->getFullUrl() ); |
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
— | — | @@ -91,8 +91,6 @@ |
92 | 92 | } |
93 | 93 | |
94 | 94 | function showList() { |
95 | | - global $wgOut, $wgUser; |
96 | | - |
97 | 95 | # Purge expired entries on one in every 10 queries |
98 | 96 | if ( !mt_rand( 0, 10 ) ) { |
99 | 97 | Block::purgeExpired(); |
— | — | @@ -100,7 +98,7 @@ |
101 | 99 | |
102 | 100 | $conds = array(); |
103 | 101 | # Is the user allowed to see hidden blocks? |
104 | | - if ( !$wgUser->isAllowed( 'hideuser' ) ){ |
| 102 | + if ( !$this->getUser()->isAllowed( 'hideuser' ) ){ |
105 | 103 | $conds['ipb_deleted'] = 0; |
106 | 104 | } |
107 | 105 | |
— | — | @@ -151,31 +149,33 @@ |
152 | 150 | $otherBlockLink = array(); |
153 | 151 | wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) ); |
154 | 152 | |
| 153 | + $out = $this->getOutput(); |
| 154 | + |
155 | 155 | # Show additional header for the local block only when other blocks exists. |
156 | 156 | # Not necessary in a standard installation without such extensions enabled |
157 | 157 | if( count( $otherBlockLink ) ) { |
158 | | - $wgOut->addHTML( |
| 158 | + $out->addHTML( |
159 | 159 | Html::rawElement( 'h2', array(), wfMsg( 'ipblocklist-localblock' ) ) . "\n" |
160 | 160 | ); |
161 | 161 | } |
162 | 162 | |
163 | 163 | $pager = new BlockListPager( $this, $conds ); |
164 | 164 | if ( $pager->getNumRows() ) { |
165 | | - $wgOut->addHTML( |
| 165 | + $out->addHTML( |
166 | 166 | $pager->getNavigationBar() . |
167 | 167 | $pager->getBody(). |
168 | 168 | $pager->getNavigationBar() |
169 | 169 | ); |
170 | 170 | |
171 | 171 | } elseif ( $this->target ) { |
172 | | - $wgOut->addWikiMsg( 'ipblocklist-no-results' ); |
| 172 | + $out->addWikiMsg( 'ipblocklist-no-results' ); |
173 | 173 | |
174 | 174 | } else { |
175 | | - $wgOut->addWikiMsg( 'ipblocklist-empty' ); |
| 175 | + $out->addWikiMsg( 'ipblocklist-empty' ); |
176 | 176 | } |
177 | 177 | |
178 | 178 | if( count( $otherBlockLink ) ) { |
179 | | - $wgOut->addHTML( |
| 179 | + $out->addHTML( |
180 | 180 | Html::rawElement( |
181 | 181 | 'h2', |
182 | 182 | array(), |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | foreach( $otherBlockLink as $link ) { |
192 | 192 | $list .= Html::rawElement( 'li', array(), $link ) . "\n"; |
193 | 193 | } |
194 | | - $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" ); |
| 194 | + $out->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" ); |
195 | 195 | } |
196 | 196 | } |
197 | 197 | } |
— | — | @@ -203,7 +203,7 @@ |
204 | 204 | $this->page = $page; |
205 | 205 | $this->conds = $conds; |
206 | 206 | $this->mDefaultDirection = true; |
207 | | - parent::__construct(); |
| 207 | + parent::__construct( $page->getContext() ); |
208 | 208 | } |
209 | 209 | |
210 | 210 | function getFieldNames() { |
— | — | @@ -225,11 +225,8 @@ |
226 | 226 | } |
227 | 227 | |
228 | 228 | function formatValue( $name, $value ) { |
229 | | - global $wgLang, $wgUser; |
230 | | - |
231 | | - static $sk, $msg; |
232 | | - if ( empty( $sk ) ) { |
233 | | - $sk = $this->getSkin(); |
| 229 | + static $msg = null; |
| 230 | + if ( $msg === null ) { |
234 | 231 | $msg = array( |
235 | 232 | 'anononlyblock', |
236 | 233 | 'createaccountblock', |
— | — | @@ -248,7 +245,7 @@ |
249 | 246 | |
250 | 247 | switch( $name ) { |
251 | 248 | case 'ipb_timestamp': |
252 | | - $formatted = $wgLang->timeanddate( $value ); |
| 249 | + $formatted = $this->getLang()->timeanddate( $value ); |
253 | 250 | break; |
254 | 251 | |
255 | 252 | case 'ipb_target': |
— | — | @@ -259,8 +256,8 @@ |
260 | 257 | switch( $type ){ |
261 | 258 | case Block::TYPE_USER: |
262 | 259 | case Block::TYPE_IP: |
263 | | - $formatted = $sk->userLink( $target->getId(), $target ); |
264 | | - $formatted .= $sk->userToolLinks( |
| 260 | + $formatted = Linker::userLink( $target->getId(), $target ); |
| 261 | + $formatted .= Linker::userToolLinks( |
265 | 262 | $target->getId(), |
266 | 263 | $target, |
267 | 264 | false, |
— | — | @@ -274,21 +271,21 @@ |
275 | 272 | break; |
276 | 273 | |
277 | 274 | case 'ipb_expiry': |
278 | | - $formatted = $wgLang->formatExpiry( $value ); |
279 | | - if( $wgUser->isAllowed( 'block' ) ){ |
| 275 | + $formatted = $this->getLang()->formatExpiry( $value ); |
| 276 | + if( $this->getUser()->isAllowed( 'block' ) ){ |
280 | 277 | if( $row->ipb_auto ){ |
281 | | - $links[] = $sk->linkKnown( |
| 278 | + $links[] = Linker::linkKnown( |
282 | 279 | SpecialPage::getTitleFor( 'Unblock' ), |
283 | 280 | $msg['unblocklink'], |
284 | 281 | array(), |
285 | 282 | array( 'wpTarget' => "#{$row->ipb_id}" ) |
286 | 283 | ); |
287 | 284 | } else { |
288 | | - $links[] = $sk->linkKnown( |
| 285 | + $links[] = Linker::linkKnown( |
289 | 286 | SpecialPage::getTitleFor( 'Unblock', $row->ipb_address ), |
290 | 287 | $msg['unblocklink'] |
291 | 288 | ); |
292 | | - $links[] = $sk->linkKnown( |
| 289 | + $links[] = Linker::linkKnown( |
293 | 290 | SpecialPage::getTitleFor( 'Block', $row->ipb_address ), |
294 | 291 | $msg['change-blocklink'] |
295 | 292 | ); |
— | — | @@ -296,7 +293,7 @@ |
297 | 294 | $formatted .= ' ' . Html::rawElement( |
298 | 295 | 'span', |
299 | 296 | array( 'class' => 'mw-blocklist-actions' ), |
300 | | - wfMsg( 'parentheses', $wgLang->pipeList( $links ) ) |
| 297 | + wfMsg( 'parentheses', $this->getLang()->pipeList( $links ) ) |
301 | 298 | ); |
302 | 299 | } |
303 | 300 | break; |
— | — | @@ -304,13 +301,13 @@ |
305 | 302 | case 'ipb_by': |
306 | 303 | $user = User::newFromId( $value ); |
307 | 304 | if( $user instanceof User ){ |
308 | | - $formatted = $sk->userLink( $user->getId(), $user->getName() ); |
309 | | - $formatted .= $sk->userToolLinks( $user->getId(), $user->getName() ); |
| 305 | + $formatted = Linker::userLink( $user->getId(), $user->getName() ); |
| 306 | + $formatted .= Linker::userToolLinks( $user->getId(), $user->getName() ); |
310 | 307 | } |
311 | 308 | break; |
312 | 309 | |
313 | 310 | case 'ipb_reason': |
314 | | - $formatted = $sk->commentBlock( $value ); |
| 311 | + $formatted = Linker::commentBlock( $value ); |
315 | 312 | break; |
316 | 313 | |
317 | 314 | case 'ipb_params': |
— | — | @@ -333,7 +330,7 @@ |
334 | 331 | $properties[] = $msg['blocklist-nousertalk']; |
335 | 332 | } |
336 | 333 | |
337 | | - $formatted = $wgLang->commaList( $properties ); |
| 334 | + $formatted = $this->getLang()->commaList( $properties ); |
338 | 335 | break; |
339 | 336 | |
340 | 337 | default: |
— | — | @@ -367,9 +364,8 @@ |
368 | 365 | 'conds' => $this->conds, |
369 | 366 | ); |
370 | 367 | |
371 | | - global $wgUser; |
372 | 368 | # Is the user allowed to see hidden blocks? |
373 | | - if ( !$wgUser->isAllowed( 'hideuser' ) ){ |
| 369 | + if ( !$this->getUser()->isAllowed( 'hideuser' ) ){ |
374 | 370 | $conds['ipb_deleted'] = 0; |
375 | 371 | } |
376 | 372 | |
— | — | @@ -391,8 +387,4 @@ |
392 | 388 | function isFieldSortable( $name ) { |
393 | 389 | return false; |
394 | 390 | } |
395 | | - |
396 | | - function getTitle() { |
397 | | - return $this->page->getTitle(); |
398 | | - } |
399 | 391 | } |
Index: trunk/phase3/includes/specials/SpecialListfiles.php |
— | — | @@ -28,7 +28,6 @@ |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function execute( $par ){ |
32 | | - global $wgOut, $wgRequest; |
33 | 32 | $this->setHeaders(); |
34 | 33 | $this->outputHeader(); |
35 | 34 | |
— | — | @@ -36,11 +35,11 @@ |
37 | 36 | $userName = $par; |
38 | 37 | $search = ''; |
39 | 38 | } else { |
40 | | - $userName = $wgRequest->getText( 'user', $par ); |
41 | | - $search = $wgRequest->getText( 'ilsearch', '' ); |
| 39 | + $userName = $this->getRequest()->getText( 'user', $par ); |
| 40 | + $search = $this->getRequest()->getText( 'ilsearch', '' ); |
42 | 41 | } |
43 | 42 | |
44 | | - $pager = new ImageListPager( $userName, $search, $this->including() ); |
| 43 | + $pager = new ImageListPager( $this->getContext(), $userName, $search, $this->including() ); |
45 | 44 | |
46 | 45 | if ( $this->including() ) { |
47 | 46 | $html = $pager->getBody(); |
— | — | @@ -50,7 +49,7 @@ |
51 | 50 | $nav = $pager->getNavigationBar(); |
52 | 51 | $html = "$form<br />\n$body<br />\n$nav"; |
53 | 52 | } |
54 | | - $wgOut->addHTML( $html ); |
| 53 | + $this->getOutput()->addHTML( $html ); |
55 | 54 | } |
56 | 55 | } |
57 | 56 | |
— | — | @@ -64,8 +63,8 @@ |
65 | 64 | var $mSearch = ''; |
66 | 65 | var $mIncluding = false; |
67 | 66 | |
68 | | - function __construct( $userName = null, $search = '', $including = false ) { |
69 | | - global $wgRequest, $wgMiserMode; |
| 67 | + function __construct( RequestContext $context, $userName = null, $search = '', $including = false ) { |
| 68 | + global $wgMiserMode; |
70 | 69 | |
71 | 70 | $this->mIncluding = $including; |
72 | 71 | |
— | — | @@ -89,7 +88,7 @@ |
90 | 89 | } |
91 | 90 | |
92 | 91 | if ( !$including ) { |
93 | | - if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { |
| 92 | + if ( $context->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) { |
94 | 93 | $this->mDefaultDirection = true; |
95 | 94 | } else { |
96 | 95 | $this->mDefaultDirection = false; |
— | — | @@ -98,13 +97,9 @@ |
99 | 98 | $this->mDefaultDirection = true; |
100 | 99 | } |
101 | 100 | |
102 | | - parent::__construct(); |
| 101 | + parent::__construct( $context ); |
103 | 102 | } |
104 | 103 | |
105 | | - function getTitle() { |
106 | | - return SpecialPage::getTitleFor( 'Listfiles' ); |
107 | | - } |
108 | | - |
109 | 104 | /** |
110 | 105 | * @return Array |
111 | 106 | */ |
— | — | @@ -197,14 +192,13 @@ |
198 | 193 | } |
199 | 194 | |
200 | 195 | function formatValue( $field, $value ) { |
201 | | - global $wgLang; |
202 | 196 | switch ( $field ) { |
203 | 197 | case 'thumb': |
204 | 198 | $file = wfLocalFile( $value ); |
205 | 199 | $thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) ); |
206 | 200 | return $thumb->toHtml( array( 'desc-link' => true ) ); |
207 | 201 | case 'img_timestamp': |
208 | | - return htmlspecialchars( $wgLang->timeanddate( $value, true ) ); |
| 202 | + return htmlspecialchars( $this->getLang()->timeanddate( $value, true ) ); |
209 | 203 | case 'img_name': |
210 | 204 | static $imgfile = null; |
211 | 205 | if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' ); |
— | — | @@ -212,7 +206,7 @@ |
213 | 207 | // Weird files can maybe exist? Bug 22227 |
214 | 208 | $filePage = Title::makeTitleSafe( NS_FILE, $value ); |
215 | 209 | if( $filePage ) { |
216 | | - $link = $this->getSkin()->linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) ); |
| 210 | + $link = Linker::linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) ); |
217 | 211 | $download = Xml::element( 'a', |
218 | 212 | array( 'href' => wfLocalFile( $filePage )->getURL() ), |
219 | 213 | $imgfile |
— | — | @@ -223,7 +217,7 @@ |
224 | 218 | } |
225 | 219 | case 'img_user_text': |
226 | 220 | if ( $this->mCurrentRow->img_user ) { |
227 | | - $link = $this->getSkin()->link( |
| 221 | + $link = Linker::link( |
228 | 222 | Title::makeTitle( NS_USER, $value ), |
229 | 223 | htmlspecialchars( $value ) |
230 | 224 | ); |
— | — | @@ -232,9 +226,9 @@ |
233 | 227 | } |
234 | 228 | return $link; |
235 | 229 | case 'img_size': |
236 | | - return $this->getSkin()->formatSize( $value ); |
| 230 | + return htmlspecialchars( $this->getLang()->formatSize( $value ) ); |
237 | 231 | case 'img_description': |
238 | | - return $this->getSkin()->commentBlock( $value ); |
| 232 | + return Linker::commentBlock( $value ); |
239 | 233 | case 'count': |
240 | 234 | return intval( $value ) + 1; |
241 | 235 | } |
Index: trunk/phase3/includes/specials/SpecialProtectedtitles.php |
— | — | @@ -36,8 +36,6 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | function execute( $par ) { |
40 | | - global $wgOut, $wgRequest; |
41 | | - |
42 | 40 | $this->setHeaders(); |
43 | 41 | $this->outputHeader(); |
44 | 42 | |
— | — | @@ -46,15 +44,16 @@ |
47 | 45 | Title::purgeExpiredRestrictions(); |
48 | 46 | } |
49 | 47 | |
50 | | - $type = $wgRequest->getVal( $this->IdType ); |
51 | | - $level = $wgRequest->getVal( $this->IdLevel ); |
52 | | - $sizetype = $wgRequest->getVal( 'sizetype' ); |
53 | | - $size = $wgRequest->getIntOrNull( 'size' ); |
54 | | - $NS = $wgRequest->getIntOrNull( 'namespace' ); |
| 48 | + $request = $this->getRequest(); |
| 49 | + $type = $request->getVal( $this->IdType ); |
| 50 | + $level = $request->getVal( $this->IdLevel ); |
| 51 | + $sizetype = $request->getVal( 'sizetype' ); |
| 52 | + $size = $request->getIntOrNull( 'size' ); |
| 53 | + $NS = $request->getIntOrNull( 'namespace' ); |
55 | 54 | |
56 | 55 | $pager = new ProtectedTitlesPager( $this, array(), $type, $level, $NS, $sizetype, $size ); |
57 | 56 | |
58 | | - $wgOut->addHTML( $this->showOptions( $NS, $type, $level ) ); |
| 57 | + $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level ) ); |
59 | 58 | |
60 | 59 | if ( $pager->getNumRows() ) { |
61 | 60 | $s = $pager->getNavigationBar(); |
— | — | @@ -65,7 +64,7 @@ |
66 | 65 | } else { |
67 | 66 | $s = '<p>' . wfMsgHtml( 'protectedtitlesempty' ) . '</p>'; |
68 | 67 | } |
69 | | - $wgOut->addHTML( $s ); |
| 68 | + $this->getOutput()->addHTML( $s ); |
70 | 69 | } |
71 | 70 | |
72 | 71 | /** |
— | — | @@ -74,19 +73,16 @@ |
75 | 74 | * @return string |
76 | 75 | */ |
77 | 76 | function formatRow( $row ) { |
78 | | - global $wgLang; |
79 | | - |
80 | 77 | wfProfileIn( __METHOD__ ); |
81 | 78 | |
82 | | - static $skin = null, $infinity = null; |
| 79 | + static $infinity = null; |
83 | 80 | |
84 | | - if( is_null( $skin ) ){ |
85 | | - $skin = $this->getSkin(); |
| 81 | + if( is_null( $infinity ) ){ |
86 | 82 | $infinity = wfGetDB( DB_SLAVE )->getInfinity(); |
87 | 83 | } |
88 | 84 | |
89 | 85 | $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title ); |
90 | | - $link = $skin->link( $title ); |
| 86 | + $link = Linker::link( $title ); |
91 | 87 | |
92 | 88 | $description_items = array (); |
93 | 89 | |
— | — | @@ -94,14 +90,13 @@ |
95 | 91 | |
96 | 92 | $description_items[] = $protType; |
97 | 93 | |
98 | | - $expiry = strlen( $row->pt_expiry ) ? $wgLang->formatExpiry( $row->pt_expiry, TS_MW ) : $infinity; |
| 94 | + $expiry = strlen( $row->pt_expiry ) ? $lang->formatExpiry( $row->pt_expiry, TS_MW ) : $infinity; |
99 | 95 | if( $expiry != $infinity ) { |
100 | | - |
101 | 96 | $expiry_description = wfMsg( |
102 | 97 | 'protect-expiring-local', |
103 | | - $wgLang->timeanddate( $expiry, true ), |
104 | | - $wgLang->date( $expiry, true ), |
105 | | - $wgLang->time( $expiry, true ) |
| 98 | + $lang->timeanddate( $expiry, true ), |
| 99 | + $lang->date( $expiry, true ), |
| 100 | + $lang->time( $expiry, true ) |
106 | 101 | ); |
107 | 102 | |
108 | 103 | $description_items[] = htmlspecialchars($expiry_description); |
— | — | @@ -121,7 +116,7 @@ |
122 | 117 | function showOptions( $namespace, $type='edit', $level ) { |
123 | 118 | global $wgScript; |
124 | 119 | $action = htmlspecialchars( $wgScript ); |
125 | | - $title = SpecialPage::getTitleFor( 'Protectedtitles' ); |
| 120 | + $title = $this->getTitle(); |
126 | 121 | $special = htmlspecialchars( $title->getPrefixedDBkey() ); |
127 | 122 | return "<form action=\"$action\" method=\"get\">\n" . |
128 | 123 | '<fieldset>' . |
— | — | @@ -194,7 +189,7 @@ |
195 | 190 | $this->level = $level; |
196 | 191 | $this->namespace = $namespace; |
197 | 192 | $this->size = intval($size); |
198 | | - parent::__construct(); |
| 193 | + parent::__construct( $form->getContext() ); |
199 | 194 | } |
200 | 195 | |
201 | 196 | function getStartBody() { |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -36,85 +36,87 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function execute( $par ) { |
40 | | - global $wgUser, $wgOut, $wgRequest; |
41 | | - |
42 | 40 | $this->setHeaders(); |
43 | 41 | $this->outputHeader(); |
44 | | - $wgOut->addModuleStyles( 'mediawiki.special' ); |
| 42 | + $out = $this->getOutput(); |
| 43 | + $out->addModuleStyles( 'mediawiki.special' ); |
45 | 44 | |
46 | 45 | $this->opts = array(); |
| 46 | + $request = $this->getRequest(); |
47 | 47 | |
48 | 48 | if( $par == 'newbies' ) { |
49 | 49 | $target = 'newbies'; |
50 | 50 | $this->opts['contribs'] = 'newbie'; |
51 | | - } elseif( isset( $par ) ) { |
| 51 | + } elseif( $par !== null ) { |
52 | 52 | $target = $par; |
53 | 53 | } else { |
54 | | - $target = $wgRequest->getVal( 'target' ); |
| 54 | + $target = $request->getVal( 'target' ); |
55 | 55 | } |
56 | 56 | |
57 | 57 | // check for radiobox |
58 | | - if( $wgRequest->getVal( 'contribs' ) == 'newbie' ) { |
| 58 | + if( $request->getVal( 'contribs' ) == 'newbie' ) { |
59 | 59 | $target = 'newbies'; |
60 | 60 | $this->opts['contribs'] = 'newbie'; |
61 | 61 | } |
62 | 62 | |
63 | | - $this->opts['deletedOnly'] = $wgRequest->getBool( 'deletedOnly' ); |
| 63 | + $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' ); |
64 | 64 | |
65 | 65 | if( !strlen( $target ) ) { |
66 | | - $wgOut->addHTML( $this->getForm() ); |
| 66 | + $out->addHTML( $this->getForm() ); |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | | - $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') ); |
| 70 | + $user = $this->getUser(); |
| 71 | + |
| 72 | + $this->opts['limit'] = $request->getInt( 'limit', $user->getOption('rclimit') ); |
71 | 73 | $this->opts['target'] = $target; |
72 | | - $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' ); |
| 74 | + $this->opts['topOnly'] = $request->getBool( 'topOnly' ); |
73 | 75 | |
74 | 76 | $nt = Title::makeTitleSafe( NS_USER, $target ); |
75 | 77 | if( !$nt ) { |
76 | | - $wgOut->addHTML( $this->getForm() ); |
| 78 | + $out->addHTML( $this->getForm() ); |
77 | 79 | return; |
78 | 80 | } |
79 | 81 | $id = User::idFromName( $nt->getText() ); |
80 | 82 | |
81 | 83 | if( $target != 'newbies' ) { |
82 | 84 | $target = $nt->getText(); |
83 | | - $wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) ); |
84 | | - $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) ); |
85 | | - $user = User::newFromName( $target, false ); |
86 | | - if ( is_object( $user ) ) { |
87 | | - $this->getSkin()->setRelevantUser( $user ); |
| 85 | + $out->setSubtitle( $this->contributionsSub( $nt, $id ) ); |
| 86 | + $out->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) ); |
| 87 | + $userObj = User::newFromName( $target, false ); |
| 88 | + if ( is_object( $userObj ) ) { |
| 89 | + $this->getSkin()->setRelevantUser( $userObj ); |
88 | 90 | } |
89 | 91 | } else { |
90 | | - $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') ); |
91 | | - $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) ); |
| 92 | + $out->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') ); |
| 93 | + $out->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) ); |
92 | 94 | } |
93 | 95 | |
94 | | - if( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) { |
| 96 | + if( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) { |
95 | 97 | $this->opts['namespace'] = intval( $ns ); |
96 | 98 | } else { |
97 | 99 | $this->opts['namespace'] = ''; |
98 | 100 | } |
99 | 101 | |
100 | | - $this->opts['tagFilter'] = (string) $wgRequest->getVal( 'tagFilter' ); |
| 102 | + $this->opts['tagFilter'] = (string) $request->getVal( 'tagFilter' ); |
101 | 103 | |
102 | 104 | // Allows reverts to have the bot flag in recent changes. It is just here to |
103 | 105 | // be passed in the form at the top of the page |
104 | | - if( $wgUser->isAllowed( 'markbotedits' ) && $wgRequest->getBool( 'bot' ) ) { |
| 106 | + if( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) { |
105 | 107 | $this->opts['bot'] = '1'; |
106 | 108 | } |
107 | 109 | |
108 | | - $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev'; |
| 110 | + $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev'; |
109 | 111 | # Offset overrides year/month selection |
110 | 112 | if( $skip ) { |
111 | 113 | $this->opts['year'] = ''; |
112 | 114 | $this->opts['month'] = ''; |
113 | 115 | } else { |
114 | | - $this->opts['year'] = $wgRequest->getIntOrNull( 'year' ); |
115 | | - $this->opts['month'] = $wgRequest->getIntOrNull( 'month' ); |
| 116 | + $this->opts['year'] = $request->getIntOrNull( 'year' ); |
| 117 | + $this->opts['month'] = $request->getIntOrNull( 'month' ); |
116 | 118 | } |
117 | 119 | |
118 | | - $feedType = $wgRequest->getVal( 'feed' ); |
| 120 | + $feedType = $request->getVal( 'feed' ); |
119 | 121 | if( $feedType ) { |
120 | 122 | // Maintain some level of backwards compatability |
121 | 123 | // If people request feeds using the old parameters, redirect to API |
— | — | @@ -144,7 +146,7 @@ |
145 | 147 | |
146 | 148 | $url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams ); |
147 | 149 | |
148 | | - $wgOut->redirect( $url, '301' ); |
| 150 | + $out->redirect( $url, '301' ); |
149 | 151 | return; |
150 | 152 | } |
151 | 153 | |
— | — | @@ -153,7 +155,7 @@ |
154 | 156 | |
155 | 157 | if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) { |
156 | 158 | |
157 | | - $wgOut->addHTML( $this->getForm() ); |
| 159 | + $out->addHTML( $this->getForm() ); |
158 | 160 | |
159 | 161 | $pager = new ContribsPager( array( |
160 | 162 | 'target' => $target, |
— | — | @@ -164,20 +166,20 @@ |
165 | 167 | 'topOnly' => $this->opts['topOnly'], |
166 | 168 | ) ); |
167 | 169 | if( !$pager->getNumRows() ) { |
168 | | - $wgOut->addWikiMsg( 'nocontribs', $target ); |
| 170 | + $out->addWikiMsg( 'nocontribs', $target ); |
169 | 171 | } else { |
170 | 172 | # Show a message about slave lag, if applicable |
171 | 173 | $lag = wfGetLB()->safeGetLag( $pager->getDatabase() ); |
172 | 174 | if( $lag > 0 ) |
173 | | - $wgOut->showLagWarning( $lag ); |
| 175 | + $out->showLagWarning( $lag ); |
174 | 176 | |
175 | | - $wgOut->addHTML( |
| 177 | + $out->addHTML( |
176 | 178 | '<p>' . $pager->getNavigationBar() . '</p>' . |
177 | 179 | $pager->getBody() . |
178 | 180 | '<p>' . $pager->getNavigationBar() . '</p>' |
179 | 181 | ); |
180 | 182 | } |
181 | | - $wgOut->preventClickjacking( $pager->getPreventClickjacking() ); |
| 183 | + $out->preventClickjacking( $pager->getPreventClickjacking() ); |
182 | 184 | |
183 | 185 | # Show the appropriate "footer" message - WHOIS tools, etc. |
184 | 186 | if( $target != 'newbies' ) { |
— | — | @@ -185,15 +187,15 @@ |
186 | 188 | if ( IP::isIPAddress( $target ) ) { |
187 | 189 | $message = 'sp-contributions-footer-anon'; |
188 | 190 | } else { |
189 | | - $user = User::newFromName( $target ); |
190 | | - if ( !$user || $user->isAnon() ) { |
| 191 | + $userObj = User::newFromName( $target ); |
| 192 | + if ( !$userObj || $userObj->isAnon() ) { |
191 | 193 | // No message for non-existing users |
192 | 194 | return; |
193 | 195 | } |
194 | 196 | } |
195 | 197 | |
196 | 198 | if( !wfMessage( $message, $target )->isDisabled() ) { |
197 | | - $wgOut->wrapWikiMsg( |
| 199 | + $out->wrapWikiMsg( |
198 | 200 | "<div class='mw-contributions-footer'>\n$1\n</div>", |
199 | 201 | array( $message, $target ) ); |
200 | 202 | } |
— | — | @@ -209,25 +211,22 @@ |
210 | 212 | * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined. |
211 | 213 | */ |
212 | 214 | protected function contributionsSub( $nt, $id ) { |
213 | | - global $wgLang, $wgUser, $wgOut; |
214 | | - |
215 | | - $sk = $this->getSkin(); |
216 | | - |
217 | 215 | if ( $id === null ) { |
218 | 216 | $user = htmlspecialchars( $nt->getText() ); |
219 | 217 | } else { |
220 | | - $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) ); |
| 218 | + $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) ); |
221 | 219 | } |
222 | 220 | $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false ); |
223 | 221 | $talk = $nt->getTalkPage(); |
224 | 222 | if( $talk ) { |
225 | | - $tools = self::getUserLinks( $nt, $talk, $userObj, $wgUser ); |
226 | | - $links = $wgLang->pipeList( $tools ); |
| 223 | + $tools = self::getUserLinks( $nt, $talk, $userObj, $this->getUser() ); |
| 224 | + $links = $this->getLang()->pipeList( $tools ); |
227 | 225 | |
228 | 226 | // Show a note if the user is blocked and display the last block log entry. |
229 | 227 | if ( $userObj->isBlocked() ) { |
| 228 | + $out = $this->getOutput(); // showLogExtract() wants first parameter by reference |
230 | 229 | LogEventsList::showLogExtract( |
231 | | - $wgOut, |
| 230 | + $out, |
232 | 231 | 'block', |
233 | 232 | $nt->getPrefixedText(), |
234 | 233 | '', |
— | — | @@ -240,7 +239,7 @@ |
241 | 240 | 'sp-contributions-blocked-notice', |
242 | 241 | $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice' |
243 | 242 | ), |
244 | | - 'offset' => '' # don't use $wgRequest parameter offset |
| 243 | + 'offset' => '' # don't use WebRequest parameter offset |
245 | 244 | ) |
246 | 245 | ); |
247 | 246 | } |
— | — | @@ -262,36 +261,35 @@ |
263 | 262 | * @param $userpage Title: Target user page |
264 | 263 | * @param $talkpage Title: Talk page |
265 | 264 | * @param $target User: Target user object |
266 | | - * @param $subject User: The viewing user ($wgUser is still checked in some cases, like userrights page!!) |
| 265 | + * @param $subject User: The viewing user ($wgUser might be still checked in some cases) |
267 | 266 | */ |
268 | 267 | public static function getUserLinks( Title $userpage, Title $talkpage, User $target, User $subject ) { |
269 | 268 | |
270 | | - $sk = $subject->getSkin(); |
271 | 269 | $id = $target->getId(); |
272 | 270 | $username = $target->getName(); |
273 | 271 | |
274 | | - $tools[] = $sk->link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) ); |
| 272 | + $tools[] = Linker::link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) ); |
275 | 273 | |
276 | 274 | if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) { |
277 | 275 | if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links |
278 | 276 | if ( $target->isBlocked() ) { |
279 | | - $tools[] = $sk->linkKnown( # Change block link |
| 277 | + $tools[] = Linker::linkKnown( # Change block link |
280 | 278 | SpecialPage::getTitleFor( 'Block', $username ), |
281 | 279 | wfMsgHtml( 'change-blocklink' ) |
282 | 280 | ); |
283 | | - $tools[] = $sk->linkKnown( # Unblock link |
| 281 | + $tools[] = Linker::linkKnown( # Unblock link |
284 | 282 | SpecialPage::getTitleFor( 'Unblock', $username ), |
285 | 283 | wfMsgHtml( 'unblocklink' ) |
286 | 284 | ); |
287 | 285 | } else { # User is not blocked |
288 | | - $tools[] = $sk->linkKnown( # Block link |
| 286 | + $tools[] = Linker::linkKnown( # Block link |
289 | 287 | SpecialPage::getTitleFor( 'Block', $username ), |
290 | 288 | wfMsgHtml( 'blocklink' ) |
291 | 289 | ); |
292 | 290 | } |
293 | 291 | } |
294 | 292 | # Block log link |
295 | | - $tools[] = $sk->linkKnown( |
| 293 | + $tools[] = Linker::linkKnown( |
296 | 294 | SpecialPage::getTitleFor( 'Log', 'block' ), |
297 | 295 | wfMsgHtml( 'sp-contributions-blocklog' ), |
298 | 296 | array(), |
— | — | @@ -301,20 +299,20 @@ |
302 | 300 | ); |
303 | 301 | } |
304 | 302 | # Uploads |
305 | | - $tools[] = $sk->linkKnown( |
| 303 | + $tools[] = Linker::linkKnown( |
306 | 304 | SpecialPage::getTitleFor( 'Listfiles', $username ), |
307 | 305 | wfMsgHtml( 'sp-contributions-uploads' ) |
308 | 306 | ); |
309 | 307 | |
310 | 308 | # Other logs link |
311 | | - $tools[] = $sk->linkKnown( |
| 309 | + $tools[] = Linker::linkKnown( |
312 | 310 | SpecialPage::getTitleFor( 'Log', $username ), |
313 | 311 | wfMsgHtml( 'sp-contributions-logs' ) |
314 | 312 | ); |
315 | 313 | |
316 | 314 | # Add link to deleted user contributions for priviledged users |
317 | 315 | if( $subject->isAllowed( 'deletedhistory' ) && !$subject->isBlocked() ) { |
318 | | - $tools[] = $sk->linkKnown( |
| 316 | + $tools[] = Linker::linkKnown( |
319 | 317 | SpecialPage::getTitleFor( 'DeletedContributions', $username ), |
320 | 318 | wfMsgHtml( 'sp-contributions-deleted' ) |
321 | 319 | ); |
— | — | @@ -322,8 +320,9 @@ |
323 | 321 | |
324 | 322 | # Add a link to change user rights for privileged users |
325 | 323 | $userrightsPage = new UserrightsPage(); |
| 324 | + $userrightsPage->getContext()->setUser( $subject ); |
326 | 325 | if( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) { |
327 | | - $tools[] = $sk->linkKnown( |
| 326 | + $tools[] = Linker::linkKnown( |
328 | 327 | SpecialPage::getTitleFor( 'Userrights', $username ), |
329 | 328 | wfMsgHtml( 'sp-contributions-userrights' ) |
330 | 329 | ); |
— | — | @@ -462,19 +461,15 @@ |
463 | 462 | return $query; |
464 | 463 | } |
465 | 464 | |
466 | | - function getTitle() { |
467 | | - return SpecialPage::getTitleFor( 'Contributions' ); |
468 | | - } |
469 | | - |
470 | 465 | function getQueryInfo() { |
471 | | - global $wgUser; |
472 | 466 | list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond(); |
473 | 467 | |
| 468 | + $user = $this->getUser(); |
474 | 469 | $conds = array_merge( $userCond, $this->getNamespaceCond() ); |
475 | 470 | // Paranoia: avoid brute force searches (bug 17342) |
476 | | - if( !$wgUser->isAllowed( 'deletedhistory' ) || $wgUser->isBlocked() ) { |
| 471 | + if( !$user->isAllowed( 'deletedhistory' ) || $user->isBlocked() ) { |
477 | 472 | $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0'; |
478 | | - } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) { |
| 473 | + } elseif( !$user->isAllowed( 'suppressrevision' ) ) { |
479 | 474 | $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) . |
480 | 475 | ' != ' . Revision::SUPPRESSED_USER; |
481 | 476 | } |
— | — | @@ -601,15 +596,13 @@ |
602 | 597 | * @todo This would probably look a lot nicer in a table. |
603 | 598 | */ |
604 | 599 | function formatRow( $row ) { |
605 | | - global $wgUser, $wgLang; |
606 | 600 | wfProfileIn( __METHOD__ ); |
607 | 601 | |
608 | | - $sk = $this->getSkin(); |
609 | 602 | $rev = new Revision( $row ); |
610 | 603 | $classes = array(); |
611 | 604 | |
612 | 605 | $page = Title::newFromRow( $row ); |
613 | | - $link = $sk->link( |
| 606 | + $link = Linker::link( |
614 | 607 | $page, |
615 | 608 | htmlspecialchars( $page->getPrefixedText() ), |
616 | 609 | array(), |
— | — | @@ -624,12 +617,12 @@ |
625 | 618 | && $page->quickUserCan( 'edit' ) ) |
626 | 619 | { |
627 | 620 | $this->preventClickjacking(); |
628 | | - $topmarktext .= ' '.$sk->generateRollback( $rev ); |
| 621 | + $topmarktext .= ' '.Linker::generateRollback( $rev ); |
629 | 622 | } |
630 | 623 | } |
631 | 624 | # Is there a visible previous revision? |
632 | 625 | if( $rev->userCan( Revision::DELETED_TEXT ) && $rev->getParentId() !== 0 ) { |
633 | | - $difftext = $sk->linkKnown( |
| 626 | + $difftext = Linker::linkKnown( |
634 | 627 | $page, |
635 | 628 | $this->messages['diff'], |
636 | 629 | array(), |
— | — | @@ -641,24 +634,17 @@ |
642 | 635 | } else { |
643 | 636 | $difftext = $this->messages['diff']; |
644 | 637 | } |
645 | | - $histlink = $sk->linkKnown( |
| 638 | + $histlink = Linker::linkKnown( |
646 | 639 | $page, |
647 | 640 | $this->messages['hist'], |
648 | 641 | array(), |
649 | 642 | array( 'action' => 'history' ) |
650 | 643 | ); |
651 | 644 | |
652 | | - if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) { |
653 | | - $chardiff = ' . . ' . ChangesList::showCharacterDifference( |
654 | | - $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . '; |
655 | | - } else { |
656 | | - $chardiff = ''; |
657 | | - } |
658 | | - |
659 | | - $comment = $wgLang->getDirMark() . $sk->revComment( $rev, false, true ); |
660 | | - $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true ); |
| 645 | + $comment = $this->getLang()->getDirMark() . Linker::revComment( $rev, false, true ); |
| 646 | + $date = $this->getLang()->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true ); |
661 | 647 | if( $rev->userCan( Revision::DELETED_TEXT ) ) { |
662 | | - $d = $sk->linkKnown( |
| 648 | + $d = Linker::linkKnown( |
663 | 649 | $page, |
664 | 650 | htmlspecialchars($date), |
665 | 651 | array(), |
— | — | @@ -672,8 +658,8 @@ |
673 | 659 | } |
674 | 660 | |
675 | 661 | if( $this->target == 'newbies' ) { |
676 | | - $userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text ); |
677 | | - $userlink .= ' ' . wfMsg( 'parentheses', $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' '; |
| 662 | + $userlink = ' . . ' . Linker::userLink( $row->rev_user, $row->rev_user_text ); |
| 663 | + $userlink .= ' ' . wfMsg( 'parentheses', Linker::userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' '; |
678 | 664 | } else { |
679 | 665 | $userlink = ''; |
680 | 666 | } |
— | — | @@ -691,17 +677,17 @@ |
692 | 678 | } |
693 | 679 | |
694 | 680 | // Don't show useless link to people who cannot hide revisions |
695 | | - $canHide = $wgUser->isAllowed( 'deleterevision' ); |
696 | | - if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) { |
| 681 | + $canHide = $this->getUser()->isAllowed( 'deleterevision' ); |
| 682 | + if( $canHide || ($rev->getVisibility() && $this->getUser()->isAllowed('deletedhistory')) ) { |
697 | 683 | if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
698 | | - $del = $this->mSkin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
| 684 | + $del = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
699 | 685 | } else { |
700 | 686 | $query = array( |
701 | 687 | 'type' => 'revision', |
702 | 688 | 'target' => $page->getPrefixedDbkey(), |
703 | 689 | 'ids' => $rev->getId() |
704 | 690 | ); |
705 | | - $del = $this->mSkin->revDeleteLink( $query, |
| 691 | + $del = Linker::revDeleteLink( $query, |
706 | 692 | $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide ); |
707 | 693 | } |
708 | 694 | $del .= ' '; |
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php |
— | — | @@ -49,13 +49,13 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | function getQueryInfo() { |
53 | | - global $wgUser; |
54 | 53 | list( $index, $userCond ) = $this->getUserCond(); |
55 | 54 | $conds = array_merge( $userCond, $this->getNamespaceCond() ); |
| 55 | + $user = $this->getUser(); |
56 | 56 | // Paranoia: avoid brute force searches (bug 17792) |
57 | | - if( !$wgUser->isAllowed( 'deletedhistory' ) ) { |
| 57 | + if( !$user->isAllowed( 'deletedhistory' ) ) { |
58 | 58 | $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0'; |
59 | | - } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) { |
| 59 | + } elseif( !$user->isAllowed( 'suppressrevision' ) ) { |
60 | 60 | $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) . |
61 | 61 | ' != ' . Revision::SUPPRESSED_USER; |
62 | 62 | } |
— | — | @@ -92,12 +92,11 @@ |
93 | 93 | } |
94 | 94 | |
95 | 95 | function getNavigationBar() { |
96 | | - global $wgLang; |
97 | | - |
98 | 96 | if ( isset( $this->mNavigationBar ) ) { |
99 | 97 | return $this->mNavigationBar; |
100 | 98 | } |
101 | | - $fmtLimit = $wgLang->formatNum( $this->mLimit ); |
| 99 | + $lang = $this->getLang(); |
| 100 | + $fmtLimit = $lang->formatNum( $this->mLimit ); |
102 | 101 | $linkTexts = array( |
103 | 102 | 'prev' => wfMsgExt( 'pager-newer-n', array( 'escape', 'parsemag' ), $fmtLimit ), |
104 | 103 | 'next' => wfMsgExt( 'pager-older-n', array( 'escape', 'parsemag' ), $fmtLimit ), |
— | — | @@ -107,9 +106,9 @@ |
108 | 107 | |
109 | 108 | $pagingLinks = $this->getPagingLinks( $linkTexts ); |
110 | 109 | $limitLinks = $this->getLimitLinks(); |
111 | | - $limits = $wgLang->pipeList( $limitLinks ); |
| 110 | + $limits = $lang->pipeList( $limitLinks ); |
112 | 111 | |
113 | | - $this->mNavigationBar = "(" . $wgLang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " . |
| 112 | + $this->mNavigationBar = "(" . $lang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " . |
114 | 113 | wfMsgExt( 'viewprevnext', array( 'parsemag', 'escape', 'replaceafter' ), $pagingLinks['prev'], $pagingLinks['next'], $limits ); |
115 | 114 | return $this->mNavigationBar; |
116 | 115 | } |
— | — | @@ -133,11 +132,8 @@ |
134 | 133 | * @todo This would probably look a lot nicer in a table. |
135 | 134 | */ |
136 | 135 | function formatRow( $row ) { |
137 | | - global $wgUser, $wgLang; |
138 | 136 | wfProfileIn( __METHOD__ ); |
139 | 137 | |
140 | | - $sk = $this->getSkin(); |
141 | | - |
142 | 138 | $rev = new Revision( array( |
143 | 139 | 'id' => $row->ar_rev_id, |
144 | 140 | 'comment' => $row->ar_comment, |
— | — | @@ -153,7 +149,7 @@ |
154 | 150 | $undelete = SpecialPage::getTitleFor( 'Undelete' ); |
155 | 151 | |
156 | 152 | $logs = SpecialPage::getTitleFor( 'Log' ); |
157 | | - $dellog = $sk->linkKnown( |
| 153 | + $dellog = Linker::linkKnown( |
158 | 154 | $logs, |
159 | 155 | $this->messages['deletionlog'], |
160 | 156 | array(), |
— | — | @@ -163,13 +159,15 @@ |
164 | 160 | ) |
165 | 161 | ); |
166 | 162 | |
167 | | - $reviewlink = $sk->linkKnown( |
| 163 | + $reviewlink = Linker::linkKnown( |
168 | 164 | SpecialPage::getTitleFor( 'Undelete', $page->getPrefixedDBkey() ), |
169 | 165 | $this->messages['undeleteviewlink'] |
170 | 166 | ); |
171 | 167 | |
172 | | - if( $wgUser->isAllowed('deletedtext') ) { |
173 | | - $last = $sk->linkKnown( |
| 168 | + $user = $this->getUser(); |
| 169 | + |
| 170 | + if( $user->isAllowed('deletedtext') ) { |
| 171 | + $last = Linker::linkKnown( |
174 | 172 | $undelete, |
175 | 173 | $this->messages['diff'], |
176 | 174 | array(), |
— | — | @@ -183,13 +181,13 @@ |
184 | 182 | $last = $this->messages['diff']; |
185 | 183 | } |
186 | 184 | |
187 | | - $comment = $sk->revComment( $rev ); |
188 | | - $date = htmlspecialchars( $wgLang->timeanddate( $rev->getTimestamp(), true ) ); |
| 185 | + $comment = Linker::revComment( $rev ); |
| 186 | + $date = htmlspecialchars( $this->getLang()->timeanddate( $rev->getTimestamp(), true ) ); |
189 | 187 | |
190 | | - if( !$wgUser->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) { |
| 188 | + if( !$user->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) { |
191 | 189 | $link = $date; // unusable link |
192 | 190 | } else { |
193 | | - $link = $sk->linkKnown( |
| 191 | + $link = Linker::linkKnown( |
194 | 192 | $undelete, |
195 | 193 | $date, |
196 | 194 | array(), |
— | — | @@ -204,7 +202,7 @@ |
205 | 203 | $link = '<span class="history-deleted">' . $link . '</span>'; |
206 | 204 | } |
207 | 205 | |
208 | | - $pagelink = $sk->link( $page ); |
| 206 | + $pagelink = Linker::link( $page ); |
209 | 207 | |
210 | 208 | if( $rev->isMinor() ) { |
211 | 209 | $mflag = ChangesList::flag( 'minor' ); |
— | — | @@ -213,13 +211,13 @@ |
214 | 212 | } |
215 | 213 | |
216 | 214 | // Revision delete link |
217 | | - $del = Linker::getRevDeleteLink( $wgUser, $rev, $page ); |
| 215 | + $del = Linker::getRevDeleteLink( $user, $rev, $page ); |
218 | 216 | if ( $del ) $del .= ' '; |
219 | 217 | |
220 | 218 | $tools = Html::rawElement( |
221 | 219 | 'span', |
222 | 220 | array( 'class' => 'mw-deletedcontribs-tools' ), |
223 | | - wfMsg( 'parentheses', $wgLang->pipeList( array( $last, $dellog, $reviewlink ) ) ) |
| 221 | + wfMsg( 'parentheses', $this->getLang()->pipeList( array( $last, $dellog, $reviewlink ) ) ) |
224 | 222 | ); |
225 | 223 | |
226 | 224 | $ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}"; |
— | — | @@ -259,68 +257,69 @@ |
260 | 258 | * @param $par String: (optional) user name of the user for which to show the contributions |
261 | 259 | */ |
262 | 260 | function execute( $par ) { |
263 | | - global $wgUser; |
264 | 261 | $this->setHeaders(); |
265 | 262 | |
266 | | - if ( !$this->userCanExecute( $wgUser ) ) { |
| 263 | + $user = $this->getUser(); |
| 264 | + |
| 265 | + if ( !$this->userCanExecute( $user ) ) { |
267 | 266 | $this->displayRestrictionError(); |
268 | 267 | return; |
269 | 268 | } |
270 | 269 | |
271 | | - if( $wgUser->isBlocked() ){ |
272 | | - throw new UserBlockedError( $wgUser->getBlock() ); |
| 270 | + if( $user->isBlocked() ){ |
| 271 | + throw new UserBlockedError( $user->getBlock() ); |
273 | 272 | } |
274 | 273 | |
275 | | - global $wgOut, $wgRequest; |
| 274 | + $request = $this->getRequest(); |
| 275 | + $out = $this->getOutput(); |
| 276 | + $out->setPageTitle( wfMsgExt( 'deletedcontributions-title', array( 'parsemag' ) ) ); |
276 | 277 | |
277 | | - $wgOut->setPageTitle( wfMsgExt( 'deletedcontributions-title', array( 'parsemag' ) ) ); |
278 | | - |
279 | 278 | $options = array(); |
280 | 279 | |
281 | | - if ( isset( $par ) ) { |
| 280 | + if ( $par !== null ) { |
282 | 281 | $target = $par; |
283 | 282 | } else { |
284 | | - $target = $wgRequest->getVal( 'target' ); |
| 283 | + $target = $request->getVal( 'target' ); |
285 | 284 | } |
286 | 285 | |
287 | 286 | if ( !strlen( $target ) ) { |
288 | | - $wgOut->addHTML( $this->getForm( '' ) ); |
| 287 | + $out->addHTML( $this->getForm( '' ) ); |
289 | 288 | return; |
290 | 289 | } |
291 | 290 | |
292 | | - $options['limit'] = $wgRequest->getInt( 'limit', 50 ); |
| 291 | + $options['limit'] = $request->getInt( 'limit', 50 ); |
293 | 292 | $options['target'] = $target; |
294 | 293 | |
295 | 294 | $nt = Title::makeTitleSafe( NS_USER, $target ); |
296 | 295 | if ( !$nt ) { |
297 | | - $wgOut->addHTML( $this->getForm( '' ) ); |
| 296 | + $out->addHTML( $this->getForm( '' ) ); |
298 | 297 | return; |
299 | 298 | } |
300 | 299 | $id = User::idFromName( $nt->getText() ); |
301 | 300 | |
302 | 301 | $target = $nt->getText(); |
303 | | - $wgOut->setSubtitle( $this->getSubTitle( $nt, $id ) ); |
| 302 | + $out->setSubtitle( $this->getSubTitle( $nt, $id ) ); |
304 | 303 | |
305 | | - if ( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) { |
| 304 | + if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) { |
306 | 305 | $options['namespace'] = intval( $ns ); |
307 | 306 | } else { |
308 | 307 | $options['namespace'] = ''; |
309 | 308 | } |
310 | 309 | |
311 | | - $wgOut->addHTML( $this->getForm( $options ) ); |
| 310 | + $out->addHTML( $this->getForm( $options ) ); |
312 | 311 | |
313 | 312 | $pager = new DeletedContribsPager( $target, $options['namespace'] ); |
314 | 313 | if ( !$pager->getNumRows() ) { |
315 | | - $wgOut->addWikiMsg( 'nocontribs' ); |
| 314 | + $out->addWikiMsg( 'nocontribs' ); |
316 | 315 | return; |
317 | 316 | } |
318 | 317 | |
319 | 318 | # Show a message about slave lag, if applicable |
320 | 319 | $lag = wfGetLB()->safeGetLag( $pager->getDatabase() ); |
321 | 320 | if( $lag > 0 ) |
322 | | - $wgOut->showLagWarning( $lag ); |
| 321 | + $out->showLagWarning( $lag ); |
323 | 322 | |
324 | | - $wgOut->addHTML( |
| 323 | + $out->addHTML( |
325 | 324 | '<p>' . $pager->getNavigationBar() . '</p>' . |
326 | 325 | $pager->getBody() . |
327 | 326 | '<p>' . $pager->getNavigationBar() . '</p>' ); |
— | — | @@ -333,7 +332,7 @@ |
334 | 333 | : 'sp-contributions-footer'; |
335 | 334 | |
336 | 335 | if( !wfMessage( $message )->isDisabled() ) { |
337 | | - $wgOut->wrapWikiMsg( "<div class='mw-contributions-footer'>\n$1\n</div>", array( $message, $target ) ); |
| 336 | + $out->wrapWikiMsg( "<div class='mw-contributions-footer'>\n$1\n</div>", array( $message, $target ) ); |
338 | 337 | } |
339 | 338 | } |
340 | 339 | } |
— | — | @@ -346,28 +345,24 @@ |
347 | 346 | * @todo FIXME: Almost the same as contributionsSub in SpecialContributions.php. Could be combined. |
348 | 347 | */ |
349 | 348 | function getSubTitle( $nt, $id ) { |
350 | | - global $wgLang, $wgUser, $wgOut; |
351 | | - |
352 | | - $sk = $this->getSkin(); |
353 | | - |
354 | 349 | if ( $id === null ) { |
355 | 350 | $user = htmlspecialchars( $nt->getText() ); |
356 | 351 | } else { |
357 | | - $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) ); |
| 352 | + $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) ); |
358 | 353 | } |
359 | 354 | $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false ); |
360 | 355 | $talk = $nt->getTalkPage(); |
361 | 356 | if( $talk ) { |
362 | 357 | # Talk page link |
363 | | - $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) ); |
| 358 | + $tools[] = Linker::link( $talk, wfMsgHtml( 'sp-contributions-talk' ) ); |
364 | 359 | if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) { |
365 | | - if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links |
| 360 | + if( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links |
366 | 361 | if ( $userObj->isBlocked() ) { |
367 | | - $tools[] = $sk->linkKnown( # Change block link |
| 362 | + $tools[] = Linker::linkKnown( # Change block link |
368 | 363 | SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ), |
369 | 364 | wfMsgHtml( 'change-blocklink' ) |
370 | 365 | ); |
371 | | - $tools[] = $sk->linkKnown( # Unblock link |
| 366 | + $tools[] = Linker::linkKnown( # Unblock link |
372 | 367 | SpecialPage::getTitleFor( 'BlockList' ), |
373 | 368 | wfMsgHtml( 'unblocklink' ), |
374 | 369 | array(), |
— | — | @@ -378,14 +373,14 @@ |
379 | 374 | ); |
380 | 375 | } |
381 | 376 | else { # User is not blocked |
382 | | - $tools[] = $sk->linkKnown( # Block link |
| 377 | + $tools[] = Linker::linkKnown( # Block link |
383 | 378 | SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ), |
384 | 379 | wfMsgHtml( 'blocklink' ) |
385 | 380 | ); |
386 | 381 | } |
387 | 382 | } |
388 | 383 | # Block log link |
389 | | - $tools[] = $sk->linkKnown( |
| 384 | + $tools[] = Linker::linkKnown( |
390 | 385 | SpecialPage::getTitleFor( 'Log' ), |
391 | 386 | wfMsgHtml( 'sp-contributions-blocklog' ), |
392 | 387 | array(), |
— | — | @@ -396,14 +391,14 @@ |
397 | 392 | ); |
398 | 393 | } |
399 | 394 | # Other logs link |
400 | | - $tools[] = $sk->linkKnown( |
| 395 | + $tools[] = Linker::linkKnown( |
401 | 396 | SpecialPage::getTitleFor( 'Log' ), |
402 | 397 | wfMsgHtml( 'sp-contributions-logs' ), |
403 | 398 | array(), |
404 | 399 | array( 'user' => $nt->getText() ) |
405 | 400 | ); |
406 | 401 | # Link to contributions |
407 | | - $tools[] = $sk->linkKnown( |
| 402 | + $tools[] = Linker::linkKnown( |
408 | 403 | SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ), |
409 | 404 | wfMsgHtml( 'sp-deletedcontributions-contribs' ) |
410 | 405 | ); |
— | — | @@ -411,7 +406,7 @@ |
412 | 407 | # Add a link to change user rights for privileged users |
413 | 408 | $userrightsPage = new UserrightsPage(); |
414 | 409 | if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) { |
415 | | - $tools[] = $sk->linkKnown( |
| 410 | + $tools[] = Linker::linkKnown( |
416 | 411 | SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ), |
417 | 412 | wfMsgHtml( 'sp-contributions-userrights' ) |
418 | 413 | ); |
— | — | @@ -419,12 +414,13 @@ |
420 | 415 | |
421 | 416 | wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) ); |
422 | 417 | |
423 | | - $links = $wgLang->pipeList( $tools ); |
| 418 | + $links = $this->getLang()->pipeList( $tools ); |
424 | 419 | |
425 | 420 | // Show a note if the user is blocked and display the last block log entry. |
426 | 421 | if ( $userObj->isBlocked() ) { |
| 422 | + $out = $this->getOutput(); // LogEventsList::showLogExtract() wants the first parameter by ref |
427 | 423 | LogEventsList::showLogExtract( |
428 | | - $wgOut, |
| 424 | + $out, |
429 | 425 | 'block', |
430 | 426 | $nt->getPrefixedText(), |
431 | 427 | '', |
— | — | @@ -435,7 +431,7 @@ |
436 | 432 | 'sp-contributions-blocked-notice', |
437 | 433 | $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice' |
438 | 434 | ), |
439 | | - 'offset' => '' # don't use $wgRequest parameter offset |
| 435 | + 'offset' => '' # don't use $this->getRequest() parameter offset |
440 | 436 | ) |
441 | 437 | ); |
442 | 438 | } |
— | — | @@ -459,7 +455,7 @@ |
460 | 456 | function getForm( $options ) { |
461 | 457 | global $wgScript; |
462 | 458 | |
463 | | - $options['title'] = SpecialPage::getTitleFor( 'DeletedContributions' )->getPrefixedText(); |
| 459 | + $options['title'] = $this->getTitle()->getPrefixedText(); |
464 | 460 | if ( !isset( $options['target'] ) ) { |
465 | 461 | $options['target'] = ''; |
466 | 462 | } else { |
Index: trunk/phase3/includes/specials/SpecialListusers.php |
— | — | @@ -34,25 +34,27 @@ |
35 | 35 | */ |
36 | 36 | class UsersPager extends AlphabeticPager { |
37 | 37 | |
38 | | - function __construct( $par=null ) { |
39 | | - global $wgRequest; |
| 38 | + function __construct( RequestContext $context = null, $par = null ) { |
| 39 | + parent::__construct( $context ); |
| 40 | + |
| 41 | + $request = $this->getRequest(); |
40 | 42 | $parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) ); |
41 | 43 | $symsForAll = array( '*', 'user' ); |
42 | 44 | if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) { |
43 | 45 | $this->requestedGroup = $par; |
44 | | - $un = $wgRequest->getText( 'username' ); |
| 46 | + $un = $request->getText( 'username' ); |
45 | 47 | } elseif ( count( $parms ) == 2 ) { |
46 | 48 | $this->requestedGroup = $parms[0]; |
47 | 49 | $un = $parms[1]; |
48 | 50 | } else { |
49 | | - $this->requestedGroup = $wgRequest->getVal( 'group' ); |
50 | | - $un = ( $par != '' ) ? $par : $wgRequest->getText( 'username' ); |
| 51 | + $this->requestedGroup = $request->getVal( 'group' ); |
| 52 | + $un = ( $par != '' ) ? $par : $request->getText( 'username' ); |
51 | 53 | } |
52 | 54 | if ( in_array( $this->requestedGroup, $symsForAll ) ) { |
53 | 55 | $this->requestedGroup = ''; |
54 | 56 | } |
55 | | - $this->editsOnly = $wgRequest->getBool( 'editsOnly' ); |
56 | | - $this->creationSort = $wgRequest->getBool( 'creationSort' ); |
| 57 | + $this->editsOnly = $request->getBool( 'editsOnly' ); |
| 58 | + $this->creationSort = $request->getBool( 'creationSort' ); |
57 | 59 | |
58 | 60 | $this->requestedUser = ''; |
59 | 61 | if ( $un != '' ) { |
— | — | @@ -64,20 +66,15 @@ |
65 | 67 | parent::__construct(); |
66 | 68 | } |
67 | 69 | |
68 | | - function getTitle() { |
69 | | - return SpecialPage::getTitleFor( 'Listusers' ); |
70 | | - } |
71 | | - |
72 | 70 | function getIndexField() { |
73 | 71 | return $this->creationSort ? 'user_id' : 'user_name'; |
74 | 72 | } |
75 | 73 | |
76 | 74 | function getQueryInfo() { |
77 | | - global $wgUser; |
78 | 75 | $dbr = wfGetDB( DB_SLAVE ); |
79 | 76 | $conds = array(); |
80 | 77 | // Don't show hidden names |
81 | | - if( !$wgUser->isAllowed('hideuser') ) { |
| 78 | + if( !$this->getUser()->isAllowed('hideuser') ) { |
82 | 79 | $conds[] = 'ipb_deleted IS NULL'; |
83 | 80 | } |
84 | 81 | |
— | — | @@ -126,8 +123,6 @@ |
127 | 124 | } |
128 | 125 | |
129 | 126 | function formatRow( $row ) { |
130 | | - global $wgLang; |
131 | | - |
132 | 127 | if ($row->user_id == 0) #Bug 16487 |
133 | 128 | return ''; |
134 | 129 | |
— | — | @@ -139,7 +134,7 @@ |
140 | 135 | $list = array(); |
141 | 136 | foreach( $groups_list as $group ) |
142 | 137 | $list[] = self::buildGroupLink( $group ); |
143 | | - $groups = $wgLang->commaList( $list ); |
| 138 | + $groups = $this->getLang()->commaList( $list ); |
144 | 139 | } else { |
145 | 140 | $groups = ''; |
146 | 141 | } |
— | — | @@ -151,7 +146,7 @@ |
152 | 147 | |
153 | 148 | global $wgEdititis; |
154 | 149 | if ( $wgEdititis ) { |
155 | | - $editCount = $wgLang->formatNum( $row->edits ); |
| 150 | + $editCount = $this->getLang()->formatNum( $row->edits ); |
156 | 151 | $edits = ' [' . wfMsgExt( 'usereditcount', array( 'parsemag', 'escape' ), $editCount ) . ']'; |
157 | 152 | } else { |
158 | 153 | $edits = ''; |
— | — | @@ -160,8 +155,8 @@ |
161 | 156 | $created = ''; |
162 | 157 | # Some rows may be NULL |
163 | 158 | if( $row->creation ) { |
164 | | - $d = $wgLang->date( wfTimestamp( TS_MW, $row->creation ), true ); |
165 | | - $t = $wgLang->time( wfTimestamp( TS_MW, $row->creation ), true ); |
| 159 | + $d = $this->getLang()->date( wfTimestamp( TS_MW, $row->creation ), true ); |
| 160 | + $t = $this->getLang()->time( wfTimestamp( TS_MW, $row->creation ), true ); |
166 | 161 | $created = ' (' . wfMsg( 'usercreated', $d, $t ) . ')'; |
167 | 162 | $created = htmlspecialchars( $created ); |
168 | 163 | } |
— | — | @@ -292,12 +287,10 @@ |
293 | 288 | * @param $par string (optional) A group to list users from |
294 | 289 | */ |
295 | 290 | public function execute( $par ) { |
296 | | - global $wgOut; |
297 | | - |
298 | 291 | $this->setHeaders(); |
299 | 292 | $this->outputHeader(); |
300 | 293 | |
301 | | - $up = new UsersPager( $par ); |
| 294 | + $up = new UsersPager( $this->getContext(), $par ); |
302 | 295 | |
303 | 296 | # getBody() first to check, if empty |
304 | 297 | $usersbody = $up->getBody(); |
— | — | @@ -311,6 +304,6 @@ |
312 | 305 | $s .= wfMessage( 'listusers-noresult' )->parseAsBlock(); |
313 | 306 | } |
314 | 307 | |
315 | | - $wgOut->addHTML( $s ); |
| 308 | + $this->getOutput()->addHTML( $s ); |
316 | 309 | } |
317 | 310 | } |
Index: trunk/phase3/includes/specials/SpecialActiveusers.php |
— | — | @@ -42,10 +42,13 @@ |
43 | 43 | */ |
44 | 44 | protected $groups; |
45 | 45 | |
46 | | - function __construct( $group = null ) { |
47 | | - global $wgRequest, $wgActiveUserDays; |
| 46 | + function __construct( RequestContext $context = null, $group = null ) { |
| 47 | + global $wgActiveUserDays; |
| 48 | + |
| 49 | + parent::__construct( $context ); |
| 50 | + |
48 | 51 | $this->RCMaxAge = $wgActiveUserDays; |
49 | | - $un = $wgRequest->getText( 'username' ); |
| 52 | + $un = $this->getRequest()->getText( 'username' ); |
50 | 53 | $this->requestedUser = ''; |
51 | 54 | if ( $un != '' ) { |
52 | 55 | $username = Title::makeTitleSafe( NS_USER, $un ); |
— | — | @@ -55,23 +58,15 @@ |
56 | 59 | } |
57 | 60 | |
58 | 61 | $this->setupOptions(); |
59 | | - |
60 | | - parent::__construct(); |
61 | 62 | } |
62 | 63 | |
63 | | - function getTitle() { |
64 | | - return SpecialPage::getTitleFor( 'Activeusers' ); |
65 | | - } |
66 | | - |
67 | 64 | public function setupOptions() { |
68 | | - global $wgRequest; |
69 | | - |
70 | 65 | $this->opts = new FormOptions(); |
71 | 66 | |
72 | 67 | $this->opts->add( 'hidebots', false, FormOptions::BOOL ); |
73 | 68 | $this->opts->add( 'hidesysops', false, FormOptions::BOOL ); |
74 | 69 | |
75 | | - $this->opts->fetchValuesFromRequest( $wgRequest ); |
| 70 | + $this->opts->fetchValuesFromRequest( $this->getRequest() ); |
76 | 71 | |
77 | 72 | $this->groups = array(); |
78 | 73 | if ( $this->opts->getValue( 'hidebots' ) == 1 ) { |
— | — | @@ -119,11 +114,10 @@ |
120 | 115 | } |
121 | 116 | |
122 | 117 | function formatRow( $row ) { |
123 | | - global $wgLang; |
124 | 118 | $userName = $row->user_name; |
125 | 119 | |
126 | | - $ulinks = $this->getSkin()->userLink( $row->user_id, $userName ); |
127 | | - $ulinks .= $this->getSkin()->userToolLinks( $row->user_id, $userName ); |
| 120 | + $ulinks = Linker::userLink( $row->user_id, $userName ); |
| 121 | + $ulinks .= Linker::userToolLinks( $row->user_id, $userName ); |
128 | 122 | |
129 | 123 | $list = array(); |
130 | 124 | foreach( self::getGroups( $row->user_id ) as $group ) { |
— | — | @@ -132,14 +126,14 @@ |
133 | 127 | } |
134 | 128 | $list[] = self::buildGroupLink( $group ); |
135 | 129 | } |
136 | | - $groups = $wgLang->commaList( $list ); |
| 130 | + $groups = $this->getLang()->commaList( $list ); |
137 | 131 | |
138 | 132 | $item = wfSpecialList( $ulinks, $groups ); |
139 | 133 | $count = wfMsgExt( 'activeusers-count', |
140 | 134 | array( 'parsemag' ), |
141 | | - $wgLang->formatNum( $row->recentedits ), |
| 135 | + $this->getLang()->formatNum( $row->recentedits ), |
142 | 136 | $userName, |
143 | | - $wgLang->formatNum ( $this->RCMaxAge ) |
| 137 | + $this->getLang()->formatNum( $this->RCMaxAge ) |
144 | 138 | ); |
145 | 139 | $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : ''; |
146 | 140 | |
— | — | @@ -188,18 +182,18 @@ |
189 | 183 | * @param $par Mixed: parameter passed to the page or null |
190 | 184 | */ |
191 | 185 | public function execute( $par ) { |
192 | | - global $wgOut, $wgLang, $wgActiveUserDays; |
| 186 | + global $wgActiveUserDays; |
193 | 187 | |
194 | 188 | $this->setHeaders(); |
195 | 189 | $this->outputHeader(); |
196 | 190 | |
197 | | - $up = new ActiveUsersPager(); |
| 191 | + $up = new ActiveUsersPager( $this->getContext() ); |
198 | 192 | |
199 | 193 | # getBody() first to check, if empty |
200 | 194 | $usersbody = $up->getBody(); |
201 | 195 | |
202 | 196 | $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), |
203 | | - wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) ) |
| 197 | + wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $wgActiveUserDays ) ) |
204 | 198 | ); |
205 | 199 | |
206 | 200 | $s .= $up->getPageHeader(); |
— | — | @@ -211,7 +205,7 @@ |
212 | 206 | $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) ); |
213 | 207 | } |
214 | 208 | |
215 | | - $wgOut->addHTML( $s ); |
| 209 | + $this->getOutput()->addHTML( $s ); |
216 | 210 | } |
217 | 211 | |
218 | 212 | } |
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php |
— | — | @@ -36,8 +36,6 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function execute( $par ) { |
40 | | - global $wgOut, $wgRequest; |
41 | | - |
42 | 40 | $this->setHeaders(); |
43 | 41 | $this->outputHeader(); |
44 | 42 | |
— | — | @@ -46,17 +44,18 @@ |
47 | 45 | Title::purgeExpiredRestrictions(); |
48 | 46 | } |
49 | 47 | |
50 | | - $type = $wgRequest->getVal( $this->IdType ); |
51 | | - $level = $wgRequest->getVal( $this->IdLevel ); |
52 | | - $sizetype = $wgRequest->getVal( 'sizetype' ); |
53 | | - $size = $wgRequest->getIntOrNull( 'size' ); |
54 | | - $NS = $wgRequest->getIntOrNull( 'namespace' ); |
55 | | - $indefOnly = $wgRequest->getBool( 'indefonly' ) ? 1 : 0; |
56 | | - $cascadeOnly = $wgRequest->getBool('cascadeonly') ? 1 : 0; |
| 48 | + $request = $this->getRequest(); |
| 49 | + $type = $request->getVal( $this->IdType ); |
| 50 | + $level = $request->getVal( $this->IdLevel ); |
| 51 | + $sizetype = $request->getVal( 'sizetype' ); |
| 52 | + $size = $request->getIntOrNull( 'size' ); |
| 53 | + $NS = $request->getIntOrNull( 'namespace' ); |
| 54 | + $indefOnly = $request->getBool( 'indefonly' ) ? 1 : 0; |
| 55 | + $cascadeOnly = $request->getBool('cascadeonly') ? 1 : 0; |
57 | 56 | |
58 | 57 | $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly, $cascadeOnly ); |
59 | 58 | |
60 | | - $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) ); |
| 59 | + $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) ); |
61 | 60 | |
62 | 61 | if( $pager->getNumRows() ) { |
63 | 62 | $s = $pager->getNavigationBar(); |
— | — | @@ -67,7 +66,7 @@ |
68 | 67 | } else { |
69 | 68 | $s = '<p>' . wfMsgHtml( 'protectedpagesempty' ) . '</p>'; |
70 | 69 | } |
71 | | - $wgOut->addHTML( $s ); |
| 70 | + $this->getOutput()->addHTML( $s ); |
72 | 71 | } |
73 | 72 | |
74 | 73 | /** |
— | — | @@ -76,19 +75,16 @@ |
77 | 76 | * @return string Formatted <li> element |
78 | 77 | */ |
79 | 78 | public function formatRow( $row ) { |
80 | | - global $wgUser, $wgLang; |
81 | | - |
82 | 79 | wfProfileIn( __METHOD__ ); |
83 | 80 | |
84 | | - static $skin = null, $infinity = null; |
| 81 | + static $infinity = null; |
85 | 82 | |
86 | | - if( is_null( $skin ) ){ |
87 | | - $skin = $this->getSkin(); |
| 83 | + if( is_null( $infinity ) ){ |
88 | 84 | $infinity = wfGetDB( DB_SLAVE )->getInfinity(); |
89 | 85 | } |
90 | 86 | |
91 | 87 | $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
92 | | - $link = $skin->link( $title ); |
| 88 | + $link = Linker::link( $title ); |
93 | 89 | |
94 | 90 | $description_items = array (); |
95 | 91 | |
— | — | @@ -101,27 +97,28 @@ |
102 | 98 | } |
103 | 99 | |
104 | 100 | $stxt = ''; |
| 101 | + $lang = $this->getLang(); |
105 | 102 | |
106 | | - $expiry = $wgLang->formatExpiry( $row->pr_expiry, TS_MW ); |
| 103 | + $expiry = $lang->formatExpiry( $row->pr_expiry, TS_MW ); |
107 | 104 | if( $expiry != $infinity ) { |
108 | 105 | |
109 | 106 | $expiry_description = wfMsg( |
110 | 107 | 'protect-expiring-local', |
111 | | - $wgLang->timeanddate( $expiry, true ), |
112 | | - $wgLang->date( $expiry, true ), |
113 | | - $wgLang->time( $expiry, true ) |
| 108 | + $lang->timeanddate( $expiry, true ), |
| 109 | + $lang->date( $expiry, true ), |
| 110 | + $lang->time( $expiry, true ) |
114 | 111 | ); |
115 | 112 | |
116 | 113 | $description_items[] = htmlspecialchars($expiry_description); |
117 | 114 | } |
118 | 115 | |
119 | 116 | if(!is_null($size = $row->page_len)) { |
120 | | - $stxt = $wgLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size ); |
| 117 | + $stxt = $lang->getDirMark() . ' ' . Linker::formatRevisionSize( $size ); |
121 | 118 | } |
122 | 119 | |
123 | 120 | # Show a link to the change protection form for allowed users otherwise a link to the protection log |
124 | | - if( $wgUser->isAllowed( 'protect' ) ) { |
125 | | - $changeProtection = ' (' . $skin->linkKnown( |
| 121 | + if( $this->getUser()->isAllowed( 'protect' ) ) { |
| 122 | + $changeProtection = ' (' . Linker::linkKnown( |
126 | 123 | $title, |
127 | 124 | wfMsgHtml( 'protect_change' ), |
128 | 125 | array(), |
— | — | @@ -129,7 +126,7 @@ |
130 | 127 | ) . ')'; |
131 | 128 | } else { |
132 | 129 | $ltitle = SpecialPage::getTitleFor( 'Log' ); |
133 | | - $changeProtection = ' (' . $skin->linkKnown( |
| 130 | + $changeProtection = ' (' . Linker::linkKnown( |
134 | 131 | $ltitle, |
135 | 132 | wfMsgHtml( 'protectlogpage' ), |
136 | 133 | array(), |
— | — | @@ -145,7 +142,7 @@ |
146 | 143 | return Html::rawElement( |
147 | 144 | 'li', |
148 | 145 | array(), |
149 | | - wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ), false ) . $changeProtection ) . "\n"; |
| 146 | + wfSpecialList( $link . $stxt, $lang->commaList( $description_items ), false ) . $changeProtection ) . "\n"; |
150 | 147 | } |
151 | 148 | |
152 | 149 | /** |
— | — | @@ -160,7 +157,7 @@ |
161 | 158 | */ |
162 | 159 | protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) { |
163 | 160 | global $wgScript; |
164 | | - $title = SpecialPage::getTitleFor( 'Protectedpages' ); |
| 161 | + $title = $this->getTitle(); |
165 | 162 | return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . |
166 | 163 | Xml::openElement( 'fieldset' ) . |
167 | 164 | Xml::element( 'legend', array(), wfMsg( 'protectedpages' ) ) . |
— | — | @@ -306,7 +303,7 @@ |
307 | 304 | $this->size = intval($size); |
308 | 305 | $this->indefonly = (bool)$indefonly; |
309 | 306 | $this->cascadeonly = (bool)$cascadeonly; |
310 | | - parent::__construct(); |
| 307 | + parent::__construct( $form->getContext() ); |
311 | 308 | } |
312 | 309 | |
313 | 310 | function getStartBody() { |
— | — | @@ -319,10 +316,6 @@ |
320 | 317 | return ''; |
321 | 318 | } |
322 | 319 | |
323 | | - function getTitle() { |
324 | | - return SpecialPage::getTitleFor( 'Protectedpages' ); |
325 | | - } |
326 | | - |
327 | 320 | function formatRow( $row ) { |
328 | 321 | return $this->mForm->formatRow( $row ); |
329 | 322 | } |
Index: trunk/phase3/includes/specials/SpecialNewimages.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | $this->setHeaders(); |
32 | 32 | $this->outputHeader(); |
33 | 33 | |
34 | | - $pager = new NewFilesPager( $par ); |
| 34 | + $pager = new NewFilesPager( $this->getContext(), $par ); |
35 | 35 | |
36 | 36 | if ( !$this->including() ) { |
37 | 37 | $form = $pager->getForm(); |
— | — | @@ -50,20 +50,13 @@ |
51 | 51 | */ |
52 | 52 | class NewFilesPager extends ReverseChronologicalPager { |
53 | 53 | |
54 | | - function __construct( $par = null ) { |
55 | | - global $wgRequest; |
| 54 | + function __construct( RequestContext $context, $par = null ) { |
| 55 | + $this->like = $context->getRequest()->getText( 'like' ); |
| 56 | + $this->showbots = $context->getRequest()->getBool( 'showbots' , 0 ); |
56 | 57 | |
57 | | - $this->like = $wgRequest->getText( 'like' ); |
58 | | - $this->showbots = $wgRequest->getBool( 'showbots' , 0 ); |
59 | | - $this->skin = $this->getSkin(); |
60 | | - |
61 | | - parent::__construct(); |
| 58 | + parent::__construct( $context ); |
62 | 59 | } |
63 | 60 | |
64 | | - function getTitle() { |
65 | | - return SpecialPage::getTitleFor( 'Newimages' ); |
66 | | - } |
67 | | - |
68 | 61 | function getQueryInfo() { |
69 | 62 | global $wgMiserMode; |
70 | 63 | $conds = $jconds = array(); |
— | — | @@ -113,24 +106,22 @@ |
114 | 107 | } |
115 | 108 | |
116 | 109 | function formatRow( $row ) { |
117 | | - global $wgLang; |
118 | | - |
119 | 110 | $name = $row->img_name; |
120 | 111 | $user = User::newFromId( $row->img_user ); |
121 | 112 | |
122 | 113 | $title = Title::makeTitle( NS_FILE, $name ); |
123 | | - $ul = $this->skin->link( $user->getUserpage(), $user->getName() ); |
| 114 | + $ul = Linker::link( $user->getUserpage(), $user->getName() ); |
124 | 115 | |
125 | 116 | $this->gallery->add( |
126 | 117 | $title, |
127 | 118 | "$ul<br />\n<i>" |
128 | | - . htmlspecialchars( $wgLang->timeanddate( $row->img_timestamp, true ) ) |
| 119 | + . htmlspecialchars( $this->getLang()->timeanddate( $row->img_timestamp, true ) ) |
129 | 120 | . "</i><br />\n" |
130 | 121 | ); |
131 | 122 | } |
132 | 123 | |
133 | 124 | function getForm() { |
134 | | - global $wgRequest, $wgMiserMode; |
| 125 | + global $wgMiserMode; |
135 | 126 | |
136 | 127 | $fields = array( |
137 | 128 | 'like' => array( |
— | — | @@ -142,16 +133,16 @@ |
143 | 134 | 'type' => 'check', |
144 | 135 | 'label' => wfMessage( 'showhidebots', wfMsg( 'show' ) ), |
145 | 136 | 'name' => 'showbots', |
146 | | - # 'default' => $wgRequest->getBool( 'showbots', 0 ), |
| 137 | + # 'default' => $this->getRequest()->getBool( 'showbots', 0 ), |
147 | 138 | ), |
148 | 139 | 'limit' => array( |
149 | 140 | 'type' => 'hidden', |
150 | | - 'default' => $wgRequest->getText( 'limit' ), |
| 141 | + 'default' => $this->getRequest()->getText( 'limit' ), |
151 | 142 | 'name' => 'limit', |
152 | 143 | ), |
153 | 144 | 'offset' => array( |
154 | 145 | 'type' => 'hidden', |
155 | | - 'default' => $wgRequest->getText( 'offset' ), |
| 146 | + 'default' => $this->getRequest()->getText( 'offset' ), |
156 | 147 | 'name' => 'offset', |
157 | 148 | ), |
158 | 149 | ); |
— | — | @@ -160,7 +151,7 @@ |
161 | 152 | unset( $fields['like'] ); |
162 | 153 | } |
163 | 154 | |
164 | | - $form = new HTMLForm( $fields ); |
| 155 | + $form = new HTMLForm( $fields, $this->getContext() ); |
165 | 156 | $form->setTitle( $this->getTitle() ); |
166 | 157 | $form->setSubmitText( wfMsg( 'ilsubmit' ) ); |
167 | 158 | $form->setMethod( 'get' ); |
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php |
— | — | @@ -40,12 +40,10 @@ |
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | | - * @param $request WebRequest |
45 | 44 | * @return void |
46 | 45 | */ |
47 | | - private function loadRequestParams( $request ) { |
48 | | - global $wgUser; |
49 | | - |
| 46 | + private function loadRequestParams() { |
| 47 | + $request = $this->getRequest(); |
50 | 48 | $this->mAction = $request->getVal( 'action' ); |
51 | 49 | $this->mTarget = $request->getVal( 'target' ); |
52 | 50 | $this->mDest = $request->getVal( 'dest' ); |
— | — | @@ -59,7 +57,7 @@ |
60 | 58 | } |
61 | 59 | $this->mComment = $request->getText( 'wpComment' ); |
62 | 60 | |
63 | | - $this->mMerge = $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ); |
| 61 | + $this->mMerge = $request->wasPosted() && $this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) ); |
64 | 62 | // target page |
65 | 63 | if( $this->mSubmitted ) { |
66 | 64 | $this->mTargetObj = Title::newFromURL( $this->mTarget ); |
— | — | @@ -83,19 +81,17 @@ |
84 | 82 | } |
85 | 83 | |
86 | 84 | public function execute( $par ) { |
87 | | - global $wgOut, $wgRequest, $wgUser; |
88 | | - |
89 | | - if ( wfReadOnly() ) { |
90 | | - $wgOut->readOnlyPage(); |
| 85 | + $user = $this->getUser(); |
| 86 | + if( !$this->userCanExecute( $user ) ) { |
| 87 | + $this->displayRestrictionError(); |
91 | 88 | return; |
92 | 89 | } |
93 | 90 | |
94 | | - if( !$this->userCanExecute( $wgUser ) ) { |
95 | | - $this->displayRestrictionError(); |
96 | | - return; |
| 91 | + if ( wfReadOnly() ) { |
| 92 | + throw new ReadOnlyError; |
97 | 93 | } |
98 | 94 | |
99 | | - $this->loadRequestParams( $wgRequest ); |
| 95 | + $this->loadRequestParams(); |
100 | 96 | |
101 | 97 | $this->setHeaders(); |
102 | 98 | $this->outputHeader(); |
— | — | @@ -132,7 +128,7 @@ |
133 | 129 | |
134 | 130 | if ( count( $errors ) ) { |
135 | 131 | $this->showMergeForm(); |
136 | | - $wgOut->addHTML( implode( "\n", $errors ) ); |
| 132 | + $this->getOutput()->addHTML( implode( "\n", $errors ) ); |
137 | 133 | } else { |
138 | 134 | $this->showHistory(); |
139 | 135 | } |
— | — | @@ -140,11 +136,11 @@ |
141 | 137 | } |
142 | 138 | |
143 | 139 | function showMergeForm() { |
144 | | - global $wgOut, $wgScript; |
| 140 | + global $wgScript; |
145 | 141 | |
146 | | - $wgOut->addWikiMsg( 'mergehistory-header' ); |
| 142 | + $this->getOutput()->addWikiMsg( 'mergehistory-header' ); |
147 | 143 | |
148 | | - $wgOut->addHTML( |
| 144 | + $this->getOutput()->addHTML( |
149 | 145 | Xml::openElement( 'form', array( |
150 | 146 | 'method' => 'get', |
151 | 147 | 'action' => $wgScript ) ) . |
— | — | @@ -171,12 +167,9 @@ |
172 | 168 | } |
173 | 169 | |
174 | 170 | private function showHistory() { |
175 | | - global $wgUser, $wgOut; |
| 171 | + $out = $this->getOutput(); |
| 172 | + $out->setPageTitle( wfMsg( 'mergehistory' ) ); |
176 | 173 | |
177 | | - $this->sk = $this->getSkin(); |
178 | | - |
179 | | - $wgOut->setPageTitle( wfMsg( 'mergehistory' ) ); |
180 | | - |
181 | 174 | $this->showMergeForm(); |
182 | 175 | |
183 | 176 | # List all stored revisions |
— | — | @@ -196,7 +189,7 @@ |
197 | 190 | 'id' => 'merge' |
198 | 191 | ) |
199 | 192 | ); |
200 | | - $wgOut->addHTML( $top ); |
| 193 | + $out->addHTML( $top ); |
201 | 194 | |
202 | 195 | if( $haveRevisions ) { |
203 | 196 | # Format the user-visible controls (comment field, submission button) |
— | — | @@ -223,27 +216,27 @@ |
224 | 217 | Xml::closeElement( 'table' ) . |
225 | 218 | Xml::closeElement( 'fieldset' ); |
226 | 219 | |
227 | | - $wgOut->addHTML( $table ); |
| 220 | + $out->addHTML( $table ); |
228 | 221 | } |
229 | 222 | |
230 | | - $wgOut->addHTML( |
| 223 | + $out->addHTML( |
231 | 224 | '<h2 id="mw-mergehistory">' . |
232 | 225 | wfMsgHtml( 'mergehistory-list' ) . "</h2>\n" |
233 | 226 | ); |
234 | 227 | |
235 | 228 | if( $haveRevisions ) { |
236 | | - $wgOut->addHTML( $revisions->getNavigationBar() ); |
237 | | - $wgOut->addHTML( '<ul>' ); |
238 | | - $wgOut->addHTML( $revisions->getBody() ); |
239 | | - $wgOut->addHTML( '</ul>' ); |
240 | | - $wgOut->addHTML( $revisions->getNavigationBar() ); |
| 229 | + $out->addHTML( $revisions->getNavigationBar() ); |
| 230 | + $out->addHTML( '<ul>' ); |
| 231 | + $out->addHTML( $revisions->getBody() ); |
| 232 | + $out->addHTML( '</ul>' ); |
| 233 | + $out->addHTML( $revisions->getNavigationBar() ); |
241 | 234 | } else { |
242 | | - $wgOut->addWikiMsg( 'mergehistory-empty' ); |
| 235 | + $out->addWikiMsg( 'mergehistory-empty' ); |
243 | 236 | } |
244 | 237 | |
245 | 238 | # Show relevant lines from the deletion log: |
246 | | - $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" ); |
247 | | - LogEventsList::showLogExtract( $wgOut, 'merge', $this->mTargetObj->getPrefixedText() ); |
| 239 | + $out->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" ); |
| 240 | + LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj->getPrefixedText() ); |
248 | 241 | |
249 | 242 | # When we submit, go by page ID to avoid some nasty but unlikely collisions. |
250 | 243 | # Such would happen if a page was renamed after the form loaded, but before submit |
— | — | @@ -251,16 +244,14 @@ |
252 | 245 | $misc .= Html::hidden( 'destID', $this->mDestObj->getArticleID() ); |
253 | 246 | $misc .= Html::hidden( 'target', $this->mTarget ); |
254 | 247 | $misc .= Html::hidden( 'dest', $this->mDest ); |
255 | | - $misc .= Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 248 | + $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() ); |
256 | 249 | $misc .= Xml::closeElement( 'form' ); |
257 | | - $wgOut->addHTML( $misc ); |
| 250 | + $out->addHTML( $misc ); |
258 | 251 | |
259 | 252 | return true; |
260 | 253 | } |
261 | 254 | |
262 | 255 | function formatRevisionRow( $row ) { |
263 | | - global $wgLang; |
264 | | - |
265 | 256 | $rev = new Revision( $row ); |
266 | 257 | |
267 | 258 | $stxt = ''; |
— | — | @@ -269,9 +260,9 @@ |
270 | 261 | $ts = wfTimestamp( TS_MW, $row->rev_timestamp ); |
271 | 262 | $checkBox = Xml::radio( 'mergepoint', $ts, false ); |
272 | 263 | |
273 | | - $pageLink = $this->sk->linkKnown( |
| 264 | + $pageLink = Linker::linkKnown( |
274 | 265 | $rev->getTitle(), |
275 | | - htmlspecialchars( $wgLang->timeanddate( $ts ) ), |
| 266 | + htmlspecialchars( $this->getLang()->timeanddate( $ts ) ), |
276 | 267 | array(), |
277 | 268 | array( 'oldid' => $rev->getId() ) |
278 | 269 | ); |
— | — | @@ -283,7 +274,7 @@ |
284 | 275 | if( !$rev->userCan( Revision::DELETED_TEXT ) ) { |
285 | 276 | $last = $this->message['last']; |
286 | 277 | } elseif( isset( $this->prevId[$row->rev_id] ) ) { |
287 | | - $last = $this->sk->linkKnown( |
| 278 | + $last = Linker::linkKnown( |
288 | 279 | $rev->getTitle(), |
289 | 280 | $this->message['last'], |
290 | 281 | array(), |
— | — | @@ -294,13 +285,13 @@ |
295 | 286 | ); |
296 | 287 | } |
297 | 288 | |
298 | | - $userLink = $this->sk->revUserTools( $rev ); |
| 289 | + $userLink = Linker::revUserTools( $rev ); |
299 | 290 | |
300 | 291 | $size = $row->rev_len; |
301 | 292 | if( !is_null( $size ) ) { |
302 | | - $stxt = $this->sk->formatRevisionSize( $size ); |
| 293 | + $stxt = Linker::formatRevisionSize( $size ); |
303 | 294 | } |
304 | | - $comment = $this->sk->revComment( $rev ); |
| 295 | + $comment = Linker::revComment( $rev ); |
305 | 296 | |
306 | 297 | return "<li>$checkBox ($last) $pageLink . . $userLink $stxt $comment</li>"; |
307 | 298 | } |
— | — | @@ -310,15 +301,13 @@ |
311 | 302 | * @return string |
312 | 303 | */ |
313 | 304 | function getPageLink( $row, $titleObj, $ts, $target ) { |
314 | | - global $wgLang; |
315 | | - |
316 | 305 | if( !$this->userCan( $row, Revision::DELETED_TEXT ) ) { |
317 | 306 | return '<span class="history-deleted">' . |
318 | | - $wgLang->timeanddate( $ts, true ) . '</span>'; |
| 307 | + $this->getLang()->timeanddate( $ts, true ) . '</span>'; |
319 | 308 | } else { |
320 | | - $link = $this->sk->linkKnown( |
| 309 | + $link = Linker::linkKnown( |
321 | 310 | $titleObj, |
322 | | - $wgLang->timeanddate( $ts, true ), |
| 311 | + $this->getLang()->timeanddate( $ts, true ), |
323 | 312 | array(), |
324 | 313 | array( |
325 | 314 | 'target' => $target, |
— | — | @@ -333,7 +322,6 @@ |
334 | 323 | } |
335 | 324 | |
336 | 325 | function merge() { |
337 | | - global $wgOut; |
338 | 326 | # Get the titles directly from the IDs, in case the target page params |
339 | 327 | # were spoofed. The queries are done based on the IDs, so it's best to |
340 | 328 | # keep it consistent... |
— | — | @@ -359,7 +347,7 @@ |
360 | 348 | ); |
361 | 349 | # Destination page must exist with revisions |
362 | 350 | if( !$maxtimestamp ) { |
363 | | - $wgOut->addWikiMsg( 'mergehistory-fail' ); |
| 351 | + $this->getOutput()->addWikiMsg( 'mergehistory-fail' ); |
364 | 352 | return false; |
365 | 353 | } |
366 | 354 | # Get the latest timestamp of the source |
— | — | @@ -371,7 +359,7 @@ |
372 | 360 | ); |
373 | 361 | # $this->mTimestamp must be older than $maxtimestamp |
374 | 362 | if( $this->mTimestamp >= $maxtimestamp ) { |
375 | | - $wgOut->addWikiMsg( 'mergehistory-fail' ); |
| 363 | + $this->getOutput()->addWikiMsg( 'mergehistory-fail' ); |
376 | 364 | return false; |
377 | 365 | } |
378 | 366 | # Update the revisions |
— | — | @@ -440,7 +428,7 @@ |
441 | 429 | $destTitle->invalidateCache(); // update histories |
442 | 430 | # Check if this did anything |
443 | 431 | if( !$count ) { |
444 | | - $wgOut->addWikiMsg( 'mergehistory-fail' ); |
| 432 | + $this->getOutput()->addWikiMsg( 'mergehistory-fail' ); |
445 | 433 | return false; |
446 | 434 | } |
447 | 435 | # Update our logs |
— | — | @@ -450,7 +438,7 @@ |
451 | 439 | array( $destTitle->getPrefixedText(), $timestampLimit ) |
452 | 440 | ); |
453 | 441 | |
454 | | - $wgOut->addHTML( |
| 442 | + $this->getOutput()->addHTML( |
455 | 443 | wfMsgExt( 'mergehistory-success', array('parseinline'), |
456 | 444 | $targetTitle->getPrefixedText(), $destTitle->getPrefixedText(), $count ) ); |
457 | 445 | |
— | — | @@ -478,13 +466,9 @@ |
479 | 467 | ); |
480 | 468 | $this->maxTimestamp = $maxtimestamp; |
481 | 469 | |
482 | | - parent::__construct(); |
| 470 | + parent::__construct( $form->getContext() ); |
483 | 471 | } |
484 | 472 | |
485 | | - function getTitle() { |
486 | | - return SpecialPage::getTitleFor( 'Contributions' ); |
487 | | - } |
488 | | - |
489 | 473 | function getStartBody() { |
490 | 474 | wfProfileIn( __METHOD__ ); |
491 | 475 | # Do a link batch query |
Index: trunk/phase3/includes/Pager.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | * |
59 | 59 | * @ingroup Pager |
60 | 60 | */ |
61 | | -abstract class IndexPager implements Pager { |
| 61 | +abstract class IndexPager extends ContextSource implements Pager { |
62 | 62 | public $mRequest; |
63 | 63 | public $mLimitsShown = array( 20, 50, 100, 250, 500 ); |
64 | 64 | public $mDefaultLimit = 50; |
— | — | @@ -103,17 +103,20 @@ |
104 | 104 | */ |
105 | 105 | public $mResult; |
106 | 106 | |
107 | | - public function __construct() { |
108 | | - global $wgRequest, $wgUser; |
109 | | - $this->mRequest = $wgRequest; |
| 107 | + public function __construct( RequestContext $context = null ) { |
| 108 | + if ( $context ) { |
| 109 | + $this->setContext( $context ); |
| 110 | + } |
110 | 111 | |
| 112 | + $this->mRequest = $this->getRequest(); |
| 113 | + |
111 | 114 | # NB: the offset is quoted, not validated. It is treated as an |
112 | 115 | # arbitrary string to support the widest variety of index types. Be |
113 | 116 | # careful outputting it into HTML! |
114 | 117 | $this->mOffset = $this->mRequest->getText( 'offset' ); |
115 | 118 | |
116 | 119 | # Use consistent behavior for the limit options |
117 | | - $this->mDefaultLimit = intval( $wgUser->getOption( 'rclimit' ) ); |
| 120 | + $this->mDefaultLimit = intval( $this->getUser()->getOption( 'rclimit' ) ); |
118 | 121 | list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset(); |
119 | 122 | |
120 | 123 | $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' ); |
— | — | @@ -186,13 +189,13 @@ |
187 | 190 | } |
188 | 191 | |
189 | 192 | /** |
190 | | - * Set the offset from an other source than $wgRequest |
| 193 | + * Set the offset from an other source than the request |
191 | 194 | */ |
192 | 195 | function setOffset( $offset ) { |
193 | 196 | $this->mOffset = $offset; |
194 | 197 | } |
195 | 198 | /** |
196 | | - * Set the limit from an other source than $wgRequest |
| 199 | + * Set the limit from an other source than the request |
197 | 200 | */ |
198 | 201 | function setLimit( $limit ) { |
199 | 202 | $this->mLimit = $limit; |
— | — | @@ -366,12 +369,11 @@ |
367 | 370 | if( $type ) { |
368 | 371 | $attrs['class'] = "mw-{$type}link"; |
369 | 372 | } |
370 | | - return $this->getSkin()->link( |
| 373 | + return Linker::linkKnown( |
371 | 374 | $this->getTitle(), |
372 | 375 | $text, |
373 | 376 | $attrs, |
374 | | - $query + $this->getDefaultQuery(), |
375 | | - array( 'noclasses', 'known' ) |
| 377 | + $query + $this->getDefaultQuery() |
376 | 378 | ); |
377 | 379 | } |
378 | 380 | |
— | — | @@ -405,29 +407,6 @@ |
406 | 408 | } |
407 | 409 | |
408 | 410 | /** |
409 | | - * Title used for self-links. Override this if you want to be able to |
410 | | - * use a title other than $wgTitle |
411 | | - * |
412 | | - * @return Title object |
413 | | - */ |
414 | | - function getTitle() { |
415 | | - return $GLOBALS['wgTitle']; |
416 | | - } |
417 | | - |
418 | | - /** |
419 | | - * Get the current skin. This can be overridden if necessary. |
420 | | - * |
421 | | - * @return Skin object |
422 | | - */ |
423 | | - function getSkin() { |
424 | | - if ( !isset( $this->mSkin ) ) { |
425 | | - global $wgUser; |
426 | | - $this->mSkin = $wgUser->getSkin(); |
427 | | - } |
428 | | - return $this->mSkin; |
429 | | - } |
430 | | - |
431 | | - /** |
432 | 411 | * Get an array of query parameters that should be put into self-links. |
433 | 412 | * By default, all parameters passed in the URL are used, except for a |
434 | 413 | * short blacklist. |
— | — | @@ -435,10 +414,8 @@ |
436 | 415 | * @return Associative array |
437 | 416 | */ |
438 | 417 | function getDefaultQuery() { |
439 | | - global $wgRequest; |
440 | | - |
441 | 418 | if ( !isset( $this->mDefaultQuery ) ) { |
442 | | - $this->mDefaultQuery = $wgRequest->getQueryValues(); |
| 419 | + $this->mDefaultQuery = $this->getRequest()->getQueryValues(); |
443 | 420 | unset( $this->mDefaultQuery['title'] ); |
444 | 421 | unset( $this->mDefaultQuery['dir'] ); |
445 | 422 | unset( $this->mDefaultQuery['offset'] ); |
— | — | @@ -542,7 +519,6 @@ |
543 | 520 | } |
544 | 521 | |
545 | 522 | function getLimitLinks() { |
546 | | - global $wgLang; |
547 | 523 | $links = array(); |
548 | 524 | if ( $this->mIsBackwards ) { |
549 | 525 | $offset = $this->mPastTheEndIndex; |
— | — | @@ -551,7 +527,7 @@ |
552 | 528 | } |
553 | 529 | foreach ( $this->mLimitsShown as $limit ) { |
554 | 530 | $links[] = $this->makeLink( |
555 | | - $wgLang->formatNum( $limit ), |
| 531 | + $this->getLang()->formatNum( $limit ), |
556 | 532 | array( 'offset' => $offset, 'limit' => $limit ), |
557 | 533 | 'num' |
558 | 534 | ); |
— | — | @@ -648,25 +624,25 @@ |
649 | 625 | * didn't want to do class magic as may be still revamped |
650 | 626 | */ |
651 | 627 | function getNavigationBar() { |
652 | | - global $wgLang; |
653 | | - |
654 | 628 | if ( !$this->isNavigationBarShown() ) return ''; |
655 | 629 | |
656 | 630 | if( isset( $this->mNavigationBar ) ) { |
657 | 631 | return $this->mNavigationBar; |
658 | 632 | } |
659 | 633 | |
| 634 | + $lang = $this->getLang(); |
| 635 | + |
660 | 636 | $opts = array( 'parsemag', 'escapenoentities' ); |
661 | 637 | $linkTexts = array( |
662 | 638 | 'prev' => wfMsgExt( |
663 | 639 | 'prevn', |
664 | 640 | $opts, |
665 | | - $wgLang->formatNum( $this->mLimit ) |
| 641 | + $lang->formatNum( $this->mLimit ) |
666 | 642 | ), |
667 | 643 | 'next' => wfMsgExt( |
668 | 644 | 'nextn', |
669 | 645 | $opts, |
670 | | - $wgLang->formatNum($this->mLimit ) |
| 646 | + $lang->formatNum($this->mLimit ) |
671 | 647 | ), |
672 | 648 | 'first' => wfMsgExt( 'page_first', $opts ), |
673 | 649 | 'last' => wfMsgExt( 'page_last', $opts ) |
— | — | @@ -674,10 +650,10 @@ |
675 | 651 | |
676 | 652 | $pagingLinks = $this->getPagingLinks( $linkTexts ); |
677 | 653 | $limitLinks = $this->getLimitLinks(); |
678 | | - $limits = $wgLang->pipeList( $limitLinks ); |
| 654 | + $limits = $lang->pipeList( $limitLinks ); |
679 | 655 | |
680 | 656 | $this->mNavigationBar = |
681 | | - "(" . $wgLang->pipeList( |
| 657 | + "(" . $lang->pipeList( |
682 | 658 | array( $pagingLinks['first'], |
683 | 659 | $pagingLinks['last'] ) |
684 | 660 | ) . ") " . |
— | — | @@ -738,13 +714,7 @@ |
739 | 715 | public $mYear; |
740 | 716 | public $mMonth; |
741 | 717 | |
742 | | - function __construct() { |
743 | | - parent::__construct(); |
744 | | - } |
745 | | - |
746 | 718 | function getNavigationBar() { |
747 | | - global $wgLang; |
748 | | - |
749 | 719 | if ( !$this->isNavigationBarShown() ) { |
750 | 720 | return ''; |
751 | 721 | } |
— | — | @@ -752,7 +722,8 @@ |
753 | 723 | if ( isset( $this->mNavigationBar ) ) { |
754 | 724 | return $this->mNavigationBar; |
755 | 725 | } |
756 | | - $nicenumber = $wgLang->formatNum( $this->mLimit ); |
| 726 | + |
| 727 | + $nicenumber = $this->getLang()->formatNum( $this->mLimit ); |
757 | 728 | $linkTexts = array( |
758 | 729 | 'prev' => wfMsgExt( |
759 | 730 | 'pager-newer-n', |
— | — | @@ -770,7 +741,7 @@ |
771 | 742 | |
772 | 743 | $pagingLinks = $this->getPagingLinks( $linkTexts ); |
773 | 744 | $limitLinks = $this->getLimitLinks(); |
774 | | - $limits = $wgLang->pipeList( $limitLinks ); |
| 745 | + $limits = $this->getLang()->pipeList( $limitLinks ); |
775 | 746 | |
776 | 747 | $this->mNavigationBar = "({$pagingLinks['first']}" . |
777 | 748 | wfMsgExt( 'pipe-separator' , 'escapenoentities' ) . |
— | — | @@ -839,15 +810,18 @@ |
840 | 811 | var $mSort; |
841 | 812 | var $mCurrentRow; |
842 | 813 | |
843 | | - function __construct() { |
844 | | - global $wgRequest; |
845 | | - $this->mSort = $wgRequest->getText( 'sort' ); |
| 814 | + function __construct( RequestContext $context = null ) { |
| 815 | + if ( $context ) { |
| 816 | + $this->setContext( $context ); |
| 817 | + } |
| 818 | + |
| 819 | + $this->mSort = $this->getRequest()->getText( 'sort' ); |
846 | 820 | if ( !array_key_exists( $this->mSort, $this->getFieldNames() ) ) { |
847 | 821 | $this->mSort = $this->getDefaultSort(); |
848 | 822 | } |
849 | | - if ( $wgRequest->getBool( 'asc' ) ) { |
| 823 | + if ( $this->getRequest()->getBool( 'asc' ) ) { |
850 | 824 | $this->mDefaultDirection = false; |
851 | | - } elseif ( $wgRequest->getBool( 'desc' ) ) { |
| 825 | + } elseif ( $this->getRequest()->getBool( 'desc' ) ) { |
852 | 826 | $this->mDefaultDirection = true; |
853 | 827 | } /* Else leave it at whatever the class default is */ |
854 | 828 | |
— | — | @@ -985,7 +959,7 @@ |
986 | 960 | * A navigation bar with images |
987 | 961 | */ |
988 | 962 | function getNavigationBar() { |
989 | | - global $wgStylePath, $wgLang; |
| 963 | + global $wgStylePath; |
990 | 964 | |
991 | 965 | if ( !$this->isNavigationBarShown() ) { |
992 | 966 | return ''; |
— | — | @@ -1010,7 +984,7 @@ |
1011 | 985 | 'next' => 'arrow_disabled_right_25.png', |
1012 | 986 | 'last' => 'arrow_disabled_last_25.png', |
1013 | 987 | ); |
1014 | | - if( $wgLang->isRTL() ) { |
| 988 | + if( $this->getLang()->isRTL() ) { |
1015 | 989 | $keys = array_keys( $labels ); |
1016 | 990 | $images = array_combine( $keys, array_reverse( $images ) ); |
1017 | 991 | $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) ); |
— | — | @@ -1041,8 +1015,6 @@ |
1042 | 1016 | * @return String: HTML fragment |
1043 | 1017 | */ |
1044 | 1018 | function getLimitSelect() { |
1045 | | - global $wgLang; |
1046 | | - |
1047 | 1019 | # Add the current limit from the query string |
1048 | 1020 | # to avoid that the limit is lost after clicking Go next time |
1049 | 1021 | if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) { |
— | — | @@ -1056,7 +1028,7 @@ |
1057 | 1029 | # will be a string. |
1058 | 1030 | if( is_int( $value ) ){ |
1059 | 1031 | $limit = $value; |
1060 | | - $text = $wgLang->formatNum( $limit ); |
| 1032 | + $text = $this->getLang()->formatNum( $limit ); |
1061 | 1033 | } else { |
1062 | 1034 | $limit = $key; |
1063 | 1035 | $text = $value; |
— | — | @@ -1075,10 +1047,8 @@ |
1076 | 1048 | * @return String: HTML fragment |
1077 | 1049 | */ |
1078 | 1050 | function getHiddenFields( $blacklist = array() ) { |
1079 | | - global $wgRequest; |
1080 | | - |
1081 | 1051 | $blacklist = (array)$blacklist; |
1082 | | - $query = $wgRequest->getQueryValues(); |
| 1052 | + $query = $this->getRequest()->getQueryValues(); |
1083 | 1053 | foreach ( $blacklist as $name ) { |
1084 | 1054 | unset( $query[$name] ); |
1085 | 1055 | } |