From 73fb00658bef1a8ee7793d599e672df7bbb043ee Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 4 Nov 2020 11:18:15 +0100 Subject: [locationinfo] Fix: api.php access in redirect mode not working Also get rid of slx-admin prefix / {{dirprefix}}. We now have only one variable to be filled in the template, namely {{api}}, which should also make sure that accessing other module's API is not possible. Matching rewrite rules should land in setup-scripts soon. --- modules-available/locationinfo/page.inc.php | 6 +++++- .../locationinfo/templates/frontend-default.html | 18 +++++++++--------- .../locationinfo/templates/frontend-summary.html | 10 +++++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index df5b3632..e350d407 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -1047,7 +1047,11 @@ class Page_LocationInfo extends Page preg_match('#^/(.*)/#', $_SERVER['PHP_SELF'], $script); preg_match('#^/([^?]+)/#', $_SERVER['REQUEST_URI'], $request); if ($script[1] !== $request[1]) { - $data['dirprefix'] = $script[1] . '/'; + // Working with server-side redirects + $data['api'] = 'api/'; + } else { + // 1:1 + $data['api'] = 'api.php?do=locationinfo&'; } if ($type === 'DEFAULT') { diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index 324ee559..ad2917f4 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -26,8 +26,8 @@ optional: