summaryrefslogtreecommitdiff
path: root/lib/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common.php')
-rw-r--r--lib/common.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/common.php b/lib/common.php
index 0333030e1..a8c7634f6 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -67,14 +67,25 @@ function _sn_to_path($sn)
return $p;
}
-// try to figure out where we are
-
-$_server = array_key_exists('SERVER_NAME', $_SERVER) ?
- strtolower($_SERVER['SERVER_NAME']) :
- null;
-$_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
- _sn_to_path($_SERVER['SCRIPT_NAME']) :
- null;
+// try to figure out where we are. $server and $path
+// can be set by including module, else we guess based
+// on HTTP info.
+
+if (isset($server)) {
+ $_server = $server;
+} else {
+ $_server = array_key_exists('SERVER_NAME', $_SERVER) ?
+ strtolower($_SERVER['SERVER_NAME']) :
+ null;
+}
+
+if (isset($path)) {
+ $_path = $path;
+} else {
+ $_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
+ _sn_to_path($_SERVER['SCRIPT_NAME']) :
+ null;
+}
// default configuration, overwritten in config.php