Index: html/includes/functions.inc.php =================================================================== --- html/includes/functions.inc.php (revision 6579) +++ html/includes/functions.inc.php (working copy) @@ -701,7 +701,7 @@ $pagination.= ' <div class="col-sm-1"> - <form class="pull-right" action=""> + <form class="pull-right" action="#"> <select class="selectpicker" data-width="90px" name="type" id="type" onchange="window.open(this.options[this.selectedIndex].value,\'_top\')">'; foreach ($pagesizes as $pagesize) @@ -1177,7 +1177,7 @@ $legend = str_replace("'", "", $args['legend']); $state = <<<STATE -<script type="text/javascript" language="JavaScript"> +<script type="text/javascript"> document.graphFrom = $from; document.graphTo = $to; document.graphWidth = $width; Index: html/includes/graphs/device/collectd.inc.php =================================================================== --- html/includes/graphs/device/collectd.inc.php (revision 6579) +++ html/includes/graphs/device/collectd.inc.php (working copy) @@ -102,7 +102,6 @@ if(isset($rrd_cmd)) { - # FIXME mres? wtf. if ($vars['from']) { $from = $vars['from']; } if ($vars['to']) { $to = $vars['to']; } $rrd_cmd .= " -s " . escapeshellarg($from) . " -e " . escapeshellarg($to); @@ -117,4 +116,4 @@ $rt = 0; $rrd_options = $rrd_cmd; -?> +// EOF Index: html/includes/graphs/port/mac_acc_total.inc.php =================================================================== --- html/includes/graphs/port/mac_acc_total.inc.php (revision 6579) +++ html/includes/graphs/port/mac_acc_total.inc.php (working copy) @@ -11,8 +11,7 @@ * */ -# FIXME mres? wtf. check for numeric! -$port = $_GET['id']; +$port = (int)$_GET['id']; if ($_GET['stat']) { $stat = $_GET['stat']; } else { $stat = "bits"; } $sort = $_GET['sort']; Index: html/includes/navbar.inc.php =================================================================== --- html/includes/navbar.inc.php (revision 6579) +++ html/includes/navbar.inc.php (working copy) @@ -348,7 +348,7 @@ $separator = 0; } - $navbar['routing']['entries'][] = array('url' => generate_url(array('page' => 'routing', 'protocol' => 'bgp', 'type' => 'all', 'graph' => 'NULL')), 'image' => "images/16/link.png", 'title' => 'BGP All Sessions', 'count' => $routing['bgp']['count']); + $navbar['routing']['entries'][] = array('url' => generate_url(array('page' => 'routing', 'protocol' => 'bgp', 'type' => 'all', 'graph' => 'NULL')), 'icon' => 'oicon-chain', 'title' => 'BGP All Sessions', 'count' => $routing['bgp']['count']); $navbar['routing']['entries'][] = array('url' => generate_url(array('page' => 'routing', 'protocol' => 'bgp', 'type' => 'external', 'graph' => 'NULL')), 'image' => "images/16/world_link.png", 'title' => 'BGP External'); $navbar['routing']['entries'][] = array('url' => generate_url(array('page' => 'routing', 'protocol' => 'bgp', 'type' => 'internal', 'graph' => 'NULL')), 'image' => "images/16/brick_link.png", 'title' => 'BGP Internal'); } @@ -357,7 +357,7 @@ if ($routing['bgp']['alerts']) { $navbar['routing']['entries'][] = array('divider' => TRUE); - $navbar['routing']['entries'][] = array('url' => generate_url(array('page' => 'routing', 'protocol' => 'bgp', 'adminstatus' => 'start', 'state' => 'down')), 'image' => "images/16/link_error.png", 'title' => 'BGP Alerts', 'count' => $routing['bgp']['alerts']); + $navbar['routing']['entries'][] = array('url' => generate_url(array('page' => 'routing', 'protocol' => 'bgp', 'adminstatus' => 'start', 'state' => 'down')), 'icon' => 'oicon-chain--exclamation', 'title' => 'BGP Alerts', 'count' => $routing['bgp']['alerts']); } } Index: html/index.php =================================================================== --- html/index.php (revision 6579) +++ html/index.php (working copy) @@ -308,7 +308,7 @@ } else { // Dim the icon to 20% opacity, makes the red pretty much blend in to the navbar ?> - <a href="<?php echo(generate_url(array('page'=>'overview'))); ?>" alt="Notification center" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"> + <a href="<?php echo(generate_url(array('page'=>'overview'))); ?>" data-alt="Notification center" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"> <i style="opacity: 0.2; filter: alpha(opacity=20);" class="oicon-tick-circle"></i></a> <?php } Index: html/pages/about.inc.php =================================================================== --- html/pages/about.inc.php (revision 6579) +++ html/pages/about.inc.php (working copy) @@ -50,13 +50,13 @@ <div class="content"> <dl class="dl-horizontal" style="margin: 0px 0px 5px 0px;"> <dt style="text-align: left;"><i class="icon-user"></i> Twitter</dt><dd>Bootstrap CSS Framework</dd> - <dt style="text-align: left;"><i class="icon-user"></i> <a href="mailto:p@yusukekamiyamane.com" alt="p@yusukekamiyamane.com">Yusuke Kamiyamane</a></dt><dd>Fugue Iconset</dd> + <dt style="text-align: left;"><i class="icon-user"></i> <a href="mailto:p@yusukekamiyamane.com" data-alt="p@yusukekamiyamane.com">Yusuke Kamiyamane</a></dt><dd>Fugue Iconset</dd> <dt style="text-align: left;"><i class="icon-user"></i> Mark James</dt><dd>Silk Iconset</dd> <dt style="text-align: left;"><i class="icon-user"></i> Jonathan De Graeve</dt><dd>SNMP code improvements</dd> <dt style="text-align: left;"><i class="icon-user"></i> Xiaochi Jin</dt><dd>Logo design</dd> <dt style="text-align: left;"><i class="icon-user"></i> Akichi Ren</dt><dd>Post-steampunk observational hamster</dd> <dt style="text-align: left;"><i class="icon-user"></i> Bruno Pramont</dt><dd>Collectd code</dd> - <dt style="text-align: left;"><i class="icon-user"></i> <a href="mailto:DavidPFarrell@gmail.com" alt="DavidPFarrell@gmail.com">David Farrell</a></dt><dd>Help with parsing net-SNMP output in PHP</dd> + <dt style="text-align: left;"><i class="icon-user"></i> <a href="mailto:DavidPFarrell@gmail.com" data-alt="DavidPFarrell@gmail.com">David Farrell</a></dt><dd>Help with parsing net-SNMP output in PHP</dd> <dt style="text-align: left;"><i class="icon-user"></i> Job Snijders</dt><dd>Python-based multi-instance poller wrapper</dd> <dt style="text-align: left;"><i class="icon-user"></i> Dennis de Houx</dt><dd>Code contributions</dd> <dt style="text-align: left;"><i class="icon-user"></i> Geert Hauwaerts</dt><dd>Code contributions</dd> Index: html/pages/add_alert_check.inc.php =================================================================== --- html/pages/add_alert_check.inc.php (revision 6579) +++ html/pages/add_alert_check.inc.php (working copy) @@ -99,9 +99,9 @@ ?> -<form name="form1" method="post" action="" class="form-horizontal"> +<form name="form1" method="post" action="<?php echo(generate_url(array('page' => 'add_alert_check'))); ?>" class="form-horizontal"> -<legend>New Alert Checker</legend> +<h2>New Alert Checker</h2> <div class="row"> <div class="col-md-6"> @@ -124,10 +124,10 @@ { // Only show this entity type if the type isnt' hidden (for meta-types like alert_entry) echo '<option value="'.$entity_type.'" '; if (!isset($entity_type_array['icon'])) { $entity_type_array['icon'] = $config['entity_default']['icon']; } - echo($vars['entity_type'] == $entity_type || ($vars['entity_type'] == '') ? 'selected' : ''); + // echo($vars['entity_type'] == $entity_type || ($vars['entity_type'] == '') ? 'selected' : ''); echo ' data-icon="'.$entity_type_array['icon'].'"> '.nicecase($entity_type).'</option>'; - } } + } ?> </select> </div> @@ -142,7 +142,7 @@ <div class="control-group"> <label class="control-label" for="alert_message">Message</label> <div class="controls"> - <textarea class="form-control col-md-11" name="alert_message" rows="3" placeholder="Alert message."/></textarea> + <textarea class="form-control col-md-11" name="alert_message" rows="3" placeholder="Alert message."></textarea> </div> </div> <div class="control-group"> Index: html/pages/adduser.inc.php =================================================================== --- html/pages/adduser.inc.php (revision 6579) +++ html/pages/adduser.inc.php (working copy) @@ -69,14 +69,14 @@ <div class="control-group<?php if (isset($errors["username"])) { echo " error"; } ?>"> <label class="control-label" for="new_username"><strong>Username</strong></label> <div class="controls"> - <input class="col-lg-4" type="text" name="new_username" value="<?php echo $vars['new_username']; ?>"> + <input class="col-lg-4" type="text" id="new_username" name="new_username" value="<?php echo $vars['new_username']; ?>"> <?php if (isset($errors["username"])) { echo $errors["username"]; } ?> </div> </div> <div class="control-group<?php if (isset($errors["passwd"])) { echo " error"; } ?>"> <label class="control-label" for="new_password"><strong>Password</strong></label> <div class="controls"> - <input class="col-lg-4" type="password" name="new_password" value="<?php echo $vars['new_password']; ?>"> + <input class="col-lg-4" type="password" id="new_password" name="new_password" value="<?php echo $vars['new_password']; ?>"> <?php if (isset($errors["passwd"])) { echo $errors["passwd"]; } ?> <input type="checkbox" checked="checked" name="can_modify_passwd"> Allow the user to change his password. </div> @@ -84,13 +84,13 @@ <div class="control-group"> <label class="control-label" for="new_realname"><strong>Real Name</strong></label> <div class="controls"> - <input class="col-lg-4" type="text" name="new_realname" value="<?php echo $vars['new_realname']; ?>"> + <input class="col-lg-4" type="text" id="new_realname" name="new_realname" value="<?php echo $vars['new_realname']; ?>"> </div> </div> <div class="control-group"> <label class="control-label" for="new_level"><strong>User Level</strong></label> <div class="controls"> - <select name="new_level" class="col-lg-2"> + <select id="new_level" name="new_level" class="col-lg-2"> <option <?php if ($vars['new_level'] == "1") { echo "selected"; } ?> value="1">Normal User</option> <option <?php if ($vars['new_level'] == "5") { echo "selected"; } ?> value="5">Global Read</option> <option <?php if ($vars['new_level'] == "10") { echo "selected"; } ?> value="10">Administrator</option> @@ -103,13 +103,13 @@ <div class="control-group"> <label class="control-label" for="new_email"><strong>E-mail</strong></label> <div class="controls"> - <input class="col-lg-4" type="text" name="new_email" value="<?php echo $vars['new_email']; ?>"> + <input class="col-lg-4" type="text" id="new_email" name="new_email" value="<?php echo $vars['new_email']; ?>"> </div> </div> <div class="control-group"> <label class="control-label" for="new_description"><strong>Description</strong></label> <div class="controls"> - <input class="col-lg-4" type="text" name="new_description" value="<?php echo $vars['new_description']; ?>"> + <input class="col-lg-4" type="text" id="new_description" name="new_description" value="<?php echo $vars['new_description']; ?>"> </div> </div> </fieldset> Index: html/pages/alert_checks.inc.php =================================================================== --- html/pages/alert_checks.inc.php (revision 6579) +++ html/pages/alert_checks.inc.php (working copy) @@ -65,7 +65,7 @@ <th class="state-marker"></th><th></th> <th style="width: 25px">Id</th> <th style="width: 250px">Name</th> - <th width="40"></th> + <th style="width: 40px"></th> <th style="width: 300px">Tests</th> <th>Device Match / Entity Match</th> <th style="width: 40px">Entities</th> Index: html/pages/bill/edit.inc.php =================================================================== --- html/pages/bill/edit.inc.php (revision 6579) +++ html/pages/bill/edit.inc.php (working copy) @@ -93,7 +93,8 @@ <select name="bill_day" style="width: 60px;"> <?php -for ($x=1;$x<32;$x++) { +foreach(range(1,31) as $x) +{ $select = (($bill_data['bill_day'] == $x) ? " selected" : ""); echo(" <option value=\"".$x."\"".$select.">".$x."</option>"); } @@ -198,7 +199,7 @@ echo(' <input type="hidden" name="port_id" value="'.$port['port_id'].'" />' . PHP_EOL); echo(' <div class="btn-toolbar">' . PHP_EOL); echo(' <div class="btn-group">' . PHP_EOL); - echo(' <button type="submit" class="btn btn-danger" style="color: #fff;"><i class="icon-minus-sign icon-white"></i> Delete</button>' . PHP_EOL); + echo(' <button type="submit" class="btn btn-danger"><i class="icon-minus-sign icon-white"></i> Delete</button>' . PHP_EOL); echo(' ' . $devicebtn . PHP_EOL); echo(' ' . $portbtn . PHP_EOL); echo(' </div>' . PHP_EOL); Index: html/pages/bill/ports.inc.php =================================================================== --- html/pages/bill/ports.inc.php (revision 6579) +++ html/pages/bill/ports.inc.php (working copy) @@ -41,13 +41,11 @@ if (!$emptyCheck) { - $res = " <div class=\"alert alert-info\">\n"; - $res .= " <i class=\"icon-info-sign\"></i> <strong>There are no ports assigned to this bill</strong>\n"; - $res .= " </div>\n"; + print_warning('There are no ports assigned to this bill'); } $ports_info = array("ports" => $count, "capacity" => $speed); -?> +echo($res); - <?php echo($res); ?> +// EOF Index: html/pages/deleted-ports.inc.php =================================================================== --- html/pages/deleted-ports.inc.php (revision 6579) +++ html/pages/deleted-ports.inc.php (working copy) @@ -38,7 +38,7 @@ <th>Port</th> <th>Description</th> <th>Deleted since</th> - <th style="text-align: right;"><a href="'.generate_url(array('page'=>'deleted-ports', 'purge'=>'all')).'"><button class="btn btn-danger btn-mini"><i class="icon-remove icon-white"></i> Purge All</button></a></th> + <th style="text-align: right;"><a class="btn btn-danger btn-mini" href="'.generate_url(array('page'=>'deleted-ports', 'purge'=>'all')).'" role="button"><i class="icon-remove icon-white"></i> Purge All</a></th> </tr></thead>'); foreach (dbFetchRows('SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = "1" AND D.device_id = P.device_id') as $port) @@ -52,7 +52,8 @@ echo('<td style="width: 350px;" class="strong">'.generate_port_link($port).'</td>'); echo('<td>'.htmlentities($port['ifAlias']).'</td>'); echo('<td>'.formatUptime($since, 'short-2').' ago</td>'); - echo('<td style="width: 100px; text-align: right;"><a href="'.generate_url(array('page'=>'deleted-ports', 'purge'=>$port['port_id'])).'"><button class="btn btn-danger btn-mini"><i class="icon-remove icon-white"></i> Purge</button></a></td>'); + echo('<td style="width: 100px; text-align: right;"><a class="btn btn-danger btn-mini" href="'.generate_url(array('page'=>'deleted-ports', 'purge'=>$port['port_id'])).'" role="button"><i class="icon-remove icon-white"></i> Purge</a></td>'); + echo(PHP_EOL); } } Index: html/pages/device/collectd.inc.php =================================================================== --- html/pages/device/collectd.inc.php (revision 6579) +++ html/pages/device/collectd.inc.php (working copy) @@ -38,10 +38,10 @@ print('<?xml version="1.0" encoding="utf-8" ?>'."\n"); print("<response>\n"); - printf(" <method>%s</method>\n", htmlspecialchars($method)); + printf(" <method>%s</method>\n", escape_html($method)); print(" <result>\n"); foreach ($items as &$item) - printf(' <option>%s</option>'."\n", htmlspecialchars($item)); + printf(' <option>%s</option>'."\n", escape_html($item)); print(" </result>\n"); print("</response>"); } @@ -60,7 +60,7 @@ if (!$vars['plugin']) { $vars['plugin'] = $plugin; } if ($vars['plugin'] == $plugin) { $navbar['options'][$plugin]['class'] = "active"; } $navbar['options'][$plugin]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'collectd', 'plugin' => $plugin)); - $navbar['options'][$plugin]['text'] = htmlspecialchars(ucwords($plugin)); + $navbar['options'][$plugin]['text'] = escape_html(ucwords($plugin)); } print_navbar($navbar); Index: html/pages/device/edit/alerts.inc.php =================================================================== --- html/pages/device/edit/alerts.inc.php (revision 6579) +++ html/pages/device/edit/alerts.inc.php (working copy) @@ -83,7 +83,7 @@ <div class="control-group"> <label class="control-label" for="sysContact">Custom contact</label> <div class="controls"> - <input type=text name="sysContact" size="32" <?php if (!$override_sysContact_bool) { echo(' disabled="1"'); } ?> value="<?php echo(escape_html($override_sysContact_string)); ?>" /> + <input type=text name="sysContact" size="32" <?php if (!$override_sysContact_bool) { echo(' disabled="disabled"'); } ?> value="<?php echo(escape_html($override_sysContact_string)); ?>" /> </div> </div> Index: html/pages/device/edit/apps.inc.php =================================================================== --- html/pages/device/edit/apps.inc.php (revision 6579) +++ html/pages/device/edit/apps.inc.php (working copy) @@ -80,15 +80,16 @@ } ?> -<form id='appedit' name='appedit' method='post' action='' class='form-inline'> +<form id="appedit" name="appedit" method="post" action="" class="form-inline"> <fieldset> <legend>Device Properties</legend> + </fieldset> - <input type=hidden name=device value='<?php echo $device['device_id'];?>'> -<table class='table table-striped table-bordered table-condensed table-rounded'> + <input type="hidden" name="device" value="<?php echo $device['device_id'];?>"> +<table class="table table-striped table-bordered table-condensed table-rounded"> <thead> - <tr align=center> - <th width=100>Enable</th> + <tr> + <th style="width: 100px;">Enable</th> <th>Application</th> </tr> </thead> @@ -101,12 +102,11 @@ if (in_array($app,$app_enabled)) { echo(" <tr>"); - echo(" <td align=center>"); - echo(" <input type=checkbox data-toggle='switch-mini' data-on-color='primary' data-off-color='danger' checked=1 name='app_". $app ."'>"); + echo(" <td>"); + echo(" <input type=checkbox data-toggle='switch-mini' data-on-color='primary' data-off-color='danger' checked='checked' name='app_". $app ."'>"); echo(" </td>"); - echo(" <td align=left>". nicecase($app) . "</td>"); - echo(" </tr> -"); + echo(" <td>". nicecase($app) . "</td>"); + echo(" </tr>"); $row++; } @@ -124,4 +124,5 @@ } else { print_error("No applications found on this device."); } + // EOF Index: html/pages/device/edit/device.inc.php =================================================================== --- html/pages/device/edit/device.inc.php (revision 6579) +++ html/pages/device/edit/device.inc.php (working copy) @@ -97,9 +97,9 @@ $unknown = 1; foreach ($config['device_types'] as $type) { - echo(' <option value="'.$type['type'].'"'); + echo(' <option value="'.$type['type'].'" data-icon="'.$type['icon'].'"'); if ($device['type'] == $type['type']) { echo(' selected="selected"'); $unknown = 0; } - echo(' >' . ucfirst($type['type']) . '</option>'); + echo('>' . ucfirst($type['type']) . '</option>'); } if ($unknown) { echo(' <option value="other">Other</option>'); } Index: html/pages/device/edit/netscaler_svcs.inc.php =================================================================== --- html/pages/device/edit/netscaler_svcs.inc.php (revision 6579) +++ html/pages/device/edit/netscaler_svcs.inc.php (working copy) @@ -46,10 +46,10 @@ <table class="table table-bordered table-striped table-condensed"> <thead> <tr> - <th width="120">Type</th> + <th style="width: 120px;">Type</th> <th>Name</th> - <th width="120">Status</th> - <th width="80">Alerts</th> + <th style="width: 120px;">Status</th> + <th style="width: 80px;">Alerts</th> </tr> </thead> <tbody> @@ -60,9 +60,9 @@ { echo('<tr>'); - echo('<td>'.htmlentities($svc['svc_type']).'</td>'); - echo('<td>'.htmlentities($svc['svc_label']).'</td>'); - echo('<td>'.htmlentities($svc['svc_state']).'</td>'); + echo('<td>'.escape_html($svc['svc_type']).'</td>'); + echo('<td>'.escape_html($svc['svc_label']).'</td>'); + echo('<td>'.escape_html($svc['svc_state']).'</td>'); echo('<td> <input type=checkbox data-toggle="switch-revert" id="svcs['.$svc['svc_id'].'][svc_ignore]" name="svcs['.$svc['svc_id'].'][svc_ignore]"'.($svc['svc_ignore'] ? "checked" : "").'> </td>'); Index: html/pages/device/edit/netscaler_vsvrs.inc.php =================================================================== --- html/pages/device/edit/netscaler_vsvrs.inc.php (revision 6579) +++ html/pages/device/edit/netscaler_vsvrs.inc.php (working copy) @@ -46,10 +46,10 @@ <table class="table table-bordered table-striped table-condensed"> <thead> <tr> - <th width="120">MIB Type</th> + <th style="width: 120px;">MIB Type</th> <th>Name</th> - <th width="60">Status</th> - <th width="50">Alerts</th> + <th style="width: 60px;">Status</th> + <th style="width: 50px;">Alerts</th> </tr> </thead> <tbody> @@ -60,9 +60,9 @@ { echo('<tr>'); - echo('<td>'.htmlentities($vsvr['vsvr_type']).'</td>'); - echo('<td>'.htmlentities($vsvr['vsvr_label']).'</td>'); - echo('<td>'.htmlentities($vsvr['vsvr_state']).'</td>'); + echo('<td>'.escape_html($vsvr['vsvr_type']).'</td>'); + echo('<td>'.escape_html($vsvr['vsvr_label']).'</td>'); + echo('<td>'.escape_html($vsvr['vsvr_state']).'</td>'); echo('<td> <input type=checkbox data-toggle="switch-revert" id="vsvrs['.$vsvr['vsvr_id'].'][vsvr_ignore]" name="vsvrs['.$vsvr['vsvr_id'].'][vsvr_ignore]"'.($vsvr['vsvr_ignore'] ? "checked" : "").'> </td>'); Index: html/pages/device/edit/ports.inc.php =================================================================== --- html/pages/device/edit/ports.inc.php (revision 6579) +++ html/pages/device/edit/ports.inc.php (working copy) @@ -149,7 +149,7 @@ echo("<td>".rewrite_ifname($port['port_label'])."<br />".htmlentities($port['ifAlias'])."</td>"); echo("<td>".$port['human_type']."<br />"); - echo('<span>'.htmlentities($port['admin_status']).'</span> / <span name="operstatus_'.$port['port_id'].'" class="'.$port['row_class'].'">'. htmlentities($port['ifOperStatus']) .'</span></td>'); + echo('<span>'.escape_html($port['admin_status']).'</span> / <span data-name="operstatus_'.$port['port_id'].'" class="'.$port['row_class'].'">'. escape_html($port['ifOperStatus']) .'</span></td>'); echo('<td style="vertical-align: middle;">'); echo("<input type=checkbox data-toggle='switch-revert' id='disabled_".$port['port_id']."' name='disabled_".$port['port_id']."'".($port['disabled'] ? ' checked' : '').">"); Index: html/pages/device/health.inc.php =================================================================== --- html/pages/device/health.inc.php (revision 6579) +++ html/pages/device/health.inc.php (working copy) @@ -11,17 +11,17 @@ * */ -$datas[] = 'overview'; +$datas = array('overview' => array('icon' => 'oicon-application-list')); -if (dbFetchCell("SELECT COUNT(*) FROM `processors` WHERE `device_id` = ?", array($device['device_id']))) { $datas[] = 'processor'; } -if (dbFetchCell("SELECT COUNT(*) FROM `mempools` WHERE `device_id` = ?", array($device['device_id']))) { $datas[] = 'mempool'; } -if (dbFetchCell("SELECT COUNT(*) FROM `storage` WHERE `device_id` = ?", array($device['device_id']))) { $datas[] = 'storage'; } -if (dbFetchCell("SELECT COUNT(*) FROM `ucd_diskio` WHERE `device_id` = ?", array($device['device_id']))) { $datas[] = 'diskio'; } -if (dbFetchCell("SELECT COUNT(*) FROM `status` WHERE `device_id` = ?", array($device['device_id']))) { $datas[] = 'status'; } +if (dbFetchCell("SELECT COUNT(*) FROM `processors` WHERE `device_id` = ?", array($device['device_id']))) { $datas['processor'] = array('icon' => $config['entities']['processor']['icon']); } +if (dbFetchCell("SELECT COUNT(*) FROM `mempools` WHERE `device_id` = ?", array($device['device_id']))) { $datas['mempool'] = array('icon' => $config['entities']['mempool']['icon']); } +if (dbFetchCell("SELECT COUNT(*) FROM `storage` WHERE `device_id` = ?", array($device['device_id']))) { $datas['storage'] = array('icon' => $config['entities']['storage']['icon']); } +if (dbFetchCell("SELECT COUNT(*) FROM `ucd_diskio` WHERE `device_id` = ?", array($device['device_id']))) { $datas['diskio'] = array('icon' => 'oicon-drive--arrow'); } +if (dbFetchCell("SELECT COUNT(*) FROM `status` WHERE `device_id` = ?", array($device['device_id']))) { $datas['status'] = array('icon' => $config['entities']['status']['icon']); } $sensors_device = dbFetchRows("SELECT `sensor_class` FROM `sensors` WHERE device_id = ? GROUP BY `sensor_class`", array($device['device_id'])); -foreach ($sensors_device as $sensor) { $datas[] = $sensor['sensor_class']; } +foreach ($sensors_device as $sensor) { $datas[$sensor['sensor_class']] = array('icon' => $config['sensor_types'][$sensor['sensor_class']]['icon']); } $link_array = array('page' => 'device', 'device' => $device['device_id'], @@ -33,9 +33,15 @@ $navbar['brand'] = "Health"; $navbar['class'] = "navbar-narrow"; -foreach ($datas as $type) +$navbar_count = count($datas); +foreach ($datas as $type => $options) { if ($vars['metric'] == $type) { $navbar['options'][$type]['class'] = "active"; } + else if ($navbar_count > 8 && $type != 'overview') { $navbar['options'][$type]['class'] = "icon"; } // Show only icons if too many items in navbar + if (isset($options['icon'])) + { + $navbar['options'][$type]['icon'] = $options['icon']; + } $navbar['options'][$type]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => $type)); $navbar['options'][$type]['text'] = nicecase($type); } @@ -53,6 +59,7 @@ } print_navbar($navbar); +unset($navbar); if ($config['sensor_types'][$vars['metric']]) { @@ -65,7 +72,7 @@ echo('<table class="table table-condensed table-striped table-hover table-bordered">'); - foreach ($datas as $type) + foreach ($datas as $type => $options) { if ($type != "overview") { Index: html/pages/device/health/diskio.inc.php =================================================================== --- html/pages/device/health/diskio.inc.php (revision 6579) +++ html/pages/device/health/diskio.inc.php (working copy) @@ -31,7 +31,7 @@ $graph_array_zoom['from'] = $config['time']['twoday']; $graph_array_zoom['to'] = $config['time']['now']; - echo("<tr bgcolor='$row_colour'><td><span class='entity-title'>"); + echo("<tr><td><span class='entity-title'>"); echo(overlib_link($fs_url, $drive['diskio_descr'], generate_graph_tag($graph_array_zoom), NULL)); echo("</span><br />"); Index: html/pages/device/hrdevice.inc.php =================================================================== --- html/pages/device/hrdevice.inc.php (revision 6579) +++ html/pages/device/hrdevice.inc.php (working copy) @@ -36,18 +36,18 @@ { $proc_id = dbFetchCell('SELECT processor_id FROM processors WHERE device_id = ? AND hrDeviceIndex = ?', array($device['device_id'], $hrdevice['hrDeviceIndex'])); $proc_url = "device/device=".$device['device_id']."/tab=health/metric=processor/"; - $proc_popup = "onmouseover=\"return overlib('<div class=entity-title>".$device['hostname']." - ".$hrdevice['hrDeviceDescr']; - $proc_popup .= "</div><img src=\'graph.php?id=" . $proc_id . "&type=processor_usage&from=".$config['time']['month']."&to=".$config['time']['now']."&width=400&height=125\'>"; - $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - echo(" <td><a href='$proc_url' $proc_popup>".$hrdevice['hrDeviceDescr']."</a></td>\n"); + echo(" <td>" . generate_entity_link('processor', $proc_id) . "</td>\n"); + $graph_array['height'] = "20"; $graph_array['width'] = "100"; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $proc_id; $graph_array['type'] = 'processor_usage'; $graph_array['from'] = $config['time']['day']; - $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + $graph_array_zoom = $graph_array; + $graph_array_zoom['height'] = "150"; + $graph_array_zoom['width'] = "400"; $mini_graph = overlib_link($proc_url, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); @@ -67,7 +67,9 @@ $graph_array['id'] = $interface['port_id']; $graph_array['type'] = 'port_bits'; $graph_array['from'] = $config['time']['day']; - $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + $graph_array_zoom = $graph_array; + $graph_array_zoom['height'] = "150"; + $graph_array_zoom['width'] = "400"; // FIXME click on graph should also link to port, but can't use generate_port_link here... $mini_graph = overlib_link(generate_port_url($interface), generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); Index: html/pages/device/loadbalancer/netscaler_services.inc.php =================================================================== --- html/pages/device/loadbalancer/netscaler_services.inc.php (revision 6579) +++ html/pages/device/loadbalancer/netscaler_services.inc.php (working copy) @@ -22,13 +22,13 @@ $i = 0; echo('<table class="table table-striped table-condensed table-bordered" style="margin-top: 10px;">'); - echo(' <thead>'); + echo(' <thead><tr>'); echo(" <th>Vserver</th>"); echo(" <th>Address</th>"); echo(" <th>Status</th>"); echo(" <th>Input</th>"); echo(" <th>Output</th>"); - echo(' </thead>'); + echo(' </tr></thead>'); foreach (dbFetchRows("SELECT * FROM `netscaler_services` WHERE `device_id` = ? AND `svc_id` = ? ORDER BY `svc_label`", array($device['device_id'], $vars['svc'])) as $svc) { @@ -45,7 +45,7 @@ echo("</tr>"); $vsvrs = dbFetchRows("SELECT * FROM `netscaler_services_vservers` AS SV, `netscaler_vservers` AS V ". - "WHERE SV. device_id = ? AND SV.svc_name = ? AND V.device_id = SV.device_id AND V.vsvr_name = SV.vsvr_name", array($device['device_id'], $svc['svc_name'])); + "WHERE SV.device_id = ? AND SV.svc_name = ? AND V.device_id = SV.device_id AND V.vsvr_name = SV.vsvr_name", array($device['device_id'], $svc['svc_name'])); if (count($vsvrs)) { @@ -137,7 +137,8 @@ $navbar['options_right'][$type]['url'] = generate_url($vars,array('view' => 'graphs', 'graph'=>$type)); } - print_navbar($navbar); unset($navbar); + print_navbar($navbar); + unset($navbar); echo('<table class="table table-striped table-condensed table-bordered" style="margin-top: 10px;">'); echo(" <thead>\n"); @@ -152,20 +153,18 @@ $i = "0"; foreach (dbFetchRows("SELECT * FROM `netscaler_services` WHERE `device_id` = ? ORDER BY `svc_name`", array($device['device_id'])) as $svc) { - if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - if ($svc['svc_state'] == "up") { $svc_class="green"; } else { $svc_class="red"; } echo("<tr>"); - echo('<td style="width: 320px;"><strong><a href="'.generate_url($vars, array('svc' => $svc['svc_id'], 'view' => NULL, 'graph' => NULL)).'">' . $svc['svc_label'] . '</a></strong></td>'); + echo('<td style="width: 320px;"><strong><a href="'.generate_url($vars, array('svc' => $svc['svc_id'], 'view' => NULL, 'graph' => NULL)).'">' . escape_html($svc['svc_label']) . '</a></strong></td>'); echo("<td style=\"width: 320px;\">" . $svc['svc_ip'] . ":" . $svc['svc_port'] . "</td>"); - echo("<td style=\"width: 100px;\"><span class='".$svc_class."'>" . $svc['svc_state'] . "</span></td>"); + echo("<td style=\"width: 100px;\"><span class='".$svc_class."'>" . escape_html($svc['svc_state']) . "</span></td>"); echo("<td style=\"width: 320px;\">" . format_si($svc['svc_bps_in']*8) . "bps</td>"); echo("<td style=\"width: 320px;\">" . format_si($svc['svc_bps_out']*8) . "bps</td>"); echo("</tr>"); if ($vars['view'] == "graphs") { - echo('<tr class="entity" bgcolor="'.$bg_colour.'">'); + echo('<tr class="entity">'); echo('<td style="padding: 0px;" colspan="5">'); $graph_type = "netscalersvc_" . $vars['graph']; $graph_array['to'] = $config['time']['now']; @@ -179,9 +178,6 @@ </tr>"); } - echo("</td>"); - echo("</tr>"); - $i++; } } Index: html/pages/device/overview.inc.php =================================================================== --- html/pages/device/overview.inc.php (revision 6579) +++ html/pages/device/overview.inc.php (working copy) @@ -118,8 +118,7 @@ </div> </div> -</div> -</div> + <?php // EOF Index: html/pages/device/overview/ucd_mem.inc.php =================================================================== --- html/pages/device/overview/ucd_mem.inc.php (revision 6579) +++ html/pages/device/overview/ucd_mem.inc.php (working copy) @@ -61,10 +61,10 @@ $percentage_bar['bars'][2] = array('percent' => $cach_perc, 'colour' => '#f0e0a0', 'text' => ''); ?> -<table width="100%" class="table table-striped table-condensed-more table-bordered"> +<table class="table table-striped table-condensed-more table-bordered"> <tr> - <td colspan=2><?php echo(overlib_link($link, $graph, $overlib_content, NULL)); ?></td> + <td colspan="2"><?php echo(overlib_link($link, $graph, $overlib_content, NULL)); ?></td> </tr> <tr> @@ -73,7 +73,7 @@ </tr> <tr class="small"> - <td colspan=2> + <td colspan="2"> <div class="row" style="margin-left: 5px;"> <div class="col-md-4"><i style="font-size: 7px; line-height: 7px; background-color: #FFAA66; border: 1px #aaa solid;"> </i> <strong>Used:</strong> <?php echo(formatStorage($mem_used * 1024).' ('.$used_perc.'%)'); ?></div> @@ -111,7 +111,7 @@ </tr> <tr class="small"> - <td colspan=2> + <td colspan="2"> <div class="row" style="margin-left: 5px;"> <div class="col-md-4"><i style="font-size: 7px; line-height: 7px; background-color: #356AA0; border: 1px #aaa solid;"> </i> <strong>Used:</strong> <?php echo(formatStorage($swap_used * 1024).' ('.$swap_perc.'%)'); ?></div> Index: html/pages/device/routing/ospf.inc.php =================================================================== --- html/pages/device/routing/ospf.inc.php (revision 6579) +++ html/pages/device/routing/ospf.inc.php (working copy) @@ -42,7 +42,7 @@ if ($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = '<span class="green">yes</span>'; } else { $abr = '<span class="grey">no</span>'; } if ($instance['ospfASBdrRtrStatus'] == "true") { $asbr = '<span class="green">yes</span>'; } else { $asbr = '<span class="grey">no</span>'; } - echo('<thead><tr><th class="state-marker"></th></th><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</th><th>Areas</th><th>Ports</th><th>Neighbours</th></tr></thead>'); + echo('<thead><tr><th class="state-marker"></th><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</th><th>Areas</th><th>Ports</th><th>Neighbours</th></tr></thead>'); echo('<tr class="'.$row_class.'">'); echo(' <td class="state-marker"></td>'); echo(' <td class="entity-title">'.$instance['ospfRouterId'] . '</td>'); @@ -134,10 +134,8 @@ $i_n = 1; foreach (dbFetchRows("SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?", array($device['device_id'])) as $nbr) { + $host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id", array($nbr['ospfNbrRtrId'])); - $host = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? - AND I.port_id = A.port_id AND D.device_id = I.device_id", array($nbr['ospfNbrRtrId'])); - if (is_array($host)) { $rtr_id = generate_device_link($host); } else { $rtr_id = "unknown"; } echo('<tr class="' . $port_row_class . '">'); @@ -162,16 +160,11 @@ echo('</tr>'); $i_n++; - } echo('</table>'); - echo('</td>'); - echo('</tr>'); $i_i++; } // End loop instances -echo('</table>'); - // EOF Index: html/pages/edituser.inc.php =================================================================== --- html/pages/edituser.inc.php (revision 6579) +++ html/pages/edituser.inc.php (working copy) @@ -214,7 +214,7 @@ $del_url = generate_url(array('page'=>'edituser', 'action'=>'perm_del', 'user_id'=>$vars['user_id'], 'entity_type'=>'device', 'entity_id'=>$device_id)); echo ' <div class="btn-group" style="margin-bottom: 5px;">'; - echo ' <button class="btn btn-danger" style="color: #fff;" onclick="location.href=\''.$del_url.'\';"><i class="icon-minus-sign icon-white"></i> Delete</button>'; + echo ' <button class="btn btn-danger" onclick="location.href=\''.$del_url.'\';"><i class="icon-minus-sign icon-white"></i> Delete</button>'; echo ' '.$devicebtn; echo ' </div><br />'; Index: html/pages/graphs.inc.php =================================================================== --- html/pages/graphs.inc.php (revision 6579) +++ html/pages/graphs.inc.php (working copy) @@ -158,7 +158,7 @@ 'twoyear' => 'Two Years' ); - echo('<table width=100% style="background: transparent;"><tr>'); + echo('<table style="width: 100%; background: transparent;"><tr>'); foreach ($thumb_array as $period => $text) { Index: html/pages/group.inc.php =================================================================== --- html/pages/group.inc.php (revision 6579) +++ html/pages/group.inc.php (working copy) @@ -539,7 +539,7 @@ <fieldset> <div class="control-group"> <label class="control-label" for="confirm"> - <h4>Confirm</h4> + Confirm </label> <div class="controls"> <label class="checkbox"> @@ -636,7 +636,7 @@ <div class="control-group"> <label class="control-label" for="group_descr">Description</label> <div class="controls"> - <textarea class="form-control col-md-12" name="group_descr" rows="3" placeholder="group message."/><?php echo(escape_html($group['group_descr'])); ?></textarea> + <textarea class="form-control col-md-12" name="group_descr" rows="3" placeholder="group message."><?php echo(escape_html($group['group_descr'])); ?></textarea> </div> </div> Index: html/pages/group_add.inc.php =================================================================== --- html/pages/group_add.inc.php (revision 6579) +++ html/pages/group_add.inc.php (working copy) @@ -83,9 +83,9 @@ ?> -<form name="add_group" method="post" action="" class="form-horizontal"> +<form name="add_group" method="post" action="<?php echo(generate_url(array('page' => 'group_add'))); ?>" class="form-horizontal"> -<legend>New Group</legend> +<h2>New Group</h2> <div class="row"> <div class="col-md-6"> @@ -105,10 +105,10 @@ { // ignore this type if it's a meta-entity echo '<option value="'.$entity_type.'" '; if (!isset($entity_type_array['icon'])) { $entity_type_array['icon'] = $config['entity_default']['icon']; } - echo($vars['entity_type'] == $entity_type || ($vars['entity_type'] == '') ? 'selected' : ''); + // echo($vars['entity_type'] == $entity_type || ($vars['entity_type'] == '') ? 'selected' : ''); echo ' data-icon="'.$entity_type_array['icon'].'"> '.nicecase($entity_type).'</option>'; - } } + } ?> </select> </div> Index: html/pages/iftype.inc.php =================================================================== --- html/pages/iftype.inc.php (revision 6579) +++ html/pages/iftype.inc.php (working copy) @@ -93,15 +93,11 @@ echo("</td></tr>"); } - + echo("</table>"); } else { - echo("None found.</td></tr>"); + print_warning('None found.'); } -?> -</table> -<?php - // EOF Index: html/pages/logon.inc.php =================================================================== --- html/pages/logon.inc.php (revision 6579) +++ html/pages/logon.inc.php (working copy) @@ -20,7 +20,7 @@ <div class="col-md-3"> </div> <div class="col-md-9"> - <form action="" method="post" name="logonform" class="form-horizontal"> + <form action="#" method="post" name="logonform" class="form-horizontal"> <fieldset> <div class="control-group"> <div class="controls">