index.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // Show errors in screen
  19. ini_set('display_errors', '1');
  20. ini_set('display_startup_errors', '1');
  21. error_reporting(E_ALL);
  22. // Repair output with Tidy
  23. // ini_set('tidy.clean_output', '1');
  24. // Empty web browser cache
  25. header('Cache-Control: no-cache');
  26. header('Pragma: no-cache');
  27. require './calendar.php';
  28. // Main operation thread
  29. $Resultado = '--';
  30. $Month = '';
  31. $Year = '';
  32. if (isset($_POST['mostrar'])) {
  33. if ($_POST['month'] && $_POST['year']) {
  34. $Month = intval($_POST['month']);
  35. $Year = intval($_POST['year']);
  36. if ($Month > 0 && $Month <= 12 && $Year > 0 && $Year < 9999) {
  37. $Calendar = new Calendar($Month, $Year);
  38. $Resultado = $Calendar->GenerateCalendar();
  39. } else {
  40. $Resultado = 'You must set a corrent month and year';
  41. }
  42. } else {
  43. $Resultado = 'You must set a month and a year';
  44. }
  45. }
  46. require './view.php';