Hacks to avoid reserved filenames

This commit is contained in:
rootcoma 2013-12-05 17:05:47 -08:00
parent f891710d79
commit e58f73142f
1 changed files with 10 additions and 2 deletions

View File

@ -66,8 +66,12 @@ class Router
// loop trough parameter names, store matching value in $params array
foreach ($argument_keys as $key => $name) {
if (isset($matches[$key + 1]))
if (isset($matches[$key + 1])) {
if($matches[$key + 1] == '*' || $matches[$key + 1] == '**') {
$matches[$key + 1] = str_replace('*', '.', $matches[$key + 1]);
}
$params[$name] = $matches[$key + 1];
}
}
}
@ -98,8 +102,12 @@ class Router
// loop trough parameter names, store matching value in $params array
foreach ($param_keys as $i => $key) {
if (isset($params[$key]))
if (isset($params[$key])) {
if($params[$key] == '.' || $params[$key] == '..') {
$params[$key] = str_replace('.', '*', $params[$key]);
}
$url = preg_replace("/:(\w+)/", $params[$key], $url, 1);
}
}
}