KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.0KB

  1. <?php
  2. $PAGE_TITLE = "KXStudio : Donations";
  3. $PAGE_TYPE = "DONATIONS";
  4. $PAGE_SOURCE_1 = ARRAY("/Donations");
  5. $PAGE_SOURCE_2 = ARRAY("Donations");
  6. include_once("includes/header.php");
  7. require "donate/config.php";
  8. require "donate/connect.php";
  9. global $biggest_donation_date;
  10. global $biggest_donation_value;
  11. global $total_ever;
  12. $biggest_donation_date = "Unknown";
  13. $biggest_donation_value = 0.0;
  14. $total_ever = 0.0;
  15. function print_donation_year($year) {
  16. global $db_link;
  17. if ($db_link === false) {
  18. echo '<tr><td colspan="6">DB connection failed</td></tr>';
  19. return;
  20. }
  21. global $biggest_donation_date;
  22. global $biggest_donation_value;
  23. global $total_ever;
  24. $amount = 0.0;
  25. $max_month = 0.0;
  26. $total_year = 0.0;
  27. $donation_count = 0.0;
  28. $sql_donations = mysql_query("SELECT * FROM donations WHERE YEAR(dt) = " . $year);
  29. if (mysql_num_rows($sql_donations)) {
  30. while ($sql_row = mysql_fetch_assoc($sql_donations)) {
  31. $amount = $sql_row["amount"];
  32. $donation_count += 1.0;
  33. if ($amount > $max_month) {
  34. $max_month = $amount;
  35. if ($amount > $biggest_donation_value) {
  36. $biggest_donation_date = date("Y-m-d", strtotime($sql_row["dt"]));
  37. $biggest_donation_value = $amount;
  38. }
  39. }
  40. $total_year += $amount;
  41. }
  42. }
  43. $total_ever += $total_year;
  44. echo '<tr>';
  45. echo ' <td>' . $year . '</td>';
  46. echo ' <td>' . $donation_count . '</td>';
  47. echo ' <td>' . number_format($total_year, 2) . '&euro;</td>';
  48. if ($donation_count > 0.0) {
  49. echo ' <td>' . number_format($total_year/$donation_count, 2) . '&euro;</td>';
  50. } else {
  51. echo ' <td>0&euro;</td>';
  52. }
  53. echo ' <td>' . number_format($total_year/12.0, 2) . '&euro;</td>';
  54. echo ' <td>' . number_format($max_month, 2) . '&euro;</td>';
  55. echo '</tr>';
  56. }
  57. ?>
  58. <p>
  59. KXStudio is and always be a free and open-source project to everyone.<br/>
  60. Donations will help ensure that developers have the needed enthusiasm and motivation to keep working hard on the project.<br/>
  61. Just because we're open-source doesn't mean we're allergic to money. ;)
  62. </p>
  63. <p>
  64. This page contain statistics regarding donations made to the KXStudio project over time.<br/>
  65. So far the KXStudio project has received <?php global $total_ever; echo number_format($total_ever, 2); ?>&euro; in donations.<br/>
  66. The biggest donation ever made was on <?php echo $biggest_donation_date; ?>, with a value of <?php echo number_format($biggest_donation_value, 2); ?>&euro;.<br/>
  67. Thank you very much for your generosity!
  68. </p>
  69. <div class="box box-description">
  70. <table style="text-align:center;">
  71. <tr>
  72. <td>&nbsp;Year&nbsp;</td>
  73. <td>&nbsp;Donation count&nbsp;</td>
  74. <td>&nbsp;Total received&nbsp;</td>
  75. <td>&nbsp;Average per donation&nbsp;</td>
  76. <td>&nbsp;Average per month&nbsp;</td>
  77. <td>&nbsp;Biggest single donation&nbsp;</td>
  78. </tr>
  79. <?php
  80. for ($year = strftime("%Y"); $year >= "2013"; $year -= 1) {
  81. print_donation_year($year);
  82. }
  83. ?>
  84. </table>
  85. </div>
  86. <p><br/></p>
  87. <?php
  88. include_once("includes/footer.php");
  89. ?>