mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-08 09:43:01 +02:00
fixes #1527 ability to disable auto-detection of url port
This commit is contained in:
@@ -638,6 +638,12 @@ $conf['picture_url_style'] = 'id';
|
||||
// tags is not unique, all tags with the same url representation will be shown
|
||||
$conf['tag_url_style'] = 'id-tag';
|
||||
|
||||
// force an explicit port in the url (like ":80" or ":443")
|
||||
// * 'none' : do not add any port, whatever protocol is detected
|
||||
// * 'auto' : tries to smartly add a port based on $_SERVER variables
|
||||
// * 123 : adds ":123" next to url host
|
||||
$conf['url_port'] = 'none';
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | tags |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
@@ -32,6 +32,7 @@ function get_root_url()
|
||||
*/
|
||||
function get_absolute_root_url($with_scheme=true)
|
||||
{
|
||||
global $conf;
|
||||
// TODO - add HERE the possibility to call PWG functions from external scripts
|
||||
|
||||
// Support X-Forwarded-Proto header for HTTPS detection in PHP
|
||||
@@ -61,15 +62,30 @@ function get_absolute_root_url($with_scheme=true)
|
||||
else
|
||||
{
|
||||
$url .= $_SERVER['HTTP_HOST'];
|
||||
if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
|
||||
||($is_https && $_SERVER['SERVER_PORT'] != 443))
|
||||
|
||||
$url_port = null;
|
||||
|
||||
if ('none' == $conf['url_port'])
|
||||
{
|
||||
$url_port = ':'.$_SERVER['SERVER_PORT'];
|
||||
if (strrchr($url, ':') != $url_port)
|
||||
// do nothing
|
||||
}
|
||||
elseif ('auto' == $conf['url_port'])
|
||||
{
|
||||
if ((!$is_https && $_SERVER['SERVER_PORT'] != 80) || ($is_https && $_SERVER['SERVER_PORT'] != 443))
|
||||
{
|
||||
$url .= $url_port;
|
||||
$url_port = ':'.$_SERVER['SERVER_PORT'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have a custom port
|
||||
$url_port = ':'.$conf['url_port'];
|
||||
}
|
||||
|
||||
if (!empty($url_port) and strrchr($url, ':') != $url_port)
|
||||
{
|
||||
$url .= $url_port;
|
||||
}
|
||||
}
|
||||
}
|
||||
$url .= cookie_path();
|
||||
|
||||
Reference in New Issue
Block a user