r97658 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97657‎ | r97658 | r97659 >
Date:20:00, 20 September 2011
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* Made IndexPager extend ContextSource
* Updated special pages using IndexPager or one if its subclasses to pass the context object and use it instead of global variables
* Call Linker methods statically
* Changed LogPager::getUser() to LogPager::getAuthor() to avoid conflict with ContextSource::getUser()
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/Pager.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialActiveusers.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlockList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialCategories.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListfiles.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListusers.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialLog.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMergeHistory.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialNewimages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialNewpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialProtectedpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialProtectedtitles.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -213,6 +213,10 @@
214214 return $this->out->getTitle();
215215 }
216216
 217+ public function getContext() {
 218+ return $this->out->getContext();
 219+ }
 220+
217221 /**
218222 * @param $queryTypes Array
219223 * @return String: Formatted HTML
@@ -630,7 +634,6 @@
631635 public static function showLogExtract(
632636 &$out, $types=array(), $page='', $user='', $param = array()
633637 ) {
634 - global $wgUser, $wgOut;
635638 $defaultParameters = array(
636639 'lim' => 25,
637640 'conds' => array(),
@@ -652,8 +655,15 @@
653656 if ( !is_array( $msgKey ) ) {
654657 $msgKey = array( $msgKey );
655658 }
 659+
 660+ if ( $out instanceof OutputPage ) {
 661+ $context = $out->getContext();
 662+ } else {
 663+ $context = RequestContext::getMain();
 664+ }
 665+
656666 # 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 );
658668 $pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
659669 if ( isset( $param['offset'] ) ) { # Tell pager to ignore $wgRequest offset
660670 $pager->setOffset( $param['offset'] );
@@ -769,7 +779,7 @@
770780 * @ingroup Pager
771781 */
772782 class LogPager extends ReverseChronologicalPager {
773 - private $types = array(), $user = '', $title = '', $pattern = '';
 783+ private $types = array(), $author = '', $title = '', $pattern = '';
774784 private $typeCGI = '';
775785 public $mLogEventsList;
776786
@@ -778,7 +788,7 @@
779789 *
780790 * @param $list LogEventsList
781791 * @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
783793 * @param $title String: the page title the log entries are for
784794 * @param $pattern String: do a prefix search rather than an exact title match
785795 * @param $conds Array: extra conditions for the query
@@ -786,15 +796,15 @@
787797 * @param $month Integer: the month to start from
788798 * @param $tagFilter String: tag
789799 */
790 - public function __construct( $list, $types = array(), $user = '', $title = '', $pattern = '',
 800+ public function __construct( $list, $types = array(), $author = '', $title = '', $pattern = '',
791801 $conds = array(), $year = false, $month = false, $tagFilter = '' ) {
792 - parent::__construct();
 802+ parent::__construct( $list->getContext() );
793803 $this->mConds = $conds;
794804
795805 $this->mLogEventsList = $list;
796806
797807 $this->limitType( $types ); // also excludes hidden types
798 - $this->limitUser( $user );
 808+ $this->limitAuthor( $author );
799809 $this->limitTitle( $title, $pattern );
800810 $this->getDateCond( $year, $month );
801811 $this->mTagFilter = $tagFilter;
@@ -803,19 +813,12 @@
804814 public function getDefaultQuery() {
805815 $query = parent::getDefaultQuery();
806816 $query['type'] = $this->typeCGI; // arrays won't work here
807 - $query['user'] = $this->user;
 817+ $query['user'] = $this->author;
808818 $query['month'] = $this->mMonth;
809819 $query['year'] = $this->mYear;
810820 return $query;
811821 }
812822
813 - /**
814 - * @return Title
815 - */
816 - function getTitle() {
817 - return $this->mLogEventsList->getDisplayTitle();
818 - }
819 -
820823 // Call ONLY after calling $this->limitType() already!
821824 public function getFilterParams() {
822825 global $wgFilterLogTypes, $wgUser, $wgRequest;
@@ -874,7 +877,7 @@
875878 *
876879 * @param $name String: (In)valid user name
877880 */
878 - private function limitUser( $name ) {
 881+ private function limitAuthor( $name ) {
879882 if( $name == '' ) {
880883 return false;
881884 }
@@ -898,7 +901,7 @@
899902 $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
900903 ' != ' . LogPage::SUPPRESSED_USER;
901904 }
902 - $this->user = $usertitle->getText();
 905+ $this->author = $usertitle->getText();
903906 }
904907 }
905908
@@ -982,7 +985,7 @@
983986 # Avoid usage of the wrong index by limiting
984987 # the choices of available indexes. This mainly
985988 # avoids site-breaking filesorts.
986 - } elseif( $this->title || $this->pattern || $this->user ) {
 989+ } elseif( $this->title || $this->pattern || $this->author ) {
987990 $index['logging'] = array( 'page_time', 'user_time' );
988991 if( count($this->types) == 1 ) {
989992 $index['logging'][] = 'log_user_type_time';
@@ -1053,8 +1056,8 @@
10541057 /**
10551058 * @return string
10561059 */
1057 - public function getUser() {
1058 - return $this->user;
 1060+ public function getAuthor() {
 1061+ return $this->author;
10591062 }
10601063
10611064 /**
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -103,14 +103,14 @@
104104 public $custom;
105105
106106 function __construct( $page, $conds, $langObj = null ) {
107 - parent::__construct();
 107+ parent::__construct( $page->getContext() );
108108 $this->mIndexField = 'am_title';
109109 $this->mPage = $page;
110110 $this->mConds = $conds;
111111 $this->mDefaultDirection = true; // always sort ascending
112112 $this->mLimitsShown = array( 20, 50, 100, 250, 500, 5000 );
113113
114 - global $wgLang, $wgContLang, $wgRequest;
 114+ global $wgContLang;
115115
116116 $this->talk = htmlspecialchars( wfMsg( 'talkpagelinktext' ) );
117117
@@ -118,14 +118,16 @@
119119 $this->langcode = $this->lang->getCode();
120120 $this->foreign = $this->langcode != $wgContLang->getCode();
121121
122 - if( $wgRequest->getVal( 'filter', 'all' ) === 'all' ){
 122+ $request = $this->getRequest();
 123+
 124+ if( $request->getVal( 'filter', 'all' ) === 'all' ){
123125 $this->custom = null; // So won't match in either case
124126 } else {
125 - $this->custom = ($wgRequest->getVal( 'filter' ) == 'unmodified');
 127+ $this->custom = ($request->getVal( 'filter' ) == 'unmodified');
126128 }
127129
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;
130132 if( $prefix !== null ){
131133 $this->displayPrefix = $prefix->getDBkey();
132134 $this->prefix = '/^' . preg_quote( $this->displayPrefix ) . '/i';
@@ -337,7 +339,6 @@
338340 }
339341
340342 function formatValue( $field, $value ){
341 - global $wgLang;
342343 switch( $field ){
343344
344345 case 'am_title' :
@@ -346,11 +347,11 @@
347348 $talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix );
348349
349350 if( $this->mCurrentRow->am_customised ){
350 - $title = Linker::linkKnown( $title, $wgLang->lcfirst( $value ) );
 351+ $title = Linker::linkKnown( $title, $this->getLang()->lcfirst( $value ) );
351352 } else {
352353 $title = Linker::link(
353354 $title,
354 - $wgLang->lcfirst( $value ),
 355+ $this->getLang()->lcfirst( $value ),
355356 array(),
356357 array(),
357358 array( 'broken' )
@@ -395,12 +396,11 @@
396397
397398 function getRowAttrs( $row, $isSecond = false ){
398399 $arr = array();
399 - global $wgLang;
400400 if( $row->am_customised ){
401401 $arr['class'] = 'allmessages-customised';
402402 }
403403 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 ) );
405405 }
406406 return $arr;
407407 }
Index: trunk/phase3/includes/specials/SpecialNewpages.php
@@ -194,7 +194,7 @@
195195 $self = $this->getTitle();
196196 foreach ( $filters as $key => $msg ) {
197197 $onoff = 1 - $this->opts->getValue( $key );
198 - $link = $this->getSkin()->link( $self, $showhide[$onoff], array(),
 198+ $link = Linker::link( $self, $showhide[$onoff], array(),
199199 array( $key => $onoff ) + $changed
200200 );
201201 $links[$key] = wfMsgHtml( $msg, $link );
@@ -315,14 +315,14 @@
316316 $query['rcid'] = $result->rc_id;
317317 }
318318
319 - $plink = $this->getSkin()->linkKnown(
 319+ $plink = Linker::linkKnown(
320320 $title,
321321 null,
322322 array( 'class' => 'mw-newpages-pagename' ),
323323 $query,
324324 array( 'known' ) // Set explicitly to avoid the default of 'known','noclasses'. This breaks the colouration for stubs
325325 );
326 - $histLink = $this->getSkin()->linkKnown(
 326+ $histLink = Linker::linkKnown(
327327 $title,
328328 wfMsgHtml( 'hist' ),
329329 array(),
@@ -335,8 +335,8 @@
336336 ']'
337337 );
338338
339 - $ulink = $this->getSkin()->revUserTools( $rev );
340 - $comment = $this->getSkin()->revComment( $rev );
 339+ $ulink = Linker::revUserTools( $rev );
 340+ $comment = Linker::revComment( $rev );
341341
342342 if ( $this->patrollable( $result ) ) {
343343 $classes[] = 'not-patrolled';
@@ -461,33 +461,11 @@
462462 protected $mForm;
463463
464464 function __construct( $form, FormOptions $opts ) {
465 - parent::__construct();
 465+ parent::__construct( $form->getContext() );
466466 $this->mForm = $form;
467467 $this->opts = $opts;
468468 }
469469
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 -
492470 function getQueryInfo() {
493471 global $wgEnableNewpagesUserFilter, $wgGroupPermissions;
494472 $conds = array();
Index: trunk/phase3/includes/specials/SpecialLog.php
@@ -35,8 +35,6 @@
3636 }
3737
3838 public function execute( $par ) {
39 - global $wgRequest;
40 -
4139 $this->setHeaders();
4240 $this->outputHeader();
4341
@@ -53,7 +51,7 @@
5452 $opts->add( 'offender', '' );
5553
5654 // Set values
57 - $opts->fetchValuesFromRequest( $wgRequest );
 55+ $opts->fetchValuesFromRequest( $this->getRequest() );
5856 if ( $par ) {
5957 $this->parseParams( $opts, (string)$par );
6058 }
@@ -99,10 +97,8 @@
10098 }
10199
102100 private function show( FormOptions $opts, array $extraConds ) {
103 - global $wgOut;
104 -
105101 # 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 );
107103 $pager = new LogPager( $loglist, $opts->getValue( 'type' ), $opts->getValue( 'user' ),
108104 $opts->getValue( 'page' ), $opts->getValue( 'pattern' ), $extraConds, $opts->getValue( 'year' ),
109105 $opts->getValue( 'month' ), $opts->getValue( 'tagfilter' ) );
@@ -110,18 +106,18 @@
111107 $this->addHeader( $opts->getValue( 'type' ) );
112108
113109 # 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() ) );
116112 }
117113
118114 # 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(),
120116 $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue( 'tagfilter' ) );
121117
122118 # Insert list
123119 $logBody = $pager->getBody();
124120 if ( $logBody ) {
125 - $wgOut->addHTML(
 121+ $this->getOutput()->addHTML(
126122 $pager->getNavigationBar() .
127123 $loglist->beginLogEventsList() .
128124 $logBody .
@@ -129,7 +125,7 @@
130126 $pager->getNavigationBar()
131127 );
132128 } else {
133 - $wgOut->addWikiMsg( 'logempty' );
 129+ $this->getOutput()->addWikiMsg( 'logempty' );
134130 }
135131 }
136132
Index: trunk/phase3/includes/specials/SpecialCategories.php
@@ -31,18 +31,16 @@
3232 }
3333
3434 function execute( $par ) {
35 - global $wgOut, $wgRequest;
36 -
3735 $this->setHeaders();
3836 $this->outputHeader();
39 - $wgOut->allowClickjacking();
 37+ $this->getOutput()->allowClickjacking();
4038
41 - $from = $wgRequest->getText( 'from', $par );
 39+ $from = $this->getRequest()->getText( 'from', $par );
4240
43 - $cap = new CategoryPager( $from );
 41+ $cap = new CategoryPager( $this->getContext(), $from );
4442 $cap->doQuery();
4543
46 - $wgOut->addHTML(
 44+ $this->getOutput()->addHTML(
4745 Html::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) .
4846 wfMsgExt( 'categoriespagetext', array( 'parse' ), $cap->getNumRows() ) .
4947 $cap->getStartForm( $from ) .
@@ -61,8 +59,8 @@
6260 * @ingroup SpecialPage Pager
6361 */
6462 class CategoryPager extends AlphabeticPager {
65 - function __construct( $from ) {
66 - parent::__construct();
 63+ function __construct( RequestContext $context, $from ) {
 64+ parent::__construct( $context );
6765 $from = str_replace( ' ', '_', $from );
6866 if( $from !== '' ) {
6967 $from = Title::capitalize( $from, NS_CATEGORY );
@@ -79,10 +77,6 @@
8078 );
8179 }
8280
83 - function getTitle() {
84 - return SpecialPage::getTitleFor( 'Categories' );
85 - }
86 -
8781 function getIndexField() {
8882 # return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
8983 return 'cat_title';
@@ -118,11 +112,10 @@
119113 }
120114
121115 function formatRow($result) {
122 - global $wgLang;
123116 $title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
124117 $titleText = Linker::link( $title, htmlspecialchars( $title->getText() ) );
125118 $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
126 - $wgLang->formatNum( $result->cat_pages ) );
 119+ $this->getLang()->formatNum( $result->cat_pages ) );
127120 return Xml::tags('li', null, wfSpecialList( $titleText, $count ) ) . "\n";
128121 }
129122
Index: trunk/phase3/includes/specials/SpecialBlockList.php
@@ -40,24 +40,24 @@
4141 * @param $par String title fragment
4242 */
4343 public function execute( $par ) {
44 - global $wgOut, $wgRequest;
45 -
4644 $this->setHeaders();
4745 $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' );
5049
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 ) );
5353
54 - $this->options = $wgRequest->getArray( 'wpOptions', array() );
 54+ $this->options = $request->getArray( 'wpOptions', array() );
5555
56 - $action = $wgRequest->getText( 'action' );
 56+ $action = $request->getText( 'action' );
5757
58 - if( $action == 'unblock' || $action == 'submit' && $wgRequest->wasPosted() ) {
 58+ if( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) {
5959 # B/C @since 1.18: Unblock interface is now at Special:Unblock
6060 $title = SpecialPage::getTitleFor( 'Unblock', $this->target );
61 - $wgOut->redirect( $title->getFullUrl() );
 61+ $out->redirect( $title->getFullUrl() );
6262 return;
6363 }
6464
@@ -91,8 +91,6 @@
9292 }
9393
9494 function showList() {
95 - global $wgOut, $wgUser;
96 -
9795 # Purge expired entries on one in every 10 queries
9896 if ( !mt_rand( 0, 10 ) ) {
9997 Block::purgeExpired();
@@ -100,7 +98,7 @@
10199
102100 $conds = array();
103101 # Is the user allowed to see hidden blocks?
104 - if ( !$wgUser->isAllowed( 'hideuser' ) ){
 102+ if ( !$this->getUser()->isAllowed( 'hideuser' ) ){
105103 $conds['ipb_deleted'] = 0;
106104 }
107105
@@ -151,31 +149,33 @@
152150 $otherBlockLink = array();
153151 wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) );
154152
 153+ $out = $this->getOutput();
 154+
155155 # Show additional header for the local block only when other blocks exists.
156156 # Not necessary in a standard installation without such extensions enabled
157157 if( count( $otherBlockLink ) ) {
158 - $wgOut->addHTML(
 158+ $out->addHTML(
159159 Html::rawElement( 'h2', array(), wfMsg( 'ipblocklist-localblock' ) ) . "\n"
160160 );
161161 }
162162
163163 $pager = new BlockListPager( $this, $conds );
164164 if ( $pager->getNumRows() ) {
165 - $wgOut->addHTML(
 165+ $out->addHTML(
166166 $pager->getNavigationBar() .
167167 $pager->getBody().
168168 $pager->getNavigationBar()
169169 );
170170
171171 } elseif ( $this->target ) {
172 - $wgOut->addWikiMsg( 'ipblocklist-no-results' );
 172+ $out->addWikiMsg( 'ipblocklist-no-results' );
173173
174174 } else {
175 - $wgOut->addWikiMsg( 'ipblocklist-empty' );
 175+ $out->addWikiMsg( 'ipblocklist-empty' );
176176 }
177177
178178 if( count( $otherBlockLink ) ) {
179 - $wgOut->addHTML(
 179+ $out->addHTML(
180180 Html::rawElement(
181181 'h2',
182182 array(),
@@ -190,7 +190,7 @@
191191 foreach( $otherBlockLink as $link ) {
192192 $list .= Html::rawElement( 'li', array(), $link ) . "\n";
193193 }
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" );
195195 }
196196 }
197197 }
@@ -203,7 +203,7 @@
204204 $this->page = $page;
205205 $this->conds = $conds;
206206 $this->mDefaultDirection = true;
207 - parent::__construct();
 207+ parent::__construct( $page->getContext() );
208208 }
209209
210210 function getFieldNames() {
@@ -225,11 +225,8 @@
226226 }
227227
228228 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 ) {
234231 $msg = array(
235232 'anononlyblock',
236233 'createaccountblock',
@@ -248,7 +245,7 @@
249246
250247 switch( $name ) {
251248 case 'ipb_timestamp':
252 - $formatted = $wgLang->timeanddate( $value );
 249+ $formatted = $this->getLang()->timeanddate( $value );
253250 break;
254251
255252 case 'ipb_target':
@@ -259,8 +256,8 @@
260257 switch( $type ){
261258 case Block::TYPE_USER:
262259 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(
265262 $target->getId(),
266263 $target,
267264 false,
@@ -274,21 +271,21 @@
275272 break;
276273
277274 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' ) ){
280277 if( $row->ipb_auto ){
281 - $links[] = $sk->linkKnown(
 278+ $links[] = Linker::linkKnown(
282279 SpecialPage::getTitleFor( 'Unblock' ),
283280 $msg['unblocklink'],
284281 array(),
285282 array( 'wpTarget' => "#{$row->ipb_id}" )
286283 );
287284 } else {
288 - $links[] = $sk->linkKnown(
 285+ $links[] = Linker::linkKnown(
289286 SpecialPage::getTitleFor( 'Unblock', $row->ipb_address ),
290287 $msg['unblocklink']
291288 );
292 - $links[] = $sk->linkKnown(
 289+ $links[] = Linker::linkKnown(
293290 SpecialPage::getTitleFor( 'Block', $row->ipb_address ),
294291 $msg['change-blocklink']
295292 );
@@ -296,7 +293,7 @@
297294 $formatted .= ' ' . Html::rawElement(
298295 'span',
299296 array( 'class' => 'mw-blocklist-actions' ),
300 - wfMsg( 'parentheses', $wgLang->pipeList( $links ) )
 297+ wfMsg( 'parentheses', $this->getLang()->pipeList( $links ) )
301298 );
302299 }
303300 break;
@@ -304,13 +301,13 @@
305302 case 'ipb_by':
306303 $user = User::newFromId( $value );
307304 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() );
310307 }
311308 break;
312309
313310 case 'ipb_reason':
314 - $formatted = $sk->commentBlock( $value );
 311+ $formatted = Linker::commentBlock( $value );
315312 break;
316313
317314 case 'ipb_params':
@@ -333,7 +330,7 @@
334331 $properties[] = $msg['blocklist-nousertalk'];
335332 }
336333
337 - $formatted = $wgLang->commaList( $properties );
 334+ $formatted = $this->getLang()->commaList( $properties );
338335 break;
339336
340337 default:
@@ -367,9 +364,8 @@
368365 'conds' => $this->conds,
369366 );
370367
371 - global $wgUser;
372368 # Is the user allowed to see hidden blocks?
373 - if ( !$wgUser->isAllowed( 'hideuser' ) ){
 369+ if ( !$this->getUser()->isAllowed( 'hideuser' ) ){
374370 $conds['ipb_deleted'] = 0;
375371 }
376372
@@ -391,8 +387,4 @@
392388 function isFieldSortable( $name ) {
393389 return false;
394390 }
395 -
396 - function getTitle() {
397 - return $this->page->getTitle();
398 - }
399391 }
Index: trunk/phase3/includes/specials/SpecialListfiles.php
@@ -28,7 +28,6 @@
2929 }
3030
3131 public function execute( $par ){
32 - global $wgOut, $wgRequest;
3332 $this->setHeaders();
3433 $this->outputHeader();
3534
@@ -36,11 +35,11 @@
3736 $userName = $par;
3837 $search = '';
3938 } 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', '' );
4241 }
4342
44 - $pager = new ImageListPager( $userName, $search, $this->including() );
 43+ $pager = new ImageListPager( $this->getContext(), $userName, $search, $this->including() );
4544
4645 if ( $this->including() ) {
4746 $html = $pager->getBody();
@@ -50,7 +49,7 @@
5150 $nav = $pager->getNavigationBar();
5251 $html = "$form<br />\n$body<br />\n$nav";
5352 }
54 - $wgOut->addHTML( $html );
 53+ $this->getOutput()->addHTML( $html );
5554 }
5655 }
5756
@@ -64,8 +63,8 @@
6564 var $mSearch = '';
6665 var $mIncluding = false;
6766
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;
7069
7170 $this->mIncluding = $including;
7271
@@ -89,7 +88,7 @@
9089 }
9190
9291 if ( !$including ) {
93 - if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) {
 92+ if ( $context->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) {
9493 $this->mDefaultDirection = true;
9594 } else {
9695 $this->mDefaultDirection = false;
@@ -98,13 +97,9 @@
9998 $this->mDefaultDirection = true;
10099 }
101100
102 - parent::__construct();
 101+ parent::__construct( $context );
103102 }
104103
105 - function getTitle() {
106 - return SpecialPage::getTitleFor( 'Listfiles' );
107 - }
108 -
109104 /**
110105 * @return Array
111106 */
@@ -197,14 +192,13 @@
198193 }
199194
200195 function formatValue( $field, $value ) {
201 - global $wgLang;
202196 switch ( $field ) {
203197 case 'thumb':
204198 $file = wfLocalFile( $value );
205199 $thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) );
206200 return $thumb->toHtml( array( 'desc-link' => true ) );
207201 case 'img_timestamp':
208 - return htmlspecialchars( $wgLang->timeanddate( $value, true ) );
 202+ return htmlspecialchars( $this->getLang()->timeanddate( $value, true ) );
209203 case 'img_name':
210204 static $imgfile = null;
211205 if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' );
@@ -212,7 +206,7 @@
213207 // Weird files can maybe exist? Bug 22227
214208 $filePage = Title::makeTitleSafe( NS_FILE, $value );
215209 if( $filePage ) {
216 - $link = $this->getSkin()->linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
 210+ $link = Linker::linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
217211 $download = Xml::element( 'a',
218212 array( 'href' => wfLocalFile( $filePage )->getURL() ),
219213 $imgfile
@@ -223,7 +217,7 @@
224218 }
225219 case 'img_user_text':
226220 if ( $this->mCurrentRow->img_user ) {
227 - $link = $this->getSkin()->link(
 221+ $link = Linker::link(
228222 Title::makeTitle( NS_USER, $value ),
229223 htmlspecialchars( $value )
230224 );
@@ -232,9 +226,9 @@
233227 }
234228 return $link;
235229 case 'img_size':
236 - return $this->getSkin()->formatSize( $value );
 230+ return htmlspecialchars( $this->getLang()->formatSize( $value ) );
237231 case 'img_description':
238 - return $this->getSkin()->commentBlock( $value );
 232+ return Linker::commentBlock( $value );
239233 case 'count':
240234 return intval( $value ) + 1;
241235 }
Index: trunk/phase3/includes/specials/SpecialProtectedtitles.php
@@ -36,8 +36,6 @@
3737 }
3838
3939 function execute( $par ) {
40 - global $wgOut, $wgRequest;
41 -
4240 $this->setHeaders();
4341 $this->outputHeader();
4442
@@ -46,15 +44,16 @@
4745 Title::purgeExpiredRestrictions();
4846 }
4947
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' );
5554
5655 $pager = new ProtectedTitlesPager( $this, array(), $type, $level, $NS, $sizetype, $size );
5756
58 - $wgOut->addHTML( $this->showOptions( $NS, $type, $level ) );
 57+ $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level ) );
5958
6059 if ( $pager->getNumRows() ) {
6160 $s = $pager->getNavigationBar();
@@ -65,7 +64,7 @@
6665 } else {
6766 $s = '<p>' . wfMsgHtml( 'protectedtitlesempty' ) . '</p>';
6867 }
69 - $wgOut->addHTML( $s );
 68+ $this->getOutput()->addHTML( $s );
7069 }
7170
7271 /**
@@ -74,19 +73,16 @@
7574 * @return string
7675 */
7776 function formatRow( $row ) {
78 - global $wgLang;
79 -
8077 wfProfileIn( __METHOD__ );
8178
82 - static $skin = null, $infinity = null;
 79+ static $infinity = null;
8380
84 - if( is_null( $skin ) ){
85 - $skin = $this->getSkin();
 81+ if( is_null( $infinity ) ){
8682 $infinity = wfGetDB( DB_SLAVE )->getInfinity();
8783 }
8884
8985 $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
90 - $link = $skin->link( $title );
 86+ $link = Linker::link( $title );
9187
9288 $description_items = array ();
9389
@@ -94,14 +90,13 @@
9591
9692 $description_items[] = $protType;
9793
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;
9995 if( $expiry != $infinity ) {
100 -
10196 $expiry_description = wfMsg(
10297 '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 )
106101 );
107102
108103 $description_items[] = htmlspecialchars($expiry_description);
@@ -121,7 +116,7 @@
122117 function showOptions( $namespace, $type='edit', $level ) {
123118 global $wgScript;
124119 $action = htmlspecialchars( $wgScript );
125 - $title = SpecialPage::getTitleFor( 'Protectedtitles' );
 120+ $title = $this->getTitle();
126121 $special = htmlspecialchars( $title->getPrefixedDBkey() );
127122 return "<form action=\"$action\" method=\"get\">\n" .
128123 '<fieldset>' .
@@ -194,7 +189,7 @@
195190 $this->level = $level;
196191 $this->namespace = $namespace;
197192 $this->size = intval($size);
198 - parent::__construct();
 193+ parent::__construct( $form->getContext() );
199194 }
200195
201196 function getStartBody() {
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -36,85 +36,87 @@
3737 }
3838
3939 public function execute( $par ) {
40 - global $wgUser, $wgOut, $wgRequest;
41 -
4240 $this->setHeaders();
4341 $this->outputHeader();
44 - $wgOut->addModuleStyles( 'mediawiki.special' );
 42+ $out = $this->getOutput();
 43+ $out->addModuleStyles( 'mediawiki.special' );
4544
4645 $this->opts = array();
 46+ $request = $this->getRequest();
4747
4848 if( $par == 'newbies' ) {
4949 $target = 'newbies';
5050 $this->opts['contribs'] = 'newbie';
51 - } elseif( isset( $par ) ) {
 51+ } elseif( $par !== null ) {
5252 $target = $par;
5353 } else {
54 - $target = $wgRequest->getVal( 'target' );
 54+ $target = $request->getVal( 'target' );
5555 }
5656
5757 // check for radiobox
58 - if( $wgRequest->getVal( 'contribs' ) == 'newbie' ) {
 58+ if( $request->getVal( 'contribs' ) == 'newbie' ) {
5959 $target = 'newbies';
6060 $this->opts['contribs'] = 'newbie';
6161 }
6262
63 - $this->opts['deletedOnly'] = $wgRequest->getBool( 'deletedOnly' );
 63+ $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
6464
6565 if( !strlen( $target ) ) {
66 - $wgOut->addHTML( $this->getForm() );
 66+ $out->addHTML( $this->getForm() );
6767 return;
6868 }
6969
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') );
7173 $this->opts['target'] = $target;
72 - $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' );
 74+ $this->opts['topOnly'] = $request->getBool( 'topOnly' );
7375
7476 $nt = Title::makeTitleSafe( NS_USER, $target );
7577 if( !$nt ) {
76 - $wgOut->addHTML( $this->getForm() );
 78+ $out->addHTML( $this->getForm() );
7779 return;
7880 }
7981 $id = User::idFromName( $nt->getText() );
8082
8183 if( $target != 'newbies' ) {
8284 $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 );
8890 }
8991 } 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' ) ) );
9294 }
9395
94 - if( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
 96+ if( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
9597 $this->opts['namespace'] = intval( $ns );
9698 } else {
9799 $this->opts['namespace'] = '';
98100 }
99101
100 - $this->opts['tagFilter'] = (string) $wgRequest->getVal( 'tagFilter' );
 102+ $this->opts['tagFilter'] = (string) $request->getVal( 'tagFilter' );
101103
102104 // Allows reverts to have the bot flag in recent changes. It is just here to
103105 // 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' ) ) {
105107 $this->opts['bot'] = '1';
106108 }
107109
108 - $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev';
 110+ $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
109111 # Offset overrides year/month selection
110112 if( $skip ) {
111113 $this->opts['year'] = '';
112114 $this->opts['month'] = '';
113115 } 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' );
116118 }
117119
118 - $feedType = $wgRequest->getVal( 'feed' );
 120+ $feedType = $request->getVal( 'feed' );
119121 if( $feedType ) {
120122 // Maintain some level of backwards compatability
121123 // If people request feeds using the old parameters, redirect to API
@@ -144,7 +146,7 @@
145147
146148 $url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams );
147149
148 - $wgOut->redirect( $url, '301' );
 150+ $out->redirect( $url, '301' );
149151 return;
150152 }
151153
@@ -153,7 +155,7 @@
154156
155157 if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
156158
157 - $wgOut->addHTML( $this->getForm() );
 159+ $out->addHTML( $this->getForm() );
158160
159161 $pager = new ContribsPager( array(
160162 'target' => $target,
@@ -164,20 +166,20 @@
165167 'topOnly' => $this->opts['topOnly'],
166168 ) );
167169 if( !$pager->getNumRows() ) {
168 - $wgOut->addWikiMsg( 'nocontribs', $target );
 170+ $out->addWikiMsg( 'nocontribs', $target );
169171 } else {
170172 # Show a message about slave lag, if applicable
171173 $lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
172174 if( $lag > 0 )
173 - $wgOut->showLagWarning( $lag );
 175+ $out->showLagWarning( $lag );
174176
175 - $wgOut->addHTML(
 177+ $out->addHTML(
176178 '<p>' . $pager->getNavigationBar() . '</p>' .
177179 $pager->getBody() .
178180 '<p>' . $pager->getNavigationBar() . '</p>'
179181 );
180182 }
181 - $wgOut->preventClickjacking( $pager->getPreventClickjacking() );
 183+ $out->preventClickjacking( $pager->getPreventClickjacking() );
182184
183185 # Show the appropriate "footer" message - WHOIS tools, etc.
184186 if( $target != 'newbies' ) {
@@ -185,15 +187,15 @@
186188 if ( IP::isIPAddress( $target ) ) {
187189 $message = 'sp-contributions-footer-anon';
188190 } else {
189 - $user = User::newFromName( $target );
190 - if ( !$user || $user->isAnon() ) {
 191+ $userObj = User::newFromName( $target );
 192+ if ( !$userObj || $userObj->isAnon() ) {
191193 // No message for non-existing users
192194 return;
193195 }
194196 }
195197
196198 if( !wfMessage( $message, $target )->isDisabled() ) {
197 - $wgOut->wrapWikiMsg(
 199+ $out->wrapWikiMsg(
198200 "<div class='mw-contributions-footer'>\n$1\n</div>",
199201 array( $message, $target ) );
200202 }
@@ -209,25 +211,22 @@
210212 * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
211213 */
212214 protected function contributionsSub( $nt, $id ) {
213 - global $wgLang, $wgUser, $wgOut;
214 -
215 - $sk = $this->getSkin();
216 -
217215 if ( $id === null ) {
218216 $user = htmlspecialchars( $nt->getText() );
219217 } else {
220 - $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
 218+ $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) );
221219 }
222220 $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false );
223221 $talk = $nt->getTalkPage();
224222 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 );
227225
228226 // Show a note if the user is blocked and display the last block log entry.
229227 if ( $userObj->isBlocked() ) {
 228+ $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
230229 LogEventsList::showLogExtract(
231 - $wgOut,
 230+ $out,
232231 'block',
233232 $nt->getPrefixedText(),
234233 '',
@@ -240,7 +239,7 @@
241240 'sp-contributions-blocked-notice',
242241 $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
243242 ),
244 - 'offset' => '' # don't use $wgRequest parameter offset
 243+ 'offset' => '' # don't use WebRequest parameter offset
245244 )
246245 );
247246 }
@@ -262,36 +261,35 @@
263262 * @param $userpage Title: Target user page
264263 * @param $talkpage Title: Talk page
265264 * @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)
267266 */
268267 public static function getUserLinks( Title $userpage, Title $talkpage, User $target, User $subject ) {
269268
270 - $sk = $subject->getSkin();
271269 $id = $target->getId();
272270 $username = $target->getName();
273271
274 - $tools[] = $sk->link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
 272+ $tools[] = Linker::link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
275273
276274 if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
277275 if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
278276 if ( $target->isBlocked() ) {
279 - $tools[] = $sk->linkKnown( # Change block link
 277+ $tools[] = Linker::linkKnown( # Change block link
280278 SpecialPage::getTitleFor( 'Block', $username ),
281279 wfMsgHtml( 'change-blocklink' )
282280 );
283 - $tools[] = $sk->linkKnown( # Unblock link
 281+ $tools[] = Linker::linkKnown( # Unblock link
284282 SpecialPage::getTitleFor( 'Unblock', $username ),
285283 wfMsgHtml( 'unblocklink' )
286284 );
287285 } else { # User is not blocked
288 - $tools[] = $sk->linkKnown( # Block link
 286+ $tools[] = Linker::linkKnown( # Block link
289287 SpecialPage::getTitleFor( 'Block', $username ),
290288 wfMsgHtml( 'blocklink' )
291289 );
292290 }
293291 }
294292 # Block log link
295 - $tools[] = $sk->linkKnown(
 293+ $tools[] = Linker::linkKnown(
296294 SpecialPage::getTitleFor( 'Log', 'block' ),
297295 wfMsgHtml( 'sp-contributions-blocklog' ),
298296 array(),
@@ -301,20 +299,20 @@
302300 );
303301 }
304302 # Uploads
305 - $tools[] = $sk->linkKnown(
 303+ $tools[] = Linker::linkKnown(
306304 SpecialPage::getTitleFor( 'Listfiles', $username ),
307305 wfMsgHtml( 'sp-contributions-uploads' )
308306 );
309307
310308 # Other logs link
311 - $tools[] = $sk->linkKnown(
 309+ $tools[] = Linker::linkKnown(
312310 SpecialPage::getTitleFor( 'Log', $username ),
313311 wfMsgHtml( 'sp-contributions-logs' )
314312 );
315313
316314 # Add link to deleted user contributions for priviledged users
317315 if( $subject->isAllowed( 'deletedhistory' ) && !$subject->isBlocked() ) {
318 - $tools[] = $sk->linkKnown(
 316+ $tools[] = Linker::linkKnown(
319317 SpecialPage::getTitleFor( 'DeletedContributions', $username ),
320318 wfMsgHtml( 'sp-contributions-deleted' )
321319 );
@@ -322,8 +320,9 @@
323321
324322 # Add a link to change user rights for privileged users
325323 $userrightsPage = new UserrightsPage();
 324+ $userrightsPage->getContext()->setUser( $subject );
326325 if( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
327 - $tools[] = $sk->linkKnown(
 326+ $tools[] = Linker::linkKnown(
328327 SpecialPage::getTitleFor( 'Userrights', $username ),
329328 wfMsgHtml( 'sp-contributions-userrights' )
330329 );
@@ -462,19 +461,15 @@
463462 return $query;
464463 }
465464
466 - function getTitle() {
467 - return SpecialPage::getTitleFor( 'Contributions' );
468 - }
469 -
470465 function getQueryInfo() {
471 - global $wgUser;
472466 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
473467
 468+ $user = $this->getUser();
474469 $conds = array_merge( $userCond, $this->getNamespaceCond() );
475470 // Paranoia: avoid brute force searches (bug 17342)
476 - if( !$wgUser->isAllowed( 'deletedhistory' ) || $wgUser->isBlocked() ) {
 471+ if( !$user->isAllowed( 'deletedhistory' ) || $user->isBlocked() ) {
477472 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
478 - } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
 473+ } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
479474 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) .
480475 ' != ' . Revision::SUPPRESSED_USER;
481476 }
@@ -601,15 +596,13 @@
602597 * @todo This would probably look a lot nicer in a table.
603598 */
604599 function formatRow( $row ) {
605 - global $wgUser, $wgLang;
606600 wfProfileIn( __METHOD__ );
607601
608 - $sk = $this->getSkin();
609602 $rev = new Revision( $row );
610603 $classes = array();
611604
612605 $page = Title::newFromRow( $row );
613 - $link = $sk->link(
 606+ $link = Linker::link(
614607 $page,
615608 htmlspecialchars( $page->getPrefixedText() ),
616609 array(),
@@ -624,12 +617,12 @@
625618 && $page->quickUserCan( 'edit' ) )
626619 {
627620 $this->preventClickjacking();
628 - $topmarktext .= ' '.$sk->generateRollback( $rev );
 621+ $topmarktext .= ' '.Linker::generateRollback( $rev );
629622 }
630623 }
631624 # Is there a visible previous revision?
632625 if( $rev->userCan( Revision::DELETED_TEXT ) && $rev->getParentId() !== 0 ) {
633 - $difftext = $sk->linkKnown(
 626+ $difftext = Linker::linkKnown(
634627 $page,
635628 $this->messages['diff'],
636629 array(),
@@ -641,24 +634,17 @@
642635 } else {
643636 $difftext = $this->messages['diff'];
644637 }
645 - $histlink = $sk->linkKnown(
 638+ $histlink = Linker::linkKnown(
646639 $page,
647640 $this->messages['hist'],
648641 array(),
649642 array( 'action' => 'history' )
650643 );
651644
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 );
661647 if( $rev->userCan( Revision::DELETED_TEXT ) ) {
662 - $d = $sk->linkKnown(
 648+ $d = Linker::linkKnown(
663649 $page,
664650 htmlspecialchars($date),
665651 array(),
@@ -672,8 +658,8 @@
673659 }
674660
675661 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 ) ) . ' ';
678664 } else {
679665 $userlink = '';
680666 }
@@ -691,17 +677,17 @@
692678 }
693679
694680 // 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')) ) {
697683 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
699685 } else {
700686 $query = array(
701687 'type' => 'revision',
702688 'target' => $page->getPrefixedDbkey(),
703689 'ids' => $rev->getId()
704690 );
705 - $del = $this->mSkin->revDeleteLink( $query,
 691+ $del = Linker::revDeleteLink( $query,
706692 $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
707693 }
708694 $del .= ' ';
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -49,13 +49,13 @@
5050 }
5151
5252 function getQueryInfo() {
53 - global $wgUser;
5453 list( $index, $userCond ) = $this->getUserCond();
5554 $conds = array_merge( $userCond, $this->getNamespaceCond() );
 55+ $user = $this->getUser();
5656 // Paranoia: avoid brute force searches (bug 17792)
57 - if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
 57+ if( !$user->isAllowed( 'deletedhistory' ) ) {
5858 $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0';
59 - } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
 59+ } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
6060 $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) .
6161 ' != ' . Revision::SUPPRESSED_USER;
6262 }
@@ -92,12 +92,11 @@
9393 }
9494
9595 function getNavigationBar() {
96 - global $wgLang;
97 -
9896 if ( isset( $this->mNavigationBar ) ) {
9997 return $this->mNavigationBar;
10098 }
101 - $fmtLimit = $wgLang->formatNum( $this->mLimit );
 99+ $lang = $this->getLang();
 100+ $fmtLimit = $lang->formatNum( $this->mLimit );
102101 $linkTexts = array(
103102 'prev' => wfMsgExt( 'pager-newer-n', array( 'escape', 'parsemag' ), $fmtLimit ),
104103 'next' => wfMsgExt( 'pager-older-n', array( 'escape', 'parsemag' ), $fmtLimit ),
@@ -107,9 +106,9 @@
108107
109108 $pagingLinks = $this->getPagingLinks( $linkTexts );
110109 $limitLinks = $this->getLimitLinks();
111 - $limits = $wgLang->pipeList( $limitLinks );
 110+ $limits = $lang->pipeList( $limitLinks );
112111
113 - $this->mNavigationBar = "(" . $wgLang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " .
 112+ $this->mNavigationBar = "(" . $lang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " .
114113 wfMsgExt( 'viewprevnext', array( 'parsemag', 'escape', 'replaceafter' ), $pagingLinks['prev'], $pagingLinks['next'], $limits );
115114 return $this->mNavigationBar;
116115 }
@@ -133,11 +132,8 @@
134133 * @todo This would probably look a lot nicer in a table.
135134 */
136135 function formatRow( $row ) {
137 - global $wgUser, $wgLang;
138136 wfProfileIn( __METHOD__ );
139137
140 - $sk = $this->getSkin();
141 -
142138 $rev = new Revision( array(
143139 'id' => $row->ar_rev_id,
144140 'comment' => $row->ar_comment,
@@ -153,7 +149,7 @@
154150 $undelete = SpecialPage::getTitleFor( 'Undelete' );
155151
156152 $logs = SpecialPage::getTitleFor( 'Log' );
157 - $dellog = $sk->linkKnown(
 153+ $dellog = Linker::linkKnown(
158154 $logs,
159155 $this->messages['deletionlog'],
160156 array(),
@@ -163,13 +159,15 @@
164160 )
165161 );
166162
167 - $reviewlink = $sk->linkKnown(
 163+ $reviewlink = Linker::linkKnown(
168164 SpecialPage::getTitleFor( 'Undelete', $page->getPrefixedDBkey() ),
169165 $this->messages['undeleteviewlink']
170166 );
171167
172 - if( $wgUser->isAllowed('deletedtext') ) {
173 - $last = $sk->linkKnown(
 168+ $user = $this->getUser();
 169+
 170+ if( $user->isAllowed('deletedtext') ) {
 171+ $last = Linker::linkKnown(
174172 $undelete,
175173 $this->messages['diff'],
176174 array(),
@@ -183,13 +181,13 @@
184182 $last = $this->messages['diff'];
185183 }
186184
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 ) );
189187
190 - if( !$wgUser->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) {
 188+ if( !$user->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) {
191189 $link = $date; // unusable link
192190 } else {
193 - $link = $sk->linkKnown(
 191+ $link = Linker::linkKnown(
194192 $undelete,
195193 $date,
196194 array(),
@@ -204,7 +202,7 @@
205203 $link = '<span class="history-deleted">' . $link . '</span>';
206204 }
207205
208 - $pagelink = $sk->link( $page );
 206+ $pagelink = Linker::link( $page );
209207
210208 if( $rev->isMinor() ) {
211209 $mflag = ChangesList::flag( 'minor' );
@@ -213,13 +211,13 @@
214212 }
215213
216214 // Revision delete link
217 - $del = Linker::getRevDeleteLink( $wgUser, $rev, $page );
 215+ $del = Linker::getRevDeleteLink( $user, $rev, $page );
218216 if ( $del ) $del .= ' ';
219217
220218 $tools = Html::rawElement(
221219 'span',
222220 array( 'class' => 'mw-deletedcontribs-tools' ),
223 - wfMsg( 'parentheses', $wgLang->pipeList( array( $last, $dellog, $reviewlink ) ) )
 221+ wfMsg( 'parentheses', $this->getLang()->pipeList( array( $last, $dellog, $reviewlink ) ) )
224222 );
225223
226224 $ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}";
@@ -259,68 +257,69 @@
260258 * @param $par String: (optional) user name of the user for which to show the contributions
261259 */
262260 function execute( $par ) {
263 - global $wgUser;
264261 $this->setHeaders();
265262
266 - if ( !$this->userCanExecute( $wgUser ) ) {
 263+ $user = $this->getUser();
 264+
 265+ if ( !$this->userCanExecute( $user ) ) {
267266 $this->displayRestrictionError();
268267 return;
269268 }
270269
271 - if( $wgUser->isBlocked() ){
272 - throw new UserBlockedError( $wgUser->getBlock() );
 270+ if( $user->isBlocked() ){
 271+ throw new UserBlockedError( $user->getBlock() );
273272 }
274273
275 - global $wgOut, $wgRequest;
 274+ $request = $this->getRequest();
 275+ $out = $this->getOutput();
 276+ $out->setPageTitle( wfMsgExt( 'deletedcontributions-title', array( 'parsemag' ) ) );
276277
277 - $wgOut->setPageTitle( wfMsgExt( 'deletedcontributions-title', array( 'parsemag' ) ) );
278 -
279278 $options = array();
280279
281 - if ( isset( $par ) ) {
 280+ if ( $par !== null ) {
282281 $target = $par;
283282 } else {
284 - $target = $wgRequest->getVal( 'target' );
 283+ $target = $request->getVal( 'target' );
285284 }
286285
287286 if ( !strlen( $target ) ) {
288 - $wgOut->addHTML( $this->getForm( '' ) );
 287+ $out->addHTML( $this->getForm( '' ) );
289288 return;
290289 }
291290
292 - $options['limit'] = $wgRequest->getInt( 'limit', 50 );
 291+ $options['limit'] = $request->getInt( 'limit', 50 );
293292 $options['target'] = $target;
294293
295294 $nt = Title::makeTitleSafe( NS_USER, $target );
296295 if ( !$nt ) {
297 - $wgOut->addHTML( $this->getForm( '' ) );
 296+ $out->addHTML( $this->getForm( '' ) );
298297 return;
299298 }
300299 $id = User::idFromName( $nt->getText() );
301300
302301 $target = $nt->getText();
303 - $wgOut->setSubtitle( $this->getSubTitle( $nt, $id ) );
 302+ $out->setSubtitle( $this->getSubTitle( $nt, $id ) );
304303
305 - if ( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
 304+ if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
306305 $options['namespace'] = intval( $ns );
307306 } else {
308307 $options['namespace'] = '';
309308 }
310309
311 - $wgOut->addHTML( $this->getForm( $options ) );
 310+ $out->addHTML( $this->getForm( $options ) );
312311
313312 $pager = new DeletedContribsPager( $target, $options['namespace'] );
314313 if ( !$pager->getNumRows() ) {
315 - $wgOut->addWikiMsg( 'nocontribs' );
 314+ $out->addWikiMsg( 'nocontribs' );
316315 return;
317316 }
318317
319318 # Show a message about slave lag, if applicable
320319 $lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
321320 if( $lag > 0 )
322 - $wgOut->showLagWarning( $lag );
 321+ $out->showLagWarning( $lag );
323322
324 - $wgOut->addHTML(
 323+ $out->addHTML(
325324 '<p>' . $pager->getNavigationBar() . '</p>' .
326325 $pager->getBody() .
327326 '<p>' . $pager->getNavigationBar() . '</p>' );
@@ -333,7 +332,7 @@
334333 : 'sp-contributions-footer';
335334
336335 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 ) );
338337 }
339338 }
340339 }
@@ -346,28 +345,24 @@
347346 * @todo FIXME: Almost the same as contributionsSub in SpecialContributions.php. Could be combined.
348347 */
349348 function getSubTitle( $nt, $id ) {
350 - global $wgLang, $wgUser, $wgOut;
351 -
352 - $sk = $this->getSkin();
353 -
354349 if ( $id === null ) {
355350 $user = htmlspecialchars( $nt->getText() );
356351 } else {
357 - $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
 352+ $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) );
358353 }
359354 $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false );
360355 $talk = $nt->getTalkPage();
361356 if( $talk ) {
362357 # Talk page link
363 - $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
 358+ $tools[] = Linker::link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
364359 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
366361 if ( $userObj->isBlocked() ) {
367 - $tools[] = $sk->linkKnown( # Change block link
 362+ $tools[] = Linker::linkKnown( # Change block link
368363 SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
369364 wfMsgHtml( 'change-blocklink' )
370365 );
371 - $tools[] = $sk->linkKnown( # Unblock link
 366+ $tools[] = Linker::linkKnown( # Unblock link
372367 SpecialPage::getTitleFor( 'BlockList' ),
373368 wfMsgHtml( 'unblocklink' ),
374369 array(),
@@ -378,14 +373,14 @@
379374 );
380375 }
381376 else { # User is not blocked
382 - $tools[] = $sk->linkKnown( # Block link
 377+ $tools[] = Linker::linkKnown( # Block link
383378 SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
384379 wfMsgHtml( 'blocklink' )
385380 );
386381 }
387382 }
388383 # Block log link
389 - $tools[] = $sk->linkKnown(
 384+ $tools[] = Linker::linkKnown(
390385 SpecialPage::getTitleFor( 'Log' ),
391386 wfMsgHtml( 'sp-contributions-blocklog' ),
392387 array(),
@@ -396,14 +391,14 @@
397392 );
398393 }
399394 # Other logs link
400 - $tools[] = $sk->linkKnown(
 395+ $tools[] = Linker::linkKnown(
401396 SpecialPage::getTitleFor( 'Log' ),
402397 wfMsgHtml( 'sp-contributions-logs' ),
403398 array(),
404399 array( 'user' => $nt->getText() )
405400 );
406401 # Link to contributions
407 - $tools[] = $sk->linkKnown(
 402+ $tools[] = Linker::linkKnown(
408403 SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ),
409404 wfMsgHtml( 'sp-deletedcontributions-contribs' )
410405 );
@@ -411,7 +406,7 @@
412407 # Add a link to change user rights for privileged users
413408 $userrightsPage = new UserrightsPage();
414409 if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) {
415 - $tools[] = $sk->linkKnown(
 410+ $tools[] = Linker::linkKnown(
416411 SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ),
417412 wfMsgHtml( 'sp-contributions-userrights' )
418413 );
@@ -419,12 +414,13 @@
420415
421416 wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
422417
423 - $links = $wgLang->pipeList( $tools );
 418+ $links = $this->getLang()->pipeList( $tools );
424419
425420 // Show a note if the user is blocked and display the last block log entry.
426421 if ( $userObj->isBlocked() ) {
 422+ $out = $this->getOutput(); // LogEventsList::showLogExtract() wants the first parameter by ref
427423 LogEventsList::showLogExtract(
428 - $wgOut,
 424+ $out,
429425 'block',
430426 $nt->getPrefixedText(),
431427 '',
@@ -435,7 +431,7 @@
436432 'sp-contributions-blocked-notice',
437433 $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
438434 ),
439 - 'offset' => '' # don't use $wgRequest parameter offset
 435+ 'offset' => '' # don't use $this->getRequest() parameter offset
440436 )
441437 );
442438 }
@@ -459,7 +455,7 @@
460456 function getForm( $options ) {
461457 global $wgScript;
462458
463 - $options['title'] = SpecialPage::getTitleFor( 'DeletedContributions' )->getPrefixedText();
 459+ $options['title'] = $this->getTitle()->getPrefixedText();
464460 if ( !isset( $options['target'] ) ) {
465461 $options['target'] = '';
466462 } else {
Index: trunk/phase3/includes/specials/SpecialListusers.php
@@ -34,25 +34,27 @@
3535 */
3636 class UsersPager extends AlphabeticPager {
3737
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();
4042 $parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) );
4143 $symsForAll = array( '*', 'user' );
4244 if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) {
4345 $this->requestedGroup = $par;
44 - $un = $wgRequest->getText( 'username' );
 46+ $un = $request->getText( 'username' );
4547 } elseif ( count( $parms ) == 2 ) {
4648 $this->requestedGroup = $parms[0];
4749 $un = $parms[1];
4850 } 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' );
5153 }
5254 if ( in_array( $this->requestedGroup, $symsForAll ) ) {
5355 $this->requestedGroup = '';
5456 }
55 - $this->editsOnly = $wgRequest->getBool( 'editsOnly' );
56 - $this->creationSort = $wgRequest->getBool( 'creationSort' );
 57+ $this->editsOnly = $request->getBool( 'editsOnly' );
 58+ $this->creationSort = $request->getBool( 'creationSort' );
5759
5860 $this->requestedUser = '';
5961 if ( $un != '' ) {
@@ -64,20 +66,15 @@
6567 parent::__construct();
6668 }
6769
68 - function getTitle() {
69 - return SpecialPage::getTitleFor( 'Listusers' );
70 - }
71 -
7270 function getIndexField() {
7371 return $this->creationSort ? 'user_id' : 'user_name';
7472 }
7573
7674 function getQueryInfo() {
77 - global $wgUser;
7875 $dbr = wfGetDB( DB_SLAVE );
7976 $conds = array();
8077 // Don't show hidden names
81 - if( !$wgUser->isAllowed('hideuser') ) {
 78+ if( !$this->getUser()->isAllowed('hideuser') ) {
8279 $conds[] = 'ipb_deleted IS NULL';
8380 }
8481
@@ -126,8 +123,6 @@
127124 }
128125
129126 function formatRow( $row ) {
130 - global $wgLang;
131 -
132127 if ($row->user_id == 0) #Bug 16487
133128 return '';
134129
@@ -139,7 +134,7 @@
140135 $list = array();
141136 foreach( $groups_list as $group )
142137 $list[] = self::buildGroupLink( $group );
143 - $groups = $wgLang->commaList( $list );
 138+ $groups = $this->getLang()->commaList( $list );
144139 } else {
145140 $groups = '';
146141 }
@@ -151,7 +146,7 @@
152147
153148 global $wgEdititis;
154149 if ( $wgEdititis ) {
155 - $editCount = $wgLang->formatNum( $row->edits );
 150+ $editCount = $this->getLang()->formatNum( $row->edits );
156151 $edits = ' [' . wfMsgExt( 'usereditcount', array( 'parsemag', 'escape' ), $editCount ) . ']';
157152 } else {
158153 $edits = '';
@@ -160,8 +155,8 @@
161156 $created = '';
162157 # Some rows may be NULL
163158 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 );
166161 $created = ' (' . wfMsg( 'usercreated', $d, $t ) . ')';
167162 $created = htmlspecialchars( $created );
168163 }
@@ -292,12 +287,10 @@
293288 * @param $par string (optional) A group to list users from
294289 */
295290 public function execute( $par ) {
296 - global $wgOut;
297 -
298291 $this->setHeaders();
299292 $this->outputHeader();
300293
301 - $up = new UsersPager( $par );
 294+ $up = new UsersPager( $this->getContext(), $par );
302295
303296 # getBody() first to check, if empty
304297 $usersbody = $up->getBody();
@@ -311,6 +304,6 @@
312305 $s .= wfMessage( 'listusers-noresult' )->parseAsBlock();
313306 }
314307
315 - $wgOut->addHTML( $s );
 308+ $this->getOutput()->addHTML( $s );
316309 }
317310 }
Index: trunk/phase3/includes/specials/SpecialActiveusers.php
@@ -42,10 +42,13 @@
4343 */
4444 protected $groups;
4545
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+
4851 $this->RCMaxAge = $wgActiveUserDays;
49 - $un = $wgRequest->getText( 'username' );
 52+ $un = $this->getRequest()->getText( 'username' );
5053 $this->requestedUser = '';
5154 if ( $un != '' ) {
5255 $username = Title::makeTitleSafe( NS_USER, $un );
@@ -55,23 +58,15 @@
5659 }
5760
5861 $this->setupOptions();
59 -
60 - parent::__construct();
6162 }
6263
63 - function getTitle() {
64 - return SpecialPage::getTitleFor( 'Activeusers' );
65 - }
66 -
6764 public function setupOptions() {
68 - global $wgRequest;
69 -
7065 $this->opts = new FormOptions();
7166
7267 $this->opts->add( 'hidebots', false, FormOptions::BOOL );
7368 $this->opts->add( 'hidesysops', false, FormOptions::BOOL );
7469
75 - $this->opts->fetchValuesFromRequest( $wgRequest );
 70+ $this->opts->fetchValuesFromRequest( $this->getRequest() );
7671
7772 $this->groups = array();
7873 if ( $this->opts->getValue( 'hidebots' ) == 1 ) {
@@ -119,11 +114,10 @@
120115 }
121116
122117 function formatRow( $row ) {
123 - global $wgLang;
124118 $userName = $row->user_name;
125119
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 );
128122
129123 $list = array();
130124 foreach( self::getGroups( $row->user_id ) as $group ) {
@@ -132,14 +126,14 @@
133127 }
134128 $list[] = self::buildGroupLink( $group );
135129 }
136 - $groups = $wgLang->commaList( $list );
 130+ $groups = $this->getLang()->commaList( $list );
137131
138132 $item = wfSpecialList( $ulinks, $groups );
139133 $count = wfMsgExt( 'activeusers-count',
140134 array( 'parsemag' ),
141 - $wgLang->formatNum( $row->recentedits ),
 135+ $this->getLang()->formatNum( $row->recentedits ),
142136 $userName,
143 - $wgLang->formatNum ( $this->RCMaxAge )
 137+ $this->getLang()->formatNum( $this->RCMaxAge )
144138 );
145139 $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : '';
146140
@@ -188,18 +182,18 @@
189183 * @param $par Mixed: parameter passed to the page or null
190184 */
191185 public function execute( $par ) {
192 - global $wgOut, $wgLang, $wgActiveUserDays;
 186+ global $wgActiveUserDays;
193187
194188 $this->setHeaders();
195189 $this->outputHeader();
196190
197 - $up = new ActiveUsersPager();
 191+ $up = new ActiveUsersPager( $this->getContext() );
198192
199193 # getBody() first to check, if empty
200194 $usersbody = $up->getBody();
201195
202196 $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 ) )
204198 );
205199
206200 $s .= $up->getPageHeader();
@@ -211,7 +205,7 @@
212206 $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) );
213207 }
214208
215 - $wgOut->addHTML( $s );
 209+ $this->getOutput()->addHTML( $s );
216210 }
217211
218212 }
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php
@@ -36,8 +36,6 @@
3737 }
3838
3939 public function execute( $par ) {
40 - global $wgOut, $wgRequest;
41 -
4240 $this->setHeaders();
4341 $this->outputHeader();
4442
@@ -46,17 +44,18 @@
4745 Title::purgeExpiredRestrictions();
4846 }
4947
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;
5756
5857 $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly, $cascadeOnly );
5958
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 ) );
6160
6261 if( $pager->getNumRows() ) {
6362 $s = $pager->getNavigationBar();
@@ -67,7 +66,7 @@
6867 } else {
6968 $s = '<p>' . wfMsgHtml( 'protectedpagesempty' ) . '</p>';
7069 }
71 - $wgOut->addHTML( $s );
 70+ $this->getOutput()->addHTML( $s );
