You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.0 KiB
80 lines
2.0 KiB
<?php
|
|
/*****************************************************************************
|
|
IP Reg, a PHP/MySQL IPAM tool
|
|
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
|
Copyright (C) 2011-2023 Thomas Hooge
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
*****************************************************************************/
|
|
|
|
include("includes.php");
|
|
|
|
$location_id = sanitize($_GET['location_id']);
|
|
|
|
include("header.php");
|
|
|
|
|
|
// locationcrumb
|
|
|
|
$query = "SELECT location_id AS id,
|
|
location_name AS name,
|
|
location_parent AS parent_id,
|
|
location_info
|
|
FROM location
|
|
WHERE location_id=" . $location_id;
|
|
$location = $db->db_select($query);
|
|
$location[0]['url'] = 'locationview.php?location_id=' . $location[0]['id'];
|
|
$crumbs[] = $location[0];
|
|
$level = 1;
|
|
while ($crumbs[0]['parent_id'] != 0) {
|
|
$query = "SELECT location_id AS id,
|
|
location_name AS name,
|
|
location_parent AS parent_id
|
|
FROM location
|
|
WHERE location_id=" . $crumbs[0]['parent_id'];
|
|
$result = $db->db_select($query);
|
|
$result[0]['url'] = 'locationview.php?location_id=' . $result[0]['id'];
|
|
array_unshift($crumbs, $result[0]);
|
|
$level++;
|
|
}
|
|
|
|
$smarty->assign("location_id", $location_id);
|
|
$smarty->assign("location_info", nl2br($location[0]['location_info']));
|
|
$smarty->assign("crumbs", $crumbs);
|
|
|
|
|
|
// sublocations
|
|
$query = "SELECT
|
|
location_id AS sublocation_id,
|
|
location_name AS sublocation_name,
|
|
LEFT(location_info, 40) AS info_short,
|
|
CHAR_LENGTH(location_info) AS info_length
|
|
FROM
|
|
location
|
|
WHERE
|
|
location_parent=" . $location_id . "
|
|
ORDER BY
|
|
location_name";
|
|
|
|
$sublocations = $db->db_select($query);
|
|
$smarty->assign("sublocations", $sublocations);
|
|
|
|
// subnets
|
|
$query = "SELECT
|
|
s.subnet_id,
|
|
s.subnet_address,
|
|
s.subnet_mask
|
|
FROM
|
|
subnet AS s LEFT JOIN subnetlocation USING (subnet_id)
|
|
WHERE
|
|
subnetlocation.location_id=" . $location_id . "
|
|
ORDER BY
|
|
INET_ATON(s.subnet_address)";
|
|
|
|
$subnets = $db->db_select($query);
|
|
$smarty->assign("subnets", $subnets);
|
|
|
|
$smarty->display("locationview.tpl");
|
|
|
|
include("footer.php");
|
|
?>
|
|
|