cleanups, small fixes and remove test-*php from the root

git-svn-id: http://www.observium.org/svn/observer/trunk@1998 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-31 10:51:02 +00:00
parent 1c524f0349
commit bb4746d4d0
23 changed files with 108 additions and 243 deletions

View File

@ -2,7 +2,7 @@
function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0)
{
global $twoday; global $day; global $now; global $config;
global $twoday, $day, $now, $config;
if (!$start) { $start = $day; }
if (!$end) { $end = $now; }
@ -56,7 +56,6 @@ function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0
return $device['hostname'];
}
return $link;
}
@ -92,8 +91,8 @@ function generate_graph_popup($graph_array)
$graph_array['from'] = $config['year'];
$content .= generate_graph_tag($graph_array);
$content .= "</div>";
return overlib_link($graph_array['link'], $graph, $content, NULL);
return overlib_link($graph_array['link'], $graph, $content, NULL);
}
function print_graph_popup($graph_array)
@ -101,8 +100,6 @@ function print_graph_popup($graph_array)
echo(generate_graph_popup($graph_array));
}
function permissions_cache($user_id)
{
$permissions = array();
@ -121,12 +118,13 @@ function permissions_cache($user_id)
{
$permissions['bill'][$bill['bill_id']] = 1;
}
return $permissions;
}
function bill_permitted($bill_id)
{
global $_SESSION; global $permissions;
global $_SESSION, $permissions;
if ($_SESSION['userlevel'] >= "5") {
$allowed = TRUE;
@ -141,7 +139,7 @@ function bill_permitted($bill_id)
function port_permitted($interface_id, $device_id = NULL)
{
global $_SESSION; global $permissions;
global $_SESSION, $permissions;
if (!is_numeric($device_id)) { $device_id = get_device_id_by_interface_id($interface_id); }
@ -161,7 +159,7 @@ function port_permitted($interface_id, $device_id = NULL)
function application_permitted($app_id, $device_id = NULL)
{
global $_SESSION; global $permissions;
global $_SESSION, $permissions;
if (is_numeric($app_id))
{
if (!$device_id) { $device_id = device_by_id_cache ($app_id); }
@ -177,12 +175,13 @@ function application_permitted($app_id, $device_id = NULL)
} else {
$allowed = FALSE;
}
return $allowed;
}
function device_permitted($device_id)
{
global $_SESSION; global $permissions;
global $_SESSION, $permissions;
if ($_SESSION['userlevel'] >= "5")
{
@ -212,10 +211,10 @@ function generate_graph_tag ($args)
$url .= $sep.$key."=".$arg;
$sep="&amp;";
}
return "<img src=\"".$url."\" border=0>";
}
function print_percentage_bar ($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background)
{
$output = '
@ -226,12 +225,14 @@ function print_percentage_bar ($width, $height, $percent, $left_text, $left_colo
<div style="vertical-align: middle;height: '.$height.'px;margin-top:-'.($height).'px; color:#'.$right_colour.'; padding-right:4px;text-align:right;"><b>'.$right_text.'</b></div>
</div>
</div>';
return $output;
}
function generate_port_link($args, $text = NULL, $type = NULL)
{
global $twoday; global $now; global $config; global $day; global $month;
global $twoday, $now, $config, $day, $month;
$args = ifNameDescr($args);
if (!$text) { $text = fixIfName($args['label']); }
if ($type) { $args['graph_type'] = $type; }
@ -270,9 +271,9 @@ function generate_port_link($args, $text = NULL, $type = NULL)
function generate_port_thumbnail($args)
{
if (!$args['bg']) { $args['bg'] = "FFFFF"; }
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&amp;id=".$args['interface_id']."&amp;from=".$args['from']."&amp;to=".$args['to']."&amp;width=".$args['width']."&amp;height=".$args['height']."&amp;legend=no&amp;bg=".$args['bg']."'>";
echo generate_port_link($args, $args['content']);
if (!$args['bg']) { $args['bg'] = "FFFFF"; }
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&amp;id=".$args['interface_id']."&amp;from=".$args['from']."&amp;to=".$args['to']."&amp;width=".$args['width']."&amp;height=".$args['height']."&amp;legend=no&amp;bg=".$args['bg']."'>";
echo(generate_port_link($args, $args['content']));
}
function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
@ -289,7 +290,6 @@ function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
<div style='margin: auto; text-align: left; padding: 2px 5px; padding-left: 11px; clear: both; display:block; " . ($height ? 'height:' . $height . 'px;' : '') . "'>");
}
function print_optionbar_end()
{
echo(' </div>