r59753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59752‎ | r59753 | r59754 >
Date:03:22, 5 December 2009
Author:tomasz
Status:ok (Comments)
Tags:
Comment:
picking up r59750, 59165, 59751, 59752 and new translations.
Modified paths:
  • /branches/wmf-deployment/extensions/ContributionReporting (modified) (history)
  • /branches/wmf-deployment/extensions/ContributionReporting/ContributionReporting.i18n.php (modified) (history)
  • /branches/wmf-deployment/extensions/ContributionReporting/ContributionStatistics_body.php (modified) (history)
  • /branches/wmf-deployment/extensions/ContributionReporting/cc-reporting.js (modified) (history)
  • /branches/wmf-deployment/extensions/ContributionReporting/cc-reporting.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/ContributionReporting/cc-reporting.php
@@ -1,4 +1,6 @@
22 <?php
 3+
 4+//handle request
35 if(isset ($_REQUEST['load'])){
46 handleLoad();
57 }
@@ -6,30 +8,41 @@
79 handleSubmit();
810 }
911
 12+//handle load
1013 function handleLoad(){
1114 $cc_id = randomCookie();
1215
13 - if(!isset($_COOKIE['cc-cookie'])){
14 - $cc_id = $_REQUEST['cc-cookie'];
 16+ //already have a cookie? use it, else set randomly generated one
 17+ if(isset($_COOKIE['cc-cookie'])){
 18+ $cc_id = $_COOKIE['cc-cookie'];
1519 }
1620 else{
1721 //set cookie to expire in maybe about a year or so... 300 days
1822 setcookie('cc-cookie', $cc_id, time() + (60 * 60 * 24 * 300), '/', "payments.wikimedia.org");
1923 }
2024
21 - //if not exist insert into DB
22 - //via REQUEST['utm_src']
 25+ //add into DB
 26+ $cc_id = addslashes($cc_id);
 27+ $utm_src = isset($_REQUEST['utm_src']) ?
 28+ addslashes($_REQUEST['utm_src']) : "unknown";
 29+ $sql = "INSERT IGNORE INTO cc-track (cookie_id, utm_src, contribs) VALUES ('$cc_id','$utm_src', 0)";
2330 }
2431
 32+//handle submit
2533 function handleSubmit(){
 34+
 35+ //for people with cookies turned off, track them via "NULL" cookie
2636 $cc_id = "NULL";
2737 if(isset($_COOKIE['cc-cookie'])){
2838 $cc_id = $_COOKIE['cc-cookie'];
2939 }
3040
31 - //donations++
 41+ //update in DB
 42+ $cc_id = addslashes($cc_id);
 43+ $sql = "UPDATE cc-track SET contribs=contribs+1 WHERE cookie_id = '$cc_id'";
3244 }
3345
 46+//random cookie
3447 function randomCookie(){
3548 return md5(mt_rand() + time());
3649 }
\ No newline at end of file
Index: branches/wmf-deployment/extensions/ContributionReporting/cc-reporting.js
@@ -3,6 +3,7 @@
44 sendReq("cc-reporting.php?load=1&utm_src=" + document.payment.utm_source.value);
55 }
66
 7+//replace "validate_form" call with this
