Diff for phpPlatonLib/Platon/Platon.php between version 1.23 and 1.24
| version 1.23, 2004/04/11 16:19:46 |
version 1.24, 2004/12/12 21:41:05 |
|
|
| * @access public |
* @access public |
| */ |
*/ |
| |
|
| /* $Platon: phpPlatonLib/Platon/Platon.php,v 1.22 2004/01/26 13:53:55 nepto Exp $ */ |
/* $Platon: phpPlatonLib/Platon/Platon.php,v 1.23 2004/04/11 16:19:46 nepto Exp $ */ |
| |
|
| class Platon |
class Platon |
| { |
{ |
|
|
| } /* }}} */ |
} /* }}} */ |
| |
|
| /** |
/** |
| |
* Performs a HTTP/1.1 redirect according to RFC 2068 |
| |
* |
| |
* @param string $where where to redirect (URL or local script) |
| |
* @param boolean $temporary if such redirect is only temporary one |
| |
* @todo implement HTML page redirecting if output was aleady sent |
| |
*/ |
| |
function redirect($where, $temporary = false) /* {{{ */ |
| |
{ |
| |
$url = ''; |
| |
if (! strncmp($where, "ftp://", 6) |
| |
|| ! strncmp($where, "http://", 7) |
| |
|| ! strncmp($where, "https://", 8)) { |
| |
$url = $where; |
| |
} else { |
| |
$url = "http://"; |
| |
$http_host = @$_SERVER['HTTP_HOST']; |
| |
$server_name = @$_SERVER['SERVER_NAME']; |
| |
|
| |
if (isset($http_host) && strlen($http_host) > 0) { |
| |
$url .= $http_host; |
| |
} elseif (isset($server_name) && strlen($server_name) > 0) { |
| |
$url .= $server_name; |
| |
} |
| |
if ($where[0] != '/') { |
| |
$url .= Platon::get_path_without_scriptname($_SERVER['REQUEST_URI']); |
| |
} |
| |
$url .= $where; |
| |
} |
| |
|
| |
header('Location: '.$url); |
| |
if (! $temporary) { |
| |
header('HTTP/1.1 301 Moved Permanently'); |
| |
} |
| |
exit; |
| |
} /* }}} */ |
| |
|
| |
/** |
| * Redirects if it is neccessary for particular file. |
* Redirects if it is neccessary for particular file. |
| * |
* |
| * @param string $file filename |
* @param string $file filename |
Platon Group <platon@platon.org> http://platon.org/
|
|