Changeset View
Changeset View
Standalone View
Standalone View
community/donations/previousdonations.php
Show All 18 Lines | |||||
19 | 19 | | |||
20 | <p>Note this list does not include campaign specific donations like:</p> | 20 | <p>Note this list does not include campaign specific donations like:</p> | ||
21 | <ul> | 21 | <ul> | ||
22 | <li><a href="/fundraisers/randameetings2014/">Randa Meetings 2014 Fundraising</a></li> | 22 | <li><a href="/fundraisers/randameetings2014/">Randa Meetings 2014 Fundraising</a></li> | ||
23 | <li><a href="/fundraisers/yearend2014/">KDE End of Year 2014 Fundraising</a></li> | 23 | <li><a href="/fundraisers/yearend2014/">KDE End of Year 2014 Fundraising</a></li> | ||
24 | <li><a href="/fundraisers/kdesprints2015/">KDE Sprints 2015 Fundraising</a></li> | 24 | <li><a href="/fundraisers/kdesprints2015/">KDE Sprints 2015 Fundraising</a></li> | ||
25 | <li><a href="/fundraisers/yearend2016/">KDE End of Year 2016 Fundraising</a></li> | 25 | <li><a href="/fundraisers/yearend2016/">KDE End of Year 2016 Fundraising</a></li> | ||
26 | </ul> | 26 | </ul> | ||
27 | 27 | | |||
aacid: Are we fine loading stuff form some random domain? | |||||
ognarb: Use https://cdn.kde.org/aether-devel/charjs.js now | |||||
28 | <?php | 28 | <?php | ||
29 | require("donations_auth.inc"); | 29 | require("donations_auth.inc"); | ||
30 | 30 | | |||
31 | $query = $dbConnection->prepare("SELECT *, UNIX_TIMESTAMP(date) AS date_t FROM donations WHERE date >= ':year-:month_s-01' AND date <= ':year-:month_s-31 23:59:59' ORDER BY date DESC;"); | ||||
32 | $count = $dbConnection->prepare("SELECT COUNT(*) WHERE date >= ':year-:month_s-01' AND date <= ':year-:month_s-31 23:59:59';"); | ||||
31 | 33 | | |||
32 | for ($year = date("Y", time()); $year > 2001; $year--) { | 34 | for ($year = date("Y", time()); $year > 2001; $year--) { | ||
33 | echo "<h3>$year</h3>"; | 35 | echo "<h3>$year</h3>"; | ||
34 | echo "<figure style='text-align: center'>"; | 36 | echo "<figure class='text-center'>"; | ||
35 | echo "<img src=\"graph.php?year=$year\">"; | 37 | echo "<img src=\"graph.php?year=$year\">"; | ||
36 | echo "</figure>"; | 38 | echo "</figure>"; | ||
37 | echo "<br><br>"; | 39 | echo "<br><br>"; | ||
38 | for ($month = 12; $month >=1 ; $month--) { | 40 | for ($month = 12; $month >=1 ; $month--) { | ||
39 | $month < 10 ? $month_s = "0".$month : $month_s = $month; | | |||
40 | $query = "select *,unix_timestamp(date) as date_t from donations "; | | |||
41 | $query .= "where date >= '".$year."-".$month_s."-01' and "; | | |||
42 | $query .= "date <= '".$year."-".$month_s."-31 23:59:59' order by date desc"; | | |||
43 | # echo "<br>".$query."<br><Br>"; | 41 | # echo "<br>".$query."<br><Br>"; | ||
44 | $q = mysql_query($query,$sq); | 42 | $count->execute([ | ||
45 | echo mysql_error(); | 43 | 'year' => $year, | ||
46 | if (mysql_num_rows($q) == 0) { | 44 | 'month_s' => $month_s, | ||
45 | ]); | ||||
46 | if ($count->fetchColumn() === 0) { | ||||
47 | continue; | 47 | continue; | ||
48 | } | 48 | } | ||
49 | $q = $query->execute([ | ||||
50 | 'year' => $year, | ||||
51 | 'month_s' => $month_s, | ||||
52 | ]); | ||||
49 | $total = 0; | 53 | $total = 0; | ||
50 | echo "<table border=1 width=\"600\">"; | 54 | echo "<table border=1 width=\"600\">"; | ||
51 | echo "<tr><th colspan=3>".date("Y - F", mktime(0,0,0,$month,1,$year))."</th></tr>"; | 55 | echo "<tr><th colspan=3>".date("Y - F", mktime(0,0,0,$month,1,$year))."</th></tr>"; | ||
52 | echo "<tr><th width=100>Date</th><th width=100>Amount</th><th width=400>Message</th></tr>"; | 56 | echo "<tr><th width=100>Date</th><th width=100>Amount</th><th width=400>Message</th></tr>"; | ||
53 | while ($row = mysql_fetch_array($q)) { | 57 | while ($row = $q->fetch()) { | ||
54 | $msg = htmlentities($row["message"]); | 58 | $msg = htmlentities($row["message"]); | ||
55 | if ($msg == "") { | 59 | if ($msg == "") { | ||
56 | $msg = "<i>Anonymous donation</i>"; | 60 | $msg = "<i>Anonymous donation</i>"; | ||
57 | } | 61 | } | ||
58 | $total += $row["amount"]; | 62 | $total += $row["amount"]; | ||
59 | 63 | | |||
60 | echo "<tr>"; | 64 | echo "<tr>"; | ||
61 | echo "<td>".date("jS H:i", $row["date_t"])."</td>"; | 65 | echo "<td>".date("jS H:i", $row["date_t"])."</td>"; | ||
Show All 16 Lines |
Are we fine loading stuff form some random domain?