diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 8303df7a64..daf0af8b92 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -104,7 +104,11 @@ if ($_SESSION['userlevel'] >= '10') { ## Display Locations entry if $config['show_locations'] if ($config['show_locations']) { - $locations = mysql_query("SELECT DISTINCT location FROM devices ORDER BY location"); + if($_SESSION['userlevel'] >= '5') { + $locations = mysql_query("SELECT DISTINCT location FROM devices GROUP BY location ORDER BY location"); + } else { + $locations = mysql_query("SELECT DISTINCT location FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' GROUP BY location ORDER BY location"); + } ?>
Locations
= '5') {
+ $query = mysql_query("SELECT location FROM devices WHERE 1 $where GROUP BY location ORDER BY location");
+ } else {
+ $query = mysql_query("SELECT location FROM devices AS D, devices_perms AS P WHERE 1 $where AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' GROUP BY location ORDER BY location");
+ }
+
while ($data = mysql_fetch_array($query))
{
if ($data['location'])