. * * index.php * * The index file. * * @author Daniele Bonini * @copyrights (c) 2016, 2024, 5 Mode */ require "../Private/core/init.inc"; use fivemode\fivemode\CatUtil; // FUNCTION AND VARIABLE DECLARATIONS $scriptPath = APP_SCRIPT_PATH; // PARAMETERS VALIDATION $url = strtolower(rtrim(substr(filter_input(INPUT_GET, "url", FILTER_SANITIZE_STRING), 0, 300), "/")); switch ($url) { case "footercontent": define("SCRIPT_NAME", "footerContent"); define("SCRIPT_FILENAME", "footerContent.php"); break; case "getxml": define("SCRIPT_NAME", "getxml"); define("SCRIPT_FILENAME", "getxml.php"); break; case "putxml": $scriptPath = APP_AJAX_PATH; define("SCRIPT_NAME", "putxml"); define("SCRIPT_FILENAME", "putxml.php"); break; case "headercontent": define("SCRIPT_NAME", "headerContent"); define("SCRIPT_FILENAME", "headerContent.php"); break; default: $platform = strtolower(substr(filter_input(INPUT_GET, "platform", FILTER_SANITIZE_STRING), 0, 1)); //$catPath = strtolower(rtrim(substr(filter_input(INPUT_GET, "cat", FILTER_SANITIZE_STRING), 0, 300), "/")); $catPath = rtrim(substr(filter_input(INPUT_GET, "cat", FILTER_SANITIZE_STRING), 0, 300), "/"); $catMaskedPath = str_replace(PHP_SLASH, PHP_TILDE, $catPath); //if (($platform!=="d") && ($platform!=="m")) { // $scriptPath = APP_ERROR_PATH; // define("SCRIPT_NAME", "err-404"); // define("SCRIPT_FILENAME", "err-404.php"); //} else { if (CatUtil::catExist($catMaskedPath)) { define("SCRIPT_NAME", "home"); define("SCRIPT_FILENAME", "home.php"); } else { // In any other case, the category has no match.. /* * $scriptPath = APP_ERROR_PATH; define("SCRIPT_NAME", "err-404"); define("SCRIPT_FILENAME", "err-404.php"); * */ $catMaskedPath = PHP_STR; define("SCRIPT_NAME", "home"); define("SCRIPT_FILENAME", "home.php"); } //} } if (SCRIPT_NAME==="err-404") { header("HTTP/1.1 404 Not Found"); } require $scriptPath . "/" . SCRIPT_FILENAME;