78 submitForm = function(){
89 sendReq("cc-reporting.php?submit=1&utm_src="+ document.payment.utm_source.value);
910 return validate_form(document.payment);
Index: branches/wmf-deployment/extensions/ContributionReporting/ContributionReporting.i18n.php
@@ -383,6 +383,9 @@
384384 'contribstats-conversion' => 'Узровень канвэрсіі (%)',
385385 'contribstats-template' => 'Шаблён',
386386 'contribstats-nodata' => 'Зьвесткі не пададзеныя',
 387+ 'contribstats-landingpage' => 'Прывітальная старонка',
 388+ 'contribstats-donatepage' => 'Старонка ахвяраваньняў',
 389+ 'contribstats-average' => 'Сярэдняе',
387390 'fundraiserstatistics' => 'Статыстыка сабраных ахвяраваньняў',
388391 'fundraiserstats-date' => 'Дата',
389392 'fundraiserstats-day' => 'Дзень $1 з $2',
@@ -472,10 +475,11 @@
473476 'contribstats-avg' => 'Keitat (SUA)',
474477 'contribstats-percentage-ytd' => 'Dregantad (er bl.-mañ)',
475478 'contribstats-total-ytd' => 'Hollad (er bloaz-mañ)',
476 - 'contribstats-day-totals' => 'Hollad evit hiziv',
 479+ 'contribstats-day-totals' => 'Hollad an deiz',
477480 'contribstats-week' => 'Sizhun',
478481 'contribstats-clicks' => 'Klikoù',
479482 'contribstats-template' => 'Patrom',
 483+ 'fundraiserstats-tab-totals' => 'Hollad (dollaroù SUA)',
480484 );
481485
482486 /** Bosnian (Bosanski)
@@ -643,6 +647,9 @@
644648 'contribstats-conversion' => 'Konverzní poměr (%)',
645649 'contribstats-template' => 'Šablona',
646650 'contribstats-nodata' => 'Údaje nejsou k dispozici',
 651+ 'contribstats-landingpage' => 'Cílová stránka',
 652+ 'contribstats-donatepage' => 'Přispívací stránka',
 653+ 'contribstats-average' => 'Průměr',
647654 'fundraiserstatistics' => 'Statistika příspěvkové kampaně',
648655 'fundraiserstats-date' => 'Datum',
649656 'fundraiserstats-day' => '$2, $1. den',
@@ -719,6 +726,7 @@
720727
721728 /** German (Deutsch)
722729 * @author Imre
 730+ * @author MF-Warburg
723731 * @author Metalhead64
724732 * @author Omnipaedista
725733 * @author Purodha
@@ -766,6 +774,8 @@
767775 'contribstats-conversion' => 'Umrechnungskurs (%)',
768776 'contribstats-template' => 'Vorlage',
769777 'contribstats-nodata' => 'Keine Daten vorhanden',
 778+ 'contribstats-donatepage' => 'Spenden-Seite',
 779+ 'contribstats-average' => 'Durchschnitt',
770780 'fundraiserstatistics' => 'Spendenstatistiken',
771781 'fundraiserstats-date' => 'Datum',
772782 'fundraiserstats-day' => 'Tag $1 von $2',
@@ -1090,28 +1100,49 @@
10911101 * @author Pikne
10921102 */
10931103 $messages['et'] = array(
1094 - 'contributionhistory' => 'Redigeerimise ajalugu',
 1104+ 'contributiontotal' => 'Annetamise kogusumma',
 1105+ 'contributionhistory' => 'Annetamise ajalugu',
 1106+ 'contrib-hist-header' => 'Reaalajas kommentaarid annetajatelt üle maailma',
10951107 'contrib-hist-name' => 'Nimi',
10961108 'contrib-hist-date' => 'Kellaaeg ja kuupäev',
 1109+ 'contrib-hist-amount' => 'Summa',
10971110 'contrib-hist-next' => 'Varasemad annetused',
10981111 'contrib-hist-previous' => 'Värskemad annetused',
10991112 'contrib-hist-anonymous' => 'Anonüümne',
1100 - 'contributionstatistics' => 'Redigeerimise arvandmed',
1101 - 'contribstats-desc' => 'Kuvab Wikimedia Sihtasutusele tehtud koostöö arvandmed.',
 1113+ 'contributionstatistics' => 'Annetamise arvandmed',
 1114+ 'contribstats-desc' => 'Kuvab arvandmed Wikimedia Sihtasutusele tehtud annetuste kohta.',
 1115+ 'contribstats-daily-totals' => '{{PLURAL:$1|Tänane kogusumma|Viimase $1 päeva kogusummad}}',
 1116+ 'contribstats-monthly-totals' => '{{PLURAL:$1|Selle kuu kogusumma|Viimase $1 kuu kogusummad}}',
 1117+ 'contribstats-month-range-totals' => '{{PLURAL:$1|Ühe kuu kogusumma|$1 kuu kogusummad}}',
 1118+ 'contribstats-contribution-range-breakdown' => 'Annetuste jaotumine summati ($1–$2)',
 1119+ 'contribstats-currency-totals' => 'Eelarveaasta $1 kogusummad vääringuti',
 1120+ 'contribstats-contribution-breakdown' => 'Eelarveaasta $1 annetuste jaotumine summati',
11021121 'contribstats-day' => 'Päev',
11031122 'contribstats-month' => 'Kuu',
11041123 'contribstats-currency' => 'Rahaühik',
1105 - 'contribstats-amount' => 'Hulk (USD)',
1106 - 'contribstats-contributions' => 'Annetused',
1107 - 'contribstats-total' => 'Summa (USD)',
 1124+ 'contribstats-amount' => 'Summa (USD)',
 1125+ 'contribstats-contributions' => 'Annetusi',
 1126+ 'contribstats-total' => 'Kokku (USD)',
11081127 'contribstats-avg' => 'Keskmine (USD)',
1109 - 'contribstats-max' => 'Maksimum (USD)',
 1128+ 'contribstats-max' => 'Suurim annetus',
 1129+ 'contribstats-percentage-ytd' => 'Protsent (sel aastal)',
 1130+ 'contribstats-total-ytd' => 'Kokku (sel aastal)',
11101131 'contribstats-value-exactly' => 'Täpselt $1',
11111132 'contribstats-value-under' => 'Alla $1',
1112 - 'contribstats-value-from' => '$1 - $2',
 1133+ 'contribstats-value-from' => '$1 – $2',
11131134 'contribstats-value-over' => 'Üle $1',
 1135+ 'contributiontrackingstatistics' => 'Annetamise jälgimisarvandmed',
 1136+ 'contribstats-day-totals' => 'Päeva kogusumma',
 1137+ 'contribstats-clicks' => 'Klõpse',
 1138+ 'contribstats-donations' => 'Annetusi',
 1139+ 'contribstats-conversion' => 'Annetusmäär (%)',
 1140+ 'contribstats-template' => 'Mall',
 1141+ 'contribstats-donatepage' => 'Annetamislehekülg',
 1142+ 'contribstats-average' => 'Keskmine',
 1143+ 'fundraiserstatistics' => 'Korjanduse arvandmed',
11141144 'fundraiserstats-date' => 'Kuupäev',
1115 - 'fundraiserstats-contributions' => 'Annetused',
 1145+ 'fundraiserstats-day' => '$1. päev ($2)',
 1146+ 'fundraiserstats-contributions' => 'Annetusi',
11161147 'fundraiserstats-total' => 'Kokku (USD)',
11171148 'fundraiserstats-avg' => 'Keskmine (USD)',
11181149 'fundraiserstats-max' => 'Maksimum (USD)',
@@ -1119,6 +1150,7 @@
11201151 'fundraiserstats-tab-contributions' => 'Annetuste hulk',
11211152 'fundraiserstats-tab-averages' => 'Keskmised (USD)',
11221153 'fundraiserstats-tab-maximums' => 'Maksimumid (USD)',
 1154+ 'specialpages-group-contribution' => 'Annetamine / korjandused',
11231155 );
11241156
11251157 /** Basque (Euskara)
@@ -1252,6 +1284,8 @@
12531285 'contribstats-clicks' => 'Klikkaukset',
12541286 'contribstats-donations' => 'Lahjoitukset',
12551287 'contribstats-template' => 'Malline',
 1288+ 'contribstats-donatepage' => 'Lahjoitussivu',
 1289+ 'contribstats-average' => 'Keskiarvo',
12561290 'fundraiserstatistics' => 'Rahankeräyksen tilastoja',
12571291 'fundraiserstats-date' => 'Päiväys',
12581292 'fundraiserstats-day' => 'Päivä $1 / $2',
@@ -1878,6 +1912,7 @@
18791913 'contribstats-value-from' => 'Inter $1 - $2',
18801914 'contribstats-value-over' => 'Plu kam $1',
18811915 'contribstats-week' => 'Semano',
 1916+ 'contribstats-template' => 'Shablono',
18821917 'fundraiserstats-date' => 'Dato',
18831918 'fundraiserstats-day' => 'Dio $1 di $2',
18841919 );
@@ -2677,6 +2712,7 @@
26782713 );
26792714
26802715 /** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
 2716+ * @author Gunnernett
26812717 * @author Harald Khan
26822718 */
26832719 $messages['nn'] = array(
@@ -2713,6 +2749,17 @@
27142750 'contribstats-value-under' => 'Under $1',
27152751 'contribstats-value-from' => 'Frå $1–$2',
27162752 'contribstats-value-over' => 'Over $1',
 2753+ 'contributiontrackingstatistics' => 'Gåvestatistikk',
 2754+ 'contribstats-day-totals' => 'Totalt for dagen',
 2755+ 'contribstats-week' => 'Veke',
 2756+ 'contribstats-weekly-totals' => '{{PLURAL:$1|Totalt denne veka|Vekesummar for dei seinaste $1 vekene}}',
 2757+ 'contribstats-clicks' => 'Klikk',
 2758+ 'contribstats-donations' => 'Gåver',
 2759+ 'contribstats-conversion' => 'Konverteringsgrad (%)',
 2760+ 'contribstats-template' => 'Mal',
 2761+ 'contribstats-nodata' => 'Ingen data oppgjeve',
 2762+ 'contribstats-donatepage' => 'Side for å gje gåver',
 2763+ 'contribstats-average' => 'Gjennomsnitt',
27172764 'fundraiserstatistics' => 'Innsamlingsstatistikk',
27182765 'fundraiserstats-date' => 'Dato',
27192766 'fundraiserstats-day' => 'Dag $1 av $2',
@@ -3278,6 +3325,9 @@
32793326 'contribstats-conversion' => 'Konverzný kurz (%)',
32803327 'contribstats-template' => 'Šablóna',
32813328 'contribstats-nodata' => 'Neboli poskytnuté žiadne údaje',
 3329+ 'contribstats-landingpage' => 'Cieľová stránka',
 3330+ 'contribstats-donatepage' => 'Stránka darov',
 3331+ 'contribstats-average' => 'Priemer',
32823332 'fundraiserstatistics' => 'Štatistika fundraisingu',
32833333 'fundraiserstats-date' => 'Dátum',
32843334 'fundraiserstats-day' => 'Deň $1 z $2',
@@ -3443,6 +3493,7 @@
34443494 'contribstats-clicks' => 'నొక్కులు',
34453495 'contribstats-donations' => 'విరాళాలు',
34463496 'contribstats-template' => 'మూస',
 3497+ 'contribstats-average' => 'సగటు',
34473498 'fundraiserstatistics' => 'నిధుల సేకరణ గణాంకాలు',
34483499 'fundraiserstats-date' => 'తేదీ',
34493500 'fundraiserstats-contributions' => 'దాతలు',
Index: branches/wmf-deployment/extensions/ContributionReporting/ContributionStatistics_body.php
@@ -244,7 +244,7 @@
245245 $factor = $numContributions > 0 ? 100.0 / $numContributions : 0;
246246
247247 $list = array(
248 - wfMsg( 'contribstats-value-exactly', $wgLang->formatNum( 30 ) ) => array( 30 ),
 248+ wfMsg( 'contribstats-value-exactly', $wgLang->formatNum( 35 ) ) => array( 35 ),
249249 wfMsg( 'contribstats-value-exactly', $wgLang->formatNum( 75 ) ) => array( 75 ),
250250 wfMsg( 'contribstats-value-exactly', $wgLang->formatNum( 100 ) ) => array( 100 ),
251251 wfMsg( 'contribstats-value-under', $wgLang->formatNum( 99.99 ) ) => array( 0, 99.99 ),
@@ -414,9 +414,9 @@
415415 // Merge null and USD
416416 $totals['USD'][1] += $totals[null][1];
417417 $totals['USD'][2] += $totals[null][2];
418 - $totals['USD'][3] = ( $totals['USD'][3] + $totals[null][3] ) / 2;
419 - $totals['USD'][4] = min( $totals['USD'][4], $totals[null][4] );
420 - $totals['USD'][5] = max( $totals['USD'][5], $totals[null][5] );
 418+ $totals['USD'][3] = ( $totals[null][3] == 0 ) ? $totals['USD'][3] : ( $totals['USD'][3] + $totals[null][3] ) / 2;
 419+ $totals['USD'][4] = max( $totals['USD'][4], $totals[null][4] );
 420+ /* $totals['USD'][5] = min( $totals['USD'][5], $totals[null][5] ); */
421421 unset( $totals[null] );
422422 }
423423
Property changes on: branches/wmf-deployment/extensions/ContributionReporting
___________________________________________________________________
Name: svn:mergeinfo
424424 - /branches/REL1_15/phase3/extensions/ContributionReporting:51646
/trunk/extensions/ContributionReporting:56151-57449,58684,58687-59049,59134-59163,59176,59690
/trunk/extensions/ContributionTracking:58684
/trunk/phase3/extensions/ContributionReporting:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57541,57916,58151,58219,58633,58816
425425 + /branches/REL1_15/phase3/extensions/ContributionReporting:51646
/trunk/extensions/ContributionReporting:56151-57449,58684,58687-59049,59134-59163,59165-59752
/trunk/extensions/ContributionTracking:58684
/trunk/phase3/extensions/ContributionReporting:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57541,57916,58151,58219,58633,58816

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59750Field 4 is actually max not min. Not using field 5 for nowtomasz02:37, 5 December 2009

Comments

#Comment by Tim Starling (talk | contribs)   23:06, 8 December 2009

Presumably also r59184 and r59183. The updates to cc-reporting.php are a bit scary since, although it's only half-written, it's not shaping up as a secure piece of code.

#Comment by Tfinc (talk | contribs)   23:08, 8 December 2009

I'll take out cc-reporting.php as it was just proof of concept that Nimish was working on.

Status & tagging log