Fix Nickname::isSystemPath() work properly for routes

This commit is contained in:
Mikael Nordfeldth 2016-02-12 02:21:11 +01:00
parent c8753353ed
commit 338df7e35b
2 changed files with 6 additions and 6 deletions

View 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));
}
/**

View 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];