mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 04:09:56 +03:00
fixes #1527 ability to disable auto-detection of url port
This commit is contained in:
parent
796f726ed1
commit
00480ce0a7
2 changed files with 27 additions and 5 deletions
|
@ -638,6 +638,12 @@ $conf['picture_url_style'] = 'id';
|
||||||
// tags is not unique, all tags with the same url representation will be shown
|
// tags is not unique, all tags with the same url representation will be shown
|
||||||
$conf['tag_url_style'] = 'id-tag';
|
$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 |
|
// | tags |
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
|
@ -32,6 +32,7 @@ function get_root_url()
|
||||||
*/
|
*/
|
||||||
function get_absolute_root_url($with_scheme=true)
|
function get_absolute_root_url($with_scheme=true)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
// TODO - add HERE the possibility to call PWG functions from external scripts
|
// TODO - add HERE the possibility to call PWG functions from external scripts
|
||||||
|
|
||||||
// Support X-Forwarded-Proto header for HTTPS detection in PHP
|
// Support X-Forwarded-Proto header for HTTPS detection in PHP
|
||||||
|
@ -61,15 +62,30 @@ function get_absolute_root_url($with_scheme=true)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$url .= $_SERVER['HTTP_HOST'];
|
$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'];
|
// do nothing
|
||||||
if (strrchr($url, ':') != $url_port)
|
}
|
||||||
|
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();
|
$url .= cookie_path();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue