Subsequent fixes after major changes for PDO

This commit is contained in:
2023-02-24 12:16:25 +01:00
parent 7c300e0a8f
commit e74bde2d14
46 changed files with 289 additions and 321 deletions

View File

@@ -10,11 +10,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
include("includes.php");
$location_id = sanitize($_GET['location_id']);
if ((isset($_GET['id'])) ? $id = sanitize($_GET['id']) : $id = '');
include("header.php");
// locationcrumb
// base location
$sql = "SELECT location_id AS id, location_name AS name,
location_parent AS parent_id, location_info AS info,
CONCAT('locationview.php?location_id=', location_id) AS url
@@ -23,9 +24,10 @@ $sql = "SELECT location_id AS id, location_name AS name,
$sth = $dbh->prepare($sql);
$sth->execute([$location_id]);
$location = $sth->fetch(PDO::FETCH_OBJ);
$smarty->assign("location", $location);
// crumbs
$crumbs[] = $location;
$level = 1;
$sql = "SELECT location_id AS id, location_name AS name,
location_parent AS parent_id,
CONCAT('locationview.php?location_id=', location_id) AS url
@@ -36,11 +38,7 @@ while ($crumbs[0]->parent_id != 0) {
$sth->execute([$crumbs[0]->parent_id]);
$result = $sth->fetch(PDO::FETCH_OBJ);
array_unshift($crumbs, $result);
$level++;
}
$smarty->assign("location_id", $location->id);
$smarty->assign("location_info", nl2br($location->info));
$smarty->assign("crumbs", $crumbs);
// sublocations