1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

web_path cleanup

force_ssl was broken, should be fixed now.
This commit is contained in:
Paul Arthur 2012-07-11 14:37:11 -04:00
parent 4ea8af4968
commit cad8d6ac86
2 changed files with 24 additions and 25 deletions

View file

@ -47,16 +47,23 @@ Config::set('prefix', $prefix);
// Register the autoloader // Register the autoloader
spl_autoload_register(array('Core', 'autoload'), true, true); spl_autoload_register(array('Core', 'autoload'), true, true);
/* // Check to see if this is http or https
Check to see if this is http or https
*/
if ((isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) if ((isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) {
|| Config::get('force_ssl')) { $http_type = 'https://';
$http_type = "https://";
} }
else { else {
$http_type = "http://"; $http_type = 'http://';
}
if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) {
$http_port = $_SERVER['HTTP_X_FORWARDED_PORT'];
}
else if (isset($_SERVER['SERVER_PORT'])) {
$http_port = $_SERVER['SERVER_PORT'];
}
if (!isset($http_port) || !$http_port) {
$http_port = 80;
} }
// Define that we've loaded the INIT file // Define that we've loaded the INIT file

View file

@ -73,25 +73,17 @@ if ($link) {
$results['version'] = '3.6-Alpha1-DEV'; $results['version'] = '3.6-Alpha1-DEV';
$results['int_config_version'] = '11'; $results['int_config_version'] = '11';
$results['raw_web_path'] = $results['web_path']; if ($results['force_ssl']) {
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; $http_type = 'https://';
if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) {
$results['http_port'] = $_SERVER['HTTP_X_FORWARDED_PORT'];
} else {
$results['http_port'] = $_SERVER['SERVER_PORT'];
}
if (!$results['http_port']) {
$results['http_port'] = '80';
}
if (!$results['site_charset']) {
$results['site_charset'] = "UTF-8";
}
if (!$results['raw_web_path']) {
$results['raw_web_path'] = '/';
}
if (!$_SERVER['SERVER_NAME']) {
$_SERVER['SERVER_NAME'] = '';
} }
$results['raw_web_path'] = $results['web_path'];
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path'];
$results['http_port'] = $results['http_port'] ?: $http_port;
$results['site_charset'] = $results['site_charset'] ?: 'UTF-8';
$results['raw_web_path'] = $results['raw_web_path'] ?: '/';
$_SERVER['SERVER_NAME'] = $_SERVER['SERVER_NAME'] ?: '';
if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality']) { if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality']) {
$results['user_ip_cardinality'] = 42; $results['user_ip_cardinality'] = 42;
} }