7271 }
7372
7473 /**
@@ -76,19 +75,16 @@
7776 * @return string Formatted <li> element
7877 */
7978 public function formatRow( $row ) {
80 - global $wgUser, $wgLang;
81 -
8279 wfProfileIn( __METHOD__ );
8380
84 - static $skin = null, $infinity = null;
 81+ static $infinity = null;
8582
86 - if( is_null( $skin ) ){
87 - $skin = $this->getSkin();
 83+ if( is_null( $infinity ) ){
8884 $infinity = wfGetDB( DB_SLAVE )->getInfinity();
8985 }
9086
9187 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
92 - $link = $skin->link( $title );
 88+ $link = Linker::link( $title );
9389
9490 $description_items = array ();
9591
@@ -101,27 +97,28 @@
10298 }
10399
104100 $stxt = '';
 101+ $lang = $this->getLang();
105102
106 - $expiry = $wgLang->formatExpiry( $row->pr_expiry, TS_MW );
 103+ $expiry = $lang->formatExpiry( $row->pr_expiry, TS_MW );
107104 if( $expiry != $infinity ) {
108105
109106 $expiry_description = wfMsg(
110107 '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 )
114111 );
115112
116113 $description_items[] = htmlspecialchars($expiry_description);
117114 }
118115
119116 if(!is_null($size = $row->page_len)) {
120 - $stxt = $wgLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
 117+ $stxt = $lang->getDirMark() . ' ' . Linker::formatRevisionSize( $size );
121118 }
122119
123120 # 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(
126123 $title,
127124 wfMsgHtml( 'protect_change' ),
128125 array(),
@@ -129,7 +126,7 @@
130127 ) . ')';
131128 } else {
132129 $ltitle = SpecialPage::getTitleFor( 'Log' );
133 - $changeProtection = ' (' . $skin->linkKnown(
 130+ $changeProtection = ' (' . Linker::linkKnown(
134131 $ltitle,
135132 wfMsgHtml( 'protectlogpage' ),
136133 array(),
@@ -145,7 +142,7 @@
146143 return Html::rawElement(
147144 'li',
148145 array(),
149 - wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
 146+ wfSpecialList( $link . $stxt, $lang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
150147 }
151148
152149 /**
@@ -160,7 +157,7 @@
161158 */
162159 protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) {
163160 global $wgScript;
164 - $title = SpecialPage::getTitleFor( 'Protectedpages' );
 161+ $title = $this->getTitle();
165162 return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
166163 Xml::openElement( 'fieldset' ) .
167164 Xml::element( 'legend', array(), wfMsg( 'protectedpages' ) ) .
@@ -306,7 +303,7 @@
307304 $this->size = intval($size);
308305 $this->indefonly = (bool)$indefonly;
309306 $this->cascadeonly = (bool)$cascadeonly;
310 - parent::__construct();
 307+ parent::__construct( $form->getContext() );
311308 }
312309
313310 function getStartBody() {
@@ -319,10 +316,6 @@
320317 return '';
321318 }
322319
323 - function getTitle() {
324 - return SpecialPage::getTitleFor( 'Protectedpages' );
325 - }
326 -
327320 function formatRow( $row ) {
328321 return $this->mForm->formatRow( $row );
329322 }
Index: trunk/phase3/includes/specials/SpecialNewimages.php
@@ -30,7 +30,7 @@
3131 $this->setHeaders();
3232 $this->outputHeader();
3333
34 - $pager = new NewFilesPager( $par );
 34+ $pager = new NewFilesPager( $this->getContext(), $par );
3535
3636 if ( !$this->including() ) {
3737 $form = $pager->getForm();
@@ -50,20 +50,13 @@
5151 */
5252 class NewFilesPager extends ReverseChronologicalPager {
5353
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 );
5657
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 );
6259 }
6360
64 - function getTitle() {
65 - return SpecialPage::getTitleFor( 'Newimages' );
66 - }
67 -
6861 function getQueryInfo() {
6962 global $wgMiserMode;
7063 $conds = $jconds = array();
@@ -113,24 +106,22 @@
114107 }
115108
116109 function formatRow( $row ) {
117 - global $wgLang;
118 -
119110 $name = $row->img_name;
120111 $user = User::newFromId( $row->img_user );
121112
122113 $title = Title::makeTitle( NS_FILE, $name );
123 - $ul = $this->skin->link( $user->getUserpage(), $user->getName() );
 114+ $ul = Linker::link( $user->getUserpage(), $user->getName() );
124115
125116 $this->gallery->add(
126117 $title,
127118 "$ul<br />\n<i>"
128 - . htmlspecialchars( $wgLang->timeanddate( $row->img_timestamp, true ) )
 119+ . htmlspecialchars( $this->getLang()->timeanddate( $row->img_timestamp, true ) )
129120 . "</i><br />\n"
130121 );
131122 }
132123
133124 function getForm() {
134 - global $wgRequest, $wgMiserMode;
 125+ global $wgMiserMode;
135126
136127 $fields = array(
137128 'like' => array(
@@ -142,16 +133,16 @@
143134 'type' => 'check',
144135 'label' => wfMessage( 'showhidebots', wfMsg( 'show' ) ),
145136 'name' => 'showbots',
146 - # 'default' => $wgRequest->getBool( 'showbots', 0 ),
 137+ # 'default' => $this->getRequest()->getBool( 'showbots', 0 ),
147138 ),
148139 'limit' => array(
149140 'type' => 'hidden',
150 - 'default' => $wgRequest->getText( 'limit' ),
 141+ 'default' => $this->getRequest()->getText( 'limit' ),
151142 'name' => 'limit',
152143 ),
153144 'offset' => array(
154145 'type' => 'hidden',
155 - 'default' => $wgRequest->getText( 'offset' ),
 146+ 'default' => $this->getRequest()->getText( 'offset' ),
156147 'name' => 'offset',
157148 ),
158149 );
@@ -160,7 +151,7 @@
161152 unset( $fields['like'] );
162153 }
163154
164 - $form = new HTMLForm( $fields );
 155+ $form = new HTMLForm( $fields, $this->getContext() );
165156 $form->setTitle( $this->getTitle() );
166157 $form->setSubmitText( wfMsg( 'ilsubmit' ) );
167158 $form->setMethod( 'get' );
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php
@@ -40,12 +40,10 @@
4141 }
4242
4343 /**
44 - * @param $request WebRequest
4544 * @return void
4645 */
47 - private function loadRequestParams( $request ) {
48 - global $wgUser;
49 -
 46+ private function loadRequestParams() {
 47+ $request = $this->getRequest();
5048 $this->mAction = $request->getVal( 'action' );
5149 $this->mTarget = $request->getVal( 'target' );
5250 $this->mDest = $request->getVal( 'dest' );
@@ -59,7 +57,7 @@
6058 }
6159 $this->mComment = $request->getText( 'wpComment' );
6260
63 - $this->mMerge = $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
 61+ $this->mMerge = $request->wasPosted() && $this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) );
