Skip to content

Commit

Permalink
Merge pull request #1106 from laf/issue-27
Browse files Browse the repository at this point in the history
Stop boxes appearing when the device is down
  • Loading branch information
paulgear committed May 22, 2015
2 parents d124e55 + ffdece9 commit 2486750
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions html/pages/front/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function generate_front_box ($frontbox_class, $content)

if ($_SESSION['userlevel'] >= '10')
{
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit'];
} else {
$sql = "SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit'];
}

// These things need to become more generic, and more manageable across different frontpages... rewrite inc :>
Expand All @@ -76,12 +76,12 @@ function generate_front_box ($frontbox_class, $content)
// Service down boxes
if ($_SESSION['userlevel'] >= '10')
{
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit'];
$param[] = '';
}
else
{
$sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0' LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit'];
$param[] = $_SESSION['user_id'];
}
foreach (dbFetchRows($sql,$param) as $service)
Expand All @@ -98,9 +98,9 @@ function generate_front_box ($frontbox_class, $content)
{
if ($_SESSION['userlevel'] >= '10')
{
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit'];
} else {
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit'];
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit'];
}
foreach (dbFetchRows($sql) as $peer)
{
Expand Down

0 comments on commit 2486750

Please sign in to comment.