Commit version 24.12.13800
This commit is contained in:
@ -5,55 +5,53 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage ajax
|
||||
* @author Adam Armstrong <adama@observium.org>
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage ajax
|
||||
* @author Adam Armstrong <adama@observium.org>
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
$config['install_dir'] = "../..";
|
||||
include_once("../../includes/observium.inc.php");
|
||||
|
||||
include_once("../../includes/sql-config.inc.php");
|
||||
|
||||
include($config['html_dir'] . "/includes/functions.inc.php");
|
||||
include($config['html_dir'] . "/includes/authenticate.inc.php");
|
||||
|
||||
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
|
||||
if (!$_SESSION['authenticated']) {
|
||||
echo("unauthenticated");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result = [];
|
||||
|
||||
if ($_SESSION['userlevel'] >= '5')
|
||||
{
|
||||
if ($_SESSION['userlevel'] >= '5') {
|
||||
|
||||
switch ($_GET['entity_type'])
|
||||
{
|
||||
switch ($_GET['entity_type']) {
|
||||
|
||||
case "port":
|
||||
case "port":
|
||||
|
||||
$where_array = build_ports_where_array($GLOBALS['vars']);
|
||||
$where_array = build_ports_where_array($GLOBALS['vars']);
|
||||
|
||||
$where = ' WHERE 1 ';
|
||||
$where .= implode('', $where_array);
|
||||
$where = ' WHERE 1 ';
|
||||
$where .= implode('', $where_array);
|
||||
|
||||
$query = 'SELECT *, `ports`.`port_id` AS `port_id` FROM `ports`';
|
||||
//$query .= ' LEFT JOIN `ports-state` AS S ON `ports`.`port_id` = S.`port_id`';
|
||||
$query .= $where;
|
||||
$query = 'SELECT *, `ports`.`port_id` AS `port_id` FROM `ports`';
|
||||
//$query .= ' LEFT JOIN `ports-state` AS S ON `ports`.`port_id` = S.`port_id`';
|
||||
$query .= $where;
|
||||
|
||||
$ports_db = dbFetchRows($query, $param);
|
||||
port_permitted_array($ports_db);
|
||||
$ports_db = dbFetchRows($query, $param);
|
||||
port_permitted_array($ports_db);
|
||||
|
||||
foreach ($ports_db as $port) {
|
||||
humanize_port($port);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
array_push($result, [ intval($port['port_id']), $device['hostname'], $port['port_label'], $port['ifAlias'], $port['ifOperStatus'] == 'up' ? 'up' : 'down' ]);
|
||||
}
|
||||
break;
|
||||
foreach ($ports_db as $port) {
|
||||
humanize_port($port);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
array_push($result, [intval($port['port_id']), $device['hostname'], $port['port_label'], $port['ifAlias'], $port['ifOperStatus'] == 'up' ? 'up' : 'down']);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
print json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
|
||||
header('Content-Type: application/json');
|
||||
print json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user