index.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of SnipSwap.
  6. *
  7. * SnipSwap 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. * SnipSwap 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 SnipSwap. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * index.php
  21. *
  22. * The index file.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2016, 2024, 5 Mode
  26. */
  27. require "../Private/core/init.inc";
  28. use fivemode\fivemode\CatUtil;
  29. // FUNCTION AND VARIABLE DECLARATIONS
  30. $scriptPath = APP_SCRIPT_PATH;
  31. // PARAMETERS VALIDATION
  32. $url = strtolower(rtrim(substr(filter_input(INPUT_GET, "url", FILTER_SANITIZE_STRING), 0, 300), "/"));
  33. switch ($url) {
  34. case "footercontent":
  35. define("SCRIPT_NAME", "footerContent");
  36. define("SCRIPT_FILENAME", "footerContent.php");
  37. break;
  38. case "getxml":
  39. define("SCRIPT_NAME", "getxml");
  40. define("SCRIPT_FILENAME", "getxml.php");
  41. break;
  42. case "putxml":
  43. $scriptPath = APP_AJAX_PATH;
  44. define("SCRIPT_NAME", "putxml");
  45. define("SCRIPT_FILENAME", "putxml.php");
  46. break;
  47. case "headercontent":
  48. define("SCRIPT_NAME", "headerContent");
  49. define("SCRIPT_FILENAME", "headerContent.php");
  50. break;
  51. default:
  52. $platform = strtolower(substr(filter_input(INPUT_GET, "platform", FILTER_SANITIZE_STRING), 0, 1));
  53. //$catPath = strtolower(rtrim(substr(filter_input(INPUT_GET, "cat", FILTER_SANITIZE_STRING), 0, 300), "/"));
  54. $catPath = rtrim(substr(filter_input(INPUT_GET, "cat", FILTER_SANITIZE_STRING), 0, 300), "/");
  55. $catMaskedPath = str_replace(PHP_SLASH, PHP_TILDE, $catPath);
  56. //if (($platform!=="d") && ($platform!=="m")) {
  57. // $scriptPath = APP_ERROR_PATH;
  58. // define("SCRIPT_NAME", "err-404");
  59. // define("SCRIPT_FILENAME", "err-404.php");
  60. //} else {
  61. if (CatUtil::catExist($catMaskedPath)) {
  62. define("SCRIPT_NAME", "home");
  63. define("SCRIPT_FILENAME", "home.php");
  64. } else {
  65. // In any other case, the category has no match..
  66. /*
  67. * $scriptPath = APP_ERROR_PATH;
  68. define("SCRIPT_NAME", "err-404");
  69. define("SCRIPT_FILENAME", "err-404.php");
  70. *
  71. */
  72. $catMaskedPath = PHP_STR;
  73. define("SCRIPT_NAME", "home");
  74. define("SCRIPT_FILENAME", "home.php");
  75. }
  76. //}
  77. }
  78. if (SCRIPT_NAME==="err-404") {
  79. header("HTTP/1.1 404 Not Found");
  80. }
  81. require $scriptPath . "/" . SCRIPT_FILENAME;