index.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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\CV;
  29. use fivemode\fivemode\SC;
  30. // FUNCTION AND VARIABLE DECLARATIONS
  31. $CV = &CV::getInstance();
  32. $SC = &SC::getInstance();
  33. // PARAMETERS VALIDATION
  34. $url = filter_input(INPUT_GET, "url")??"";
  35. $url = strip_tags($url);
  36. $url = strtolower(trim(substr($url, 0, 300), "/"));
  37. switch ($url) {
  38. case "cachecrc":
  39. $rret = $CV->CV_CHECK_CACHE("cachecrc", APP_ROUTES_PATH . "/cachecrc", false);
  40. if ( $rret ) {
  41. $CV->CV_CHECK_CACHE("cachecrc", APP_ROUTES_PATH . "/cachecrc", true);
  42. exit(0);
  43. } else {
  44. $scriptPath = APP_ERROR_PATH;
  45. define("ROUTE_NAME", "err-502");
  46. define("ROUTE_FILENAME", "err-502.php");
  47. }
  48. break;
  49. case "inccrcsource":
  50. $scriptPath = APP_ROUTES_PATH . "/cachedcrc";
  51. define("ROUTE_NAME", "end");
  52. define("ROUTE_FILENAME", "end.php");
  53. break;
  54. case "":
  55. case "test":
  56. $rret = $SC->SC_CHECK_ROUTE_ALL("test");
  57. if ( $rret === 200) {
  58. $scriptPath = APP_ROUTES_PATH . "/test";
  59. define("ROUTE_NAME", "test");
  60. define("ROUTE_FILENAME", "test.php");
  61. } else {
  62. $scriptPath = APP_ERROR_PATH;
  63. define("ROUTE_NAME", "err-$rret");
  64. define("ROUTE_FILENAME", "err-$rret.php");
  65. }
  66. break;
  67. case "test/+desc":
  68. $scriptPath = APP_ROUTES_PATH . "/test";
  69. define("ROUTE_NAME", "+DESC");
  70. define("ROUTE_FILENAME", "+DESC");
  71. break;
  72. default:
  73. $scriptPath = APP_ERROR_PATH;
  74. define("ROUTE_NAME", "err-404");
  75. define("ROUTE_FILENAME", "err-404.php");
  76. }
  77. if (ROUTE_NAME==="err-404") {
  78. header("HTTP/1.1 404 Not Found");
  79. }
  80. require $scriptPath . "/" . ROUTE_FILENAME;