mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 00:24:21 +02:00
Apply "Squiz" code style on old (pre-2014) files
This commit is contained in:
@@ -2,90 +2,103 @@
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo("<span style='font-weight: bold;'>Serverfarm Rservers</span> » ");
|
||||
echo "<span style='font-weight: bold;'>Serverfarm Rservers</span> » ";
|
||||
|
||||
#$auth = TRUE;
|
||||
// $auth = TRUE;
|
||||
$menu_options = array('basic' => 'Basic');
|
||||
|
||||
$menu_options = array('basic' => 'Basic',
|
||||
);
|
||||
if (!$_GET['opta']) {
|
||||
$_GET['opta'] = 'basic';
|
||||
}
|
||||
|
||||
if (!$_GET['opta']) { $_GET['opta'] = "basic"; }
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
if ($_GET['optd'] == $option) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
$sep = "";
|
||||
foreach ($menu_options as $option => $text)
|
||||
{
|
||||
if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/type=loadbalancer_rservers/' . $option . '/">' . $text
|
||||
. '</a>');
|
||||
if ($_GET['optd'] == $option) { echo("</span>"); }
|
||||
echo(" | ");
|
||||
echo '<a href="device/device='.$device['device_id'].'/tab=routing/type=loadbalancer_rservers/'.$option.'/">'.$text .'</a>';
|
||||
if ($_GET['optd'] == $option) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo ' | ';
|
||||
}
|
||||
|
||||
unset($sep);
|
||||
|
||||
echo(' Graphs: ');
|
||||
echo ' Graphs: ';
|
||||
|
||||
#$graph_types = array("bits" => "Bits",
|
||||
# "pkts" => "Packets",
|
||||
# "errors" => "Errors");
|
||||
// $graph_types = array("bits" => "Bits",
|
||||
// "pkts" => "Packets",
|
||||
// "errors" => "Errors");
|
||||
$graph_types = array(
|
||||
'curr' => 'CurrentConns',
|
||||
'failed' => 'FailedConns',
|
||||
'total' => 'TotalConns',
|
||||
);
|
||||
|
||||
$graph_types = array("curr" => "CurrentConns",
|
||||
"failed" => "FailedConns",
|
||||
"total" => "TotalConns");
|
||||
foreach ($graph_types as $type => $descr) {
|
||||
echo "$type_sep";
|
||||
if ($_GET['opte'] == $type) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
foreach ($graph_types as $type => $descr)
|
||||
{
|
||||
echo("$type_sep");
|
||||
if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="device/device=' . $device['device_id'] . '/tab=routing/type=loadbalancer_rservers/graphs/'.$type.'/">'.$descr.'</a>');
|
||||
if ($_GET['opte'] == $type) { echo("</span>"); }
|
||||
echo '<a href="device/device='.$device['device_id'].'/tab=routing/type=loadbalancer_rservers/graphs/'.$type.'/">'.$descr.'</a>';
|
||||
if ($_GET['opte'] == $type) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
$type_sep = " | ";
|
||||
$type_sep = ' | ';
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>");
|
||||
$i = "0";
|
||||
foreach (dbFetchRows("SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ? ORDER BY `farm_id`", array($device['device_id'])) as $rserver)
|
||||
{
|
||||
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>";
|
||||
$i = '0';
|
||||
foreach (dbFetchRows('SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ? ORDER BY `farm_id`', array($device['device_id'])) as $rserver) {
|
||||
if (is_integer($i / 2)) {
|
||||
$bg_colour = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$bg_colour = $list_colour_b;
|
||||
}
|
||||
|
||||
if($rserver['StateDescr'] == "Server is now operational") { $rserver_class="green"; } else { $rserver_class="red"; }
|
||||
if ($rserver['StateDescr'] == 'Server is now operational') {
|
||||
$rserver_class = 'green';
|
||||
} else {
|
||||
$rserver_class = 'red';
|
||||
}
|
||||
|
||||
echo("<tr bgcolor='$bg_colour'>");
|
||||
#echo("<td width=320 class=list-large>" . $tunnel['local_addr'] . " » " . $tunnel['peer_addr'] . "</a></td>");
|
||||
echo("<td width=700 class=list-small>" . $rserver['farm_id'] . "</a></td>");
|
||||
#echo("<td width=150 class=box-desc>" . $rserver['farm_id'] . "</td>");
|
||||
echo("<td width=230 class=list-small><span class='".$rserver_class."'>" . $rserver['StateDescr'] . "</span></td>");
|
||||
echo("</tr>");
|
||||
if ($_GET['optd'] == "graphs")
|
||||
{
|
||||
echo('<tr class="list-bold">');
|
||||
echo("<td colspan = 3>");
|
||||
$graph_type = "rserver_" . $_GET['opte'];
|
||||
echo "<tr bgcolor='$bg_colour'>";
|
||||
// echo("<td width=320 class=list-large>" . $tunnel['local_addr'] . " » " . $tunnel['peer_addr'] . "</a></td>");
|
||||
echo '<td width=700 class=list-small>'.$rserver['farm_id'].'</a></td>';
|
||||
// echo("<td width=150 class=box-desc>" . $rserver['farm_id'] . "</td>");
|
||||
echo "<td width=230 class=list-small><span class='".$rserver_class."'>".$rserver['StateDescr'].'</span></td>';
|
||||
echo '</tr>';
|
||||
if ($_GET['optd'] == 'graphs') {
|
||||
echo '<tr class="list-bold">';
|
||||
echo '<td colspan = 3>';
|
||||
$graph_type = 'rserver_'.$_GET['opte'];
|
||||
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $rserver['rserver_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $rserver['rserver_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-graphrow.inc.php");
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
#include("includes/print-interface-graphs.inc.php");
|
||||
|
||||
echo("
|
||||
// include("includes/print-interface-graphs.inc.php");
|
||||
echo '
|
||||
</td>
|
||||
</tr>");
|
||||
}
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo("</td>");
|
||||
echo("</tr>");
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("</table></div>");
|
||||
|
||||
?>
|
||||
echo '</table></div>';
|
||||
|
||||
@@ -1,141 +1,164 @@
|
||||
<?php
|
||||
|
||||
if(is_numeric($vars['vsvr']))
|
||||
{
|
||||
if (is_numeric($vars['vsvr'])) {
|
||||
// print_optionbar_start();
|
||||
// echo("<span style='font-weight: bold;'>VServer</span> » ");
|
||||
// echo('<a href="'.generate_url($vars, array('vsvr' => NULL)).'">All</a>');
|
||||
// print_optionbar_end();
|
||||
$graph_types = array(
|
||||
'bits' => 'Bits',
|
||||
'pkts' => 'Packets',
|
||||
'conns' => 'Connections',
|
||||
'reqs' => 'Requests',
|
||||
'hitmiss' => 'Hit/Miss',
|
||||
);
|
||||
|
||||
#print_optionbar_start();
|
||||
#echo("<span style='font-weight: bold;'>VServer</span> » ");
|
||||
#echo('<a href="'.generate_url($vars, array('vsvr' => NULL)).'">All</a>');
|
||||
#print_optionbar_end();
|
||||
$i = 0;
|
||||
|
||||
$graph_types = array("bits" => "Bits",
|
||||
"pkts" => "Packets",
|
||||
"conns" => "Connections",
|
||||
"reqs" => "Requests",
|
||||
"hitmiss" => "Hit/Miss");
|
||||
echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>";
|
||||
foreach (dbFetchRows('SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? AND `vsvr_id` = ? ORDER BY `vsvr_name`', array($device['device_id'], $vars['vsvr'])) as $vsvr) {
|
||||
if (is_integer($i / 2)) {
|
||||
$bg_colour = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$bg_colour = $list_colour_b;
|
||||
}
|
||||
|
||||
$i=0;
|
||||
if ($vsvr['vsvr_state'] == 'up') {
|
||||
$vsvr_class = 'green';
|
||||
}
|
||||
else {
|
||||
$vsvr_class = 'red';
|
||||
}
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? AND `vsvr_id` = ? ORDER BY `vsvr_name`", array($device['device_id'], $vars['vsvr'])) as $vsvr)
|
||||
{
|
||||
echo "<tr bgcolor='$bg_colour'>";
|
||||
echo '<td width=320 class=list-large><a href="'.generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => null, 'graph' => null)).'">'.$vsvr['vsvr_name'].'</a></td>';
|
||||
echo '<td width=320 class=list-small>'.$vsvr['vsvr_ip'].':'.$vsvr['vsvr_port'].'</a></td>';
|
||||
echo "<td width=100 class=list-small><span class='".$vsvr_class."'>".$vsvr['vsvr_state'].'</span></td>';
|
||||
echo ('<td width=320 class=list-small>'.format_si(($vsvr['vsvr_bps_in'] * 8)).'bps</a></td>');
|
||||
echo ('<td width=320 class=list-small>'.format_si(($vsvr['vsvr_bps_out'] * 8)).'bps</a></td>');
|
||||
echo '</tr>';
|
||||
|
||||
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
foreach ($graph_types as $graph_type => $graph_text) {
|
||||
$i++;
|
||||
echo '<tr class="list-bold" bgcolor="'.$bg_colour.'">';
|
||||
echo '<td colspan="5">';
|
||||
$graph_type = 'netscalervsvr_'.$graph_type;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '213';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $vsvr['vsvr_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
if ($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; }
|
||||
echo '<h3>'.$graph_text.'</h3>';
|
||||
|
||||
echo("<tr bgcolor='$bg_colour'>");
|
||||
echo('<td width=320 class=list-large><a href="'.generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => NULL, 'graph' => NULL)).'">' . $vsvr['vsvr_name'] . '</a></td>');
|
||||
echo("<td width=320 class=list-small>" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "</a></td>");
|
||||
echo("<td width=100 class=list-small><span class='".$vsvr_class."'>" . $vsvr['vsvr_state'] . "</span></td>");
|
||||
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_in']*8) . "bps</a></td>");
|
||||
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_out']*8) . "bps</a></td>");
|
||||
echo("</tr>");
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
foreach ($graph_types as $graph_type => $graph_text)
|
||||
{
|
||||
$i++;
|
||||
echo('<tr class="list-bold" bgcolor="'.$bg_colour.'">');
|
||||
echo('<td colspan="5">');
|
||||
$graph_type = "netscalervsvr_" . $graph_type;
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "213";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $vsvr['vsvr_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo('<h3>'.$graph_text.'</h3>');
|
||||
|
||||
include("includes/print-graphrow.inc.php");
|
||||
|
||||
echo("
|
||||
echo '
|
||||
</td>
|
||||
</tr>");
|
||||
}
|
||||
</tr>';
|
||||
}
|
||||
}//end foreach
|
||||
|
||||
echo '</table></div>';
|
||||
}
|
||||
else {
|
||||
print_optionbar_start();
|
||||
|
||||
echo("</table></div>");
|
||||
echo "<span style='font-weight: bold;'>VServers</span> » ";
|
||||
|
||||
} else {
|
||||
$menu_options = array('basic' => 'Basic');
|
||||
|
||||
print_optionbar_start();
|
||||
if (!$vars['view']) {
|
||||
$vars['view'] = 'basic';
|
||||
}
|
||||
|
||||
echo("<span style='font-weight: bold;'>VServers</span> » ");
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
if ($vars['view'] == $option) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
$menu_options = array('basic' => 'Basic',
|
||||
);
|
||||
echo '<a href="'.generate_url($vars, array('view' => 'basic', 'graph' => null)).'">'.$text.'</a>';
|
||||
if ($vars['view'] == $option) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
if (!$vars['view']) { $vars['view'] = "basic"; }
|
||||
echo ' | ';
|
||||
}
|
||||
|
||||
$sep = "";
|
||||
foreach ($menu_options as $option => $text)
|
||||
{
|
||||
if ($vars['view'] == $option) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="'.generate_url($vars, array('view' => 'basic', 'graph' => NULL)).'">'.$text.'</a>');
|
||||
if ($vars['view'] == $option) { echo("</span>"); }
|
||||
echo(" | ");
|
||||
}
|
||||
unset($sep);
|
||||
echo ' Graphs: ';
|
||||
$graph_types = array(
|
||||
'bits' => 'Bits',
|
||||
'pkts' => 'Packets',
|
||||
'conns' => 'Connections',
|
||||
'reqs' => 'Requests',
|
||||
'hitmiss' => 'Hit/Miss',
|
||||
);
|
||||
|
||||
unset($sep);
|
||||
echo(' Graphs: ');
|
||||
$graph_types = array("bits" => "Bits",
|
||||
"pkts" => "Packets",
|
||||
"conns" => "Connections",
|
||||
"reqs" => "Requests",
|
||||
"hitmiss" => "Hit/Miss");
|
||||
foreach ($graph_types as $type => $descr) {
|
||||
echo "$type_sep";
|
||||
if ($vars['graph'] == $type) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
foreach ($graph_types as $type => $descr)
|
||||
{
|
||||
echo("$type_sep");
|
||||
if ($vars['graph'] == $type) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="'.generate_url($vars, array('view' => 'graphs', 'graph' => $type)).'">'.$descr.'</a>');
|
||||
if ($vars['graph'] == $type) { echo("</span>"); }
|
||||
$type_sep = " | ";
|
||||
}
|
||||
echo '<a href="'.generate_url($vars, array('view' => 'graphs', 'graph' => $type)).'">'.$descr.'</a>';
|
||||
if ($vars['graph'] == $type) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
$type_sep = ' | ';
|
||||
}
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "0";
|
||||
foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? ORDER BY `vsvr_name`", array($device['device_id'])) as $vsvr)
|
||||
{
|
||||
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
print_optionbar_end();
|
||||
|
||||
if ($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; }
|
||||
echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>";
|
||||
$i = '0';
|
||||
foreach (dbFetchRows('SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? ORDER BY `vsvr_name`', array($device['device_id'])) as $vsvr) {
|
||||
if (is_integer($i / 2)) {
|
||||
$bg_colour = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$bg_colour = $list_colour_b;
|
||||
}
|
||||
|
||||
echo("<tr bgcolor='$bg_colour'>");
|
||||
echo('<td width=320 class=list-large><a href="'.generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => NULL, 'graph' => NULL)).'">' . $vsvr['vsvr_name'] . '</a></td>');
|
||||
echo("<td width=320 class=list-small>" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "</a></td>");
|
||||
echo("<td width=100 class=list-small><span class='".$vsvr_class."'>" . $vsvr['vsvr_state'] . "</span></td>");
|
||||
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_in']*8) . "bps</a></td>");
|
||||
echo("<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_out']*8) . "bps</a></td>");
|
||||
echo("</tr>");
|
||||
if ($vars['view'] == "graphs")
|
||||
{
|
||||
echo('<tr class="list-bold" bgcolor="'.$bg_colour.'">');
|
||||
echo('<td colspan="5">');
|
||||
$graph_type = "netscalervsvr_" . $vars['graph'];
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "213";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $vsvr['vsvr_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
if ($vsvr['vsvr_state'] == 'up') {
|
||||
$vsvr_class = 'green';
|
||||
}
|
||||
else {
|
||||
$vsvr_class = 'red';
|
||||
}
|
||||
|
||||
include("includes/print-graphrow.inc.php");
|
||||
echo "<tr bgcolor='$bg_colour'>";
|
||||
echo '<td width=320 class=list-large><a href="'.generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => null, 'graph' => null)).'">'.$vsvr['vsvr_name'].'</a></td>';
|
||||
echo '<td width=320 class=list-small>'.$vsvr['vsvr_ip'].':'.$vsvr['vsvr_port'].'</a></td>';
|
||||
echo "<td width=100 class=list-small><span class='".$vsvr_class."'>".$vsvr['vsvr_state'].'</span></td>';
|
||||
echo ('<td width=320 class=list-small>'.format_si(($vsvr['vsvr_bps_in'] * 8)).'bps</a></td>');
|
||||
echo ('<td width=320 class=list-small>'.format_si(($vsvr['vsvr_bps_out'] * 8)).'bps</a></td>');
|
||||
echo '</tr>';
|
||||
if ($vars['view'] == 'graphs') {
|
||||
echo '<tr class="list-bold" bgcolor="'.$bg_colour.'">';
|
||||
echo '<td colspan="5">';
|
||||
$graph_type = 'netscalervsvr_'.$vars['graph'];
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '213';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $vsvr['vsvr_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo("
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>");
|
||||
}
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo("</td>");
|
||||
echo("</tr>");
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}//end foreach
|
||||
|
||||
echo("</table></div>");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
echo '</table></div>';
|
||||
}//end if
|
||||
|
||||
Reference in New Issue
Block a user