r103844 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103843‎ | r103844 | r103845 >
Date:22:17, 21 November 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/FundraiserLandingPage (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.php
@@ -40,7 +40,8 @@
4141 $wgFundraiserLPDefaults = array(
4242 'template' => 'Lp-wrapper',
4343 'appeal' => 'Appeal-default',
44 - 'form' => 'Form-default'
 44+ 'form' => 'Form-default',
 45+ 'country' => 'XX' // per Charles Barr
4546 );
4647
4748 // Adding configurrable variable for caching time
Index: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
@@ -29,14 +29,29 @@
3030 $template = $this->make_safe( $request->getText( 'template', $wgFundraiserLPDefaults[ 'template' ] ) );
3131 $appeal = $this->make_safe( $request->getText( 'appeal', $wgFundraiserLPDefaults[ 'appeal' ] ) );
3232 $form = $this->make_safe( $request->getText( 'form', $wgFundraiserLPDefaults[ 'form' ] ) );
 33+ $country = $request->getVal( 'country' );
 34+ // If no country was passed do a GeoIP lookup
 35+ if ( !$country ) {
 36+ if ( function_exists( 'geoip_country_code_by_name' ) ) {
 37+ $ip = wfGetIP();
 38+ if ( IP::isValid( $ip ) ) {
 39+ $country = geoip_country_code_by_name( $ip );
 40+ }
 41+ }
 42+ }
 43+ // If country still isn't set, set it to the default
 44+ if ( !$country ) {
 45+ $country = $wgFundraiserLPDefaults[ 'country' ];
 46+ }
 47+ $country = $this->make_safe( $country );
3348
3449 # begin generating the template call
35 - $output .= "{{ $template\n| appeal = $appeal\n| form = $form\n";
 50+ $output .= "{{ $template\n| appeal = $appeal\n| form = $form\n| country = $country\n";
3651
3752 # add any parameters passed in the querystring
3853 foreach ( $request->getValues() as $k_unsafe => $v_unsafe ) {
3954 # skip the required variables
40 - if ( $k_unsafe == "template" || $k_unsafe == "appeal" || $k_unsafe == "form" ) {
 55+ if ( $k_unsafe == "template" || $k_unsafe == "appeal" || $k_unsafe == "form" || $k_unsafe == "country" ) {
4156 continue;
4257 }
4358 # get the variables name and value
Property changes on: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
___________________________________________________________________
Modified: svn:mergeinfo
4459 Merged /trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php:r103829
Property changes on: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage
___________________________________________________________________
Added: svn:mergeinfo
4560 Merged /branches/sqlite/extensions/FundraiserLandingPage:r58211-58321
4661 Merged /trunk/phase3/extensions/FundraiserLandingPage:r92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,98578,98598,98656
4762 Merged /branches/new-installer/phase3/extensions/FundraiserLandingPage:r43664-66004
4863 Merged /branches/REL1_15/phase3/extensions/FundraiserLandingPage:r51646
4964 Merged /branches/REL1_18/extensions/FundraiserLandingPage:r101758,103190
5065 Merged /branches/REL1_17/phase3/extensions/FundraiserLandingPage:r81445,81448
5166 Merged /trunk/extensions/FundraiserLandingPage:r99592,99653,100092,100419,100686,100692,100699,103669,103829

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103829adding geoIP lookup to FundraiserLandingPagekaldari19:49, 21 November 2011

Status & tagging log