Exemple #1
0
    $array = $route->getTarget();
    if (isset($array["get"])) {
        $_GET[$array["get"]] = true;
    }
    if (isset($array["post"])) {
        $_GET[$array["post"]] = true;
    }
    foreach ($route->getParameters() as $key => $value) {
        $_GET[$key] = mysql_real_escape_string($value);
        $_POST[$key] = mysql_real_escape_string($value);
    }
    $loadPage = $APP_DIR . "/controller/" . $array["url"] . ".php";
} else {
    $loadPage = "";
}
// Begin loading the routed page
if (!empty($loadPage)) {
    require_once $loadPage;
} else {
    if ($config->logs) {
        $t = getdate();
        $time = "[ " . $t['hours'] . ":" . $t['minutes'] . ":" . $t['seconds'] . " ] ";
        $timeFile = $t['year'] . "-" . $t['mon'] . "-" . $t['mday'] . "_";
        $fh = fopen($APP_DIR . "/logs/" . $timeFile . "router_noroute.log", 'a');
        $stringData = $time . "No route found for: " . $_SERVER["REQUEST_URI"] . "\n";
        fwrite($fh, $stringData);
        fclose($fh);
    }
    header("HTTP/1.0 404 Not Found");
    $cms->error("No route found for '" . $_SERVER["REQUEST_URI"] . "'");
}