Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | } |
144 | 144 | |
145 | 145 | function efCentralNoticeLoader( $out, $skin ) { |
146 | | - global $wgUser, $wgOut, $wgCentralDBname, $wgScript; |
| 146 | + global $wgOut; |
147 | 147 | |
148 | 148 | // Include '.js' to exempt script from squid cache override |
149 | 149 | $centralLoader = SpecialPage::getTitleFor( 'BannerController' )->getLocalUrl( 'cache=/cn.js' ); |
Index: trunk/extensions/CentralNotice/TemplatePager.php |
— | — | @@ -54,7 +54,6 @@ |
55 | 55 | } |
56 | 56 | |
57 | 57 | // Link and Preview |
58 | | - $viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' ); |
59 | 58 | $render = new SpecialBannerLoader(); |
60 | 59 | $render->siteName = 'Wikipedia'; |
61 | 60 | $render->language = $this->mRequest->getVal( 'wpUserLanguage' ); |
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -203,7 +203,7 @@ |
204 | 204 | $dbr = wfGetDB( DB_SLAVE ); |
205 | 205 | $res = $dbr->select( 'cn_notices', 'not_name', null, __METHOD__ ); |
206 | 206 | $notices = array(); |
207 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 207 | + foreach ( $res as $row ) { |
208 | 208 | $notices[] = $row->not_name; |
209 | 209 | } |
210 | 210 | return $notices; |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | $htmlOut .= $this->tableRow( $headers, 'th' ); |
352 | 352 | |
353 | 353 | // Table rows |
354 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 354 | + foreach ( $res as $row ) { |
355 | 355 | $fields = array(); |
356 | 356 | |
357 | 357 | // Name |
— | — | @@ -362,7 +362,6 @@ |
363 | 363 | $fields[] = htmlspecialchars( $this->getProjectName( $row->not_project ) ); |
364 | 364 | |
365 | 365 | // Languages |
366 | | - $project_langs = array(); |
367 | 366 | $project_langs = $this->getNoticeLanguages( $row->not_name ); |
368 | 367 | $language_count = count( $project_langs ); |
369 | 368 | $languageList = ''; |
— | — | @@ -429,7 +428,7 @@ |
430 | 429 | $htmlOut .= Xml::closeElement( 'table' ); |
431 | 430 | |
432 | 431 | if ( $this->editable ) { |
433 | | - $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() ); |
| 432 | + $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
434 | 433 | $htmlOut .= Xml::openElement( 'div', array( 'class' => 'cn-buttons' ) ); |
435 | 434 | $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-modify' ), |
436 | 435 | array( |
— | — | @@ -703,7 +702,7 @@ |
704 | 703 | } |
705 | 704 | } |
706 | 705 | if ( $this->editable ) { |
707 | | - $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() ); |
| 706 | + $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
708 | 707 | |
709 | 708 | // Submit button |
710 | 709 | $htmlOut .= Xml::tags( 'div', |
— | — | @@ -917,7 +916,7 @@ |
918 | 917 | wfMsg ( "centralnotice-templates" ) ); |
919 | 918 | |
920 | 919 | // Table rows |
921 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 920 | + foreach( $res as $row ) { |
922 | 921 | |
923 | 922 | $htmlOut .= Xml::openElement( 'tr' ); |
924 | 923 | |
— | — | @@ -1076,8 +1075,6 @@ |
1077 | 1076 | } |
1078 | 1077 | |
1079 | 1078 | function addNotice( $noticeName, $enabled, $start, $project_name, $project_languages, $geotargeted, $geo_countries ) { |
1080 | | - global $wgOut; |
1081 | | - |
1082 | 1079 | if ( $this->noticeExists( $noticeName ) ) { |
1083 | 1080 | $this->showError( 'centralnotice-notice-exists' ); |
1084 | 1081 | return; |
— | — | @@ -1136,7 +1133,6 @@ |
1137 | 1134 | } |
1138 | 1135 | |
1139 | 1136 | function removeNotice( $noticeName ) { |
1140 | | - global $wgOut; |
1141 | 1137 | $dbr = wfGetDB( DB_SLAVE ); |
1142 | 1138 | |
1143 | 1139 | $res = $dbr->select( 'cn_notices', 'not_name, not_locked', |
— | — | @@ -1163,8 +1159,6 @@ |
1164 | 1160 | } |
1165 | 1161 | |
1166 | 1162 | function addTemplateTo( $noticeName, $templateName, $weight ) { |
1167 | | - global $wgOut; |
1168 | | - |
1169 | 1163 | $dbr = wfGetDB( DB_SLAVE ); |
1170 | 1164 | |
1171 | 1165 | $eNoticeName = htmlspecialchars ( $noticeName ); |
— | — | @@ -1261,8 +1255,6 @@ |
1262 | 1256 | } |
1263 | 1257 | |
1264 | 1258 | function updateNoticeDate( $noticeName, $start, $end ) { |
1265 | | - global $wgOut; |
1266 | | - |
1267 | 1259 | $dbr = wfGetDB( DB_SLAVE ); |
1268 | 1260 | |
1269 | 1261 | // Start/end don't line up |
— | — | @@ -1295,8 +1287,6 @@ |
1296 | 1288 | * Update the enabled/disabled state of a campaign |
1297 | 1289 | */ |
1298 | 1290 | private function updateEnabled( $noticeName, $isEnabled ) { |
1299 | | - global $wgOut; |
1300 | | - |
1301 | 1291 | if ( !$this->noticeExists( $noticeName ) ) { |
1302 | 1292 | $this->showError( 'centralnotice-doesnt-exist' ); |
1303 | 1293 | } else { |
— | — | @@ -1329,8 +1319,6 @@ |
1330 | 1320 | * Update the geotargeted/not geotargeted state of a campaign |
1331 | 1321 | */ |
1332 | 1322 | function updateGeotargeted( $noticeName, $isGeotargeted ) { |
1333 | | - global $wgOut; |
1334 | | - |
1335 | 1323 | if ( !$this->noticeExists( $noticeName ) ) { |
1336 | 1324 | $this->showError( 'centralnotice-doesnt-exist' ); |
1337 | 1325 | } else { |
— | — | @@ -1346,8 +1334,6 @@ |
1347 | 1335 | * Update the locked/unlocked state of a campaign |
1348 | 1336 | */ |
1349 | 1337 | function updateLock( $noticeName, $isLocked ) { |
1350 | | - global $wgOut; |
1351 | | - |
1352 | 1338 | if ( !$this->noticeExists( $noticeName ) ) { |
1353 | 1339 | $this->showError( 'centralnotice-doesnt-exist' ); |
1354 | 1340 | } else { |
— | — | @@ -1457,7 +1443,6 @@ |
1458 | 1444 | $dbw->begin(); |
1459 | 1445 | |
1460 | 1446 | // Get the previously assigned languages |
1461 | | - $oldLanguages = array(); |
1462 | 1447 | $oldLanguages = $this->getNoticeLanguages( $notice ); |
1463 | 1448 | |
1464 | 1449 | // Get the notice id |
— | — | @@ -1638,7 +1623,7 @@ |
1639 | 1624 | $render->siteName = 'Wikipedia'; |
1640 | 1625 | $render->language = $this->mRequest->getVal( 'wpUserLanguage' ); |
1641 | 1626 | $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), |
1642 | | - $this->getSkin()->makeLinkObj( $this->viewPage, |
| 1627 | + $this->getSkin()->makeLinkObj( $viewPage, |
1643 | 1628 | htmlspecialchars( $row->tmp_name ), |
1644 | 1629 | 'template=' . urlencode( $row->tmp_name ) ) . |
1645 | 1630 | Xml::fieldset( wfMsg( 'centralnotice-preview' ), |
— | — | @@ -1679,7 +1664,6 @@ |
1680 | 1665 | * Close table |
1681 | 1666 | */ |
1682 | 1667 | function getEndBody() { |
1683 | | - global $wgUser; |
1684 | 1668 | $htmlOut = ''; |
1685 | 1669 | $htmlOut .= Xml::closeElement( 'table' ); |
1686 | 1670 | return $htmlOut; |
Index: trunk/extensions/CentralNotice/SpecialBannerController.php |
— | — | @@ -13,8 +13,7 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | function execute( $par ) { |
17 | | - global $wgOut, $wgRequest; |
18 | | - global $wgNoticeLang, $wgNoticeProject; |
| 17 | + global $wgOut; |
19 | 18 | |
20 | 19 | $wgOut->disable(); |
21 | 20 | $this->sendHeaders(); |
— | — | @@ -26,7 +25,6 @@ |
27 | 26 | } else { |
28 | 27 | echo $content; |
29 | 28 | } |
30 | | - |
31 | 29 | } |
32 | 30 | |
33 | 31 | /** |
Index: trunk/extensions/CentralNotice/SpecialBannerAllocation.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | * Handle different types of page requests |
21 | 21 | */ |
22 | 22 | function execute( $sub ) { |
23 | | - global $wgOut, $wgUser, $wgRequest, $wgExtensionAssetsPath, $wgNoticeProjects, $wgLanguageCode; |
| 23 | + global $wgOut, $wgRequest, $wgExtensionAssetsPath, $wgNoticeProjects, $wgLanguageCode; |
24 | 24 | |
25 | 25 | if ( $wgRequest->wasPosted() ) { |
26 | 26 | $this->project = $wgRequest->getText( 'project', 'wikipedia' ); |
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php |
— | — | @@ -618,8 +618,6 @@ |
619 | 619 | } |
620 | 620 | |
621 | 621 | private function removeTemplate ( $name ) { |
622 | | - global $wgOut; |
623 | | - |
624 | 622 | $id = $this->getTemplateId( $name ); |
625 | 623 | $dbr = wfGetDB( DB_SLAVE ); |
626 | 624 | $res = $dbr->select( 'cn_assignments', 'asn_id', array( 'tmp_id' => $id ), __METHOD__ ); |
— | — | @@ -647,8 +645,6 @@ |
648 | 646 | * Create a new banner |
649 | 647 | */ |
650 | 648 | private function addTemplate( $name, $body, $displayAnon, $displayAccount ) { |
651 | | - global $wgOut; |
652 | | - |
653 | 649 | if ( $body == '' || $name == '' ) { |
654 | 650 | $this->showError( 'centralnotice-null-string' ); |
655 | 651 | return; |
— | — | @@ -692,8 +688,6 @@ |
693 | 689 | * Update a banner |
694 | 690 | */ |
695 | 691 | private function editTemplate( $name, $body, $displayAnon, $displayAccount ) { |
696 | | - global $wgOut; |
697 | | - |
698 | 692 | if ( $body == '' || $name == '' ) { |
699 | 693 | $this->showError( 'centralnotice-null-string' ); |
700 | 694 | return; |
— | — | @@ -772,7 +766,6 @@ |
773 | 767 | * Find all message fields set for a banner |
774 | 768 | */ |
775 | 769 | private function findFields( $template ) { |
776 | | - $messages = array(); |
777 | 770 | $body = wfMsg( "Centralnotice-template-{$template}" ); |
778 | 771 | |
779 | 772 | // Generate list of message fields from parsing the body |