Beispiel #1
0
function requestURI($full = 0)
{
    //$s = $full?((stripos($_SERVER['SERVER_PROTOCOL'],"https") === false)?"http://":"https://").$_SERVER['HTTP_HOST']:"";
    $s = $full ? Header::makeHTTPHost() : "";
    $uri = $_SERVER['REQUEST_URI'];
    if (strpos($uri, "javascript:") !== false) {
        $uri = str_replace("javascript:", "", $uri);
    }
    return $s . $uri;
}
Beispiel #2
0
    /** {{{ redirect
     * Переадресация клиента
     *
     * RFC 2616, 10.3.4
     * RFC 2616, 10.3.3
     *
     * @param    string $url    Адрес пересылки
     * @return   void
     */
    static function redirect($url, $code = 302)
    {
        header($_SERVER['SERVER_PROTOCOL'] . ' ' . $code . ' ' . self::$statusText[$code]);
        if (!strpos($url, '://')) {
            $url = Header::makeHTTPHost() . $url;
        }
        header('Location: ' . $url);
        echo <<<GO
            <html><head><title>Redirect</title></head><body><p><p> 
            HTTP redirect (status code: {$code} ).<br> 
            Follow the <a href="{$url}">"White Rabbit"</a>. 
            </body></html> 
GO;
        die;
    }
Beispiel #3
0
 /**
  * Redirects to specified location or page.
  *
  * @param string location, ie "/blog/2.html" or page "2.html". In the last case, all 
  * current parameters will be saved and only page will be changed.
  * return null
  */
 protected function gotoLocation($loc)
 {
     if (!isset($loc)) {
         exit;
     }
     if (($pos = strpos($loc, "/")) === false) {
         $loc = $this->makeURL($loc);
     } elseif ($pos == 0) {
         $loc = Header::makeHTTPHost() . $loc;
     }
     Header::redirect($loc, Header::SEE_OTHER);
 }