]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - index.php
Merge ActivitySpam plugin
[quix0rs-gnu-social.git] / index.php
index 3534739bface4334914d14a07dbb700363d3f974..1566399fa2f351e8381796397d0f697b5b4e617f 100644 (file)
--- 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.');