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:
@@ -1,4 +1,4 @@
|
||||
<?php // vim:fenc=utf-8:filetype=php:ts=4
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2099 Bruno Prémont <bonbons AT linux-vserver.org>
|
||||
*
|
||||
@@ -16,97 +16,115 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02150-1301, USA.
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL | E_NOTICE | E_WARNING);
|
||||
error_reporting((E_ALL | E_NOTICE | E_WARNING));
|
||||
|
||||
require('includes/collectd/config.php');
|
||||
require('includes/collectd/functions.php');
|
||||
require('includes/collectd/definitions.php');
|
||||
|
||||
#require('config.php');
|
||||
#require('functions.php');
|
||||
#require('definitions.php');
|
||||
require 'includes/collectd/config.php';
|
||||
require 'includes/collectd/functions.php';
|
||||
require 'includes/collectd/definitions.php';
|
||||
|
||||
load_graph_definitions();
|
||||
|
||||
|
||||
/**
|
||||
* Send back new list content
|
||||
* @items Array of options values to return to browser
|
||||
* @method Name of Javascript method that will be called to process data
|
||||
*/
|
||||
function dhtml_response_list(&$items, $method) {
|
||||
header("Content-Type: text/xml");
|
||||
function dhtml_response_list(&$items, $method)
|
||||
{
|
||||
header('Content-Type: text/xml');
|
||||
|
||||
print ('<?xml version="1.0" encoding="utf-8" ?>'."\n");
|
||||
print ("<response>\n");
|
||||
printf(" <method>%s</method>\n", htmlspecialchars($method));
|
||||
print (" <result>\n");
|
||||
foreach ($items as &$item) {
|
||||
printf(' <option>%s</option>'."\n", htmlspecialchars($item));
|
||||
}
|
||||
|
||||
print (" </result>\n");
|
||||
print ('</response>');
|
||||
|
||||
}//end dhtml_response_list()
|
||||
|
||||
print('<?xml version="1.0" encoding="utf-8" ?>'."\n");
|
||||
print("<response>\n");
|
||||
printf(" <method>%s</method>\n", htmlspecialchars($method));
|
||||
print(" <result>\n");
|
||||
foreach ($items as &$item)
|
||||
printf(' <option>%s</option>'."\n", htmlspecialchars($item));
|
||||
print(" </result>\n");
|
||||
print("</response>");
|
||||
}
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
$link_array = array('page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'collectd');
|
||||
$link_array = array(
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'collectd',
|
||||
);
|
||||
|
||||
$plugins = collectd_list_plugins($device['hostname']);
|
||||
unset($sep);
|
||||
foreach ($plugins as &$plugin) {
|
||||
if (!$vars['plugin']) { $vars['plugin'] = $plugin; }
|
||||
echo($sep);
|
||||
if ($vars['plugin'] == $plugin) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo(generate_link(htmlspecialchars($plugin),$link_array,array('plugin'=>$plugin)));
|
||||
if ($vars['plugin'] == $plugin) { echo("</span>"); }
|
||||
$sep = ' | ';
|
||||
$plugins = collectd_list_plugins($device['hostname']);
|
||||
unset($sep);
|
||||
foreach ($plugins as &$plugin) {
|
||||
if (!$vars['plugin']) {
|
||||
$vars['plugin'] = $plugin;
|
||||
}
|
||||
unset ($sep);
|
||||
|
||||
echo $sep;
|
||||
if ($vars['plugin'] == $plugin) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link(htmlspecialchars($plugin), $link_array, array('plugin' => $plugin));
|
||||
if ($vars['plugin'] == $plugin) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
$sep = ' | ';
|
||||
}
|
||||
|
||||
unset($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
$pinsts = collectd_list_pinsts($device['hostname'], $vars['plugin']);
|
||||
foreach ($pinsts as &$instance) {
|
||||
$pinsts = collectd_list_pinsts($device['hostname'], $vars['plugin']);
|
||||
foreach ($pinsts as &$instance) {
|
||||
$types = collectd_list_types($device['hostname'], $vars['plugin'], $instance);
|
||||
foreach ($types as &$type) {
|
||||
$typeinstances = collectd_list_tinsts($device['hostname'], $vars['plugin'], $instance, $type);
|
||||
|
||||
$types = collectd_list_types($device['hostname'], $vars['plugin'], $instance);
|
||||
foreach ($types as &$type) {
|
||||
if ($MetaGraphDefs[$type]) {
|
||||
$typeinstances = array($MetaGraphDefs[$type]);
|
||||
}
|
||||
|
||||
$typeinstances = collectd_list_tinsts($device['hostname'], $vars['plugin'], $instance, $type);
|
||||
foreach ($typeinstances as &$tinst) {
|
||||
$i++;
|
||||
if (!is_integer($i / 2)) {
|
||||
$row_colour = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$row_colour = $list_colour_b;
|
||||
}
|
||||
|
||||
if ($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); }
|
||||
echo '<div style="background-color: '.$row_colour.';">';
|
||||
echo '<div class="graphhead" style="padding:4px 0px 0px 8px;">';
|
||||
if ($tinst) {
|
||||
echo $vars['plugin']." $instance - $type - $tinst";
|
||||
}
|
||||
else {
|
||||
echo $vars['plugin']." $instance - $type";
|
||||
}
|
||||
|
||||
foreach ($typeinstances as &$tinst) {
|
||||
$i++;
|
||||
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
echo '</div>';
|
||||
|
||||
echo('<div style="background-color: '.$row_colour.';">');
|
||||
echo('<div class="graphhead" style="padding:4px 0px 0px 8px;">');
|
||||
if ($tinst) {
|
||||
echo($vars['plugin']." $instance - $type - $tinst");
|
||||
} else {
|
||||
echo($vars['plugin']." $instance - $type");
|
||||
}
|
||||
echo("</div>");
|
||||
$graph_array['type'] = 'device_collectd';
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
|
||||
$graph_array['type'] = "device_collectd";
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['c_plugin'] = $vars['plugin'];
|
||||
$graph_array['c_plugin_instance'] = $instance;
|
||||
$graph_array['c_type'] = $type;
|
||||
$graph_array['c_type_instance'] = $tinst;
|
||||
|
||||
$graph_array['c_plugin'] = $vars['plugin'];
|
||||
$graph_array['c_plugin_instance'] = $instance;
|
||||
$graph_array['c_type'] = $type;
|
||||
$graph_array['c_type_instance'] = $tinst;
|
||||
|
||||
include("includes/print-graphrow.inc.php");
|
||||
|
||||
echo("</div>");
|
||||
|
||||
}
|
||||
}
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pagetitle[] = "CollectD";
|
||||
?>
|
||||
$pagetitle[] = 'CollectD';
|
||||
|
||||
Reference in New Issue
Block a user