Example #1
0
if ($rule) {
    if ($rule->secure && !getValIfExists($_SERVER, "HTTPS")) {
        $https_enabled = false;
        try {
            $https_enabled = file_exists("https://{$_SERVER["HTTP_HOST"]}/{$SITE_ROOT}/{$url}");
        } catch (Exception $e) {
            $https_enabled = false;
        }
        if ($https_enabled) {
            header("location: https://{$_SERVER["HTTP_HOST"]}/{$SITE_ROOT}/{$url}");
            die;
        }
    } elseif ($rule->secure) {
        //flash("Warning: this page is not secure as HTTPS is not avaiable", "err");
    }
    if ($rule->login && !$auth->isLoggedIn()) {
        header("Cache-Control: no-cache, must-revalidate");
        if (array_key_exists("provider", $_GET)) {
            $_SESSION["provider"] = $_GET["provider"];
            $auth = new AuthManager();
            $frm = $auth->requestlogin($url, $_GET["provider"]);
        } else {
            $auth = new AuthManager();
            $frm = $auth->requestlogin($url);
        }
        echo applyTemplate("./base.html", "./loginbase.html", array("form" => $frm));
        return;
    }
    if ($rule->redirect) {
        $url = $rule->redirect;
    }