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:
parent
4ea8af4968
commit
cad8d6ac86
2 changed files with 24 additions and 25 deletions
|
@ -47,16 +47,23 @@ Config::set('prefix', $prefix);
|
|||
// Register the autoloader
|
||||
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' )
|
||||
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
|
||||
|| Config::get('force_ssl')) {
|
||||
$http_type = "https://";
|
||||
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) {
|
||||
$http_type = 'https://';
|
||||
}
|
||||
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
|
||||
|
|
26
lib/init.php
26
lib/init.php
|
@ -73,25 +73,17 @@ if ($link) {
|
|||
$results['version'] = '3.6-Alpha1-DEV';
|
||||
$results['int_config_version'] = '11';
|
||||
|
||||
if ($results['force_ssl']) {
|
||||
$http_type = 'https://';
|
||||
}
|
||||
|
||||
$results['raw_web_path'] = $results['web_path'];
|
||||
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path'];
|
||||
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['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']) {
|
||||
$results['user_ip_cardinality'] = 42;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue