| version 1.14, 2026/11/06 11:37:07 |
version 1.15, 2026/11/06 14:16:37 |
|
|
| * @access public |
* @access public |
| */ |
*/ |
| |
|
| /* $Platon: phpPlatonLib/Platon/Platon.php,v 1.44 2026/11/06 11:34:53 nepto Exp $ */ |
/* $Platon: phpPlatonLib/Platon/Platon.php,v 1.46 2026/11/06 14:11:54 nepto Exp $ */ |
| |
|
| class Platon |
class Platon |
| { |
{ |
|
|
| || ! strncmp($where, "https://", 8)) { |
|| ! strncmp($where, "https://", 8)) { |
| $url = $where; |
$url = $where; |
| } else { |
} else { |
| $url = "http://"; |
$https = ! empty($_SERVER['HTTPS']) |
| |
&& strtolower($_SERVER['HTTPS']) != 'off'; |
| |
$url = $https ? 'https://' : 'http://'; |
| $http_host = @$_SERVER['HTTP_HOST']; |
$http_host = @$_SERVER['HTTP_HOST']; |
| $server_name = @$_SERVER['SERVER_NAME']; |
$server_name = @$_SERVER['SERVER_NAME']; |
| |
|
|
|
| return; |
return; |
| } |
} |
| } |
} |
| $schema = strcasecmp($_SERVER['HTTPS'], 'on') ? 'http' : 'https'; |
$https = ! empty($_SERVER['HTTPS']) |
| |
&& strtolower($_SERVER['HTTPS']) != 'off'; |
| |
$schema = $https ? 'https' : 'http'; |
| $request_uri = $_SERVER['REQUEST_URI']; |
$request_uri = $_SERVER['REQUEST_URI']; |
| return Platon::redirect("$schema://$new_http_host$request_uri"); |
return Platon::redirect("$schema://$new_http_host$request_uri"); |
| } /* }}} */ |
} /* }}} */ |
|
|
| } |
} |
| return true; |
return true; |
| } |
} |
| if (! isset($_SERVER['PHP_SELF']) |
// PHP_SELF contains PATH_INFO, so /cvs.php/x/db.inc.php would match |
| || stripos($_SERVER['PHP_SELF'], $file) === false ) { |
if (! isset($_SERVER['SCRIPT_NAME']) |
| |
|| strcasecmp(basename($_SERVER['SCRIPT_NAME']), $file)) { |
| return true; |
return true; |
| } |
} |
| if (strlen($url) <= 0) { |
if (strlen($url) <= 0) { |
| trigger_error('empty input parameter $url' |
trigger_error('empty input parameter $url' |
| .' in Platon::redirect_test()'.$method, E_USER_ERROR); |
.' in Platon::redirect_test()', E_USER_ERROR); |
| return; |
return; |
| } |
} |
| |
$https = ! empty($_SERVER['HTTPS']) |
| |
&& strtolower($_SERVER['HTTPS']) != 'off'; |
| $schema = ''; |
$schema = ''; |
| if (strncmp($url, "http://", 7)) { |
if (strncmp($url, 'http://', 7) != 0 |
| $schema = 'http'; |
&& strncmp($url, 'https://', 8) != 0) { |
| } elseif (strncmp($url, "https://", 8)) { |
$schema = $https ? 'https' : 'http'; |
| $schema = 'https'; |
|
| } |
} |
| if (strlen($schema) > 0) { |
if (strlen($schema) > 0) { |
| // TODO: create delim according to $_SERVER['SCRIPT_NAME'] |
// TODO: create delim according to $_SERVER['SCRIPT_NAME'] |