Пример #1
0
/**
 * Make the redirect on server side; 
 * @param string $url the URL to which is makeing the redirect;
 * @return nothing;
 */
function KT_redir($url)
{
    $protocol = "http://";
    $server_name = $_SERVER["HTTP_HOST"];
    if ($server_name != '') {
        $protocol = "http://";
        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
            $protocol = "https://";
        }
        if (preg_match("#^/#", $url)) {
            $url = $protocol . $server_name . $url;
        } else {
            if (!preg_match("#^[a-z]+://#", $url)) {
                $script = KT_getPHP_SELF();
                if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '' && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
                    $script = substr($script, 0, strlen($script) - strlen($_SERVER['PATH_INFO']));
                }
                $url = $protocol . $server_name . preg_replace("#/[^/]*\$#", "/", $script) . $url;
            }
        }
        $url = str_replace(" ", "%20", $url);
        if (KT_is_ajax_request()) {
            header("Kt_location: " . $url);
            echo "Redirecting to: " . $url;
        } else {
            header("Location: " . $url);
        }
    }
    exit;
}
Пример #2
0
 /**
  * Constructor
  * @return null
  */
 function PanelController()
 {
     $this->currentPage = basename(KT_getPHP_SELF());
 }