create common method for generating type_wheres

This commit is contained in:
Brandon Boudrias
2016-06-24 14:56:45 -07:00
parent 4202b7920f
commit 4ad75fb89d
4 changed files with 65 additions and 59 deletions

View File

@ -495,19 +495,10 @@ function get_graph_by_portgroup() {
$vars['width'] = $_GET['width'] ?: 1075;
$vars['height'] = $_GET['height'] ?: 300;
$auth = '1';
$type_where = ' (';
$or = '';
$type_param = array();
foreach (explode(',', $group) as $type) {
$type_where .= " $or `port_descr_type` = ?";
$or = 'OR';
$type_param[] = $type;
}
$type_where .= ') ';
$ports = get_ports_from_type(explode(',', $group));
$if_list = '';
$seperator = '';
$ports = dbFetchRows("SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias", $type_param);
foreach ($ports as $port) {
$if_list .= $seperator.$port['port_id'];
$seperator = ',';