From 338df7e35b252fff50da404a71ed82b095b9b8c1 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 12 Feb 2016 02:21:11 +0100 Subject: [PATCH] Fix Nickname::isSystemPath() work properly for routes --- lib/nickname.php | 10 +++++----- lib/urlmapper.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) 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];