Skip to content

Commit a3153be

Browse files
committed
pagesupdate
1 parent 80f96e0 commit a3153be

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

admin.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8071,7 +8071,7 @@ class SimpleRouter implements Router
80718071

80728072
public function __construct(string $basePath, Responder $responder, Cache $cache, int $ttl)
80738073
{
8074-
$this->basePath = rtrim($basePath, '/');
8074+
$this->basePath = rtrim($basePath, '/') ?: rtrim($this->detectBasePath(), '/');;
80758075
$this->responder = $responder;
80768076
$this->cache = $cache;
80778077
$this->ttl = $ttl;
@@ -8081,18 +8081,18 @@ public function __construct(string $basePath, Responder $responder, Cache $cache
80818081
$this->middlewares = array();
80828082
}
80838083

8084-
private function detectBasePath(ServerRequestInterface $request): string
8084+
private function detectBasePath(): string
80858085
{
8086-
$serverParams = $request->getServerParams();
8087-
if (isset($serverParams['REQUEST_URI'])) {
8088-
$fullPath = urldecode(explode('?', $serverParams['REQUEST_URI'])[0]);
8089-
if (isset($serverParams['PATH_INFO'])) {
8090-
$path = $serverParams['PATH_INFO'];
8086+
if (isset($_SERVER['REQUEST_URI'])) {
8087+
$fullPath = urldecode(explode('?', $_SERVER['REQUEST_URI'])[0]);
8088+
if (isset($_SERVER['PATH_INFO'])) {
8089+
$path = $_SERVER['PATH_INFO'];
80918090
if (substr($fullPath, -1 * strlen($path)) == $path) {
80928091
return substr($fullPath, 0, -1 * strlen($path));
80938092
}
80948093
}
8095-
if ('/' . basename(__FILE__) == $fullPath) {
8094+
$path = '/' . basename(__FILE__);
8095+
if (substr($fullPath, -1 * strlen($path)) == $path) {
80968096
return $fullPath;
80978097
}
80988098
}
@@ -8133,9 +8133,6 @@ public function load(Middleware $middleware) /*: void*/
81338133

81348134
public function route(ServerRequestInterface $request): ResponseInterface
81358135
{
8136-
if (!$this->basePath) {
8137-
$this->basePath = rtrim($this->detectBasePath($request), '/');
8138-
}
81398136
if ($this->registration) {
81408137
$data = gzcompress(json_encode($this->routes, JSON_UNESCAPED_UNICODE));
81418138
$this->cache->set('PathTree', $data, $this->ttl);

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)