Merge pull request #78 from bifek/rssfix

improve self-url discovery
This commit is contained in:
Tom.C. 2014-11-26 22:40:42 +01:00
commit ab376c1641

28
rss.php
View file

@ -2,11 +2,31 @@
/*============================*/
/* Gallery address definition */
/*============================*/
$gallery_protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$gallery_domain = $_SERVER['HTTP_HOST'].'/';
$gallery_path = dirname($_SERVER['REQUEST_URI']);
$gallery_link = $gallery_protocol.$gallery_domain.$gallery_path;
if (!empty($_SERVER['REQUEST_SCHEME'])) {
$g_protocol = $_SERVER['REQUEST_SCHEME'];
} elseif (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$g_protocol = 'https';
} else {
$g_protocol = 'http';
}
$g_host = $_SERVER['HTTP_HOST'];
$g_port = $_SERVER['SERVER_PORT'];
$g_path = dirname($_SERVER['REQUEST_URI']);
// remove default ports
if (($g_protocol == 'https' && $g_port == '443') ||
($g_protocol == 'http' && $g_port == '80')) {
$g_port = '';
} else {
$g_port = ':' . $g_port;
}
if ($g_path[0] != '/') {
$g_path = '/' . $g_path;
}
$gallery_link = $g_protocol . '://' . $g_host . $g_port . $g_path;
/*===================*/
/* Functions */