Index: branches/querypage-work/phase3/includes/specials/SpecialWantedcategories.php |
— | — | @@ -13,20 +13,12 @@ |
14 | 14 | * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason |
15 | 15 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
16 | 16 | */ |
17 | | -class WantedCategoriesPage extends QueryPage { |
| 17 | +class WantedCategoriesPage extends WantedQueryPage { |
18 | 18 | |
19 | 19 | function getName() { |
20 | 20 | return 'Wantedcategories'; |
21 | 21 | } |
22 | 22 | |
23 | | - function isExpensive() { |
24 | | - return true; |
25 | | - } |
26 | | - |
27 | | - function isSyndicated() { |
28 | | - return false; |
29 | | - } |
30 | | - |
31 | 23 | function getSQL() { |
32 | 24 | $dbr = wfGetDB( DB_SLAVE ); |
33 | 25 | list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' ); |
— | — | @@ -45,23 +37,6 @@ |
46 | 38 | "; |
47 | 39 | } |
48 | 40 | |
49 | | - function sortDescending() { return true; } |
50 | | - |
51 | | - /** |
52 | | - * Fetch user page links and cache their existence |
53 | | - */ |
54 | | - function preprocessResults( $db, $res ) { |
55 | | - $batch = new LinkBatch; |
56 | | - while ( $row = $db->fetchObject( $res ) ) |
57 | | - $batch->add( $row->namespace, $row->title ); |
58 | | - $batch->execute(); |
59 | | - |
60 | | - // Back to start for display |
61 | | - if ( $db->numRows( $res ) > 0 ) |
62 | | - // If there are no rows we get an error seeking. |
63 | | - $db->dataSeek( $res, 0 ); |
64 | | - } |
65 | | - |
66 | 41 | function formatResult( $skin, $result ) { |
67 | 42 | global $wgLang, $wgContLang; |
68 | 43 | |
Index: branches/querypage-work/phase3/includes/specials/SpecialDeletedContributions.php |
— | — | @@ -333,9 +333,9 @@ |
334 | 334 | * @param $options Array: the options to be included. |
335 | 335 | */ |
336 | 336 | function getForm( $options ) { |
337 | | - global $wgScript, $wgTitle, $wgRequest; |
| 337 | + global $wgScript, $wgRequest; |
338 | 338 | |
339 | | - $options['title'] = $wgTitle->getPrefixedText(); |
| 339 | + $options['title'] = SpecialPage::getTitleFor( 'DeletedContributions' )->getPrefixedText(); |
340 | 340 | if ( !isset( $options['target'] ) ) { |
341 | 341 | $options['target'] = ''; |
342 | 342 | } else { |
Index: branches/querypage-work/phase3/includes/specials/SpecialRemoveRestrictions.php |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | function wfSpecialRemoveRestrictions() { |
5 | | - global $wgOut, $wgRequest, $wgUser, $wgLang, $wgTitle; |
| 5 | + global $wgOut, $wgRequest, $wgUser, $wgLang; |
6 | 6 | $sk = $wgUser->getSkin(); |
7 | | - |
| 7 | + $title = SpecialPage::getTitleFor( 'RemoveRestrictions' ); |
8 | 8 | $id = $wgRequest->getVal( 'id' ); |
9 | 9 | if( !is_numeric( $id ) ) { |
10 | 10 | $wgOut->addWikiMsg( 'removerestrictions-noid' ); |
— | — | @@ -36,11 +36,11 @@ |
37 | 37 | if( $result ) |
38 | 38 | $wgOut->addHTML( '<strong class="success">' . wfMsgExt( 'removerestrictions-success', |
39 | 39 | 'parseinline', $r->getSubjectText() ) . '</strong>' ); |
40 | | - $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $wgTitle->getLocalUrl( array( 'id' => $id ) ), |
| 40 | + $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $title->getLocalUrl( array( 'id' => $id ) ), |
41 | 41 | 'method' => 'post' ) ) ); |
42 | 42 | $wgOut->addHTML( Xml::buildForm( $form, 'removerestrictions-submit' ) ); |
43 | 43 | $wgOut->addHTML( Xml::hidden( 'id', $r->getId() ) ); |
44 | | - $wgOut->addHTML( Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ) ); |
| 44 | + $wgOut->addHTML( Xml::hidden( 'title', $title->getPrefixedDbKey() ) ); |
45 | 45 | $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) ); |
46 | 46 | $wgOut->addHTML( "</form></fieldset>" ); |
47 | 47 | } |
Index: branches/querypage-work/phase3/includes/specials/SpecialRevisiondelete.php |
— | — | @@ -29,11 +29,16 @@ |
30 | 30 | $this->target = $wgRequest->getText( 'target' ); |
31 | 31 | # Handle our many different possible input types. |
32 | 32 | # Use CVS, since the cgi handling will break on arrays. |
33 | | - $this->oldids = array_filter( explode( ',', $wgRequest->getVal('oldid') ) ); |
34 | | - $this->artimestamps = array_filter( explode( ',', $wgRequest->getVal('artimestamp') ) ); |
35 | | - $this->logids = array_filter( explode( ',', $wgRequest->getVal('logid') ) ); |
36 | | - $this->oldimgs = array_filter( explode( ',', $wgRequest->getVal('oldimage') ) ); |
37 | | - $this->fileids = array_filter( explode( ',', $wgRequest->getVal('fileid') ) ); |
| 33 | + $this->oldids = explode( ',', $wgRequest->getVal('oldid') ); |
| 34 | + $this->oldids = array_unique( array_filter($this->oldids) ); |
| 35 | + $this->artimestamps = explode( ',', $wgRequest->getVal('artimestamp') ); |
| 36 | + $this->artimestamps = array_unique( array_filter($this->artimestamps) ); |
| 37 | + $this->logids = explode( ',', $wgRequest->getVal('logid') ); |
| 38 | + $this->logids = array_unique( array_filter($this->logids) ); |
| 39 | + $this->oldimgs = explode( ',', $wgRequest->getVal('oldimage') ); |
| 40 | + $this->oldimgs = array_unique( array_filter($this->oldimgs) ); |
| 41 | + $this->fileids = explode( ',', $wgRequest->getVal('fileid') ); |
| 42 | + $this->fileids = array_unique( array_filter($this->fileids) ); |
38 | 43 | # For reviewing deleted files... |
39 | 44 | $this->file = $wgRequest->getVal( 'file' ); |
40 | 45 | # Only one target set at a time please! |
— | — | @@ -41,14 +46,13 @@ |
42 | 47 | + (bool)$this->artimestamps + (bool)$this->fileids + (bool)$this->oldimgs; |
43 | 48 | # No targets? |
44 | 49 | if( $types == 0 ) { |
45 | | - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
46 | | - return; |
| 50 | + return $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
47 | 51 | # Too many targets? |
48 | 52 | } else if( $types > 1 ) { |
49 | | - $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' ); |
50 | | - return; |
| 53 | + return $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' ); |
51 | 54 | } |
52 | 55 | $this->page = Title::newFromUrl( $this->target ); |
| 56 | + $this->contextPage = Title::newFromUrl( $wgRequest->getText( 'page' ) ); |
53 | 57 | # If we have revisions, get the title from the first one |
54 | 58 | # since they should all be from the same page. This allows |
55 | 59 | # for more flexibility with page moves... |
— | — | @@ -81,15 +85,16 @@ |
82 | 86 | $this->showImages(); |
83 | 87 | } else if( $this->deleteKey == 'logid' ) { |
84 | 88 | $this->showLogItems(); |
| 89 | + return; // no logs for now |
85 | 90 | } |
86 | | - $qc = $this->getLogQueryCond(); |
| 91 | + list($qc,$lim) = $this->getLogQueryCond(); |
87 | 92 | # Show relevant lines from the deletion log |
88 | 93 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
89 | | - LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', 25, $qc ); |
| 94 | + LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', $lim, $qc ); |
90 | 95 | # Show relevant lines from the suppression log |
91 | 96 | if( $wgUser->isAllowed( 'suppressionlog' ) ) { |
92 | 97 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); |
93 | | - LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', 25, $qc ); |
| 98 | + LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', $lim, $qc ); |
94 | 99 | } |
95 | 100 | } |
96 | 101 | |
— | — | @@ -117,7 +122,8 @@ |
118 | 123 | |
119 | 124 | private function getLogQueryCond() { |
120 | 125 | $ids = $safeIds = array(); |
121 | | - $action = 'revision'; |
| 126 | + $limit = 25; // default |
| 127 | + $conds = array( 'log_action' => 'revision' ); // revision delete logs |
122 | 128 | switch( $this->deleteKey ) { |
123 | 129 | case 'oldid': |
124 | 130 | $ids = $this->oldids; |
— | — | @@ -131,15 +137,12 @@ |
132 | 138 | case 'fileid': |
133 | 139 | $ids = $this->fileids; |
134 | 140 | break; |
135 | | - case 'logid': |
136 | | - $ids = $this->logids; |
137 | | - $action = 'event'; |
138 | | - break; |
| 141 | + default: // bad type? |
| 142 | + return array($conds,$limit); |
139 | 143 | } |
140 | | - // Revision delete logs |
141 | | - $conds = array( 'log_action' => $action ); |
142 | 144 | // Just get the whole log if there are a lot if items |
143 | | - if( count($ids) > 20 ) return $conds; |
| 145 | + if( count($ids) > $limit ) |
| 146 | + return array($conds,$limit); |
144 | 147 | // Digit chars only |
145 | 148 | foreach( $ids as $id ) { |
146 | 149 | if( preg_match( '/^\d+$/', $id, $m ) ) { |
— | — | @@ -148,9 +151,11 @@ |
149 | 152 | } |
150 | 153 | // Format is <id1,id2,i3...> |
151 | 154 | if( count($safeIds) ) { |
152 | | - $conds[] = "log_params RLIKE '(^|\n|,)(".implode('|',$safeIds).")(,|$)'"; |
| 155 | + $conds[] = "log_params RLIKE '^{$this->deleteKey}.*(^|\n|,)(".implode('|',$safeIds).")(,|\n|$)'"; |
| 156 | + } else { |
| 157 | + $conds = array('1=0'); |
153 | 158 | } |
154 | | - return $conds; |
| 159 | + return array($conds,$limit); |
155 | 160 | } |
156 | 161 | |
157 | 162 | private function secureOperation() { |
— | — | @@ -243,21 +248,20 @@ |
244 | 249 | $result = $dbr->select( array('revision','page'), '*', |
245 | 250 | array( |
246 | 251 | 'rev_page' => $this->page->getArticleID(), |
247 | | - 'rev_id' => $where, |
248 | | - 'rev_page = page_id' ), |
249 | | - __METHOD__ ); |
| 252 | + 'rev_id' => $where, |
| 253 | + 'rev_page = page_id' |
| 254 | + ), |
| 255 | + __METHOD__ |
| 256 | + ); |
250 | 257 | while( $row = $dbr->fetchObject( $result ) ) { |
251 | 258 | $revObjs[$row->rev_id] = new Revision( $row ); |
252 | 259 | } |
253 | 260 | foreach( $this->revisions as $revid ) { |
254 | | - // Hiding top revisison is bad |
255 | | - if( !isset($revObjs[$revid]) || $revObjs[$revid]->isCurrent() ) { |
256 | | - continue; |
257 | | - } else if( !$revObjs[$revid]->userCan(Revision::DELETED_RESTRICTED) ) { |
258 | | - // If a rev is hidden from sysops |
| 261 | + if( !isset($revObjs[$revid]) ) continue; // Must exist |
| 262 | + // Check if the revision was Oversighted |
| 263 | + if( !$revObjs[$revid]->userCan(Revision::DELETED_RESTRICTED) ) { |
259 | 264 | if( !$this->wasPosted ) { |
260 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
261 | | - return; |
| 265 | + return $wgOut->permissionRequired( 'suppressrevision' ); |
262 | 266 | } |
263 | 267 | $UserAllowed = false; |
264 | 268 | } |
— | — | @@ -274,9 +278,11 @@ |
275 | 279 | $result = $dbr->select( 'archive', '*', |
276 | 280 | array( |
277 | 281 | 'ar_namespace' => $this->page->getNamespace(), |
278 | | - 'ar_title' => $this->page->getDBKey(), |
279 | | - 'ar_timestamp' => $where ), |
280 | | - __METHOD__ ); |
| 282 | + 'ar_title' => $this->page->getDBKey(), |
| 283 | + 'ar_timestamp' => $where |
| 284 | + ), |
| 285 | + __METHOD__ |
| 286 | + ); |
281 | 287 | while( $row = $dbr->fetchObject( $result ) ) { |
282 | 288 | $timestamp = wfTimestamp( TS_MW, $row->ar_timestamp ); |
283 | 289 | $revObjs[$timestamp] = new Revision( array( |
— | — | @@ -298,8 +304,7 @@ |
299 | 305 | } else if( !$revObjs[$timestamp]->userCan(Revision::DELETED_RESTRICTED) ) { |
300 | 306 | // If a rev is hidden from sysops |
301 | 307 | if( !$this->wasPosted ) { |
302 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
303 | | - return; |
| 308 | + return $wgOut->permissionRequired( 'suppressrevision' ); |
304 | 309 | } |
305 | 310 | $UserAllowed = false; |
306 | 311 | } |
— | — | @@ -309,8 +314,7 @@ |
310 | 315 | } |
311 | 316 | } |
312 | 317 | if( !$revisions ) { |
313 | | - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
314 | | - return; |
| 318 | + return $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
315 | 319 | } |
316 | 320 | |
317 | 321 | $wgOut->addHTML( "</ul>" ); |
— | — | @@ -334,10 +338,9 @@ |
335 | 339 | } else { |
336 | 340 | $hidden[] = Xml::hidden( 'artimestamp', implode(',',$this->artimestamps) ); |
337 | 341 | } |
338 | | - $special = SpecialPage::getTitleFor( 'Revisiondelete' ); |
339 | 342 | $wgOut->addHTML( |
340 | 343 | Xml::openElement( 'form', array( 'method' => 'post', |
341 | | - 'action' => $special->getLocalUrl( 'action=submit' ), |
| 344 | + 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ), |
342 | 345 | 'id' => 'mw-revdel-form-revisions' ) ) . |
343 | 346 | Xml::openElement( 'fieldset' ) . |
344 | 347 | xml::element( 'legend', null, wfMsg( 'revdelete-legend' ) ) |
— | — | @@ -381,9 +384,11 @@ |
382 | 385 | } |
383 | 386 | $result = $dbr->select( 'oldimage', '*', |
384 | 387 | array( |
385 | | - 'oi_name' => $this->page->getDBKey(), |
386 | | - 'oi_archive_name' => $where ), |
387 | | - __METHOD__ ); |
| 388 | + 'oi_name' => $this->page->getDBKey(), |
| 389 | + 'oi_archive_name' => $where |
| 390 | + ), |
| 391 | + __METHOD__ |
| 392 | + ); |
388 | 393 | while( $row = $dbr->fetchObject( $result ) ) { |
389 | 394 | $filesObjs[$row->oi_archive_name] = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row ); |
390 | 395 | $filesObjs[$row->oi_archive_name]->user = $row->oi_user; |
— | — | @@ -397,8 +402,7 @@ |
398 | 403 | } else if( !$filesObjs[$archivename]->userCan(File::DELETED_RESTRICTED) ) { |
399 | 404 | // If a rev is hidden from sysops |
400 | 405 | if( !$this->wasPosted ) { |
401 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
402 | | - return; |
| 406 | + return $wgOut->permissionRequired( 'suppressrevision' ); |
403 | 407 | } |
404 | 408 | $UserAllowed = false; |
405 | 409 | } |
— | — | @@ -416,8 +420,10 @@ |
417 | 421 | $result = $dbr->select( 'filearchive', '*', |
418 | 422 | array( |
419 | 423 | 'fa_name' => $this->page->getDBKey(), |
420 | | - 'fa_id' => $where ), |
421 | | - __METHOD__ ); |
| 424 | + 'fa_id' => $where |
| 425 | + ), |
| 426 | + __METHOD__ |
| 427 | + ); |
422 | 428 | while( $row = $dbr->fetchObject( $result ) ) { |
423 | 429 | $filesObjs[$row->fa_id] = ArchivedFile::newFromRow( $row ); |
424 | 430 | } |
— | — | @@ -428,8 +434,7 @@ |
429 | 435 | } else if( !$filesObjs[$fileid]->userCan(File::DELETED_RESTRICTED) ) { |
430 | 436 | // If a rev is hidden from sysops |
431 | 437 | if( !$this->wasPosted ) { |
432 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
433 | | - return; |
| 438 | + return $wgOut->permissionRequired( 'suppressrevision' ); |
434 | 439 | } |
435 | 440 | $UserAllowed = false; |
436 | 441 | } |
— | — | @@ -440,8 +445,7 @@ |
441 | 446 | } |
442 | 447 | } |
443 | 448 | if( !$revisions ) { |
444 | | - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
445 | | - return; |
| 449 | + return $wgOut->showErrorPage( 'revdelete-nooldid-title','revdelete-nooldid-text' ); |
446 | 450 | } |
447 | 451 | |
448 | 452 | $wgOut->addHTML( "</ul>" ); |
— | — | @@ -464,10 +468,9 @@ |
465 | 469 | } else { |
466 | 470 | $hidden[] = Xml::hidden( 'fileid', implode(',',$this->fileids) ); |
467 | 471 | } |
468 | | - $special = SpecialPage::getTitleFor( 'Revisiondelete' ); |
469 | 472 | $wgOut->addHTML( |
470 | 473 | Xml::openElement( 'form', array( 'method' => 'post', |
471 | | - 'action' => $special->getLocalUrl( 'action=submit' ), |
| 474 | + 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ), |
472 | 475 | 'id' => 'mw-revdel-form-filerevisions' ) |
473 | 476 | ) . |
474 | 477 | Xml::fieldset( wfMsg( 'revdelete-legend' ) ) |
— | — | @@ -508,10 +511,9 @@ |
509 | 512 | } |
510 | 513 | list($log,$logtype) = explode( '/',$this->page->getDBKey(), 2 ); |
511 | 514 | $result = $dbr->select( 'logging', '*', |
512 | | - array( |
513 | | - 'log_type' => $logtype, |
514 | | - 'log_id' => $where ), |
515 | | - __METHOD__ ); |
| 515 | + array( 'log_type' => $logtype, 'log_id' => $where ), |
| 516 | + __METHOD__ |
| 517 | + ); |
516 | 518 | while( $row = $dbr->fetchObject( $result ) ) { |
517 | 519 | $logRows[$row->log_id] = $row; |
518 | 520 | } |
— | — | @@ -523,8 +525,7 @@ |
524 | 526 | } else if( !LogEventsList::userCan( $logRows[$logid],Revision::DELETED_RESTRICTED) ) { |
525 | 527 | // If an event is hidden from sysops |
526 | 528 | if( !$this->wasPosted ) { |
527 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
528 | | - return; |
| 529 | + return $wgOut->permissionRequired( 'suppressrevision' ); |
529 | 530 | } |
530 | 531 | $UserAllowed = false; |
531 | 532 | } |
— | — | @@ -533,8 +534,7 @@ |
534 | 535 | $bitfields |= $logRows[$logid]->log_deleted; |
535 | 536 | } |
536 | 537 | if( !$logItems ) { |
537 | | - $wgOut->showErrorPage( 'revdelete-nologid-title', 'revdelete-nologid-text' ); |
538 | | - return; |
| 538 | + return $wgOut->showErrorPage( 'revdelete-nologid-title', 'revdelete-nologid-text' ); |
539 | 539 | } |
540 | 540 | |
541 | 541 | $wgOut->addHTML( "</ul>" ); |
— | — | @@ -548,15 +548,15 @@ |
549 | 549 | Xml::submitButton( wfMsg( 'revdelete-submit' ) ) ); |
550 | 550 | $hidden = array( |
551 | 551 | Xml::hidden( 'wpEditToken', $wgUser->editToken() ), |
552 | | - Xml::hidden( 'target', $this->page->getPrefixedText() ), |
| 552 | + Xml::hidden( 'target', $this->page->getPrefixedDBKey() ), |
| 553 | + Xml::hidden( 'page', $this->contextPage ? $this->contextPage->getPrefixedDBKey() : '' ), |
553 | 554 | Xml::hidden( 'type', $this->deleteKey ), |
554 | 555 | Xml::hidden( 'logid', implode(',',$this->logids) ) |
555 | 556 | ); |
556 | 557 | |
557 | | - $special = SpecialPage::getTitleFor( 'Revisiondelete' ); |
558 | 558 | $wgOut->addHTML( |
559 | 559 | Xml::openElement( 'form', array( 'method' => 'post', |
560 | | - 'action' => $special->getLocalUrl( 'action=submit' ), 'id' => 'mw-revdel-form-logs' ) ) . |
| 560 | + 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ), 'id' => 'mw-revdel-form-logs' ) ) . |
561 | 561 | Xml::fieldset( wfMsg( 'revdelete-legend' ) ) |
562 | 562 | ); |
563 | 563 | |
— | — | @@ -643,7 +643,7 @@ |
644 | 644 | * @returns string |
645 | 645 | */ |
646 | 646 | private function fileLine( $file ) { |
647 | | - global $wgLang, $wgTitle; |
| 647 | + global $wgLang; |
648 | 648 | |
649 | 649 | $target = $this->page->getPrefixedText(); |
650 | 650 | $date = $wgLang->timeanddate( $file->getTimestamp(), true ); |
— | — | @@ -655,7 +655,7 @@ |
656 | 656 | if( !$file->userCan(File::DELETED_FILE) ) { |
657 | 657 | $pageLink = $date; |
658 | 658 | } else { |
659 | | - $pageLink = $this->skin->makeKnownLinkObj( $wgTitle, $date, |
| 659 | + $pageLink = $this->skin->makeKnownLinkObj( $this->getTitle(), $date, |
660 | 660 | "target=$target&file=$file->sha1.".$file->getExtension() ); |
661 | 661 | } |
662 | 662 | $pageLink = '<span class="history-deleted">' . $pageLink . '</span>'; |
— | — | @@ -665,9 +665,8 @@ |
666 | 666 | $pageLink = "<a href=\"{$url}\">{$date}</a>"; |
667 | 667 | } |
668 | 668 | |
669 | | - $data = wfMsg( 'widthheight', |
670 | | - $wgLang->formatNum( $file->getWidth() ), |
671 | | - $wgLang->formatNum( $file->getHeight() ) ) . |
| 669 | + $data = wfMsg( 'widthheight', $wgLang->formatNum( $file->getWidth() ), |
| 670 | + $wgLang->formatNum( $file->getHeight() ) ) . |
672 | 671 | ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')'; |
673 | 672 | $data = htmlspecialchars( $data ); |
674 | 673 | |
— | — | @@ -694,9 +693,8 @@ |
695 | 694 | $del = ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>'; |
696 | 695 | } |
697 | 696 | |
698 | | - $data = wfMsg( 'widthheight', |
699 | | - $wgLang->formatNum( $file->getWidth() ), |
700 | | - $wgLang->formatNum( $file->getHeight() ) ) . |
| 697 | + $data = wfMsg( 'widthheight', $wgLang->formatNum( $file->getWidth() ), |
| 698 | + $wgLang->formatNum( $file->getHeight() ) ) . |
701 | 699 | ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')'; |
702 | 700 | $data = htmlspecialchars( $data ); |
703 | 701 | |
— | — | @@ -794,31 +792,26 @@ |
795 | 793 | $wgOut->permissionRequired( 'suppressrevision' ); |
796 | 794 | return false; |
797 | 795 | } |
798 | | - # If the save went through, go to success message. Otherwise |
799 | | - # bounce back to form... |
| 796 | + # If the save went through, go to success message... |
800 | 797 | if( $this->save( $bitfield, $comment, $this->page ) ) { |
801 | 798 | $this->success(); |
802 | | - } else if( $request->getCheck( 'oldid' ) || $request->getCheck( 'artimestamp' ) ) { |
803 | | - return $this->showRevs(); |
804 | | - } else if( $request->getCheck( 'logid' ) ) { |
805 | | - return $this->showLogs(); |
806 | | - } else if( $request->getCheck( 'oldimage' ) || $request->getCheck( 'fileid' ) ) { |
807 | | - return $this->showImages(); |
| 799 | + return true; |
| 800 | + # ...otherwise, bounce back to form... |
| 801 | + } else { |
| 802 | + $this->failure(); |
808 | 803 | } |
| 804 | + return false; |
809 | 805 | } |
810 | 806 | |
811 | 807 | private function success() { |
812 | 808 | global $wgOut; |
813 | | - |
814 | 809 | $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); |
815 | | - |
816 | 810 | $wrap = '<span class="success">$1</span>'; |
817 | | - |
818 | 811 | if( $this->deleteKey == 'logid' ) { |
819 | 812 | $wgOut->wrapWikiMsg( $wrap, 'logdelete-success' ); |
820 | 813 | $this->showLogItems(); |
821 | 814 | } else if( $this->deleteKey == 'oldid' || $this->deleteKey == 'artimestamp' ) { |
822 | | - $wgOut->wrapWikiMsg( $wrap, 'revdelete-success' ); |
| 815 | + $wgOut->wrapWikiMsg( $wrap, 'revdelete-success' ); |
823 | 816 | $this->showRevs(); |
824 | 817 | } else if( $this->deleteKey == 'fileid' ) { |
825 | 818 | $wgOut->wrapWikiMsg( $wrap, 'revdelete-success' ); |
— | — | @@ -828,6 +821,24 @@ |
829 | 822 | $this->showImages(); |
830 | 823 | } |
831 | 824 | } |
| 825 | + |
| 826 | + private function failure() { |
| 827 | + global $wgOut; |
| 828 | + $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); |
| 829 | + $wrap = '<span class="error">$1</span>'; |
| 830 | + if( $this->deleteKey == 'logid' ) { |
| 831 | + $this->showLogItems(); |
| 832 | + } else if( $this->deleteKey == 'oldid' || $this->deleteKey == 'artimestamp' ) { |
| 833 | + $wgOut->wrapWikiMsg( $wrap, 'revdelete-failure' ); |
| 834 | + $this->showRevs(); |
| 835 | + } else if( $this->deleteKey == 'fileid' ) { |
| 836 | + $wgOut->wrapWikiMsg( $wrap, 'revdelete-failure' ); |
| 837 | + $this->showImages(); |
| 838 | + } else if( $this->deleteKey == 'oldimage' ) { |
| 839 | + $wgOut->wrapWikiMsg( $wrap, 'revdelete-failure' ); |
| 840 | + $this->showImages(); |
| 841 | + } |
| 842 | + } |
832 | 843 | |
833 | 844 | /** |
834 | 845 | * Put together a rev_deleted bitfield from the submitted checkboxes |
— | — | @@ -864,6 +875,7 @@ |
865 | 876 | } else if( isset($this->events) ) { |
866 | 877 | return $deleter->setEventVisibility( $title, $this->events, $bitfield, $reason ); |
867 | 878 | } |
| 879 | + return false; |
868 | 880 | } |
869 | 881 | } |
870 | 882 | |
— | — | @@ -892,30 +904,32 @@ |
893 | 905 | foreach( $items as $revid ) { |
894 | 906 | $where[] = intval($revid); |
895 | 907 | } |
896 | | - $result = $this->dbw->select( 'revision', '*', |
897 | | - array( |
898 | | - 'rev_page' => $title->getArticleID(), |
899 | | - 'rev_id' => $where ), |
900 | | - __METHOD__ ); |
| 908 | + $result = $this->dbw->select( array('revision','page'), '*', |
| 909 | + array( 'rev_page' => $title->getArticleID(), |
| 910 | + 'rev_id' => $where, 'rev_page = page_id' ), |
| 911 | + __METHOD__ |
| 912 | + ); |
901 | 913 | while( $row = $this->dbw->fetchObject( $result ) ) { |
902 | 914 | $revObjs[$row->rev_id] = new Revision( $row ); |
903 | 915 | } |
904 | 916 | // To work! |
905 | 917 | foreach( $items as $revid ) { |
906 | | - if( !isset($revObjs[$revid]) || $revObjs[$revid]->isCurrent() ) { |
| 918 | + if( !isset($revObjs[$revid]) ) { |
907 | 919 | $success = false; |
908 | 920 | continue; // Must exist |
| 921 | + } else if( $revObjs[$revid]->isCurrent() && ($bitfield & Revision::DELETED_TEXT) ) { |
| 922 | + $success = false; |
| 923 | + continue; // Cannot hide current version text |
909 | 924 | } else if( !$revObjs[$revid]->userCan(Revision::DELETED_RESTRICTED) ) { |
910 | | - $userAllowedAll=false; |
| 925 | + $userAllowedAll = false; |
911 | 926 | continue; |
912 | 927 | } |
913 | 928 | // For logging, maintain a count of revisions |
914 | 929 | if( $revObjs[$revid]->mDeleted != $bitfield ) { |
915 | | - $revCount++; |
916 | | - $revIDs[]=$revid; |
917 | | - |
| 930 | + $revIDs[] = $revid; |
918 | 931 | $this->updateRevision( $revObjs[$revid], $bitfield ); |
919 | 932 | $this->updateRecentChangesEdits( $revObjs[$revid], $bitfield, false ); |
| 933 | + $revCount++; |
920 | 934 | } |
921 | 935 | } |
922 | 936 | // Clear caches... |
— | — | @@ -955,8 +969,9 @@ |
956 | 970 | array( |
957 | 971 | 'ar_namespace' => $title->getNamespace(), |
958 | 972 | 'ar_title' => $title->getDBKey(), |
959 | | - 'ar_timestamp' => $where ), |
960 | | - __METHOD__ ); |
| 973 | + 'ar_timestamp' => $where |
| 974 | + ), __METHOD__ |
| 975 | + ); |
961 | 976 | while( $row = $this->dbw->fetchObject( $result ) ) { |
962 | 977 | $timestamp = wfTimestamp( TS_MW, $row->ar_timestamp ); |
963 | 978 | $revObjs[$timestamp] = new Revision( array( |
— | — | @@ -986,10 +1001,9 @@ |
987 | 1002 | } |
988 | 1003 | // Which revisions did we change anything about? |
989 | 1004 | if( $revObjs[$timestamp]->mDeleted != $bitfield ) { |
990 | | - $Id_set[]=$timestamp; |
991 | | - $count++; |
992 | | - |
993 | | - $this->updateArchive( $revObjs[$timestamp], $title, $bitfield ); |
| 1005 | + $Id_set[] = $timestamp; |
| 1006 | + $this->updateArchive( $revObjs[$timestamp], $title, $bitfield ); |
| 1007 | + $count++; |
994 | 1008 | } |
995 | 1009 | } |
996 | 1010 | // For logging, maintain a count of revisions |
— | — | @@ -1023,10 +1037,9 @@ |
1024 | 1038 | $where[] = $timestamp.'!'.$title->getDBKey(); |
1025 | 1039 | } |
1026 | 1040 | $result = $this->dbw->select( 'oldimage', '*', |
1027 | | - array( |
1028 | | - 'oi_name' => $title->getDBKey(), |
1029 | | - 'oi_archive_name' => $where ), |
1030 | | - __METHOD__ ); |
| 1041 | + array( 'oi_name' => $title->getDBKey(), 'oi_archive_name' => $where ), |
| 1042 | + __METHOD__ |
| 1043 | + ); |
1031 | 1044 | while( $row = $this->dbw->fetchObject( $result ) ) { |
1032 | 1045 | $filesObjs[$row->oi_archive_name] = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row ); |
1033 | 1046 | $filesObjs[$row->oi_archive_name]->user = $row->oi_user; |
— | — | @@ -1172,10 +1185,9 @@ |
1173 | 1186 | } |
1174 | 1187 | list($log,$logtype) = explode( '/',$title->getDBKey(), 2 ); |
1175 | 1188 | $result = $this->dbw->select( 'logging', '*', |
1176 | | - array( |
1177 | | - 'log_type' => $logtype, |
1178 | | - 'log_id' => $where ), |
1179 | | - __METHOD__ ); |
| 1189 | + array( 'log_type' => $logtype, 'log_id' => $where ), |
| 1190 | + __METHOD__ |
| 1191 | + ); |
1180 | 1192 | while( $row = $this->dbw->fetchObject( $result ) ) { |
1181 | 1193 | $logRows[$row->log_id] = $row; |
1182 | 1194 | } |
— | — | @@ -1185,18 +1197,17 @@ |
1186 | 1198 | $success = false; |
1187 | 1199 | continue; // Must exist |
1188 | 1200 | } else if( !LogEventsList::userCan($logRows[$logid], LogPage::DELETED_RESTRICTED) |
1189 | | - || $logRows[$logid]->log_type == 'suppress' ) { |
1190 | | - // Don't hide from oversight log!!! |
1191 | | - $userAllowedAll=false; |
| 1201 | + || $logRows[$logid]->log_type == 'suppress' ) |
| 1202 | + { |
| 1203 | + $userAllowedAll=false; // Don't hide from oversight log!!! |
1192 | 1204 | continue; |
1193 | 1205 | } |
1194 | 1206 | // Which logs did we change anything about? |
1195 | 1207 | if( $logRows[$logid]->log_deleted != $bitfield ) { |
1196 | | - $log_Ids[]=$logid; |
| 1208 | + $log_Ids[] = $logid; |
| 1209 | + $this->updateLogs( $logRows[$logid], $bitfield ); |
| 1210 | + $this->updateRecentChangesLog( $logRows[$logid], $bitfield ); |
1197 | 1211 | $count++; |
1198 | | - |
1199 | | - $this->updateLogs( $logRows[$logid], $bitfield ); |
1200 | | - $this->updateRecentChangesLog( $logRows[$logid], $bitfield, true ); |
1201 | 1212 | } |
1202 | 1213 | } |
1203 | 1214 | // Don't log or touch if nothing changed |
— | — | @@ -1330,9 +1341,9 @@ |
1331 | 1342 | function updateRevision( $rev, $bitfield ) { |
1332 | 1343 | $this->dbw->update( 'revision', |
1333 | 1344 | array( 'rev_deleted' => $bitfield ), |
1334 | | - array( 'rev_id' => $rev->getId(), |
1335 | | - 'rev_page' => $rev->getPage() ), |
1336 | | - __METHOD__ ); |
| 1345 | + array( 'rev_id' => $rev->getId(), 'rev_page' => $rev->getPage() ), |
| 1346 | + __METHOD__ |
| 1347 | + ); |
1337 | 1348 | } |
1338 | 1349 | |
1339 | 1350 | /** |
— | — | @@ -1346,8 +1357,10 @@ |
1347 | 1358 | array( 'ar_deleted' => $bitfield ), |
1348 | 1359 | array( 'ar_namespace' => $title->getNamespace(), |
1349 | 1360 | 'ar_title' => $title->getDBKey(), |
| 1361 | + // use timestamp for index |
1350 | 1362 | 'ar_timestamp' => $this->dbw->timestamp( $rev->getTimestamp() ), |
1351 | | - 'ar_rev_id' => $rev->getId() ), |
| 1363 | + 'ar_rev_id' => $rev->getId() |
| 1364 | + ), |
1352 | 1365 | __METHOD__ ); |
1353 | 1366 | } |
1354 | 1367 | |
— | — | @@ -1361,7 +1374,8 @@ |
1362 | 1375 | array( 'oi_deleted' => $bitfield ), |
1363 | 1376 | array( 'oi_name' => $file->getName(), |
1364 | 1377 | 'oi_timestamp' => $this->dbw->timestamp( $file->getTimestamp() ) ), |
1365 | | - __METHOD__ ); |
| 1378 | + __METHOD__ |
| 1379 | + ); |
1366 | 1380 | } |
1367 | 1381 | |
1368 | 1382 | /** |
— | — | @@ -1373,7 +1387,8 @@ |
1374 | 1388 | $this->dbw->update( 'filearchive', |
1375 | 1389 | array( 'fa_deleted' => $bitfield ), |
1376 | 1390 | array( 'fa_id' => $file->getId() ), |
1377 | | - __METHOD__ ); |
| 1391 | + __METHOD__ |
| 1392 | + ); |
1378 | 1393 | } |
1379 | 1394 | |
1380 | 1395 | /** |
— | — | @@ -1385,7 +1400,8 @@ |
1386 | 1401 | $this->dbw->update( 'logging', |
1387 | 1402 | array( 'log_deleted' => $bitfield ), |
1388 | 1403 | array( 'log_id' => $row->log_id ), |
1389 | | - __METHOD__ ); |
| 1404 | + __METHOD__ |
| 1405 | + ); |
1390 | 1406 | } |
1391 | 1407 | |
1392 | 1408 | /** |
— | — | @@ -1399,7 +1415,8 @@ |
1400 | 1416 | 'rc_patrolled' => 1 ), |
1401 | 1417 | array( 'rc_this_oldid' => $rev->getId(), |
1402 | 1418 | 'rc_timestamp' => $this->dbw->timestamp( $rev->getTimestamp() ) ), |
1403 | | - __METHOD__ ); |
| 1419 | + __METHOD__ |
| 1420 | + ); |
1404 | 1421 | } |
1405 | 1422 | |
1406 | 1423 | /** |
— | — | @@ -1413,7 +1430,8 @@ |
1414 | 1431 | 'rc_patrolled' => 1 ), |
1415 | 1432 | array( 'rc_logid' => $row->log_id, |
1416 | 1433 | 'rc_timestamp' => $row->log_timestamp ), |
1417 | | - __METHOD__ ); |
| 1434 | + __METHOD__ |
| 1435 | + ); |
1418 | 1436 | } |
1419 | 1437 | |
1420 | 1438 | /** |
— | — | @@ -1440,7 +1458,7 @@ |
1441 | 1459 | * @param int $diff The xor of the old and new bitfields. |
1442 | 1460 | * @param array $arr The array to update. |
1443 | 1461 | */ |
1444 | | - function checkItem( $desc, $field, $diff, $new, &$arr ) { |
| 1462 | + protected static function checkItem( $desc, $field, $diff, $new, &$arr ) { |
1445 | 1463 | if( $diff & $field ) { |
1446 | 1464 | $arr[ ( $new & $field ) ? 0 : 1 ][] = $desc; |
1447 | 1465 | } |
— | — | @@ -1458,15 +1476,15 @@ |
1459 | 1477 | * @param int $o The old bitfield. |
1460 | 1478 | * @return An array as described above. |
1461 | 1479 | */ |
1462 | | - function getChanges( $n, $o ) { |
| 1480 | + protected static function getChanges( $n, $o ) { |
1463 | 1481 | $diff = $n ^ $o; |
1464 | 1482 | $ret = array( 0 => array(), 1 => array(), 2 => array() ); |
1465 | 1483 | // Build bitfield changes in language |
1466 | | - $this->checkItem( wfMsgForContent( 'revdelete-content' ), |
| 1484 | + self::checkItem( wfMsgForContent( 'revdelete-content' ), |
1467 | 1485 | Revision::DELETED_TEXT, $diff, $n, $ret ); |
1468 | | - $this->checkItem( wfMsgForContent( 'revdelete-summary' ), |
| 1486 | + self::checkItem( wfMsgForContent( 'revdelete-summary' ), |
1469 | 1487 | Revision::DELETED_COMMENT, $diff, $n, $ret ); |
1470 | | - $this->checkItem( wfMsgForContent( 'revdelete-uname' ), |
| 1488 | + self::checkItem( wfMsgForContent( 'revdelete-uname' ), |
1471 | 1489 | Revision::DELETED_USER, $diff, $n, $ret ); |
1472 | 1490 | // Restriction application to sysops |
1473 | 1491 | if( $diff & Revision::DELETED_RESTRICTED ) { |
— | — | @@ -1486,34 +1504,25 @@ |
1487 | 1505 | * @param int $count The number of effected revisions. |
1488 | 1506 | * @param int $nbitfield The new bitfield for the revision. |
1489 | 1507 | * @param int $obitfield The old bitfield for the revision. |
1490 | | - * @param string $comment The comment associated with the change. |
1491 | 1508 | * @param bool $isForLog |
1492 | 1509 | */ |
1493 | | - function getLogMessage( $count, $nbitfield, $obitfield, $comment, $isForLog = false ) { |
1494 | | - global $wgContLang; |
1495 | | - |
| 1510 | + public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) { |
| 1511 | + global $wgLang; |
1496 | 1512 | $s = ''; |
1497 | | - $changes = $this->getChanges( $nbitfield, $obitfield ); |
1498 | | - |
| 1513 | + $changes = self::getChanges( $nbitfield, $obitfield ); |
1499 | 1514 | if( count( $changes[0] ) ) { |
1500 | | - $s .= wfMsgForContent ( 'revdelete-hid', implode ( ', ', $changes[0] ) ); |
| 1515 | + $s .= wfMsgForContent( 'revdelete-hid', implode( ', ', $changes[0] ) ); |
1501 | 1516 | } |
1502 | 1517 | if( count( $changes[1] ) ) { |
1503 | 1518 | if ($s) $s .= '; '; |
1504 | | - $s .= wfMsgForContent ( 'revdelete-unhid', implode ( ', ', $changes[1] ) ); |
| 1519 | + $s .= wfMsgForContent( 'revdelete-unhid', implode( ', ', $changes[1] ) ); |
1505 | 1520 | } |
1506 | 1521 | if( count( $changes[2] ) ) { |
1507 | 1522 | $s .= $s ? ' (' . $changes[2][0] . ')' : $changes[2][0]; |
1508 | 1523 | } |
1509 | | - |
1510 | 1524 | $msg = $isForLog ? 'logdelete-log-message' : 'revdelete-log-message'; |
1511 | | - $ret = wfMsgExt ( $msg, array( 'parsemag', 'content' ), |
1512 | | - $s, $wgContLang->formatNum( $count ) ); |
| 1525 | + return wfMsgExt( $msg, array( 'parsemag', 'content' ), $s, $wgLang->formatNum($count) ); |
1513 | 1526 | |
1514 | | - if( $comment ) $ret .= ": $comment"; |
1515 | | - |
1516 | | - return $ret; |
1517 | | - |
1518 | 1527 | } |
1519 | 1528 | |
1520 | 1529 | /** |
— | — | @@ -1534,16 +1543,15 @@ |
1535 | 1544 | $logtype = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ? |
1536 | 1545 | 'suppress' : 'delete'; |
1537 | 1546 | $log = new LogPage( $logtype ); |
| 1547 | + $itemCSV = implode(',',$items); |
1538 | 1548 | |
1539 | | - $reason = $this->getLogMessage( $count, $nbitfield, $obitfield, $comment, $param == 'logid' ); |
1540 | | - |
1541 | 1549 | if( $param == 'logid' ) { |
1542 | | - $params = array( implode( ',', $items) ); |
1543 | | - $log->addEntry( 'event', $title, $reason, $params ); |
| 1550 | + $params = array( $itemCSV, "ofield={$obitfield}", "nfield={$nbitfield}" ); |
| 1551 | + $log->addEntry( 'event', $title, $comment, $params ); |
1544 | 1552 | } else { |
1545 | 1553 | // Add params for effected page and ids |
1546 | | - $params = array( $param, implode( ',', $items) ); |
1547 | | - $log->addEntry( 'revision', $title, $reason, $params ); |
| 1554 | + $params = array( $param, $itemCSV, "ofield={$obitfield}", "nfield={$nbitfield}" ); |
| 1555 | + $log->addEntry( 'revision', $title, $comment, $params ); |
1548 | 1556 | } |
1549 | 1557 | } |
1550 | 1558 | } |
Index: branches/querypage-work/phase3/includes/specials/SpecialListUserRestrictions.php |
— | — | @@ -23,12 +23,12 @@ |
24 | 24 | |
25 | 25 | class SpecialListUserRestrictionsForm { |
26 | 26 | public function getHTML() { |
27 | | - global $wgRequest, $wgScript, $wgTitle; |
| 27 | + global $wgRequest, $wgScript; |
28 | 28 | $action = htmlspecialchars( $wgScript ); |
29 | 29 | $s = ''; |
30 | 30 | $s .= Xml::fieldset( wfMsg( 'listuserrestrictions-legend' ) ); |
31 | 31 | $s .= "<form action=\"{$action}\">"; |
32 | | - $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ); |
| 32 | + $s .= Xml::hidden( 'title', SpecialPage::getTitleFor('ListUserRestrictions')->getPrefixedDbKey() ); |
33 | 33 | $s .= Xml::label( wfMsgHtml( 'listuserrestrictions-type' ), 'type' ) . ' ' . |
34 | 34 | self::typeSelector( 'type', $wgRequest->getVal( 'type' ), 'type' ); |
35 | 35 | $s .= ' '; |
Index: branches/querypage-work/phase3/includes/specials/SpecialBlockip.php |
— | — | @@ -519,12 +519,15 @@ |
520 | 520 | array('ar_user_text' => $userId), __METHOD__ ); |
521 | 521 | # Hide name from logs |
522 | 522 | $dbw->update( 'logging', array("log_deleted = log_deleted $op $delUser"), |
523 | | - array('log_user' => $userId), __METHOD__ ); |
| 523 | + array('log_user' => $userId, "log_type != 'suppress'"), __METHOD__ ); |
524 | 524 | $dbw->update( 'logging', array("log_deleted = log_deleted $op $delAction"), |
525 | | - array('log_namespace' => NS_USER, 'log_title' => $userDbKey), __METHOD__ ); |
| 525 | + array('log_namespace' => NS_USER, 'log_title' => $userDbKey, |
| 526 | + "log_type != 'suppress'"), __METHOD__ ); |
526 | 527 | # Hide name from RC |
527 | 528 | $dbw->update( 'recentchanges', array("rc_deleted = rc_deleted $op $delUser"), |
528 | 529 | array('rc_user_text' => $name), __METHOD__ ); |
| 530 | + $dbw->update( 'recentchanges', array("rc_deleted = rc_deleted $op $delAction"), |
| 531 | + array('rc_namespace' => NS_USER, 'rc_title' => $userDbKey, 'rc_logid > 0'), __METHOD__ ); |
529 | 532 | # Hide name from live images |
530 | 533 | $dbw->update( 'oldimage', array("oi_deleted = oi_deleted $op $delUser"), |
531 | 534 | array('oi_user_text' => $name), __METHOD__ ); |
— | — | @@ -597,7 +600,8 @@ |
598 | 601 | $flags[] = 'anononly'; |
599 | 602 | if( $this->BlockCreateAccount ) |
600 | 603 | $flags[] = 'nocreate'; |
601 | | - if( !$this->BlockEnableAutoblock ) |
| 604 | + if( !$this->BlockEnableAutoblock && !IP::isIPAddress( $this->BlockAddress ) ) |
| 605 | + // Same as anononly, this is not displayed when blocking an IP address |
602 | 606 | $flags[] = 'noautoblock'; |
603 | 607 | if ( $this->BlockEmail ) |
604 | 608 | $flags[] = 'noemail'; |
Index: branches/querypage-work/phase3/includes/specials/SpecialAllpages.php |
— | — | @@ -114,8 +114,7 @@ |
115 | 115 | * @param integer $namespace (default NS_MAIN) |
116 | 116 | */ |
117 | 117 | function showToplevel( $namespace = NS_MAIN, $from = '', $to = '' ) { |
118 | | - global $wgOut, $wgContLang; |
119 | | - $align = $wgContLang->isRtl() ? 'left' : 'right'; |
| 118 | + global $wgOut; |
120 | 119 | |
121 | 120 | # TODO: Either make this *much* faster or cache the title index points |
122 | 121 | # in the querycache table. |
— | — | @@ -198,13 +197,13 @@ |
199 | 198 | } |
200 | 199 | |
201 | 200 | # At this point, $lines should contain an even number of elements. |
202 | | - $out .= "<table class='allpageslist' style='background: inherit;'>"; |
| 201 | + $out .= Xml::openElement( 'table', array( 'class' => 'allpageslist' ) ); |
203 | 202 | while( count ( $lines ) > 0 ) { |
204 | 203 | $inpoint = array_shift( $lines ); |
205 | 204 | $outpoint = array_shift( $lines ); |
206 | 205 | $out .= $this->showline( $inpoint, $outpoint, $namespace ); |
207 | 206 | } |
208 | | - $out .= '</table>'; |
| 207 | + $out .= Xml::closeElement( 'table' ); |
209 | 208 | $nsForm = $this->namespaceForm( $namespace, $from, $to ); |
210 | 209 | |
211 | 210 | # Is there more? |
— | — | @@ -213,11 +212,17 @@ |
214 | 213 | } else { |
215 | 214 | if( isset($from) || isset($to) ) { |
216 | 215 | global $wgUser; |
217 | | - $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
218 | | - $out2 .= '<tr valign="top"><td>' . $nsForm; |
219 | | - $out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">' . |
220 | | - $wgUser->getSkin()->makeKnownLinkObj( $this->getTitle(), wfMsgHtml ( 'allpages' ) ); |
221 | | - $out2 .= "</td></tr></table>"; |
| 216 | + $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ). |
| 217 | + '<tr> |
| 218 | + <td>' . |
| 219 | + $nsForm . |
| 220 | + '</td> |
| 221 | + <td class="mw-allpages-nav">' . |
| 222 | + $wgUser->getSkin()->link( $this->getTitle(), wfMsgHtml ( 'allpages' ), |
| 223 | + array(), array(), 'known' ) . |
| 224 | + "</td> |
| 225 | + </tr>" . |
| 226 | + Xml::closeElement( 'table' ); |
222 | 227 | } else { |
223 | 228 | $out2 = $nsForm; |
224 | 229 | } |
— | — | @@ -233,7 +238,6 @@ |
234 | 239 | */ |
235 | 240 | function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { |
236 | 241 | global $wgContLang; |
237 | | - $align = $wgContLang->isRtl() ? 'left' : 'right'; |
238 | 242 | $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); |
239 | 243 | $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); |
240 | 244 | // Don't let the length runaway |
— | — | @@ -248,7 +252,7 @@ |
249 | 253 | "<a href=\"$link\">$inpointf</a></td><td>", |
250 | 254 | "</td><td><a href=\"$link\">$outpointf</a>" |
251 | 255 | ); |
252 | | - return '<tr><td align="' . $align . '">'.$out.'</td></tr>'; |
| 256 | + return '<tr><td class="mw-allpages-alphaindexline">' . $out . '</td></tr>'; |
253 | 257 | } |
254 | 258 | |
255 | 259 | /** |
— | — | @@ -264,8 +268,6 @@ |
265 | 269 | $fromList = $this->getNamespaceKeyAndText($namespace, $from); |
266 | 270 | $toList = $this->getNamespaceKeyAndText( $namespace, $to ); |
267 | 271 | $namespaces = $wgContLang->getNamespaces(); |
268 | | - $align = $wgContLang->isRtl() ? 'left' : 'right'; |
269 | | - |
270 | 272 | $n = 0; |
271 | 273 | |
272 | 274 | if ( !$fromList || !$toList ) { |
— | — | @@ -299,8 +301,7 @@ |
300 | 302 | ); |
301 | 303 | |
302 | 304 | if( $res->numRows() > 0 ) { |
303 | | - $out = '<table style="background: inherit;" border="0" width="100%">'; |
304 | | - |
| 305 | + $out = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-chunk' ) ); |
305 | 306 | while( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { |
306 | 307 | $t = Title::makeTitle( $s->page_namespace, $s->page_title ); |
307 | 308 | if( $t ) { |
— | — | @@ -316,13 +317,13 @@ |
317 | 318 | $out .= "<td width=\"33%\">$link</td>"; |
318 | 319 | $n++; |
319 | 320 | if( $n % 3 == 0 ) { |
320 | | - $out .= '</tr>'; |
| 321 | + $out .= "</tr>\n"; |
321 | 322 | } |
322 | 323 | } |
323 | 324 | if( ($n % 3) != 0 ) { |
324 | | - $out .= '</tr>'; |
| 325 | + $out .= "</tr>\n"; |
325 | 326 | } |
326 | | - $out .= '</table>'; |
| 327 | + $out .= Xml::closeElement( 'table' ); |
327 | 328 | } else { |
328 | 329 | $out = ''; |
329 | 330 | } |
— | — | @@ -370,11 +371,13 @@ |
371 | 372 | $self = $this->getTitle(); |
372 | 373 | |
373 | 374 | $nsForm = $this->namespaceForm( $namespace, $from, $to ); |
374 | | - $out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">'; |
375 | | - $out2 .= '<tr valign="top"><td>' . $nsForm; |
376 | | - $out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">' . |
377 | | - $sk->makeKnownLinkObj( $self, |
378 | | - wfMsgHtml ( 'allpages' ) ); |
| 375 | + $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ). |
| 376 | + '<tr> |
| 377 | + <td>' . |
| 378 | + $nsForm . |
| 379 | + '</td> |
| 380 | + <td class="mw-allpages-nav">' . |
| 381 | + $sk->link( $self, wfMsgHtml ( 'allpages' ), array(), array(), 'known' ); |
379 | 382 | |
380 | 383 | # Do we put a previous link ? |
381 | 384 | if( isset( $prevTitle ) && $pt = $prevTitle->getText() ) { |
— | — | @@ -399,7 +402,7 @@ |
400 | 403 | |
401 | 404 | $wgOut->addHTML( $out2 . $out ); |
402 | 405 | if( isset($prevLink) or isset($nextLink) ) { |
403 | | - $wgOut->addHTML( '<hr /><p style="font-size: smaller; float: ' . $align . '">' ); |
| 406 | + $wgOut->addHTML( '<hr /><p class="mw-allpages-nav">' ); |
404 | 407 | if( isset( $prevLink ) ) { |
405 | 408 | $wgOut->addHTML( $prevLink ); |
406 | 409 | } |
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedpages.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * implements Special:Wantedpages |
10 | 10 | * @ingroup SpecialPage |
11 | 11 | */ |
12 | | -class WantedPagesPage extends QueryPage { |
| 12 | +class WantedPagesPage extends WantedQueryPage { |
13 | 13 | var $nlinks; |
14 | 14 | |
15 | 15 | function WantedPagesPage( $inc = false, $nlinks = true ) { |
— | — | @@ -20,11 +20,6 @@ |
21 | 21 | return 'Wantedpages'; |
22 | 22 | } |
23 | 23 | |
24 | | - function isExpensive() { |
25 | | - return true; |
26 | | - } |
27 | | - function isSyndicated() { return false; } |
28 | | - |
29 | 24 | function getSQL() { |
30 | 25 | global $wgWantedPagesThreshold; |
31 | 26 | $count = $wgWantedPagesThreshold - 1; |
— | — | @@ -49,66 +44,6 @@ |
50 | 45 | wfRunHooks( 'WantedPages::getSQL', array( &$this, &$sql ) ); |
51 | 46 | return $sql; |
52 | 47 | } |
53 | | - |
54 | | - /** |
55 | | - * Cache page existence for performance |
56 | | - */ |
57 | | - function preprocessResults( $db, $res ) { |
58 | | - $batch = new LinkBatch; |
59 | | - while ( $row = $db->fetchObject( $res ) ) |
60 | | - $batch->add( $row->namespace, $row->title ); |
61 | | - $batch->execute(); |
62 | | - |
63 | | - // Back to start for display |
64 | | - if ( $db->numRows( $res ) > 0 ) |
65 | | - // If there are no rows we get an error seeking. |
66 | | - $db->dataSeek( $res, 0 ); |
67 | | - } |
68 | | - |
69 | | - /** |
70 | | - * Format an individual result |
71 | | - * |
72 | | - * @param $skin Skin to use for UI elements |
73 | | - * @param $result Result row |
74 | | - * @return string |
75 | | - */ |
76 | | - public function formatResult( $skin, $result ) { |
77 | | - $title = Title::makeTitleSafe( $result->namespace, $result->title ); |
78 | | - if( $title instanceof Title ) { |
79 | | - if( $this->isCached() ) { |
80 | | - $pageLink = $title->exists() |
81 | | - ? '<s>' . $skin->makeLinkObj( $title ) . '</s>' |
82 | | - : $skin->makeBrokenLinkObj( $title ); |
83 | | - } else { |
84 | | - $pageLink = $skin->makeBrokenLinkObj( $title ); |
85 | | - } |
86 | | - return wfSpecialList( $pageLink, $this->makeWlhLink( $title, $skin, $result ) ); |
87 | | - } else { |
88 | | - $tsafe = htmlspecialchars( $result->title ); |
89 | | - return wfMsg( 'wantedpages-badtitle', $tsafe ); |
90 | | - } |
91 | | - } |
92 | | - |
93 | | - /** |
94 | | - * Make a "what links here" link for a specified result if required |
95 | | - * |
96 | | - * @param $title Title to make the link for |
97 | | - * @param $skin Skin to use |
98 | | - * @param $result Result row |
99 | | - * @return string |
100 | | - */ |
101 | | - private function makeWlhLink( $title, $skin, $result ) { |
102 | | - global $wgLang; |
103 | | - if( $this->nlinks ) { |
104 | | - $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' ); |
105 | | - $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ), |
106 | | - $wgLang->formatNum( $result->value ) ); |
107 | | - return $skin->makeKnownLinkObj( $wlh, $label, 'target=' . $title->getPrefixedUrl() ); |
108 | | - } else { |
109 | | - return null; |
110 | | - } |
111 | | - } |
112 | | - |
113 | 48 | } |
114 | 49 | |
115 | 50 | /** |
Index: branches/querypage-work/phase3/includes/specials/SpecialUndelete.php |
— | — | @@ -642,7 +642,7 @@ |
643 | 643 | $this->showList( $result ); |
644 | 644 | } |
645 | 645 | } else { |
646 | | - $wgOut->addWikiText( wfMsgHtml( 'undelete-header' ) ); |
| 646 | + $wgOut->addWikiMsg( 'undelete-header' ); |
647 | 647 | } |
648 | 648 | return; |
649 | 649 | } |
— | — | @@ -763,7 +763,7 @@ |
764 | 764 | $wgOut->addHTML( '<hr />' ); |
765 | 765 | } |
766 | 766 | } else { |
767 | | - $wgOut->addHTML( wfMsgHtml( 'undelete-nodiff' ) ); |
| 767 | + $wgOut->addWikiMsg( 'undelete-nodiff' ); |
768 | 768 | } |
769 | 769 | } |
770 | 770 | |
— | — | @@ -774,13 +774,16 @@ |
775 | 775 | $t = htmlspecialchars( $wgLang->time( $timestamp, true ) ); |
776 | 776 | $user = $skin->revUserTools( $rev ); |
777 | 777 | |
778 | | - $wgOut->addHTML( '<p>' . wfMsgHtml( 'undelete-revision', $link, $time, $user, $d, $t ) . '</p>' ); |
| 778 | + if( $this->mPreview ) { |
| 779 | + $openDiv = '<div id="mw-undelete-revision" class="mw-warning">'; |
| 780 | + } else { |
| 781 | + $openDiv = '<div id="mw-undelete-revision">'; |
| 782 | + } |
779 | 783 | |
| 784 | + $wgOut->addHTML( $openDiv . wfMsgWikiHtml( 'undelete-revision', $link, $time, $user, $d, $t ) . '</div>' ); |
780 | 785 | wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ); |
781 | 786 | |
782 | 787 | if( $this->mPreview ) { |
783 | | - $wgOut->addHTML( "<hr />\n" ); |
784 | | - |
785 | 788 | //Hide [edit]s |
786 | 789 | $popts = $wgOut->parserOptions(); |
787 | 790 | $popts->setEditSection( false ); |
— | — | @@ -941,7 +944,7 @@ |
942 | 945 | $wgOut->setPagetitle( wfMsg( 'viewdeletedpage' ) ); |
943 | 946 | } |
944 | 947 | |
945 | | - $wgOut->addWikiText( wfMsgHtml( 'undeletepagetitle', $this->mTargetObj->getPrefixedText()) ); |
| 948 | + $wgOut->addWikiMsg( 'undeletepagetitle', $this->mTargetObj->getPrefixedText() ); |
946 | 949 | |
947 | 950 | $archive = new PageArchive( $this->mTargetObj ); |
948 | 951 | /* |
Index: branches/querypage-work/phase3/includes/specials/SpecialWhatlinkshere.php |
— | — | @@ -7,40 +7,27 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** |
11 | | - * Entry point |
12 | | - * @param $par String: An article name ?? |
13 | | - */ |
14 | | -function wfSpecialWhatlinkshere($par = NULL) { |
15 | | - global $wgRequest; |
16 | | - $page = new WhatLinksHerePage( $wgRequest, $par ); |
17 | | - $page->execute(); |
18 | | -} |
19 | | - |
20 | | -/** |
21 | 11 | * implements Special:Whatlinkshere |
22 | 12 | * @ingroup SpecialPage |
23 | 13 | */ |
24 | | -class WhatLinksHerePage { |
25 | | - // Stored data |
26 | | - protected $par; |
| 14 | +class SpecialWhatLinksHere extends SpecialPage { |
27 | 15 | |
28 | 16 | // Stored objects |
29 | 17 | protected $opts, $target, $selfTitle; |
30 | 18 | |
31 | 19 | // Stored globals |
32 | | - protected $skin, $request; |
| 20 | + protected $skin; |
33 | 21 | |
34 | 22 | protected $limits = array( 20, 50, 100, 250, 500 ); |
35 | 23 | |
36 | | - function WhatLinksHerePage( $request, $par = null ) { |
| 24 | + public function __construct() { |
| 25 | + parent::__construct( 'Whatlinkshere' ); |
37 | 26 | global $wgUser; |
38 | | - $this->request = $request; |
39 | 27 | $this->skin = $wgUser->getSkin(); |
40 | | - $this->par = $par; |
41 | 28 | } |
42 | 29 | |
43 | | - function execute() { |
44 | | - global $wgOut; |
| 30 | + function execute( $par ) { |
| 31 | + global $wgOut, $wgRequest; |
45 | 32 | |
46 | 33 | $opts = new FormOptions(); |
47 | 34 | |
— | — | @@ -54,12 +41,12 @@ |
55 | 42 | $opts->add( 'hidelinks', false ); |
56 | 43 | $opts->add( 'hideimages', false ); |
57 | 44 | |
58 | | - $opts->fetchValuesFromRequest( $this->request ); |
| 45 | + $opts->fetchValuesFromRequest( $wgRequest ); |
59 | 46 | $opts->validateIntBounds( 'limit', 0, 5000 ); |
60 | 47 | |
61 | 48 | // Give precedence to subpage syntax |
62 | | - if ( isset($this->par) ) { |
63 | | - $opts->setValue( 'target', $this->par ); |
| 49 | + if ( isset($par) ) { |
| 50 | + $opts->setValue( 'target', $par ); |
64 | 51 | } |
65 | 52 | |
66 | 53 | // Bind to member variable |
— | — | @@ -346,7 +333,7 @@ |
347 | 334 | } |
348 | 335 | |
349 | 336 | function whatlinkshereForm() { |
350 | | - global $wgScript, $wgTitle; |
| 337 | + global $wgScript; |
351 | 338 | |
352 | 339 | // We get nicer value from the title object |
353 | 340 | $this->opts->consumeValue( 'target' ); |
— | — | @@ -360,7 +347,7 @@ |
361 | 348 | $f = Xml::openElement( 'form', array( 'action' => $wgScript ) ); |
362 | 349 | |
363 | 350 | # Values that should not be forgotten |
364 | | - $f .= Xml::hidden( 'title', $wgTitle->getPrefixedText() ); |
| 351 | + $f .= Xml::hidden( 'title', SpecialPage::getTitleFor( 'Whatlinkshere' )->getPrefixedText() ); |
365 | 352 | foreach ( $this->opts->getUnconsumedValues() as $name => $value ) { |
366 | 353 | $f .= Xml::hidden( $name, $value ); |
367 | 354 | } |
Index: branches/querypage-work/phase3/includes/specials/SpecialRecentchanges.php |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | // Is there either one namespace selected or excluded? |
308 | 308 | // Tag filtering also has a better index. |
309 | 309 | // Also, if this is "all" or main namespace, just use timestamp index. |
310 | | - if( is_null($namespace) || $invert || $namespace == NS_MAIN || $opts['tagfilter'] ) { |
| 310 | + if( is_null($namespace) || $invert || $opts['tagfilter'] ) { |
311 | 311 | $res = $dbr->select( $tables, '*', $conds, __METHOD__, |
312 | 312 | array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) + |
313 | 313 | $query_options, |
— | — | @@ -597,8 +597,12 @@ |
598 | 598 | global $wgUser; |
599 | 599 | $sk = $wgUser->getSkin(); |
600 | 600 | $params = $override + $options; |
601 | | - return $sk->link( $this->getTitle(), htmlspecialchars( $title ), |
602 | | - ( $active ? array( 'style'=>'font-weight: bold;' ) : array() ), $params, array( 'known' ) ); |
| 601 | + if ( $active ) { |
| 602 | + return $sk->link( $this->getTitle(), '<strong>' . htmlspecialchars( $title ) . '</strong>', |
| 603 | + array(), $params, array( 'known' ) ); |
| 604 | + } else { |
| 605 | + return $sk->link( $this->getTitle(), htmlspecialchars( $title ), array() , $params, array( 'known' ) ); |
| 606 | + } |
603 | 607 | } |
604 | 608 | |
605 | 609 | /** |
Index: branches/querypage-work/phase3/includes/specials/SpecialFilepath.php |
— | — | @@ -37,13 +37,13 @@ |
38 | 38 | } |
39 | 39 | |
40 | 40 | function execute() { |
41 | | - global $wgOut, $wgTitle, $wgScript; |
| 41 | + global $wgOut, $wgScript; |
42 | 42 | |
43 | 43 | $wgOut->addHTML( |
44 | 44 | Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) . |
45 | 45 | Xml::openElement( 'fieldset' ) . |
46 | 46 | Xml::element( 'legend', null, wfMsg( 'filepath' ) ) . |
47 | | - Xml::hidden( 'title', $wgTitle->getPrefixedText() ) . |
| 47 | + Xml::hidden( 'title', SpecialPage::getTitleFor( 'Filepath' )->getPrefixedText() ) . |
48 | 48 | Xml::inputLabel( wfMsg( 'filepath-page' ), 'file', 'file', 25, is_object( $this->mTitle ) ? $this->mTitle->getText() : '' ) . ' ' . |
49 | 49 | Xml::submitButton( wfMsg( 'filepath-submit' ) ) . "\n" . |
50 | 50 | Xml::closeElement( 'fieldset' ) . |
Index: branches/querypage-work/phase3/includes/specials/SpecialRestrictUser.php |
— | — | @@ -36,12 +36,12 @@ |
37 | 37 | |
38 | 38 | class RestrictUserForm { |
39 | 39 | public static function selectUserForm( $val = null, $error = null ) { |
40 | | - global $wgScript, $wgTitle; |
| 40 | + global $wgScript; |
41 | 41 | $action = htmlspecialchars( $wgScript ); |
42 | 42 | $s = Xml::fieldset( wfMsg( 'restrictuser-userselect' ) ) . "<form action=\"{$action}\">"; |
43 | 43 | if( $error ) |
44 | 44 | $s .= '<p>' . $error . '</p>'; |
45 | | - $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ); |
| 45 | + $s .= Xml::hidden( 'title', SpecialPage::getTitleFor( 'RestrictUser' )->getPrefixedDbKey() ); |
46 | 46 | $form = array( 'restrictuser-user' => Xml::input( 'user', false, $val ) ); |
47 | 47 | $s .= Xml::buildForm( $form, 'restrictuser-go' ); |
48 | 48 | $s .= "</form></fieldset>"; |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | } |
61 | 61 | |
62 | 62 | public static function pageRestrictionForm( $uid, $user, $oldRestrictions ) { |
63 | | - global $wgOut, $wgTitle, $wgRequest, $wgUser; |
| 63 | + global $wgOut, $wgRequest, $wgUser; |
64 | 64 | $error = ''; |
65 | 65 | $success = false; |
66 | 66 | if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::PAGE && |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | |
88 | 88 | self::printSuccessError( $success, $error ); |
89 | 89 | |
90 | | - $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $wgTitle->getLocalUrl(), |
| 90 | + $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => SpecialPage::getTitleFor( 'RestrictUser' )->getLocalUrl(), |
91 | 91 | 'method' => 'post' ) ) ); |
92 | 92 | $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::PAGE ) ); |
93 | 93 | $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) ); |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | } |
132 | 132 | |
133 | 133 | public static function namespaceRestrictionForm( $uid, $user, $oldRestrictions ) { |
134 | | - global $wgOut, $wgTitle, $wgRequest, $wgUser, $wgContLang; |
| 134 | + global $wgOut, $wgRequest, $wgUser, $wgContLang; |
135 | 135 | $error = ''; |
136 | 136 | $success = false; |
137 | 137 | if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::NAMESPACE && |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | |
156 | 156 | self::printSuccessError( $success, $error ); |
157 | 157 | |
158 | | - $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $wgTitle->getLocalUrl(), |
| 158 | + $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => SpecialPage::getTitleFor( 'RestrictUser' )->getLocalUrl(), |
159 | 159 | 'method' => 'post' ) ) ); |
160 | 160 | $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::NAMESPACE ) ); |
161 | 161 | $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) ); |
Index: branches/querypage-work/phase3/includes/specials/SpecialSpecialpages.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | $total = count($sortedPages); |
57 | 57 | $count = 0; |
58 | 58 | |
59 | | - $wgOut->wrapWikiMsg( "<h4 class='mw-specialpagesgroup'>$1</h4>\n", "specialpages-group-$group" ); |
| 59 | + $wgOut->wrapWikiMsg( "<h4 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h4>\n", "specialpages-group-$group" ); |
60 | 60 | $wgOut->addHTML( "<table style='width: 100%;' class='mw-specialpages-table'><tr>" ); |
61 | 61 | $wgOut->addHTML( "<td width='30%' valign='top'><ul>\n" ); |
62 | 62 | foreach( $sortedPages as $desc => $specialpage ) { |
Index: branches/querypage-work/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * Constructor. |
11 | 11 | */ |
12 | 12 | function wfSpecialAllmessages() { |
13 | | - global $wgOut, $wgRequest, $wgMessageCache, $wgTitle; |
| 13 | + global $wgOut, $wgRequest, $wgMessageCache; |
14 | 14 | global $wgUseDatabaseMessages, $wgLang; |
15 | 15 | |
16 | 16 | # The page isn't much use if the MediaWiki namespace is not being used |
— | — | @@ -47,12 +47,13 @@ |
48 | 48 | |
49 | 49 | wfProfileIn( __METHOD__ . '-output' ); |
50 | 50 | $wgOut->addScriptFile( 'allmessages.js' ); |
| 51 | + $title = SpecialPage::getTitleFor( 'Allmessages' ); |
51 | 52 | if ( $ot == 'php' ) { |
52 | 53 | $navText .= wfAllMessagesMakePhp( $messages ); |
53 | 54 | $wgOut->addHTML( $wgLang->pipeList( array( |
54 | 55 | 'PHP', |
55 | | - '<a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a>', |
56 | | - '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' . |
| 56 | + '<a href="' . $title->escapeLocalUrl( 'ot=html' ) . '">HTML</a>', |
| 57 | + '<a href="' . $title->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' . |
57 | 58 | '<pre>' . htmlspecialchars( $navText ) . '</pre>' |
58 | 59 | ) ) ); |
59 | 60 | } else if ( $ot == 'xml' ) { |
— | — | @@ -61,9 +62,9 @@ |
62 | 63 | echo wfAllMessagesMakeXml( $messages ); |
63 | 64 | } else { |
64 | 65 | $wgOut->addHTML( $wgLang->pipeList( array( |
65 | | - '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a>', |
| 66 | + '<a href="' . $title->escapeLocalUrl( 'ot=php' ) . '">PHP</a>', |
66 | 67 | 'HTML', |
67 | | - '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' |
| 68 | + '<a href="' . $title->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' |
68 | 69 | ) ) ); |
69 | 70 | $wgOut->addWikiText( $navText ); |
70 | 71 | $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) ); |
Index: branches/querypage-work/phase3/includes/specials/SpecialRecentchangeslinked.php |
— | — | @@ -85,13 +85,8 @@ |
86 | 86 | $join_conds['watchlist'] = array( 'LEFT JOIN', "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace" ); |
87 | 87 | } |
88 | 88 | |
89 | | - ChangeTags::modifyDisplayQuery( $tables, |
90 | | - $select, |
91 | | - $conds, |
92 | | - $join_conds, |
93 | | - $query_options, |
94 | | - $opts['tagfilter'], |
95 | | - ); |
| 89 | + ChangeTags::modifyDisplayQuery( $tables, $select, $conds, $join_conds, |
| 90 | + $query_options, $opts['tagfilter'] ); |
96 | 91 | |
97 | 92 | // XXX: parent class does this, should we too? |
98 | 93 | // wfRunHooks('SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts ) ); |
— | — | @@ -195,7 +190,6 @@ |
196 | 191 | |
197 | 192 | function setBottomText( OutputPage $out, FormOptions $opts ){ |
198 | 193 | if( isset( $this->mTargetTitle ) && is_object( $this->mTargetTitle ) ){ |
199 | | - global $wgUser; |
200 | 194 | $out->setFeedAppendQuery( "target=" . urlencode( $this->mTargetTitle->getPrefixedDBkey() ) ); |
201 | 195 | } |
202 | 196 | if( isset( $this->mResultEmpty ) && $this->mResultEmpty ){ |
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedtemplates.php |
— | — | @@ -15,20 +15,12 @@ |
16 | 16 | * @copyright Copyright © 2008, Danny B. |
17 | 17 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
18 | 18 | */ |
19 | | -class WantedTemplatesPage extends QueryPage { |
| 19 | +class WantedTemplatesPage extends WantedQueryPage { |
20 | 20 | |
21 | 21 | function getName() { |
22 | 22 | return 'Wantedtemplates'; |
23 | 23 | } |
24 | 24 | |
25 | | - function isExpensive() { |
26 | | - return true; |
27 | | - } |
28 | | - |
29 | | - function isSyndicated() { |
30 | | - return false; |
31 | | - } |
32 | | - |
33 | 25 | function getSQL() { |
34 | 26 | $dbr = wfGetDB( DB_SLAVE ); |
35 | 27 | list( $templatelinks, $page ) = $dbr->tableNamesN( 'templatelinks', 'page' ); |
— | — | @@ -45,55 +37,6 @@ |
46 | 38 | GROUP BY tl_namespace, tl_title |
47 | 39 | "; |
48 | 40 | } |
49 | | - |
50 | | - function sortDescending() { return true; } |
51 | | - |
52 | | - /** |
53 | | - * Fetch user page links and cache their existence |
54 | | - */ |
55 | | - function preprocessResults( $db, $res ) { |
56 | | - $batch = new LinkBatch; |
57 | | - while ( $row = $db->fetchObject( $res ) ) |
58 | | - $batch->add( $row->namespace, $row->title ); |
59 | | - $batch->execute(); |
60 | | - |
61 | | - // Back to start for display |
62 | | - if ( $db->numRows( $res ) > 0 ) |
63 | | - // If there are no rows we get an error seeking. |
64 | | - $db->dataSeek( $res, 0 ); |
65 | | - } |
66 | | - |
67 | | - function formatResult( $skin, $result ) { |
68 | | - global $wgLang, $wgContLang; |
69 | | - |
70 | | - $nt = Title::makeTitle( $result->namespace, $result->title ); |
71 | | - $text = $wgContLang->convert( $nt->getText() ); |
72 | | - |
73 | | - $plink = $this->isCached() ? |
74 | | - $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) : |
75 | | - $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) ); |
76 | | - |
77 | | - return wfSpecialList( |
78 | | - $plink, |
79 | | - $this->makeWlhLink( $nt, $skin, $result ) |
80 | | - ); |
81 | | - } |
82 | | - |
83 | | - /** |
84 | | - * Make a "what links here" link for a given title |
85 | | - * |
86 | | - * @param Title $title Title to make the link for |
87 | | - * @param Skin $skin Skin to use |
88 | | - * @param object $result Result row |
89 | | - * @return string |
90 | | - */ |
91 | | - private function makeWlhLink( $title, $skin, $result ) { |
92 | | - global $wgLang; |
93 | | - $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' ); |
94 | | - $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ), |
95 | | - $wgLang->formatNum( $result->value ) ); |
96 | | - return $skin->link( $wlh, $label, array(), array( 'target' => $title->getPrefixedText() ) ); |
97 | | - } |
98 | 41 | } |
99 | 42 | |
100 | 43 | /** |
Index: branches/querypage-work/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | | - $this->opts['limit'] = $wgRequest->getInt( 'limit', 50 ); |
| 43 | + $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') ); |
44 | 44 | $this->opts['target'] = $target; |
45 | 45 | |
46 | 46 | $nt = Title::makeTitleSafe( NS_USER, $target ); |
— | — | @@ -203,9 +203,9 @@ |
204 | 204 | * @param $this->opts Array: the options to be included. |
205 | 205 | */ |
206 | 206 | protected function getForm() { |
207 | | - global $wgScript, $wgTitle; |
| 207 | + global $wgScript; |
208 | 208 | |
209 | | - $this->opts['title'] = $wgTitle->getPrefixedText(); |
| 209 | + $this->opts['title'] = SpecialPage::getTitleFor( 'Contributions' )->getPrefixedText(); |
210 | 210 | if( !isset( $this->opts['target'] ) ) { |
211 | 211 | $this->opts['target'] = ''; |
212 | 212 | } else { |
Index: branches/querypage-work/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -617,7 +617,7 @@ |
618 | 618 | $redirectLabel = Xml::label( wfMsg( 'powersearch-redir' ), 'redirs' ); |
619 | 619 | $searchField = Xml::inputLabel( wfMsg('powersearch-field'), 'search', 'powerSearchText', 50, $term, |
620 | 620 | array( 'type' => 'text') ); |
621 | | - $searchButton = Xml::submitButton( wfMsg( 'powersearch' ), array( 'name' => 'fulltext' )) . "\n"; |
| 621 | + $searchButton = Xml::submitButton( wfMsg( 'powersearch' ) ) . "\n"; |
622 | 622 | $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
623 | 623 | |
624 | 624 | $redirectText = ''; |
— | — | @@ -759,7 +759,7 @@ |
760 | 760 | // Term box |
761 | 761 | $out .= Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'searchText' ) ) . "\n"; |
762 | 762 | $out .= Xml::hidden( 'fulltext', 'Search' ); |
763 | | - $out .= Xml::submitButton( wfMsg( 'searchbutton' ), array( 'name' => 'fulltext' ) ); |
| 763 | + $out .= Xml::submitButton( wfMsg( 'searchbutton' ) ); |
764 | 764 | $out .= ' (' . wfMsgExt('searchmenu-help',array('parseinline') ) . ')'; |
765 | 765 | $out .= Xml::closeElement( 'form' ); |
766 | 766 | // Add prefix link for single-namespace searches |
— | — | @@ -1428,7 +1428,7 @@ |
1429 | 1429 | $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1', 'id' => 'redirs' ) ); |
1430 | 1430 | $redirectLabel = Xml::label( wfMsg( 'powersearch-redir' ), 'redirs' ); |
1431 | 1431 | $searchField = Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'powerSearchText' ) ); |
1432 | | - $searchButton = Xml::submitButton( wfMsg( 'powersearch' ), array( 'name' => 'fulltext' ) ) . "\n"; |
| 1432 | + $searchButton = Xml::submitButton( wfMsg( 'powersearch' ) ) . "\n"; |
1433 | 1433 | $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
1434 | 1434 | $searchHiddens = Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n"; |
1435 | 1435 | $searchHiddens .= Xml::hidden( 'fulltext', 'Advanced search' ) . "\n"; |
— | — | @@ -1480,7 +1480,7 @@ |
1481 | 1481 | } |
1482 | 1482 | $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ); |
1483 | 1483 | $out .= Xml::hidden( 'fulltext', 'Search' ); |
1484 | | - $out .= Xml::submitButton( wfMsg( 'searchbutton' ), array( 'name' => 'fulltext' ) ); |
| 1484 | + $out .= Xml::submitButton( wfMsg( 'searchbutton' ) ); |
1485 | 1485 | $out .= Xml::closeElement( 'form' ); |
1486 | 1486 | |
1487 | 1487 | return $out; |
Index: branches/querypage-work/phase3/includes/specials/SpecialMIMEsearch.php |
— | — | @@ -83,12 +83,12 @@ |
84 | 84 | * Output the HTML search form, and constructs the MIMEsearchPage object. |
85 | 85 | */ |
86 | 86 | function wfSpecialMIMEsearch( $par = null ) { |
87 | | - global $wgRequest, $wgTitle, $wgOut; |
| 87 | + global $wgRequest, $wgOut; |
88 | 88 | |
89 | 89 | $mime = isset( $par ) ? $par : $wgRequest->getText( 'mime' ); |
90 | 90 | |
91 | 91 | $wgOut->addHTML( |
92 | | - Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => $wgTitle->getLocalUrl() ) ) . |
| 92 | + Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor( 'MIMEsearch' )->getLocalUrl() ) ) . |
93 | 93 | Xml::openElement( 'fieldset' ) . |
94 | 94 | Xml::element( 'legend', null, wfMsg( 'mimesearch' ) ) . |
95 | 95 | Xml::inputLabel( wfMsg( 'mimetype' ), 'mime', 'mime', 20, $mime ) . ' ' . |
Index: branches/querypage-work/phase3/includes/specials/SpecialIpblocklist.php |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | } |
308 | 308 | |
309 | 309 | function searchForm() { |
310 | | - global $wgTitle, $wgScript, $wgRequest, $wgLang; |
| 310 | + global $wgScript, $wgRequest, $wgLang; |
311 | 311 | |
312 | 312 | $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) ); |
313 | 313 | $nondefaults = array(); |
— | — | @@ -334,7 +334,7 @@ |
335 | 335 | |
336 | 336 | return |
337 | 337 | Xml::tags( 'form', array( 'action' => $wgScript ), |
338 | | - Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ) . |
| 338 | + Xml::hidden( 'title', SpecialPage::getTitleFor( 'Ipblocklist' )->getPrefixedDbKey() ) . |
339 | 339 | Xml::openElement( 'fieldset' ) . |
340 | 340 | Xml::element( 'legend', null, wfMsg( 'ipblocklist-legend' ) ) . |
341 | 341 | Xml::inputLabel( wfMsg( 'ipblocklist-username' ), 'ip', 'ip', /* size */ false, $this->ip ) . |
Index: branches/querypage-work/phase3/includes/specials/SpecialListusers.php |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | $dbr = wfGetDB( DB_SLAVE ); |
76 | 76 | $conds = array(); |
77 | 77 | // Don't show hidden names |
78 | | - $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0'; |
| 78 | + $conds[] = 'ipb_deleted IS NULL'; |
79 | 79 | if( $this->requestedGroup != '' ) { |
80 | 80 | $conds['ug_group'] = $this->requestedGroup; |
81 | 81 | $useIndex = ''; |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | |
99 | 99 | $query = array( |
100 | 100 | 'tables' => " $user $useIndex LEFT JOIN $user_groups ON user_id=ug_user |
101 | | - LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_auto=0 ", |
| 101 | + LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_deleted=1 AND ipb_auto=0 ", |
102 | 102 | 'fields' => array( |
103 | 103 | $this->creationSort ? 'MAX(user_name) AS user_name' : 'user_name', |
104 | 104 | $this->creationSort ? 'user_id' : 'MAX(user_id) AS user_id', |
Index: branches/querypage-work/phase3/includes/specials/SpecialPreferences.php |
— | — | @@ -104,10 +104,11 @@ |
105 | 105 | } |
106 | 106 | |
107 | 107 | function execute() { |
108 | | - global $wgUser, $wgOut, $wgTitle; |
| 108 | + global $wgUser, $wgOut; |
109 | 109 | |
110 | 110 | if ( $wgUser->isAnon() ) { |
111 | | - $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', array($wgTitle->getPrefixedDBkey()) ); |
| 111 | + $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', |
| 112 | + array( SpecialPage::getTitleFor( 'Preferences' )->getPrefixedDBkey() ) ); |
112 | 113 | return; |
113 | 114 | } |
114 | 115 | if ( wfReadOnly() ) { |
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedfiles.php |
— | — | @@ -13,20 +13,12 @@ |
14 | 14 | * @copyright Copyright © 2008, Soxred93 |
15 | 15 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
16 | 16 | */ |
17 | | -class WantedFilesPage extends QueryPage { |
| 17 | +class WantedFilesPage extends WantedQueryPage { |
18 | 18 | |
19 | 19 | function getName() { |
20 | 20 | return 'Wantedfiles'; |
21 | 21 | } |
22 | 22 | |
23 | | - function isExpensive() { |
24 | | - return true; |
25 | | - } |
26 | | - |
27 | | - function isSyndicated() { |
28 | | - return false; |
29 | | - } |
30 | | - |
31 | 23 | function getSQL() { |
32 | 24 | $dbr = wfGetDB( DB_SLAVE ); |
33 | 25 | list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' ); |
— | — | @@ -44,55 +36,6 @@ |
45 | 37 | GROUP BY il_to |
46 | 38 | "; |
47 | 39 | } |
48 | | - |
49 | | - function sortDescending() { return true; } |
50 | | - |
51 | | - /** |
52 | | - * Fetch user page links and cache their existence |
53 | | - */ |
54 | | - function preprocessResults( $db, $res ) { |
55 | | - $batch = new LinkBatch; |
56 | | - while ( $row = $db->fetchObject( $res ) ) |
57 | | - $batch->add( $row->namespace, $row->title ); |
58 | | - $batch->execute(); |
59 | | - |
60 | | - // Back to start for display |
61 | | - if ( $db->numRows( $res ) > 0 ) |
62 | | - // If there are no rows we get an error seeking. |
63 | | - $db->dataSeek( $res, 0 ); |
64 | | - } |
65 | | - |
66 | | - function formatResult( $skin, $result ) { |
67 | | - global $wgLang, $wgContLang; |
68 | | - |
69 | | - $nt = Title::makeTitle( $result->namespace, $result->title ); |
70 | | - $text = $wgContLang->convert( $nt->getText() ); |
71 | | - |
72 | | - $plink = $this->isCached() ? |
73 | | - $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) : |
74 | | - $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) ); |
75 | | - |
76 | | - return wfSpecialList( |
77 | | - $plink, |
78 | | - $this->makeWlhLink( $nt, $skin, $result ) |
79 | | - ); |
80 | | - } |
81 | | - |
82 | | - /** |
83 | | - * Make a "what links here" link for a given title |
84 | | - * |
85 | | - * @param Title $title Title to make the link for |
86 | | - * @param Skin $skin Skin to use |
87 | | - * @param object $result Result row |
88 | | - * @return string |
89 | | - */ |
90 | | - private function makeWlhLink( $title, $skin, $result ) { |
91 | | - global $wgLang; |
92 | | - $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' ); |
93 | | - $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ), |
94 | | - $wgLang->formatNum( $result->value ) ); |
95 | | - return $skin->link( $wlh, $label, array(), array( 'target' => $title->getPrefixedText() ) ); |
96 | | - } |
97 | 40 | } |
98 | 41 | |
99 | 42 | /** |
Index: branches/querypage-work/phase3/includes/specials/SpecialImport.php |
— | — | @@ -132,11 +132,11 @@ |
133 | 133 | } |
134 | 134 | |
135 | 135 | private function showForm() { |
136 | | - global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources, $wgExportMaxLinkDepth; |
| 136 | + global $wgUser, $wgOut, $wgRequest, $wgImportSources, $wgExportMaxLinkDepth; |
137 | 137 | if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) ) |
138 | 138 | return $wgOut->permissionRequired( 'import' ); |
139 | 139 | |
140 | | - $action = $wgTitle->getLocalUrl( 'action=submit' ); |
| 140 | + $action = $this->getTitle()->getLocalUrl( 'action=submit' ); |
141 | 141 | |
142 | 142 | if( $wgUser->isAllowed( 'importupload' ) ) { |
143 | 143 | $wgOut->addWikiMsg( "importtext" ); |
Property changes on: branches/querypage-work/phase3/includes/specials |
___________________________________________________________________ |
Added: svn:mergeinfo |
144 | 144 | Merged /trunk/phase3/includes/specials:r49084-49527 |