From: Mikael Nordfeldth Date: Fri, 12 Feb 2016 01:21:11 +0000 (+0100) Subject: Fix Nickname::isSystemPath() work properly for routes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=338df7e35b252fff50da404a71ed82b095b9b8c1;p=quix0rs-gnu-social.git Fix Nickname::isSystemPath() work properly for routes --- diff --git a/lib/nickname.php b/lib/nickname.php index 1ed0abbe78..c49ce20f5e 100644 --- a/lib/nickname.php +++ b/lib/nickname.php @@ -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)); } /** diff --git a/lib/urlmapper.php b/lib/urlmapper.php index ae31147203..931b5c3c2a 100644 --- a/lib/urlmapper.php +++ b/lib/urlmapper.php @@ -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];