Commit 6f4b072d authored by Pablo Rauzy's avatar Pablo Rauzy
Browse files

add protocol in url

parent ec990564
...@@ -55,20 +55,21 @@ if (isset($_GET['logout']) || !isset($_SESSION['user'])) { ...@@ -55,20 +55,21 @@ if (isset($_GET['logout']) || !isset($_SESSION['user'])) {
} }
// Finalize config // Finalize config
$cigala_url = '//'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if (!isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['REQUEST_SCHEME'] = 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : ''); }
$cigala_url = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if ($config['multidomain']) { if ($config['multidomain']) {
$login = SQLite3::escapeString(str_replace('..', '', $_SESSION['user'])); $login = SQLite3::escapeString(str_replace('..', '', $_SESSION['user']));
list($name, $domain, $tld) = explode('.', $login, 3); list($name, $domain, $tld) = explode('.', $login, 3);
$config['home'] = str_replace('%DOMAIN%', $domain, $config['home']).$name; $config['home'] = str_replace('%DOMAIN%', $domain, $config['home']).$name;
$config['deleted'] = str_replace('%DOMAIN%', $domain, $config['deleted']).$name; $config['deleted'] = str_replace('%DOMAIN%', $domain, $config['deleted']).$name;
$config['url'] = '//'.$login.'/'; $config['url'] = $_SERVER['REQUEST_SCHEME'].'://'.$login.'/';
} }
else { else {
$name = $login = SQLite3::escapeString(str_replace('..', '', $_SESSION['user'])); $name = $login = SQLite3::escapeString(str_replace('..', '', $_SESSION['user']));
if (!$config['singleuser']) { if (!$config['singleuser']) {
$config['home'] .= $name; $config['home'] .= $name;
$config['deleted'] .= $name; $config['deleted'] .= $name;
$config['url'] = '//'.$name.'.'.$_SERVER['HTTP_HOST'].'/'; $config['url'] = $_SERVER['REQUEST_SCHEME'].'://'.$name.'.'.$_SERVER['HTTP_HOST'].'/';
} }
else { else {
$config['url'] = dirname($cigala_url).'/'; $config['url'] = dirname($cigala_url).'/';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment