index.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * Copyright 2021, 2026 5 Mode
  4. *
  5. * This file is part of SqueePF.
  6. *
  7. * SqueePF is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * SqueePF is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with SqueePF. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * index.php
  21. *
  22. * The index file.
  23. *
  24. * @author Daniele Bonini <my25mb@has.im>
  25. * @copyrights (c) 2016, 2026 5 Mode
  26. */
  27. require "../Private/core/init.inc";
  28. use fivemode\fivemode\SC;
  29. // FUNCTION AND VARIABLE DECLARATIONS
  30. $SC = &SC::getInstance();
  31. // PARAMETERS VALIDATION
  32. $url = filter_input(INPUT_GET, "url")??"";
  33. $url = strip_tags($url);
  34. $url = strtolower(trim(substr($url, 0, 300), "/"));
  35. switch ($url) {
  36. case "cachedcrc":
  37. //$rret = SC_CHECK_ROUTE_ALL("test");
  38. //if ( $rret === 200) {
  39. $scriptPath = APP_ROUTES_PATH . "/cachedcrc";
  40. define("ROUTE_NAME", "testcached");
  41. define("ROUTE_FILENAME", "testcached.php");
  42. //} else {
  43. // $scriptPath = APP_ERROR_PATH;
  44. // define("ROUTE_NAME", "err-$rret");
  45. // define("ROUTE_FILENAME", "err-$rret.php");
  46. //}
  47. break;
  48. case "inccrcsource":
  49. $scriptPath = APP_ROUTES_PATH . "/cachedcrc";
  50. define("ROUTE_NAME", "end");
  51. define("ROUTE_FILENAME", "end.php");
  52. break;
  53. case "":
  54. case "test":
  55. $rret = $SC->SC_CHECK_ROUTE_ALL("test");
  56. if ( $rret === 200) {
  57. $scriptPath = APP_ROUTES_PATH . "/test";
  58. define("ROUTE_NAME", "test");
  59. define("ROUTE_FILENAME", "test.php");
  60. } else {
  61. $scriptPath = APP_ERROR_PATH;
  62. define("ROUTE_NAME", "err-$rret");
  63. define("ROUTE_FILENAME", "err-$rret.php");
  64. }
  65. break;
  66. case "test/+desc":
  67. $scriptPath = APP_ROUTES_PATH . "/test";
  68. define("ROUTE_NAME", "+DESC");
  69. define("ROUTE_FILENAME", "+DESC");
  70. break;
  71. default:
  72. $scriptPath = APP_ERROR_PATH;
  73. define("ROUTE_NAME", "err-404");
  74. define("ROUTE_FILENAME", "err-404.php");
  75. }
  76. if (ROUTE_NAME==="err-404") {
  77. header("HTTP/1.1 404 Not Found");
  78. }
  79. require $scriptPath . "/" . ROUTE_FILENAME;