]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/common.php
Merge branch '0.8.x' into cmdline
[quix0rs-gnu-social.git] / lib / common.php
index 0333030e1d8753025a92e46c0cc5bc4fa1e4b121..a8c7634f6231b050a2e4b47421c846f7a3d54723 100644 (file)
@@ -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