diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-06-01 13:47:42 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-06-01 13:47:42 +0000 |
commit | 721a9dd4a146a08f26866196d8a347c7aad57274 (patch) | |
tree | 181f0955fd519718bc30274d226e4ddd108a7242 /phpBB/includes/session.php | |
parent | 4354cda6dc695806dc01fdad1e4d11b2749ee9d4 (diff) | |
download | forums-721a9dd4a146a08f26866196d8a347c7aad57274.tar forums-721a9dd4a146a08f26866196d8a347c7aad57274.tar.gz forums-721a9dd4a146a08f26866196d8a347c7aad57274.tar.bz2 forums-721a9dd4a146a08f26866196d8a347c7aad57274.tar.xz forums-721a9dd4a146a08f26866196d8a347c7aad57274.zip |
- create forums by default
- hide prune options if not enabled
- fixed module management enable/disable switch if in module itself
- fixed some schema errors
- adjusted $user->page array generation for developers calling scripts outside of phpBB root
git-svn-id: file:///svn/phpbb/trunk@5995 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
-rw-r--r-- | phpBB/includes/session.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 39fe8e9f1d..40c6da1606 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -55,6 +55,8 @@ class session } } + // The following examples given are for an request uri of {path to the phpbb directory}/adm/index.php?i=10&b=2 + // The current query string $query_string = trim(implode('&', $args)); @@ -62,16 +64,30 @@ class session $page_name = htmlspecialchars(basename($script_name)); // current directory within the phpBB root (for example: adm) - $page_dir = substr(str_replace(str_replace('\\', '/', realpath($root_path)), '', str_replace('\\', '/', realpath('./'))), 1); + $root_dirs = explode('/', str_replace('\\', '/', realpath($root_path))); + $page_dirs = explode('/', str_replace('\\', '/', realpath('./'))); + $intersection = array_intersect_assoc($root_dirs, $page_dirs); + + $root_dirs = array_diff_assoc($root_dirs, $intersection); + $page_dirs = array_diff_assoc($page_dirs, $intersection); + + $page_dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); + + if ($page_dir && $page_dir{strlen($page_dir) - 1} == '/') + { + $page_dir = substr($page_dir, 0, -1); + } - // Current page from phpBB root (for example: adm/index.php?i=10) + // Current page from phpBB root (for example: adm/index.php?i=10&b=2) $page = (($page_dir) ? $page_dir . '/' : '') . $page_name . (($query_string) ? "?$query_string" : ''); // The script path from the webroot to the current directory (for example: /phpBB2/adm) : always prefixed with / $script_path = trim(str_replace('\\', '/', dirname($script_name))); // The script path from the webroot to the phpBB root (for example: /phpBB2) - $root_script_path = ($page_dir) ? str_replace('/' . $page_dir, '', $script_path) : $script_path; + $script_dirs = explode('/', $script_path); + array_splice($script_dirs, -sizeof($page_dirs)); + $root_script_path = implode('/', $script_dirs) . (sizeof($root_dirs) ? '/' . implode('/', $root_dirs) : ''); // We are on the base level (phpBB root == webroot), lets adjust the variables a bit... if (!$root_script_path) |