diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-06-20 14:58:47 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-06-20 14:58:47 -0700 |
commit | 198afa0a1d61c4db2cf6b66e5801af506462ab9b (patch) | |
tree | d42ba4a5afae56af975ebddc784c93be820cbcdb /lib/common.php | |
parent | 45430d2b3b952dda31d232c2726e5980a7e6e56a (diff) |
change scripts to take server and path from commandline
Diffstat (limited to 'lib/common.php')
-rw-r--r-- | lib/common.php | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/common.php b/lib/common.php index 702da8235..17eed71cd 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 |