better calculation of path
This commit is contained in:
parent
68b34b3266
commit
597df6a234
@ -55,13 +55,25 @@ require_once(INSTALLDIR.'/lib/language.php');
|
|||||||
require_once(INSTALLDIR.'/lib/event.php');
|
require_once(INSTALLDIR.'/lib/event.php');
|
||||||
require_once(INSTALLDIR.'/lib/plugin.php');
|
require_once(INSTALLDIR.'/lib/plugin.php');
|
||||||
|
|
||||||
|
function _sn_to_path($sn)
|
||||||
|
{
|
||||||
|
$past_root = substr($sn, 1);
|
||||||
|
$last_slash = strrpos($past_root, '/');
|
||||||
|
if ($last_slash > 0) {
|
||||||
|
$p = substr($past_root, 0, $last_slash);
|
||||||
|
} else {
|
||||||
|
$p = '';
|
||||||
|
}
|
||||||
|
return $p;
|
||||||
|
}
|
||||||
|
|
||||||
// try to figure out where we are
|
// try to figure out where we are
|
||||||
|
|
||||||
$_server = array_key_exists('SERVER_NAME', $_SERVER) ?
|
$_server = array_key_exists('SERVER_NAME', $_SERVER) ?
|
||||||
strtolower($_SERVER['SERVER_NAME']) :
|
strtolower($_SERVER['SERVER_NAME']) :
|
||||||
null;
|
null;
|
||||||
$_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
|
$_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
|
||||||
substr($_SERVER['SCRIPT_NAME'], 1, strrpos($_SERVER['SCRIPT_NAME'], '/') - 1) :
|
_sn_to_path($_SERVER['SCRIPT_NAME']) :
|
||||||
null;
|
null;
|
||||||
|
|
||||||
// default configuration, overwritten in config.php
|
// default configuration, overwritten in config.php
|
||||||
|
Loading…
Reference in New Issue
Block a user