improve rss self-url discovery:
use ports if not standard, use other vars for scheme, remove extra '/'.
This commit is contained in:
parent
4a36279803
commit
50f5bf7deb
1 changed files with 24 additions and 4 deletions
28
rss.php
28
rss.php
|
@ -2,11 +2,31 @@
|
||||||
/*============================*/
|
/*============================*/
|
||||||
/* Gallery address definition */
|
/* 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 */
|
/* Functions */
|
||||||
|
|
Loading…
Reference in a new issue