');
if($vars['searchbar'] == "hide")
{
echo('
Search');
} else {
echo('
Search');
}
echo(" | ");
if($vars['bare'] == "yes")
{
echo('
Header');
} else {
echo('
Header');
}
echo('
');
print_optionbar_end();
#if ($_SESSION['userlevel'] >= '5') {
# $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
#} else {
# $sql = "SELECT * FROM `ports` AS I, `devices` AS D, `devices_perms` AS P WHERE I.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, I.ifDescr";
#}
$param = array();
# FIXME block below is not totally used, at least the iftype stuff is bogus?
if ($_GET['opta'] == "down" || $_GET['type'] == "down" || $vars['state'] == "down")
{
$where .= "AND I.ifAdminStatus = 'up' AND I.ifOperStatus = 'down' AND I.ignore = '0'";
} elseif ($_GET['optb'] == "admindown" || $_GET['type'] == "admindown" || $vars['state'] == "admindown") {
$where .= "AND I.ifAdminStatus = 'down'";
} elseif ($_GET['optb'] == "errors" || $_GET['type'] == "errors" || $vars['state'] == "errors") {
$where .= "AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')";
} elseif ($_GET['type'] == "up" || $vars['state'] == "up") {
$where .= "AND I.ifOperStatus = 'up'";
} elseif ($_GET['optb'] == "ignored" || $_GET['type'] == "ignored" || $vars['state'] == "ignored") {
$where .= "AND I.ignore = '1'";
} elseif ($_GET['type'] == "l2vlan" || $vars['state'] == "l2vlan") {
$where .= " AND I.ifType = 'l2vlan'";
} elseif ($_GET['type'] == "ethernet" || $vars['state'] == "ethernet") {
$where .= " AND I.ifType = 'ethernetCsmacd'";
} elseif ($_GET['type'] == "loopback" || $vars['state'] == "loopback") {
$where .= " AND I.ifType = 'softwareLoopback'";
} elseif ($_GET['type'] == "sonet" || $vars['state'] == "sonet") {
$where .= " AND I.ifType = 'sonet'";
} elseif ($vars['state'] == "propvirtual") {
$where .= " AND I.ifType = 'propVirtual'";
} elseif ($vars['state'] == "ppp") {
$where .= " AND I.ifType = 'ppp'";
}
if (is_numeric($vars['device_id']))
{
$where .= " AND I.device_id = ?";
$param[] = $vars['device_id'];
}
if ($vars['ifType'])
{
$where .= " AND I.ifType = ?";
$param[] = $vars['ifType'];
}
if ($vars['port_descr_type'])
{
$where .= " AND I.port_descr_type = ?";
$param[] = $vars['port_descr_type'];
}
if (is_numeric($vars['ifSpeed']))
{
$where .= " AND I.ifSpeed = ?";
$param[] = $vars['ifSpeed'];
}
if ($vars['ifAlias']) {
$where .= " AND I.ifAlias LIKE ?";
$param[] = "%".$vars['ifAlias']."%";
}
if ($vars['deleted'] || $_GET['type'] == "deleted") { $where .= " AND I.deleted = '1'"; }
$query = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ".$where." ORDER BY D.hostname, I.ifIndex";
$row = 1;
list($format, $subformat) = explode("_", $vars['format']);
if(file_exists('pages/ports/'.$format.'.inc.php'))
{
include('pages/ports/'.$format.'.inc.php');
}
?>