mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Status Graph: Auto-load first interface found.
This commit is contained in:
@@ -8,6 +8,14 @@ $text['title-traffic_graph']['pt-br'] = "Gráfico de tráfego";
|
|||||||
$text['title-traffic_graph']['pl'] = "Wykres przesyłu danych";
|
$text['title-traffic_graph']['pl'] = "Wykres przesyłu danych";
|
||||||
$text['title-traffic_graph']['sv-se'] = "Trafik Graf";
|
$text['title-traffic_graph']['sv-se'] = "Trafik Graf";
|
||||||
|
|
||||||
|
$text['message-no_interfaces_found']['en-us'] = "No interfaces found.";
|
||||||
|
$text['message-no_interfaces_found']['es-cl'] = "Sin interfaces encontrados.";
|
||||||
|
$text['message-no_interfaces_found']['pt-pt'] = "Sem interfaces encontrados.";
|
||||||
|
$text['message-no_interfaces_found']['fr-fr'] = "Aucune interface trouvé.";
|
||||||
|
$text['message-no_interfaces_found']['pt-br'] = "Sem interfaces encontrados.";
|
||||||
|
$text['message-no_interfaces_found']['pl'] = "Nie znaleziono interfejsy.";
|
||||||
|
$text['message-no_interfaces_found']['sv-se'] = "Inga gränssnitt hittades.";
|
||||||
|
|
||||||
$text['label-interface']['en-us'] = "Interface";
|
$text['label-interface']['en-us'] = "Interface";
|
||||||
$text['label-interface']['es-cl'] = "Interfaz";
|
$text['label-interface']['es-cl'] = "Interfaz";
|
||||||
$text['label-interface']['pt-pt'] = "Interface";
|
$text['label-interface']['pt-pt'] = "Interface";
|
||||||
|
|||||||
@@ -71,71 +71,68 @@ require_once "resources/header.php";
|
|||||||
$document['title'] = $text['title-traffic_graph'];
|
$document['title'] = $text['title-traffic_graph'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
|
<table cellpadding='0' cellspacing='0' border='0' align='right'>
|
||||||
<tr>
|
<tr>
|
||||||
<td align='left' valign='top'>
|
<td>
|
||||||
<p class="pgtitle"><b><?php echo $text['header-traffic_graph']?></b></p>
|
<?php
|
||||||
</td>
|
// run netstat to determine interface info
|
||||||
<td align='right' valign='top'>
|
exec("netstat -i", $result_array);
|
||||||
<form name="form1" action="status_graph.php" method="get" style="">
|
//parse the data into a named array
|
||||||
<?php echo $text['label-interface']?>:
|
$x = 0;
|
||||||
<select name="interface" class="formfld" style="width:100px; z-index: -10;" onchange="document.form1.submit()">
|
foreach ($result_array as $key => $value) {
|
||||||
<option value=''></option>
|
if ($value != "Kernel Interface table") {
|
||||||
<?php
|
if ($x != 0) {
|
||||||
// run netstat to determine interface info
|
//get the values
|
||||||
exec("netstat -i", $result_array);
|
$interface_info = preg_split("/\s+/", $result_array[$key]);
|
||||||
//exec("netstat -i -nWb -f link", $result_array);
|
//list all the interfaces
|
||||||
|
$options[] = "<option value='".$interface_info[0]."' ".(($interface == $interface_info[0]) ? "selected='selected'" : null).">".htmlspecialchars($interface_info[0])."</option>";
|
||||||
//show the result array
|
//auto-select first interface
|
||||||
//echo "<pre>\n";
|
if ($interface == '') { $interface = $interface_info[0]; }
|
||||||
//print_r($result_array);
|
}
|
||||||
//echo "</pre>\n";
|
$x++;
|
||||||
|
|
||||||
//parse the data into a named array
|
|
||||||
$x = 0;
|
|
||||||
foreach ($result_array as $key => $value) {
|
|
||||||
if ($value != "Kernel Interface table") {
|
|
||||||
if ($x == 0) {
|
|
||||||
//get the names of the values
|
|
||||||
$interface_name_info = preg_split("/\s+/", $result_array[1]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//get the values
|
|
||||||
$interface_value_info = preg_split("/\s+/", $result_array[$key]);
|
|
||||||
//list all the interfaces
|
|
||||||
if ($interface == $interface_value_info[0]) {
|
|
||||||
echo "<option value='".$interface_value_info[0]."' selected='selected'>".$interface_value_info[0]."</option>";
|
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
echo "<option value='".$interface_value_info[0]."'>".htmlspecialchars($interface_value_info[0])."</option>";
|
//output form, if interfaces exist'
|
||||||
}
|
if (sizeof($options)) {
|
||||||
}
|
?>
|
||||||
$x++;
|
<form name="form1" action="status_graph.php" method="get" style="">
|
||||||
}
|
<strong><?php echo $text['label-interface']?></strong>
|
||||||
}
|
<select name="interface" class="formfld" style="width: 100px; z-index: -10;" onchange="document.form1.submit()">
|
||||||
?>
|
<?php echo implode("\n", $options); ?>
|
||||||
</select>
|
</select>
|
||||||
<input type='hidden' name='width' value='<?php echo $width; ?>'>
|
<input type='hidden' name='width' value='<?php echo $width; ?>'>
|
||||||
<input type='hidden' name='height' value='<?php echo $height; ?>'>
|
<input type='hidden' name='height' value='<?php echo $height; ?>'>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
<?php
|
||||||
</tr>
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<b><?php echo $text['header-traffic_graph']?></b>
|
||||||
|
<br><br>
|
||||||
<?php echo $text['description-traffic_graph']?>
|
<?php echo $text['description-traffic_graph']?>
|
||||||
|
<br><br>
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<object data="svg_graph.php?interface=<?php echo $interface; ?>" type="image/svg+xml" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
|
<br><br>
|
||||||
<param name="src" value="svg_graph.php?interface=<?php echo $interface; ?>" />
|
<?php
|
||||||
<?php echo $text['description-no_svg']?>
|
if (sizeof($options) > 0) {
|
||||||
</object>
|
?>
|
||||||
|
<object data="svg_graph.php?interface=<?php echo $interface; ?>" type="image/svg+xml" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
|
||||||
|
<param name="src" value="svg_graph.php?interface=<?php echo $interface; ?>" />
|
||||||
|
<?php echo $text['description-no_svg']?>
|
||||||
|
</object>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<br><br><br><br><br>";
|
||||||
|
echo $text['message-no_interfaces_found'];
|
||||||
|
echo "<br><br><br><br><br>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<br><br>
|
<br><br><br>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|||||||
Reference in New Issue
Block a user