Diff for Metafox/lib/Platon.php between version 1.8 and 1.9
| version 1.8, 2011/06/17 13:56:38 |
version 1.9, 2012/05/15 17:47:56 |
|
|
| * <?php |
* <?php |
| * require_once 'Platon.php'; |
* require_once 'Platon.php'; |
| * Platon::function_name(); |
* Platon::function_name(); |
| * ?> |
* ? > |
| * |
* |
| * @author Ondrej Jombik <nepto@platon.sk> |
* @author Ondrej Jombik <nepto@platon.sk> |
| * @package Platon |
* @package Platon |
|
|
| * @access public |
* @access public |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/lib/Platon.php,v 1.7 2011-05-31 13:04:30 igor Exp $ */ |
/* $Platon: Metafox/lib/Platon.php,v 1.8 2011-06-17 13:56:38 igor Exp $ */ |
| |
|
| class Platon |
class Platon |
| { |
{ |
|
|
| * @param boolean $temporary if such redirect is only temporary one |
* @param boolean $temporary if such redirect is only temporary one |
| * @todo implement HTML page redirecting if output was aleady sent |
* @todo implement HTML page redirecting if output was aleady sent |
| */ |
*/ |
| function redirect($where, $temporary = false) /* {{{ */ |
function redirect($where, $temporary = false, $status_code = 301) /* {{{ */ |
| { |
{ |
| $url = ''; |
$url = ''; |
| if (! strncmp($where, "ftp://", 6) |
if (! strncmp($where, "ftp://", 6) |
|
|
| |
|
| header('Location: '.$url); |
header('Location: '.$url); |
| if (! $temporary) { |
if (! $temporary) { |
| header('HTTP/1.1 301 Moved Permanently'); |
switch($status_code) { |
| |
case 303: |
| |
header('HTTP/1.1 303 See Other'); |
| |
break; |
| |
case 302: |
| |
header('HTTP/1.1 302 Found'); |
| |
break; |
| |
case 301: |
| |
default: |
| |
header('HTTP/1.1 301 Moved Permanently'); |
| |
break; |
| |
} |
| } |
} |
| exit; |
exit; |
| } /* }}} */ |
} /* }}} */ |
Platon Group <platon@platon.org> http://platon.org/
|
|