Index: trunk/extensions/CentralNotice/special/SpecialBannerController.php |
— | — | @@ -54,12 +54,11 @@ |
55 | 55 | 'getVars': {} |
56 | 56 | }, |
57 | 57 | 'fn': { |
58 | | - 'loadBanner': function( bannerName, fundraising, landingPages, campaign ) { |
| 58 | + 'loadBanner': function( bannerName, campaign ) { |
59 | 59 | // Get the requested banner |
60 | 60 | var bannerPageQuery = $.param( { |
61 | 61 | 'banner': bannerName, 'campaign': campaign, 'userlang': wgUserLanguage, |
62 | | - 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country, |
63 | | - 'fundraising': fundraising, 'landingpages': landingPages |
| 62 | + 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country |
64 | 63 | } ); |
65 | 64 | var bannerPage = '?title=Special:BannerLoader&' + bannerPageQuery; |
66 | 65 | JAVASCRIPT; |
— | — | @@ -119,8 +118,6 @@ |
120 | 119 | // Load a random banner from our groomed list |
121 | 120 | $.centralNotice.fn.loadBanner( |
122 | 121 | groomedBannerList[pointer].name, |
123 | | - groomedBannerList[pointer].fundraising, |
124 | | - groomedBannerList[pointer].landing_pages, |
125 | 122 | groomedBannerList[pointer].campaign |
126 | 123 | ); |
127 | 124 | }, |
Index: trunk/extensions/CentralNotice/special/SpecialBannerLoader.php |
— | — | @@ -23,9 +23,7 @@ |
24 | 24 | // Get values from the query string |
25 | 25 | $this->language = $wgRequest->getText( 'userlang', 'en' ); |
26 | 26 | $this->siteName = $wgRequest->getText( 'sitename', 'Wikipedia' ); |
27 | | - $this->campaign = $wgRequest->getText( 'campaign', 'unknown' ); |
28 | | - $this->fundraising = $wgRequest->getBool( 'fundraising', false ); |
29 | | - $this->landingPages = $wgRequest->getText( 'landingpages' ); |
| 27 | + $this->campaign = $wgRequest->getText( 'campaign', 'undefined' ); |
30 | 28 | |
31 | 29 | if ( $wgRequest->getText( 'banner' ) ) { |
32 | 30 | $bannerName = $wgRequest->getText( 'banner' ); |
— | — | @@ -76,8 +74,8 @@ |
77 | 75 | 'bannerName' => $bannerName, |
78 | 76 | 'bannerHtml' => $bannerHtml, |
79 | 77 | 'campaign' => $this->campaign, |
80 | | - 'fundraising' => $this->fundraising, |
81 | | - 'landingPages' => $this->landingPages |
| 78 | + 'fundraising' => $this->getFundraising( $bannerName ), |
| 79 | + 'landingPages' => $this->getLandingPages( $bannerName ) |
82 | 80 | ); |
83 | 81 | $bannerJs = 'insertBanner('.FormatJson::encode( $bannerArray ).');'; |
84 | 82 | return $bannerJs; |
— | — | @@ -196,6 +194,22 @@ |
197 | 195 | } |
198 | 196 | return $count; |
199 | 197 | } |
| 198 | + |
| 199 | + function getFundraising( $bannerName ) { |
| 200 | + global $wgCentralDBname; |
| 201 | + $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
| 202 | + $eBannerName = htmlspecialchars( $bannerName ); |
| 203 | + $row = $dbr->selectRow( 'cn_templates', 'tmp_fundraising', array( 'tmp_name' => $eBannerName ) ); |
| 204 | + return $row->tmp_fundraising; |
| 205 | + } |
| 206 | + |
| 207 | + function getLandingPages( $bannerName ) { |
| 208 | + global $wgCentralDBname; |
| 209 | + $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
| 210 | + $eBannerName = htmlspecialchars( $bannerName ); |
| 211 | + $row = $dbr->selectRow( 'cn_templates', 'tmp_landing_pages', array( 'tmp_name' => $eBannerName ) ); |
| 212 | + return $row->tmp_landing_pages; |
| 213 | + } |
200 | 214 | } |
201 | 215 | /** |
202 | 216 | * @defgroup Exception Exception |