diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-22 08:13:19 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-22 08:13:19 +1000 |
| commit | ff4352d914f7fbedbbfd7068c4df5407b3ce1648 (patch) | |
| tree | 53cb24b5356803a49ed7e4caa56881aa4b9237d7 /inc | |
| parent | 763f28f07ce2d514ce8f6aef036c95e2b70e7f5c (diff) | |
Fixed automatic $config['root'] detection with mod.php
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/config.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/inc/config.php b/inc/config.php index 2bdd3131..5105c25f 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1000,9 +1000,14 @@ // The root directory, including the trailing slash, for Tinyboard. // Examples: '/', 'http://boards.chan.org/', '/chan/'. - if (isset($_SERVER['REQUEST_URI'])) - $config['root'] = str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/'; - else + if (isset($_SERVER['REQUEST_URI'])) { + $request_uri = $_SERVER['REQUEST_URI']; + if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] !== '') + $request_uri = substr($request_uri, 0, - 1 - strlen($_SERVER['QUERY_STRING'])); + $config['root'] = str_replace('\\', '/', dirname($request_uri)) == '/' + ? '/' : str_replace('\\', '/', dirname($request_uri)) . '/'; + unset($request_uri); + } else $config['root'] = '/'; // CLI mode // The scheme and domain. This is used to get the site's absolute URL (eg. for image identification links). |