6462 // target page
6563 if( $this->mSubmitted ) {
6664 $this->mTargetObj = Title::newFromURL( $this->mTarget );
@@ -83,19 +81,17 @@
8482 }
8583
8684 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();
9188 return;
9289 }
9390
94 - if( !$this->userCanExecute( $wgUser ) ) {
95 - $this->displayRestrictionError();
96 - return;
 91+ if ( wfReadOnly() ) {
 92+ throw new ReadOnlyError;
9793 }
9894
99 - $this->loadRequestParams( $wgRequest );
 95+ $this->loadRequestParams();
10096
10197 $this->setHeaders();
10298 $this->outputHeader();
@@ -132,7 +128,7 @@
133129
134130 if ( count( $errors ) ) {
135131 $this->showMergeForm();
136 - $wgOut->addHTML( implode( "\n", $errors ) );
 132+ $this->getOutput()->addHTML( implode( "\n", $errors ) );
137133 } else {
138134 $this->showHistory();
139135 }
@@ -140,11 +136,11 @@
141137 }
142138
143139 function showMergeForm() {
144 - global $wgOut, $wgScript;
 140+ global $wgScript;
145141
146 - $wgOut->addWikiMsg( 'mergehistory-header' );
 142+ $this->getOutput()->addWikiMsg( 'mergehistory-header' );
147143
148 - $wgOut->addHTML(
 144+ $this->getOutput()->addHTML(
149145 Xml::openElement( 'form', array(
150146 'method' => 'get',
151147 'action' => $wgScript ) ) .
@@ -171,12 +167,9 @@
172168 }
173169
174170 private function showHistory() {
175 - global $wgUser, $wgOut;
 171+ $out = $this->getOutput();
 172+ $out->setPageTitle( wfMsg( 'mergehistory' ) );
176173
177 - $this->sk = $this->getSkin();
178 -
179 - $wgOut->setPageTitle( wfMsg( 'mergehistory' ) );
180 -
181174 $this->showMergeForm();
182175
183176 # List all stored revisions
@@ -196,7 +189,7 @@
197190 'id' => 'merge'
198191 )
199192 );
200 - $wgOut->addHTML( $top );
 193+ $out->addHTML( $top );
201194
202195 if( $haveRevisions ) {
203196 # Format the user-visible controls (comment field, submission button)
@@ -223,27 +216,27 @@
224217 Xml::closeElement( 'table' ) .
225218 Xml::closeElement( 'fieldset' );
226219
227 - $wgOut->addHTML( $table );
 220+ $out->addHTML( $table );
228221 }
229222
230 - $wgOut->addHTML(
 223+ $out->addHTML(
231224 '<h2 id="mw-mergehistory">' .
232225 wfMsgHtml( 'mergehistory-list' ) . "</h2>\n"
233226 );
234227
235228 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() );
241234 } else {
242 - $wgOut->addWikiMsg( 'mergehistory-empty' );
 235+ $out->addWikiMsg( 'mergehistory-empty' );
243236 }
244237
245238 # 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() );
248241
249242 # When we submit, go by page ID to avoid some nasty but unlikely collisions.
250243 # Such would happen if a page was renamed after the form loaded, but before submit
@@ -251,16 +244,14 @@
252245 $misc .= Html::hidden( 'destID', $this->mDestObj->getArticleID() );
253246 $misc .= Html::hidden( 'target', $this->mTarget );
254247 $misc .= Html::hidden( 'dest', $this->mDest );
255 - $misc .= Html::hidden( 'wpEditToken', $wgUser->editToken() );
 248+ $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
