| Index: trunk/extensions/ContributionTracking/ContributionTracking_body.php |
| — | — | @@ -29,14 +29,11 @@ |
| 30 | 30 | |
| 31 | 31 | function execute( $language ) { |
| 32 | 32 | global $wgRequest, $wgOut; |
| 33 | | - wfLoadExtensionMessages( 'ContributionTracking' ); |
| 34 | 33 | |
| 35 | 34 | if ( !preg_match( '/^[a-z-]+$/', $language ) ) { |
| 36 | 35 | $language = 'en'; |
| 37 | 36 | } |
| 38 | 37 | $this->lang = Language::factory( $language ); |
| 39 | | - wfLoadExtensionMessages( 'ContributionTracking' ); |
| 40 | | - wfLoadExtensionMessages( 'ContributionTracking', $language ); |
| 41 | 38 | |
| 42 | 39 | $this->setHeaders(); |
| 43 | 40 | |
| Index: trunk/extensions/ContributionTracking/ContributionTracking.php |
| — | — | @@ -26,7 +26,6 @@ |
| 27 | 27 | //this only works if contribution tracking is inside a mediawiki DB, which typically it isn't. |
| 28 | 28 | //$wgHooks['LoadExtensionSchemaUpdates'][] = 'efContributionTrackingLoadUpdates'; |
| 29 | 29 | |
| 30 | | - |
| 31 | 30 | $wgContributionTrackingDBserver = $wgDBserver; |
| 32 | 31 | $wgContributionTrackingDBname = $wgDBname; |
| 33 | 32 | $wgContributionTrackingDBuser = $wgDBuser; |
| Index: trunk/extensions/ContactPageFundraiser/SpecialContact.php |
| — | — | @@ -27,7 +27,6 @@ |
| 28 | 28 | * Constructor |
| 29 | 29 | */ |
| 30 | 30 | function __construct() { |
| 31 | | - global $wgOut; |
| 32 | 31 | parent::__construct( 'Contact', '', true ); |
| 33 | 32 | } |
| 34 | 33 | |
| — | — | @@ -38,7 +37,6 @@ |
| 39 | 38 | function execute( $par ) { |
| 40 | 39 | global $wgUser, $wgOut, $wgRequest, $wgEnableEmail, $wgContactUser; |
| 41 | 40 | |
| 42 | | - wfLoadExtensionMessages( 'ContactPageFundraiser' ); |
| 43 | 41 | $fname = "SpecialContact::execute"; |
| 44 | 42 | |
| 45 | 43 | if ( $wgRequest->wasPosted() ) { |
| — | — | @@ -56,7 +54,7 @@ |
| 57 | 55 | $form['url'] = $wgRequest->getVal('url'); |
| 58 | 56 | $form['country'] = $wgRequest->getVal('country'); |
| 59 | 57 | $form['citytown'] = $wgRequest->getVal('city-town'); |
| 60 | | - $form['provstat'] = $wgRequest->getVal('prov-state'); |
| | 58 | + $form['provstat'] = $wgRequest->getVal('prov-state'); |
| 61 | 59 | $form['story'] = $wgRequest->getVal('story'); |
| 62 | 60 | $form['followup'] = $wgRequest->getVal('follow-up'); |
| 63 | 61 | |
| — | — | @@ -67,57 +65,53 @@ |
| 68 | 66 | $f->setText( $text ); |
| 69 | 67 | $f->doSubmit(); |
| 70 | 68 | } |
| | 69 | + if( !$wgEnableEmail || !$wgContactUser ) { |
| | 70 | + $wgOut->showErrorPage( "nosuchspecialpage", "nospecialpagetext" ); |
| | 71 | + return; |
| | 72 | + } |
| 71 | 73 | |
| 72 | | - else { |
| 73 | | - |
| 74 | | - } |
| 75 | | - if( !$wgEnableEmail || !$wgContactUser ) { |
| 76 | | - $wgOut->showErrorPage( "nosuchspecialpage", "nospecialpagetext" ); |
| 77 | | - return; |
| 78 | | - } |
| | 74 | + $action = $wgRequest->getVal( 'action' ); |
| 79 | 75 | |
| 80 | | - $action = $wgRequest->getVal( 'action' ); |
| | 76 | + $nu = User::newFromName( $wgContactUser ); |
| | 77 | + if( is_null( $nu ) || !$nu->canReceiveEmail() ) { |
| | 78 | + wfDebug( "Target is invalid user or can't receive.\n" ); |
| | 79 | + $wgOut->showErrorPage( "noemailtitle", "noemailtext" ); |
| | 80 | + return; |
| | 81 | + } |
| 81 | 82 | |
| 82 | | - $nu = User::newFromName( $wgContactUser ); |
| 83 | | - if( is_null( $nu ) || !$nu->canReceiveEmail() ) { |
| 84 | | - wfDebug( "Target is invalid user or can't receive.\n" ); |
| 85 | | - $wgOut->showErrorPage( "noemailtitle", "noemailtext" ); |
| 86 | | - return; |
| 87 | | - } |
| | 83 | + $f = new EmailContactForm( $nu ); |
| 88 | 84 | |
| 89 | | - $f = new EmailContactForm( $nu ); |
| | 85 | + if ( "success" == $action ) { |
| | 86 | + wfDebug( "$fname: success.\n" ); |
| | 87 | + $f->showSuccess( ); |
| | 88 | + } else if ( "submit" == $action && $wgRequest->wasPosted() && $f->hasAllInfo() ) { |
| | 89 | + $token = $wgRequest->getVal( 'wpEditToken' ); |
| 90 | 90 | |
| 91 | | - if ( "success" == $action ) { |
| 92 | | - wfDebug( "$fname: success.\n" ); |
| 93 | | - $f->showSuccess( ); |
| 94 | | - } else if ( "submit" == $action && $wgRequest->wasPosted() && $f->hasAllInfo() ) { |
| 95 | | - $token = $wgRequest->getVal( 'wpEditToken' ); |
| 96 | | - |
| 97 | | - if( $wgUser->isAnon() ) { |
| 98 | | - # Anonymous users may not have a session |
| 99 | | - # open. Check for suffix anyway. |
| 100 | | - $tokenOk = ( EDIT_TOKEN_SUFFIX == $token ); |
| 101 | | - } else { |
| 102 | | - $tokenOk = $wgUser->matchEditToken( $token ); |
| 103 | | - } |
| 104 | | - |
| 105 | | - if ( !$tokenOk ) { |
| 106 | | - wfDebug( "$fname: bad token (".($wgUser->isAnon()?'anon':'user')."): $token\n" ); |
| 107 | | - $wgOut->addWikiText( wfMsg( 'sessionfailure' ) ); |
| 108 | | - $f->showForm(); |
| 109 | | - } else if ( !$f->passCaptcha() ) { |
| 110 | | - wfDebug( "$fname: captcha failed" ); |
| 111 | | - $wgOut->addWikiText( wfMsg( 'contactpage-captcha-failed' ) ); //TODO: provide a message for this! |
| 112 | | - $f->showForm(); |
| 113 | | - } else { |
| 114 | | - wfDebug( "$fname: submit\n" ); |
| 115 | | - $f->doSubmit(); |
| 116 | | - } |
| | 91 | + if( $wgUser->isAnon() ) { |
| | 92 | + # Anonymous users may not have a session |
| | 93 | + # open. Check for suffix anyway. |
| | 94 | + $tokenOk = ( EDIT_TOKEN_SUFFIX == $token ); |
| 117 | 95 | } else { |
| 118 | | - wfDebug( "$fname: form\n" ); |
| | 96 | + $tokenOk = $wgUser->matchEditToken( $token ); |
| | 97 | + } |
| | 98 | + |
| | 99 | + if ( !$tokenOk ) { |
| | 100 | + wfDebug( "$fname: bad token (".($wgUser->isAnon()?'anon':'user')."): $token\n" ); |
| | 101 | + $wgOut->addWikiText( wfMsg( 'sessionfailure' ) ); |
| 119 | 102 | $f->showForm(); |
| | 103 | + } else if ( !$f->passCaptcha() ) { |
| | 104 | + wfDebug( "$fname: captcha failed" ); |
| | 105 | + $wgOut->addWikiText( wfMsg( 'contactpage-captcha-failed' ) ); //TODO: provide a message for this! |
| | 106 | + $f->showForm(); |
| | 107 | + } else { |
| | 108 | + wfDebug( "$fname: submit\n" ); |
| | 109 | + $f->doSubmit(); |
| 120 | 110 | } |
| | 111 | + } else { |
| | 112 | + wfDebug( "$fname: form\n" ); |
| | 113 | + $f->showForm(); |
| 121 | 114 | } |
| | 115 | + } |
| 122 | 116 | } |
| 123 | 117 | |
| 124 | 118 | /** |
| — | — | @@ -135,7 +129,6 @@ |
| 136 | 130 | */ |
| 137 | 131 | function __construct( $target ) { |
| 138 | 132 | global $wgRequest, $wgUser; |
| 139 | | - global $wgCaptchaClass; |
| 140 | 133 | |
| 141 | 134 | $this->target = $target; |
| 142 | 135 | $this->text = $wgRequest->getText( 'wpText' ); |
| — | — | @@ -284,8 +277,8 @@ |
| 285 | 278 | |
| 286 | 279 | function doSubmit( ) { |
| 287 | 280 | global $wgOut, $wgRequest; |
| 288 | | - global $wgEnableEmail, $wgUserEmailUseReplyTo, $wgEmergencyContact; |
| 289 | | - global $wgContactUser, $wgContactSender, $wgContactSenderName; |
| | 281 | + global $wgUserEmailUseReplyTo, $wgEmergencyContact; |
| | 282 | + global $wgContactSender, $wgContactSenderName; |
| 290 | 283 | |
| 291 | 284 | $csender = $wgContactSender ? $wgContactSender : $wgEmergencyContact; |
| 292 | 285 | $cname = $wgContactSenderName; |
| Index: trunk/extensions/ContributionReporting/ContributionStatistics_body.php |
| — | — | @@ -20,13 +20,9 @@ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | // Initialize special page |
| 23 | 23 | parent::__construct( 'ContributionStatistics' ); |
| 24 | | - |
| 25 | | - // Internationalization |
| 26 | | - wfLoadExtensionMessages( 'ContributionReporting' ); |
| 27 | 24 | } |
| 28 | 25 | |
| 29 | 26 | public function execute( $sub ) { |
| 30 | | - global $wgRequest, $wgOut, $wgUser; |
| 31 | 27 | global $egContributionStatisticsViewDays; |
| 32 | 28 | |
| 33 | 29 | $this->evalDateRange(); |
| — | — | @@ -124,8 +120,7 @@ |
| 125 | 121 | |
| 126 | 122 | $months = $this->getMonthlyTotals(); |
| 127 | 123 | $total = $this->getTotalContributions(); |
| 128 | | - |
| 129 | | - $msg = ''; |
| | 124 | + |
| 130 | 125 | if ( $this->mMode == 'range' ) { |
| 131 | 126 | $msg = wfMsgExt( 'contribstats-month-range-totals', array( 'parsemag' ), $wgLang->formatNum( count( $months ) ) ); |
| 132 | 127 | } else { |
| — | — | @@ -216,8 +211,7 @@ |
| 217 | 212 | |
| 218 | 213 | public function showContributionBreakdown() { |
| 219 | 214 | global $wgOut, $wgLang; |
| 220 | | - |
| 221 | | - $msg = ''; |
| | 215 | + |
| 222 | 216 | if ( $this->mMode == 'range' ) { |
| 223 | 217 | $msg = wfMsg( 'contribstats-contribution-range-breakdown', |
| 224 | 218 | $wgLang->date( wfTimestamp( TS_MW, $this->mStartDate ) ), |
| — | — | @@ -252,7 +246,6 @@ |
| 253 | 247 | wfMsg( 'contribstats-value-over', $wgLang->formatNum( 1000 ) ) => array( 1000, 999999999999.99 ), |
| 254 | 248 | ); |
| 255 | 249 | foreach( $list as $label => $range ) { |
| 256 | | - $data = array(); |
| 257 | 250 | if( isset( $range[1] ) ) { |
| 258 | 251 | $data = $this->getNumContributionsWithin( $range[0], $range[1] ); |
| 259 | 252 | } else { |
| — | — | @@ -301,7 +294,7 @@ |
| 302 | 295 | |
| 303 | 296 | // Build day/value array |
| 304 | 297 | $totals = array(); |
| 305 | | - while ( $row = $dbr->fetchRow( $res ) ) { |
| | 298 | + foreach ( $res as $row ) { |
| 306 | 299 | /* |
| 307 | 300 | $median = $dbr->selectField( 'public_reporting', |
| 308 | 301 | array( 'converted_amount' ), |
| — | — | @@ -347,7 +340,7 @@ |
| 348 | 341 | |
| 349 | 342 | // Build day/value array |
| 350 | 343 | $totals = array(); |
| 351 | | - while ( $row = $dbr->fetchRow( $res ) ) { |
| | 344 | + foreach ( $res as $row ) { |
| 352 | 345 | $median = $dbr->selectField( 'public_reporting', |
| 353 | 346 | array( 'converted_amount' ), |
| 354 | 347 | array( |
| — | — | @@ -390,7 +383,7 @@ |
| 391 | 384 | ); |
| 392 | 385 | |
| 393 | 386 | $totals = array(); |
| 394 | | - while ( $row = $dbr->fetchRow( $res ) ) { |
| | 387 | + foreach ( $res as $row ) { |
| 395 | 388 | $median = $dbr->selectField( 'public_reporting', |
| 396 | 389 | array( 'converted_amount' ), |
| 397 | 390 | array_merge( |
| Index: trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php |
| — | — | @@ -15,9 +15,6 @@ |
| 16 | 16 | public function __construct() { |
| 17 | 17 | // Initialize special page |
| 18 | 18 | parent::__construct( 'ContributionTrackingStatistics' ); |
| 19 | | - |
| 20 | | - // Internationalization |
| 21 | | - wfLoadExtensionMessages( 'ContributionReporting' ); |
| 22 | 19 | } |
| 23 | 20 | |
| 24 | 21 | public function execute( $sub ) { |
| — | — | @@ -75,10 +72,6 @@ |
| 76 | 73 | // Generic Table Display for Totals |
| 77 | 74 | // FORMAT: 1 daily, 2 weekly, 3 Monthly, 4 Combined |
| 78 | 75 | public function showTotalsForRange( $range, $format ) { |
| 79 | | - global $wgOut; |
| 80 | | - global $wgAllowedTempaltes, $wgAllowedSupport, |
| 81 | | - $wgAllowedPaymentMethod, $wgContributionReportingBaseURL; |
| 82 | | - |
| 83 | 76 | list( $start, $end ) = $range; |
| 84 | 77 | $current = $end; |
| 85 | 78 | |
| — | — | @@ -121,7 +114,7 @@ |
| 122 | 115 | |
| 123 | 116 | public function createTable( $totals ) { |
| 124 | 117 | // Table headers |
| 125 | | - global $wgOut, $wgAllowedTemplates, $wgAllowedSupport; |
| | 118 | + global $wgAllowedTemplates, $wgAllowedSupport; |
| 126 | 119 | global $wgAllowedPaymentMethod, $wgContributionReportingBaseURL; |
| 127 | 120 | |
| 128 | 121 | $htmlOut = Xml::openElement( 'table', |
| — | — | @@ -145,11 +138,16 @@ |
| 146 | 139 | foreach( $totals as $template ) { |
| 147 | 140 | //grab info from utm_src, 'unpack' template, landing page, donation page thus far |
| 148 | 141 | $expanded_template = explode(".", $template[0]); |
| 149 | | - if(!isset($expanded_template[1])){ $expanded_template[1] = "";} |
| 150 | | - if(!isset($expanded_template[2])){ $expanded_template[2] = "";} |
| | 142 | + if(!isset($expanded_template[1])) { |
| | 143 | + $expanded_template[1] = ""; |
| | 144 | + } |
| | 145 | + if(!isset($expanded_template[2])) { |
| | 146 | + $expanded_template[2] = ""; |
| | 147 | + } |
| 151 | 148 | |
| 152 | | - if ( ! in_array($expanded_template[0], $wgAllowedTemplates ) ) |
| | 149 | + if ( ! in_array($expanded_template[0], $wgAllowedTemplates ) ) { |
| 153 | 150 | continue; |
| | 151 | + } |
| 154 | 152 | if( ($expanded_template[1] != "") && (! in_array($expanded_template[1], $wgAllowedSupport)) ){ |
| 155 | 153 | continue; |
| 156 | 154 | } |
| — | — | @@ -250,7 +248,7 @@ |
| 251 | 249 | |
| 252 | 250 | ); |
| 253 | 251 | |
| 254 | | - while ( $row = $dbr->fetchRow( $res ) ) { |
| | 252 | + foreach ( $res as $row ) { |
| 255 | 253 | $result[] = array( |
| 256 | 254 | $row[0], |
| 257 | 255 | $row[1], |
| Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php |
| — | — | @@ -12,7 +12,6 @@ |
| 13 | 13 | |
| 14 | 14 | public function __construct() { |
| 15 | 15 | parent::__construct( 'FundraiserStatistics' ); |
| 16 | | - wfLoadExtensionMessages( 'ContributionReporting' ); |
| 17 | 16 | } |
| 18 | 17 | |
| 19 | 18 | public function execute( $sub ) { |
| — | — | @@ -88,7 +87,7 @@ |
| 89 | 88 | } |
| 90 | 89 | // Scale factors |
| 91 | 90 | foreach ( $charts as $name => $chart ) { |
| 92 | | - $charts[$name]['factor'] = $factor = 300 / $chart['max']; |
| | 91 | + $charts[$name]['factor'] = 300 / $chart['max']; |
| 93 | 92 | } |
| 94 | 93 | // HTML-time! |
| 95 | 94 | $view = 0; |
| Index: trunk/extensions/ContributionReporting/ContributionHistory_body.php |
| — | — | @@ -16,9 +16,6 @@ |
| 17 | 17 | $offset = $wgRequest->getIntOrNull( 'offset' ); |
| 18 | 18 | $show = 100; |
| 19 | 19 | |
| 20 | | - wfLoadExtensionMessages( 'ContributionReporting' ); |
| 21 | | - wfLoadExtensionMessages( 'ContributionReporting', $language ); |
| 22 | | - |
| 23 | 20 | $this->setHeaders(); |
| 24 | 21 | |
| 25 | 22 | $db = efContributionReportingConnection(); |
| — | — | @@ -109,8 +106,8 @@ |
| 110 | 107 | 'LIMIT' => $show |
| 111 | 108 | ) |
| 112 | 109 | ); |
| 113 | | - $alt = TRUE; |
| 114 | | - while ( $row = $res->fetchRow() ) { |
| | 110 | + $alt = true; |
| | 111 | + foreach ( $res as $row ) { |
| 115 | 112 | if ( $this->isTiny( $row ) ) { |
| 116 | 113 | continue; // Skip over micro payments generally < $1 |
| 117 | 114 | } |
| Index: trunk/extensions/ContributionReporting/ContributionTotal_body.php |
| — | — | @@ -8,8 +8,6 @@ |
| 9 | 9 | function execute( $par ) { |
| 10 | 10 | global $wgRequest, $wgOut; |
| 11 | 11 | |
| 12 | | - wfLoadExtensionMessages( 'ContributionReporting' ); |
| 13 | | - |
| 14 | 12 | $this->setHeaders(); |
| 15 | 13 | |
| 16 | 14 | # Get request data from, e.g. |