]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix Nickname::isSystemPath() work properly for routes
authorMikael Nordfeldth <mmn@hethane.se>
Fri, 12 Feb 2016 01:21:11 +0000 (02:21 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Fri, 12 Feb 2016 01:21:11 +0000 (02:21 +0100)
lib/nickname.php
lib/urlmapper.php

index 1ed0abbe78dbfcec46365c97f73684cb2ff34b83..c49ce20f5eff28ae0e5bb4d1534c55cf37764190 100644 (file)
@@ -180,18 +180,18 @@ class Nickname
         // All directory and file names in site root should be blacklisted
         $d = dir(INSTALLDIR);
         while (false !== ($entry = $d->read())) {
-            $paths[] = $entry;
+            $paths[$entry] = true;
         }
         $d->close();
 
         // All top level names in the router should be blacklisted
         $router = Router::get();
-        foreach (array_keys($router->m->getPaths()) as $path) {
-            if (preg_match('/^\/(.*?)[\/\?]/',$path,$matches)) {
-                $paths[] = $matches[1];
+        foreach ($router->m->getPaths() as $path) {
+            if (preg_match('/^([^\/\?]+)[\/\?]/',$path,$matches) && isset($matches[1])) {
+                $paths[$matches[1]] = true;
             }
         }
-        return in_array($str, $paths);
+        return in_array($str, array_keys($paths));
     }
 
     /**
index ae31147203320251e61572afe1fcdd84fab214fe..931b5c3c2a1cf554a5f35ac7229d7e2fa59a0c82 100644 (file)
@@ -66,7 +66,7 @@ class URLMapper
             throw new Exception(sprintf("Can't connect %s; path has no action.", $path));
         }
 
-        $allpaths[] = $path;
+        $this->allpaths[] = $path;
 
         $action = $args[self::ACTION];