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.

100 lines
2.7KB

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