From: Stricted Date: Sun, 17 Jul 2016 05:26:56 +0000 (+0200) Subject: fix travis build X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8ea7345693f44f3dde6197e56238d43d3ea7562d;p=GitHub%2FStricted%2FDomain-Control-Panel.git fix travis build --- diff --git a/lib/system/RequestHandler.class.php b/lib/system/RequestHandler.class.php index d08c0b3..1877b48 100644 --- a/lib/system/RequestHandler.class.php +++ b/lib/system/RequestHandler.class.php @@ -1,9 +1,9 @@ getUri(); + $path = $uri->getPath(); - $uri = $request->getUri(); - $path = $uri->getPath(); + if ($pathOffset !== null) { + if ($pathOffset >= 0 && strlen($path) >= $pathOffset && !empty($this->route)) { + if (strpos($path, $this->route, $pathOffset) === $pathOffset) { + return new RouteMatch($this->defaults, strlen($this->route)); + } + } - if ($pathOffset !== null) { - if ($pathOffset >= 0 && strlen($path) >= $pathOffset && !empty($this->route)) { - if (strpos($path, $this->route, $pathOffset) === $pathOffset) { - return new RouteMatch($this->defaults, strlen($this->route)); - } - } + return; + } - return; - } - - if (mb_strtolower($path) === mb_strtolower($this->route)) { - return new RouteMatch($this->defaults, strlen($this->route)); - } + if (mb_strtolower($path) === mb_strtolower($this->route)) { + return new RouteMatch($this->defaults, strlen($this->route)); + } - return; - } + return; + } } diff --git a/lib/system/route/Regex.class.php b/lib/system/route/Regex.class.php index 049cb87..c411423 100644 --- a/lib/system/route/Regex.class.php +++ b/lib/system/route/Regex.class.php @@ -1,39 +1,40 @@ getUri(); + $path = $uri->getPath(); - $uri = $request->getUri(); - $path = $uri->getPath(); + if ($pathOffset !== null) { + $result = preg_match('(\G' . $this->regex . ')i', $path, $matches, null, $pathOffset); + } + else { + $result = preg_match('(^' . $this->regex . '$)i', $path, $matches); + } - if ($pathOffset !== null) { - $result = preg_match('(\G' . $this->regex . ')i', $path, $matches, null, $pathOffset); - } else { - $result = preg_match('(^' . $this->regex . '$)i', $path, $matches); - } + if (!$result) { + return; + } - if (!$result) { - return; - } + $matchedLength = strlen($matches[0]); - $matchedLength = strlen($matches[0]); + foreach ($matches as $key => $value) { + if (is_numeric($key) || is_int($key) || $value === '') { + unset($matches[$key]); + } + else { + $matches[$key] = rawurldecode($value); + } + } - foreach ($matches as $key => $value) { - if (is_numeric($key) || is_int($key) || $value === '') { - unset($matches[$key]); - } else { - $matches[$key] = rawurldecode($value); - } - } - - return new RouteMatch(array_merge($this->defaults, $matches), $matchedLength); - } + return new RouteMatch(array_merge($this->defaults, $matches), $matchedLength); + } }