diff options
Diffstat (limited to 'application/http')
-rw-r--r-- | application/http/HttpUtils.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/application/http/HttpUtils.php b/application/http/HttpUtils.php index 2ea9195d..f00c4336 100644 --- a/application/http/HttpUtils.php +++ b/application/http/HttpUtils.php | |||
@@ -369,7 +369,7 @@ function server_url($server) | |||
369 | */ | 369 | */ |
370 | function index_url($server) | 370 | function index_url($server) |
371 | { | 371 | { |
372 | $scriptname = $server['SCRIPT_NAME']; | 372 | $scriptname = $server['SCRIPT_NAME'] ?? ''; |
373 | if (endsWith($scriptname, 'index.php')) { | 373 | if (endsWith($scriptname, 'index.php')) { |
374 | $scriptname = substr($scriptname, 0, -9); | 374 | $scriptname = substr($scriptname, 0, -9); |
375 | } | 375 | } |
@@ -377,7 +377,7 @@ function index_url($server) | |||
377 | } | 377 | } |
378 | 378 | ||
379 | /** | 379 | /** |
380 | * Returns the absolute URL of the current script, with the query | 380 | * Returns the absolute URL of the current script, with current route and query |
381 | * | 381 | * |
382 | * If the resource is "index.php", then it is removed (for better-looking URLs) | 382 | * If the resource is "index.php", then it is removed (for better-looking URLs) |
383 | * | 383 | * |
@@ -387,10 +387,17 @@ function index_url($server) | |||
387 | */ | 387 | */ |
388 | function page_url($server) | 388 | function page_url($server) |
389 | { | 389 | { |
390 | $scriptname = $server['SCRIPT_NAME'] ?? ''; | ||
391 | if (endsWith($scriptname, 'index.php')) { | ||
392 | $scriptname = substr($scriptname, 0, -9); | ||
393 | } | ||
394 | |||
395 | $route = ltrim($server['REQUEST_URI'] ?? '', $scriptname); | ||
390 | if (! empty($server['QUERY_STRING'])) { | 396 | if (! empty($server['QUERY_STRING'])) { |
391 | return index_url($server).'?'.$server['QUERY_STRING']; | 397 | return index_url($server) . $route . '?' . $server['QUERY_STRING']; |
392 | } | 398 | } |
393 | return index_url($server); | 399 | |
400 | return index_url($server) . $route; | ||
394 | } | 401 | } |
395 | 402 | ||
396 | /** | 403 | /** |