X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=1566399fa2f351e8381796397d0f697b5b4e617f;hb=0d35673d5ab2093c21cc5fe0e5327868e18d0a1b;hp=3534739bface4334914d14a07dbb700363d3f974;hpb=55068030d22b6faf46f216d0c2411d6a32ec655e;p=quix0rs-gnu-social.git diff --git a/index.php b/index.php index 3534739bfa..1566399fa2 100644 --- a/index.php +++ b/index.php @@ -49,21 +49,29 @@ $action = null; function getPath($req) { + $p = null; + if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER)) && array_key_exists('p', $req) ) { - return $req['p']; + $p = $req['p']; } else if (array_key_exists('PATH_INFO', $_SERVER)) { $path = $_SERVER['PATH_INFO']; $script = $_SERVER['SCRIPT_NAME']; if (substr($path, 0, mb_strlen($script)) == $script) { - return substr($path, mb_strlen($script)); + $p = substr($path, mb_strlen($script) + 1); } else { - return $path; + $p = $path; } } else { - return null; + $p = null; } + + // Trim all initial '/' + + $p = ltrim($p, '/'); + + return $p; } /** @@ -116,16 +124,14 @@ function handleError($error) common_config('site', 'name'), common_config('site', 'email') ); + + $dac = new DBErrorAction($msg, 500); + $dac->showPage(); } else { - // TRANS: Error message. - $msg = _('An important error occured, probably related to email setup. '. - 'Check logfiles for more info.' - ); + $sac = new ServerErrorAction($error->getMessage(), 500, $error); + $sac->showPage(); } - $dac = new DBErrorAction($msg, 500); - $dac->showPage(); - } catch (Exception $e) { // TRANS: Error message. echo _('An error occurred.');