Index: branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -28,10 +28,11 @@ |
29 | 29 | $wgNoticeInfrastructure = true; |
30 | 30 | |
31 | 31 | // The name of the database which hosts the centralized campaign data |
32 | | -$wgCentralDBname = 'metawiki'; |
| 32 | +$wgCentralDBname = ''; |
33 | 33 | |
34 | 34 | // The path to Special Pages on the wiki that hosts the CentralNotice infrastructure |
35 | | -$wgCentralPagePath = 'http://meta.wikimedia.org/wiki/'; |
| 35 | +// For example 'http://meta.wikimedia.org/wiki/' |
| 36 | +$wgCentralPagePath = ''; |
36 | 37 | |
37 | 38 | // Enable the loader itself |
38 | 39 | // Allows to control the loader visibility, without destroying infrastructure |
— | — | @@ -151,7 +152,7 @@ |
152 | 153 | } |
153 | 154 | |
154 | 155 | function efCentralNoticeLoader( $out, $skin ) { |
155 | | - global $wgUser, $wgOut, $wgCentralDBname; |
| 156 | + global $wgOut; |
156 | 157 | |
157 | 158 | // Include '.js' to exempt script from squid cache override |
158 | 159 | $centralLoader = SpecialPage::getTitleFor( 'BannerController' )->getLocalUrl( 'cache=/cn.js' ); |
Index: branches/wmf/1.16wmf4/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: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | $dbr = wfGetDB( DB_SLAVE ); |
206 | 206 | $res = $dbr->select( 'cn_notices', 'not_name', null, __METHOD__ ); |
207 | 207 | $notices = array(); |
208 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 208 | + foreach ( $res as $row ) { |
209 | 209 | $notices[] = $row->not_name; |
210 | 210 | } |
211 | 211 | return $notices; |
— | — | @@ -351,7 +351,7 @@ |
352 | 352 | $htmlOut .= $this->tableRow( $headers, 'th' ); |
353 | 353 | |
354 | 354 | // Table rows |
355 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 355 | + foreach ( $res as $row ) { |
356 | 356 | $fields = array(); |
357 | 357 | |
358 | 358 | // Name |
— | — | @@ -363,7 +363,6 @@ |
364 | 364 | $fields[] = htmlspecialchars( $this->getProjectName( $row->not_project ) ); |
365 | 365 | |
366 | 366 | // Languages |
367 | | - $project_langs = array(); |
368 | 367 | $project_langs = $this->getNoticeLanguages( $row->not_name ); |
369 | 368 | $language_count = count( $project_langs ); |
370 | 369 | $languageList = ''; |
— | — | @@ -433,7 +432,7 @@ |
434 | 433 | $htmlOut .= Xml::closeElement( 'table' ); |
435 | 434 | |
436 | 435 | if ( $this->editable ) { |
437 | | - $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() ); |
| 436 | + $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
438 | 437 | $htmlOut .= Xml::openElement( 'div', array( 'class' => 'cn-buttons' ) ); |
439 | 438 | $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-modify' ), |
440 | 439 | array( |
— | — | @@ -716,7 +715,7 @@ |
717 | 716 | } |
718 | 717 | } |
719 | 718 | if ( $this->editable ) { |
720 | | - $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() ); |
| 719 | + $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() ); |
721 | 720 | |
722 | 721 | // Submit button |
723 | 722 | $htmlOut .= Xml::tags( 'div', |
— | — | @@ -953,7 +952,7 @@ |
954 | 953 | wfMsg ( "centralnotice-templates" ) ); |
955 | 954 | |
956 | 955 | // Table rows |
957 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 956 | + foreach( $res as $row ) { |
958 | 957 | |
959 | 958 | $htmlOut .= Xml::openElement( 'tr' ); |
960 | 959 | |
— | — | @@ -1118,8 +1117,6 @@ |
1119 | 1118 | function addNotice( $noticeName, $enabled, $start, $project_name, |
1120 | 1119 | $project_languages, $geotargeted, $geo_countries ) |
1121 | 1120 | { |
1122 | | - global $wgOut; |
1123 | | - |
1124 | 1121 | if ( $this->noticeExists( $noticeName ) ) { |
1125 | 1122 | $this->showError( 'centralnotice-notice-exists' ); |
1126 | 1123 | return; |
— | — | @@ -1185,7 +1182,6 @@ |
1186 | 1183 | } |
1187 | 1184 | |
1188 | 1185 | function removeNotice( $noticeName ) { |
1189 | | - global $wgOut; |
1190 | 1186 | $dbr = wfGetDB( DB_SLAVE ); |
1191 | 1187 | |
1192 | 1188 | $res = $dbr->select( 'cn_notices', 'not_name, not_locked', |
— | — | @@ -1212,8 +1208,6 @@ |
1213 | 1209 | } |
1214 | 1210 | |
1215 | 1211 | function addTemplateTo( $noticeName, $templateName, $weight ) { |
1216 | | - global $wgOut; |
1217 | | - |
1218 | 1212 | $dbr = wfGetDB( DB_SLAVE ); |
1219 | 1213 | |
1220 | 1214 | $eNoticeName = htmlspecialchars ( $noticeName ); |
— | — | @@ -1312,8 +1306,6 @@ |
1313 | 1307 | } |
1314 | 1308 | |
1315 | 1309 | function updateNoticeDate( $noticeName, $start, $end ) { |
1316 | | - global $wgOut; |
1317 | | - |
1318 | 1310 | $dbr = wfGetDB( DB_SLAVE ); |
1319 | 1311 | |
1320 | 1312 | // Start/end don't line up |
— | — | @@ -1346,8 +1338,6 @@ |
1347 | 1339 | * Update the enabled/disabled state of a campaign |
1348 | 1340 | */ |
1349 | 1341 | private function updateEnabled( $noticeName, $isEnabled ) { |
1350 | | - global $wgOut; |
1351 | | - |
1352 | 1342 | if ( !$this->noticeExists( $noticeName ) ) { |
1353 | 1343 | $this->showError( 'centralnotice-doesnt-exist' ); |
1354 | 1344 | } else { |
— | — | @@ -1380,8 +1370,6 @@ |
1381 | 1371 | * Update the geotargeted/not geotargeted state of a campaign |
1382 | 1372 | */ |
1383 | 1373 | function updateGeotargeted( $noticeName, $isGeotargeted ) { |
1384 | | - global $wgOut; |
1385 | | - |
1386 | 1374 | if ( !$this->noticeExists( $noticeName ) ) { |
1387 | 1375 | $this->showError( 'centralnotice-doesnt-exist' ); |
1388 | 1376 | } else { |
— | — | @@ -1397,8 +1385,6 @@ |
1398 | 1386 | * Update the locked/unlocked state of a campaign |
1399 | 1387 | */ |
1400 | 1388 | function updateLock( $noticeName, $isLocked ) { |
1401 | | - global $wgOut; |
1402 | | - |
1403 | 1389 | if ( !$this->noticeExists( $noticeName ) ) { |
1404 | 1390 | $this->showError( 'centralnotice-doesnt-exist' ); |
1405 | 1391 | } else { |
— | — | @@ -1519,7 +1505,6 @@ |
1520 | 1506 | $dbw->begin(); |
1521 | 1507 | |
1522 | 1508 | // Get the previously assigned languages |
1523 | | - $oldLanguages = array(); |
1524 | 1509 | $oldLanguages = $this->getNoticeLanguages( $notice ); |
1525 | 1510 | |
1526 | 1511 | // Get the notice id |
— | — | @@ -1709,7 +1694,6 @@ |
1710 | 1695 | } |
1711 | 1696 | |
1712 | 1697 | // Link and Preview |
1713 | | - $viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' ); |
1714 | 1698 | $render = new SpecialBannerLoader(); |
1715 | 1699 | $render->siteName = 'Wikipedia'; |
1716 | 1700 | $render->language = $this->mRequest->getVal( 'wpUserLanguage' ); |
— | — | @@ -1755,7 +1739,6 @@ |
1756 | 1740 | * Close table |
1757 | 1741 | */ |
1758 | 1742 | function getEndBody() { |
1759 | | - global $wgUser; |
1760 | 1743 | $htmlOut = ''; |
1761 | 1744 | $htmlOut .= Xml::closeElement( 'table' ); |
1762 | 1745 | return $htmlOut; |
Index: branches/wmf/1.16wmf4/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 | /** |
— | — | @@ -75,7 +73,7 @@ |
76 | 74 | var geoLocation = Geo.country; // pull the geo info |
77 | 75 | } |
78 | 76 | var bannerListQuery = $.param( { 'language': wgContentLanguage, 'project': wgNoticeProject, 'country': geoLocation } ); |
79 | | - var bannerListURL = wgScript + '?title=' + wgFormattedNamespaces[-1] + ':BannerListLoader&cache=/cn.js&' + bannerListQuery; |
| 77 | + var bannerListURL = wgScript + '?title=' + encodeURIComponent(wgFormattedNamespaces[-1]) + ':BannerListLoader&cache=/cn.js&' + bannerListQuery; |
80 | 78 | var request = $.ajax( { |
81 | 79 | url: bannerListURL, |
82 | 80 | dataType: 'json', |
Index: branches/wmf/1.16wmf4/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, $wgScriptPath, $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: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php |
— | — | @@ -680,8 +680,6 @@ |
681 | 681 | } |
682 | 682 | |
683 | 683 | private function removeTemplate ( $name ) { |
684 | | - global $wgOut; |
685 | | - |
686 | 684 | $id = $this->getTemplateId( $name ); |
687 | 685 | $dbr = wfGetDB( DB_SLAVE ); |
688 | 686 | $res = $dbr->select( 'cn_assignments', 'asn_id', array( 'tmp_id' => $id ), __METHOD__ ); |
— | — | @@ -709,8 +707,6 @@ |
710 | 708 | * Create a new banner |
711 | 709 | */ |
712 | 710 | private function addTemplate( $name, $body, $displayAnon, $displayAccount ) { |
713 | | - global $wgOut; |
714 | | - |
715 | 711 | if ( $body == '' || $name == '' ) { |
716 | 712 | $this->showError( 'centralnotice-null-string' ); |
717 | 713 | return; |
— | — | @@ -754,8 +750,6 @@ |
755 | 751 | * Update a banner |
756 | 752 | */ |
757 | 753 | private function editTemplate( $name, $body, $displayAnon, $displayAccount ) { |
758 | | - global $wgOut; |
759 | | - |
760 | 754 | if ( $body == '' || $name == '' ) { |
761 | 755 | $this->showError( 'centralnotice-null-string' ); |
762 | 756 | return; |
— | — | @@ -834,7 +828,6 @@ |
835 | 829 | * Find all message fields set for a banner |
836 | 830 | */ |
837 | 831 | private function findFields( $template ) { |
838 | | - $messages = array(); |
839 | 832 | $body = wfMsg( "Centralnotice-template-{$template}" ); |
840 | 833 | |
841 | 834 | // Generate list of message fields from parsing the body |
Property changes on: branches/wmf/1.16wmf4/extensions/CentralNotice |
___________________________________________________________________ |
Modified: svn:mergeinfo |
842 | 835 | Merged /trunk/extensions/CentralNotice:r73963,75674,75889,76145 |