diff options
author | Renato Botelho <renato@netgate.com> | 2017-04-20 16:08:19 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-04-20 16:08:19 -0300 |
commit | d900c7f6196e90ccd429a7a132f78550d26fc654 (patch) | |
tree | ea79246850cdb1d6bce4664f94a5af3f3a7d7a02 /src/etc/inc/pfsense-utils.inc | |
parent | e05283ad1947cbe2002ccb75ad049117c5180735 (diff) | |
parent | 61fe6d83dea8dbf28a1495906cf6d7b2261cc834 (diff) | |
download | pfsense-d900c7f6196e90ccd429a7a132f78550d26fc654.zip pfsense-d900c7f6196e90ccd429a7a132f78550d26fc654.tar.gz |
Merge pull request #3629 from doktornotor/patch-18
Diffstat (limited to 'src/etc/inc/pfsense-utils.inc')
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index 20487fb..3fa06c0 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -130,6 +130,37 @@ function get_dns_servers() { return array_unique($dns_servers); } +/****f* pfsense-utils/pfSenseHeader + * NAME + * pfSenseHeader + * INPUTS + * none + * RESULT + * Javascript header change or browser Location: + ******/ +function pfSenseHeader($text) { + global $_SERVER; + if (isAjax()) { + if ($_SERVER['HTTPS'] == "on") { + $protocol = "https"; + } else { + $protocol = "http"; + } + + $port = ":{$_SERVER['SERVER_PORT']}"; + if ($_SERVER['SERVER_PORT'] == "80" && $protocol == "http") { + $port = ""; + } + if ($_SERVER['SERVER_PORT'] == "443" && $protocol == "https") { + $port = ""; + } + $complete_url = "{$protocol}://{$_SERVER['HTTP_HOST']}{$port}/{$text}"; + echo "\ndocument.location.href = '{$complete_url}';\n"; + } else { + header("Location: $text"); + } +} + /****f* pfsense-utils/get_css_files * NAME * get_css_files - get a list of the available CSS files (themes) |