summaryrefslogtreecommitdiffstats
path: root/etc/inc/functions.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-12-02 02:43:42 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-12-02 02:43:42 +0000
commitab6738c74344b572d25e325dcd669fa813a7a1e5 (patch)
tree2baaa717b6783c983db2a9861c527dd302f47cda /etc/inc/functions.inc
parent392dc1a7ebb5e9e58bdf5ab7e1c633c9306e0d5e (diff)
downloadpfsense-ab6738c74344b572d25e325dcd669fa813a7a1e5.zip
pfsense-ab6738c74344b572d25e325dcd669fa813a7a1e5.tar.gz
Use correct pfSenseHeader() function.
Diffstat (limited to 'etc/inc/functions.inc')
-rw-r--r--etc/inc/functions.inc28
1 files changed, 26 insertions, 2 deletions
diff --git a/etc/inc/functions.inc b/etc/inc/functions.inc
index 2d6338a..fbd1b99 100644
--- a/etc/inc/functions.inc
+++ b/etc/inc/functions.inc
@@ -39,8 +39,32 @@ if(!function_exists("gettext")) {
}
if(!function_exists("pfSenseHeader")) {
- function pfSenseHeader($location) {
- header("Location: $location");
+ /****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['SERVER_NAME']}{$port}/{$text}";
+ echo "\ndocument.location.href = '{$complete_url}';\n";
+ } else {
+ Header("Location: $text");
+ }
}
}
/* END compatibility goo with HEAD */
OpenPOWER on IntegriCloud