256249 $misc .= Xml::closeElement( 'form' );
257 - $wgOut->addHTML( $misc );
 250+ $out->addHTML( $misc );
258251
259252 return true;
260253 }
261254
262255 function formatRevisionRow( $row ) {
263 - global $wgLang;
264 -
265256 $rev = new Revision( $row );
266257
267258 $stxt = '';
@@ -269,9 +260,9 @@
270261 $ts = wfTimestamp( TS_MW, $row->rev_timestamp );
271262 $checkBox = Xml::radio( 'mergepoint', $ts, false );
272263
273 - $pageLink = $this->sk->linkKnown(
 264+ $pageLink = Linker::linkKnown(
274265 $rev->getTitle(),
275 - htmlspecialchars( $wgLang->timeanddate( $ts ) ),
 266+ htmlspecialchars( $this->getLang()->timeanddate( $ts ) ),
276267 array(),
277268 array( 'oldid' => $rev->getId() )
278269 );
@@ -283,7 +274,7 @@
284275 if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
285276 $last = $this->message['last'];
286277 } elseif( isset( $this->prevId[$row->rev_id] ) ) {
287 - $last = $this->sk->linkKnown(
 278+ $last = Linker::linkKnown(
288279 $rev->getTitle(),
289280 $this->message['last'],
290281 array(),
@@ -294,13 +285,13 @@
295286 );
296287 }
297288
298 - $userLink = $this->sk->revUserTools( $rev );
 289+ $userLink = Linker::revUserTools( $rev );
299290
300291 $size = $row->rev_len;
301292 if( !is_null( $size ) ) {
302 - $stxt = $this->sk->formatRevisionSize( $size );
 293+ $stxt = Linker::formatRevisionSize( $size );
303294 }
304 - $comment = $this->sk->revComment( $rev );
 295+ $comment = Linker::revComment( $rev );
305296
306297 return "<li>$checkBox ($last) $pageLink . . $userLink $stxt $comment</li>";
307298 }
@@ -310,15 +301,13 @@
311302 * @return string
312303 */
313304 function getPageLink( $row, $titleObj, $ts, $target ) {
314 - global $wgLang;
315 -
316305 if( !$this->userCan( $row, Revision::DELETED_TEXT ) ) {
317306 return '<span class="history-deleted">' .
318 - $wgLang->timeanddate( $ts, true ) . '</span>';
 307+ $this->getLang()->timeanddate( $ts, true ) . '</span>';
319308 } else {
320 - $link = $this->sk->linkKnown(
 309+ $link = Linker::linkKnown(
321310 $titleObj,
322 - $wgLang->timeanddate( $ts, true ),
 311+ $this->getLang()->timeanddate( $ts, true ),
323312 array(),
324313 array(
325314 'target' => $target,
@@ -333,7 +322,6 @@
334323 }
335324
336325 function merge() {
337 - global $wgOut;
338326 # Get the titles directly from the IDs, in case the target page params
339327 # were spoofed. The queries are done based on the IDs, so it's best to
340328 # keep it consistent...
@@ -359,7 +347,7 @@
360348 );
361349 # Destination page must exist with revisions
362350 if( !$maxtimestamp ) {
363 - $wgOut->addWikiMsg( 'mergehistory-fail' );
 351+ $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
364352 return false;
365353 }
366354 # Get the latest timestamp of the source
@@ -371,7 +359,7 @@
372360 );
373361 # $this->mTimestamp must be older than $maxtimestamp
374362 if( $this->mTimestamp >= $maxtimestamp ) {
375 - $wgOut->addWikiMsg( 'mergehistory-fail' );
 363+ $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
376364 return false;
377365 }
378366 # Update the revisions
@@ -440,7 +428,7 @@
441429 $destTitle->invalidateCache(); // update histories
442430 # Check if this did anything
443431 if( !$count ) {
444 - $wgOut->addWikiMsg( 'mergehistory-fail' );
 432+ $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
445433 return false;
446434 }
447435 # Update our logs
@@ -450,7 +438,7 @@
451439 array( $destTitle->getPrefixedText(), $timestampLimit )
452440 );
453441
454 - $wgOut->addHTML(
 442+ $this->getOutput()->addHTML(
455443 wfMsgExt( 'mergehistory-success', array('parseinline'),
456444 $targetTitle->getPrefixedText(), $destTitle->getPrefixedText(), $count ) );
457445
@@ -478,13 +466,9 @@
479467 );
480468 $this->maxTimestamp = $maxtimestamp;
481469
482 - parent::__construct();
 470+ parent::__construct( $form->getContext() );
483471 }
484472
485 - function getTitle() {
486 - return SpecialPage::getTitleFor( 'Contributions' );
487 - }
488 -
489473 function getStartBody() {
490474 wfProfileIn( __METHOD__ );
491475 # Do a link batch query
Index: trunk/phase3/includes/Pager.php
@@ -57,7 +57,7 @@
5858 *
5959 * @ingroup Pager
6060 */
61 -abstract class IndexPager implements Pager {
 61+abstract class IndexPager extends ContextSource implements Pager {
6262 public $mRequest;
6363 public $mLimitsShown = array( 20, 50, 100, 250, 500 );
6464 public $mDefaultLimit = 50;
@@ -103,17 +103,20 @@
104104 */
105105 public $mResult;
106106
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+ }
110111
 112+ $this->mRequest = $this->getRequest();
 113+
111114 # NB: the offset is quoted, not validated. It is treated as an
112115 # arbitrary string to support the widest variety of index types. Be
113116 # careful outputting it into HTML!
114117 $this->mOffset = $this->mRequest->getText( 'offset' );
115118
116119 # Use consistent behavior for the limit options
117 - $this->mDefaultLimit = intval( $wgUser->getOption( 'rclimit' ) );
 120+ $this->mDefaultLimit = intval( $this->getUser()->getOption( 'rclimit' ) );
118121 list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset();
119122
120123 $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
@@ -186,13 +189,13 @@
187190 }
188191
189192 /**
190 - * Set the offset from an other source than $wgRequest
 193+ * Set the offset from an other source than the request
191194 */
192195 function setOffset( $offset ) {
193196 $this->mOffset = $offset;
194197 }
195198 /**
196 - * Set the limit from an other source than $wgRequest
 199+ * Set the limit from an other source than the request
197200 */
198201 function setLimit( $limit ) {
199202 $this->mLimit = $limit;
@@ -366,12 +369,11 @@
367370 if( $type ) {
368371 $attrs['class'] = "mw-{$type}link";
369372 }
370 - return $this->getSkin()->link(
 373+ return Linker::linkKnown(
371374 $this->getTitle(),
372375 $text,
373376 $attrs,
374 - $query + $this->getDefaultQuery(),
375 - array( 'noclasses', 'known' )
 377+ $query + $this->getDefaultQuery()
376378 );
377379 }
378380
@@ -405,29 +407,6 @@
406408 }
407409
408410 /**
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 - /**
432411 * Get an array of query parameters that should be put into self-links.
433412 * By default, all parameters passed in the URL are used, except for a
434413 * short blacklist.
@@ -435,10 +414,8 @@
436415 * @return Associative array
437416 */
438417 function getDefaultQuery() {
439 - global $wgRequest;
440 -
441418 if ( !isset( $this->mDefaultQuery ) ) {
442 - $this->mDefaultQuery = $wgRequest->getQueryValues();
 419+ $this->mDefaultQuery = $this->getRequest()->getQueryValues();
443420 unset( $this->mDefaultQuery['title'] );
444421 unset( $this->mDefaultQuery['dir'] );
445422 unset( $this->mDefaultQuery['offset'] );
@@ -542,7 +519,6 @@
543520 }
544521
545522 function getLimitLinks() {
546 - global $wgLang;
547523 $links = array();
548524 if ( $this->mIsBackwards ) {
549525 $offset = $this->mPastTheEndIndex;
@@ -551,7 +527,7 @@
552528 }
553529 foreach ( $this->mLimitsShown as $limit ) {
554530 $links[] = $this->makeLink(
555 - $wgLang->formatNum( $limit ),
 531+ $this->getLang()->formatNum( $limit ),
556532 array( 'offset' => $offset, 'limit' => $limit ),
557533 'num'
558534 );
@@ -648,25 +624,25 @@
649625 * didn't want to do class magic as may be still revamped
650626 */
651627 function getNavigationBar() {
652 - global $wgLang;
653 -
654628 if ( !$this->isNavigationBarShown() ) return '';
655629
656630 if( isset( $this->mNavigationBar ) ) {
657631 return $this->mNavigationBar;
658632 }
659633
 634+ $lang = $this->getLang();
 635+
660636 $opts = array( 'parsemag', 'escapenoentities' );
661637 $linkTexts = array(
662638 'prev' => wfMsgExt(
663639 'prevn',
664640 $opts,
665 - $wgLang->formatNum( $this->mLimit )
 641+ $lang->formatNum( $this->mLimit )
666642 ),
667643 'next' => wfMsgExt(
668644 'nextn',
669645 $opts,
670 - $wgLang->formatNum($this->mLimit )
 646+ $lang->formatNum($this->mLimit )
671647 ),
672648 'first' => wfMsgExt( 'page_first', $opts ),
673649 'last' => wfMsgExt( 'page_last', $opts )
@@ -674,10 +650,10 @@
675651
676652 $pagingLinks = $this->getPagingLinks( $linkTexts );
677653 $limitLinks = $this->getLimitLinks();
678 - $limits = $wgLang->pipeList( $limitLinks );
 654+ $limits = $lang->pipeList( $limitLinks );
679655
680656 $this->mNavigationBar =
681 - "(" . $wgLang->pipeList(
 657+ "(" . $lang->pipeList(
682658 array( $pagingLinks['first'],
683659 $pagingLinks['last'] )
684660 ) . ") " .
@@ -738,13 +714,7 @@
739715 public $mYear;
740716 public $mMonth;
741717
742 - function __construct() {
743 - parent::__construct();
744 - }
745 -
746718 function getNavigationBar() {
747 - global $wgLang;
748 -
749719 if ( !$this->isNavigationBarShown() ) {
750720 return '';
751721 }
@@ -752,7 +722,8 @@
753723 if ( isset( $this->mNavigationBar ) ) {
754724 return $this->mNavigationBar;
755725 }
756 - $nicenumber = $wgLang->formatNum( $this->mLimit );
 726+
 727+ $nicenumber = $this->getLang()->formatNum( $this->mLimit );
757728 $linkTexts = array(
758729 'prev' => wfMsgExt(
759730 'pager-newer-n',
@@ -770,7 +741,7 @@
771742
772743 $pagingLinks = $this->getPagingLinks( $linkTexts );
773744 $limitLinks = $this->getLimitLinks();
774 - $limits = $wgLang->pipeList( $limitLinks );
 745+ $limits = $this->getLang()->pipeList( $limitLinks );
775746
776747 $this->mNavigationBar = "({$pagingLinks['first']}" .
777748 wfMsgExt( 'pipe-separator' , 'escapenoentities' ) .
@@ -839,15 +810,18 @@
840811 var $mSort;
841812 var $mCurrentRow;
842813
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' );
846820 if ( !array_key_exists( $this->mSort, $this->getFieldNames() ) ) {
847821 $this->mSort = $this->getDefaultSort();
848822 }
849 - if ( $wgRequest->getBool( 'asc' ) ) {
 823+ if ( $this->getRequest()->getBool( 'asc' ) ) {
850824 $this->mDefaultDirection = false;
851 - } elseif ( $wgRequest->getBool( 'desc' ) ) {
 825+ } elseif ( $this->getRequest()->getBool( 'desc' ) ) {
852826 $this->mDefaultDirection = true;
853827 } /* Else leave it at whatever the class default is */
854828
@@ -985,7 +959,7 @@
986960 * A navigation bar with images
987961 */
988962 function getNavigationBar() {
989 - global $wgStylePath, $wgLang;
 963+ global $wgStylePath;
990964
991965 if ( !$this->isNavigationBarShown() ) {
992966 return '';
@@ -1010,7 +984,7 @@
1011985 'next' => 'arrow_disabled_right_25.png',
1012986 'last' => 'arrow_disabled_last_25.png',
1013987 );
1014 - if( $wgLang->isRTL() ) {
 988+ if( $this->getLang()->isRTL() ) {
1015989 $keys = array_keys( $labels );
1016990 $images = array_combine( $keys, array_reverse( $images ) );
1017991 $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
@@ -1041,8 +1015,6 @@
10421016 * @return String: HTML fragment
10431017 */
10441018 function getLimitSelect() {
1045 - global $wgLang;
1046 -
10471019 # Add the current limit from the query string
10481020 # to avoid that the limit is lost after clicking Go next time
10491021 if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) {
@@ -1056,7 +1028,7 @@
10571029 # will be a string.
10581030 if( is_int( $value ) ){
10591031 $limit = $value;
1060 - $text = $wgLang->formatNum( $limit );
 1032+ $text = $this->getLang()->formatNum( $limit );
10611033 } else {
10621034 $limit = $key;
10631035 $text = $value;
@@ -1075,10 +1047,8 @@
10761048 * @return String: HTML fragment
10771049 */
10781050 function getHiddenFields( $blacklist = array() ) {
1079 - global $wgRequest;
1080 -
10811051 $blacklist = (array)$blacklist;
1082 - $query = $wgRequest->getQueryValues();
 1052+ $query = $this->getRequest()->getQueryValues();
10831053 foreach ( $blacklist as $name ) {
10841054 unset( $query[$name] );
10851055 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r97698Fix a conflict(?) in Special:Contributions in r97658.nikerabbit05:52, 21 September 2011
r97703Per Nikerabbit, follow-up r97658: change getAuthor() into getPerformer() for ...ialex07:41, 21 September 2011
r97839Per Aaron, fix for r97658: removed double call to parent constructor that wil...ialex19:15, 22 September 2011
r99116-rakkaus/#mediawiki-i18n- (1 lines skipped) [06-Oct-2011 16:12:26] PHP Fatal ...reedy16:33, 6 October 2011
r99117Followup r99116, didn't notice $lang was used lower downreedy16:36, 6 October 2011
r100516Fix links on SpecialGlobalUsers, which were pointing to ListUsers instead of ...hartman20:55, 22 October 2011
r110836Fixes Bug 34243 - [Regression] Can't navigate from Special:ListUsers/sysop to...johnduhart11:03, 7 February 2012

Comments

#Comment by 😂 (talk | contribs)   00:43, 21 September 2011

PHP Notice: Undefined variable: chardiff in /www/phase3/includes/specials/SpecialContributions.php on line 699

#Comment by Nikerabbit (talk | contribs)   05:47, 21 September 2011

My new logging code uses getPerformer, so I'd use that name for consistency.

#Comment by IAlex (talk | contribs)   07:42, 21 September 2011

Done in r97703.

#Comment by Aaron Schulz (talk | contribs)   17:54, 22 September 2011

Notice: Undefined property: UsersPager::$creationSort in D:\www\MW_trunk\phase3\includes\specials\SpecialListusers.php on line 70

Parent constructor is also called twice.

#Comment by IAlex (talk | contribs)   19:16, 22 September 2011

Fixed in r97839.

#Comment by Bawolff (talk | contribs)   10:29, 7 February 2012

causes bugzilla:34243 - the pager in Special:Listusers now uses the RequestContext to determine title, which uses the actual title, where before this revision getTitle returned just the base page. This causes issues when the subpage can be a paramter, but can also be selected via a form field

Status & tagging log