From e58f73142f4bb09cbfc9ff7a5d7103e259052f78 Mon Sep 17 00:00:00 2001 From: rootcoma Date: Thu, 5 Dec 2013 17:05:47 -0800 Subject: [PATCH] Hacks to avoid reserved filenames --- php/includes/Router.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/php/includes/Router.php b/php/includes/Router.php index e9be5e2..1e32473 100644 --- a/php/includes/Router.php +++ b/php/includes/Router.php @@ -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); + } } }