aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/http/HttpUtils.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-17 14:16:32 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commitc4d5be53c2ae503c00da3cfe6b28d0ce9d2ca7f5 (patch)
tree2aa6b156d45da7a1bb3cfe0b6e8622030fddb990 /application/http/HttpUtils.php
parente3d28be9673a9f8404ff907b8191209729ad690c (diff)
downloadShaarli-c4d5be53c2ae503c00da3cfe6b28d0ce9d2ca7f5.tar.gz
Shaarli-c4d5be53c2ae503c00da3cfe6b28d0ce9d2ca7f5.tar.zst
Shaarli-c4d5be53c2ae503c00da3cfe6b28d0ce9d2ca7f5.zip
Process Daily RSS feed through Slim controller
The daily RSS template has been entirely rewritten to handle the whole feed through the template engine.
Diffstat (limited to 'application/http/HttpUtils.php')
-rw-r--r--application/http/HttpUtils.php15
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 */
370function index_url($server) 370function 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 */
388function page_url($server) 388function 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/**