Minor fixes, some cleanups, and standardising on echo("x") instead of echo "x"

git-svn-id: http://www.observium.org/svn/observer/trunk@1728 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-11-20 14:04:07 +00:00
parent 0cd548f0f2
commit 30bdd952ee
63 changed files with 199 additions and 283 deletions
+14 -13
View File
@@ -1,6 +1,6 @@
<?php
if($_GET['debug']) {
if ($_GET['debug']) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 0);
@@ -8,21 +8,22 @@ if($_GET['debug']) {
ini_set('error_reporting', E_ALL);
}
include("../includes/defaults.inc.php");
include("../config.php");
include("includes/functions.inc.php");
include("../includes/common.php");
include("../includes/rewrites.php");
include("includes/authenticate.inc.php");
include("../includes/defaults.inc.php");
include("../config.php");
include("includes/functions.inc.php");
include("../includes/common.php");
include("../includes/rewrites.php");
include("includes/authenticate.inc.php");
if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if(is_numeric($_GET['device_id'])){
$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_GET['device_id']."'");
while($interface = mysql_fetch_array($ports)) {
echo "obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n";
if (is_numeric($_GET['device_id']))
{
$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_GET['device_id']."'");
while($interface = mysql_fetch_array($ports))
{
echo("obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n");
}
}
+4 -8
View File
@@ -6,17 +6,13 @@ session_start();
// Preflight checks
if(!is_dir($config['rrd_dir']))
echo "<div class='errorbox'>RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.</div>";
### RRD dir probably shouldn't be writable by apache :>
#if(!$config['rrdcached'] && !is_writable($config['rrd_dir']))
# echo "<div class='errorbox'>RRD Log Directory is not writable ({$config['rrd_dir']}). Graphing may fail.</div>";
echo("<div class='errorbox'>RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.</div>");
if(!is_dir($config['temp_dir']))
echo "<div class='errorbox'>Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.</div>";
echo("<div class='errorbox'>Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.</div>");
if(!is_writable($config['temp_dir']))
echo "<div class='errorbox'>Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.</div>";
echo("<div class='errorbox'>Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.</div>");
if(isset($_GET['logout']) && $_SESSION['authenticated']) {
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('" . $_SESSION['username'] . "', '".$_SERVER["REMOTE_ADDR"]."', 'logged out')");
@@ -50,7 +46,7 @@ if (file_exists('includes/authentication/' . $config['auth_mechanism'] . '.inc.p
}
else
{
echo "<div class='errorbox'>ERROR: no valid auth_mechanism defined</div>";
echo("<div class='errorbox'>ERROR: no valid auth_mechanism defined</div>");
exit();
}
+1 -1
View File
@@ -27,7 +27,7 @@ function authenticate($username,$password)
}
else
{
echo ldap_error($ds);
echo(ldap_error($ds));
}
}
else
+3 -3
View File
@@ -93,7 +93,7 @@ function generate_graph_popup($graph_array)
function print_graph_popup($graph_array)
{
echo (generate_graph_popup($graph_array));
echo(generate_graph_popup($graph_array));
}
@@ -185,7 +185,7 @@ function device_permitted($device_id)
function print_graph_tag ($args)
{
echo generate_graph_tag ($args);
echo(generate_graph_tag ($args));
}
function generate_graph_tag ($args)
@@ -260,7 +260,7 @@ function generate_port_thumbnail($args)
if(!$args['bg']) { $args['bg'] = "FFFFF"; }
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&id=".$args['interface_id']."&from=".$args['from']."&to=".$args['to']."&width=".$args['width']."&height=".$args['height']."&legend=no&bg=".$args['bg']."'>";
$output = generate_port_link($args, $args['content']);
echo $output;
echo($output);
}
function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
+2 -2
View File
@@ -2,7 +2,7 @@
$iftype = fixiftype($interface[ifType]);
echo ("<p class=interface-header>$inf</p>");
echo("<p class=interface-header>$inf</p>");
if($ifalias && $ifalias != "") { echo("<span class=box-desc>$ifalias</span><br />"); }
if($iftype && $iftype != "") { echo("<span class=box-desc>$iftype</span> ");
if($mac && $mac != "") { echo("<span class=box-desc>$mac</span><br />");
@@ -17,6 +17,6 @@
echo("</span>");
}
echo ("<span class=box-desc><b>$status</b></span>");
echo("<span class=box-desc><b>$status</b></span>");
?>
+4 -4
View File
@@ -54,12 +54,12 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
foreach ($config['device_types'] as $devtype)
{
echo ' <li><a href="devices/' . $devtype['type'] . '/"><img src="images/icons/' . $devtype['icon'] . '" border="0" align="absmiddle" /> ' . $devtype['text'] . '</a></li>';
echo(' <li><a href="devices/' . $devtype['type'] . '/"><img src="images/icons/' . $devtype['icon'] . '" border="0" align="absmiddle" /> ' . $devtype['text'] . '</a></li>');
}
?>
<li><hr width="140" /></li>
<li><a href="devices/alerted/"><img src="images/16/server_error.png" border="0" align="absmiddle" /> Alerts (<?php echo $device_alerts ?>)</a></li>
<li><a href="devices/alerted/"><img src="images/16/server_error.png" border="0" align="absmiddle" /> Alerts (<?php echo($device_alerts) ?>)</a></li>
<?php
if ($_SESSION['userlevel'] >= '10') {
echo('
@@ -118,7 +118,7 @@ if ($config['show_locations'])
{
if ($row['location'] != '')
{
echo ' <li><a href="?page=devices&location=' . urlencode($row['location']) . '"><img src="images/16/building.png" border="0" align="absmiddle" /> ' . $row['location'] . ' </a></li>';
echo(' <li><a href="?page=devices&location=' . urlencode($row['location']) . '"><img src="images/16/building.png" border="0" align="absmiddle" /> ' . $row['location'] . ' </a></li>');
}
}
?>
@@ -277,7 +277,7 @@ echo(' <li><hr /></li>
<li><a href="?page=edituser"><img src="images/16/user_edit.png" border="0" align="absmiddle" /> Edit User</a></li>
<li><hr width="140" /></li>');
}
echo ('
echo('
<li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>');
} ?>
</ul>
+18 -18
View File
@@ -48,39 +48,39 @@ if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['b
<table cellpadding="2" cellspacing="0" border="0">
<tr style="background-color: <?php echo $devices[bgcolour]; ?>">
<tr style="background-color: <?php echo($devices[bgcolour]); ?>">
<td width="5"></td>
<td>Devices : </td>
<td><?php echo $devices['count'] ?></td>
<td><?php echo($devices['count']) ?></td>
<td> ( </td>
<td style="text-align: right"><span class="green"> <?php echo $devices['up'] ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo $devices['down'] ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo $devices['ignored'] ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo $devices['disabled'] ?> disabled</span></td>
<td style="text-align: right"><span class="green"> <?php echo($devices['up']) ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo($devices['down']) ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo($devices['ignored']) ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo($devices['disabled']) ?> disabled</span></td>
<td> ) </td>
<td width="5"></td>
</tr>
<tr style="background-color: <?php echo $ports['bgcolour'] ?>">
<tr style="background-color: <?php echo($ports['bgcolour']) ?>">
<td width="5"></td><td>Ports : </td>
<td><?php echo $ports['count'] ?></td>
<td><?php echo($ports['count']) ?></td>
<td> ( </td>
<td style="text-align: right"><span class="green"> <?php echo $ports['up'] ?> up </span></td>
<td style="text-align: right"><span class="red"> <?php echo $ports['down'] ?> down </span></td>
<td style="text-align: right"><span class="black"> <?php echo $ports['ignored'] ?> ignored </span></td>
<td style="text-align: right"><span class="grey"> <?php echo $ports['shutdown'] ?> shutdown</span></td>
<td style="text-align: right"><span class="green"> <?php echo($ports['up']) ?> up </span></td>
<td style="text-align: right"><span class="red"> <?php echo($ports['down']) ?> down </span></td>
<td style="text-align: right"><span class="black"> <?php echo($ports['ignored']) ?> ignored </span></td>
<td style="text-align: right"><span class="grey"> <?php echo($ports['shutdown']) ?> shutdown</span></td>
<td> ) </td>
<td width="5"></td>
</tr>
<?php if ($config['show_services']) { ?>
<tr style="background-color: <?php echo $services['bgcolour'] ?>">
<tr style="background-color: <?php echo($services['bgcolour']) ?>">
<td width="5"></td>
<td>Services : </td>
<td><?php echo $services['count'] ?></td>
<td><?php echo($services['count']) ?></td>
<td> ( </td>
<td style="text-align: right"><span class="green"><?php echo $services['up'] ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo $services['down'] ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo $services['ignored'] ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo $services['disabled'] ?> disabled</span></td>
<td style="text-align: right"><span class="green"><?php echo($services['up']) ?> up</span></td>
<td style="text-align: right"><span class="red"> <?php echo($services['down']) ?> down</span></td>
<td style="text-align: right"><span class="black"> <?php echo($services['ignored']) ?> ignored</span> </td>
<td style="text-align: right"><span class="grey"> <?php echo($services['disabled']) ?> disabled</span></td>
<td> ) </td>
<td width="5"></td>
</tr>
+8 -10
View File
@@ -43,8 +43,6 @@ if(strpos($_SERVER['REQUEST_URI'], "debug")) {
eval("\$config['" . $confitem . "'] = \$confval;");
}
}
} else {
# echo "Please check config.php.default and adjust your settings to reflect the new Multi-Tenancy configuration.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -113,24 +111,24 @@ function popUp(URL) {
$end = utime(); $run = $end - $start;
$gentime = substr($run, 0, 5);
echo '<br /> <br /> <br /> <br /> <div id="footer">' . (isset($config['footer']) ? $config['footer'] : '');
echo '<br />Powered by <a href="http://www.observium.org" target="_blank">Observium ' . $config['version'];
echo('<br /> <br /> <br /> <br /> <div id="footer">' . (isset($config['footer']) ? $config['footer'] : ''));
echo('<br />Powered by <a href="http://www.observium.org" target="_blank">Observium ' . $config['version']);
if (file_exists('.svn/entries'))
{
$svn = File('.svn/entries');
echo '-SVN r' . trim($svn[3]);
echo('-SVN r' . trim($svn[3]));
unset($svn);
}
echo '</a>. Copyright &copy; 2006-'. date("Y"). ' by Adam Armstrong. All rights reserved.';
echo('</a>. Copyright &copy; 2006-'. date("Y"). ' by Adam Armstrong. All rights reserved.');
if ($config['page_gen']) {
echo '<br />Generated in ' . $gentime . ' seconds.';
if ($config['page_gen'])
{
echo('<br />Generated in ' . $gentime . ' seconds.');
}
echo '</div>';
echo('</div>');
?>
</body>
</html>
+2 -2
View File
@@ -164,10 +164,10 @@ else
{
if ($_SESSION['authenticated']) ## FIXME level 10 only?
{
echo '<center>
echo('<center>
<object data="'. $config['base_url'] . '/map.php?format=svg" type="image/svg+xml">
</object>
</center>';
</center>');
}
}
?>
+3 -1
View File
@@ -1,6 +1,8 @@
<meta http-equiv="refresh" content="60">
<?php
# FIXME is this used anywhere??
if($_GET['del']) {
$id = mres($_GET['del']);
$query = "DELETE FROM `alerts` WHERE `id` = '$id'";
@@ -37,7 +39,7 @@ case "0":
}
if(!$argh) {
echo ("
echo("
<tr style=\"background-color: $bg;\">
<td width=10></td>
<td class=syslog width=200>
+1 -2
View File
@@ -7,8 +7,7 @@ if ($_SESSION['userlevel'] < '5')
else
{
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
echo '<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>';
echo('<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>');
$i = "1";
+3 -3
View File
@@ -42,13 +42,13 @@ $bill_data_types = array ('cdr' => 'CDR with 95th', 'quota' => 'Monthly Quota');
$unknown = 1;
foreach ($bill_data_types as $type => $text)
{
echo ' <option value="'.$type.'"';
echo(' <option value="'.$type.'"');
if ($bill_data['bill_type'] == $type)
{
echo 'selected="1"';
echo('selected="1"');
$unknown = 0;
}
echo ' >' . ucfirst($text) . '</option>';
echo(' >' . ucfirst($text) . '</option>');
}
echo("
</select>
+2 -4
View File
@@ -5,10 +5,8 @@ if($_SESSION['userlevel'] < 10) {
exit;
}
if($_POST['id']) {
echo delete_device(mres($_POST['id']));
} elseif ($_GET['id']) {
echo delete_device(mres($_GET['id']));
if($_REQUEST['id']) {
echo(delete_device(mres($_REQUEST['id'])));
}
?>
+4 -4
View File
@@ -71,17 +71,17 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
$unknown = 1;
foreach ($device_types as $type)
{
echo ' <option value="'.$type.'"';
echo(' <option value="'.$type.'"');
if ($device['type'] == $type)
{
echo 'selected="1"';
echo('selected="1"');
$unknown = 0;
}
echo ' >' . ucfirst($type) . '</option>';
echo(' >' . ucfirst($type) . '</option>');
}
if ($unknown)
{
echo ' <option value="other">Other</option>';
echo(' <option value="other">Other</option>');
}
echo("
</select>
+10 -10
View File
@@ -24,23 +24,23 @@ echo("<div style='float: left;'>
$query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` ");
while($device = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td align=right>". $device['ifIndex']."</td>";
echo "<td align=left>".$device['ifDescr'] . "</td>";
echo "<td align=right>". $device['ifAdminStatus']."</td>";
echo("<tr>");
echo("<td align=right>". $device['ifIndex']."</td>");
echo("<td align=left>".$device['ifDescr'] . "</td>");
echo("<td align=right>". $device['ifAdminStatus']."</td>");
# Mark interfaces which are down yet not ignored, or up - yet ignored - as to draw the attention
# to a possible problem.
#
$outofsync = ($device['ignore'] == ($device['ifOperStatus'] == 'down' ? 1 : 0)) ? "" : "class=red";
echo "<td align=right><span ".$outofsync.">". $device['ifOperStatus']."</span></td>";
echo("<td align=right><span ".$outofsync.">". $device['ifOperStatus']."</span></td>");
echo "<td>";
echo "<input type=checkbox name='ignore_".$device['interface_id']."'".($device['ignore'] ? 'checked' : '').">";
echo "<input type=hidden name='oldval_".$device['interface_id']."' value=".($device['ignore'] ? 1 : 0).">";
echo "</td>";
echo "</tr>";
echo("<td>");
echo("<input type=checkbox name='ignore_".$device['interface_id']."'".($device['ignore'] ? 'checked' : '').">");
echo("<input type=hidden name='oldval_".$device['interface_id']."' value=".($device['ignore'] ? 1 : 0).">");
echo("</td>");
echo("</tr>");
}
echo('<tr><td></td><td></td><td></td><td></td><td><input type="submit" value="Save"></td></tr>');
+2 -2
View File
@@ -52,14 +52,14 @@ echo("<div style='clear: both;'>");
print_optionbar_start();
echo ("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/'>Graphs</a> | ");
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/'>Graphs</a> | ");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0))
{
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/interface/".$interface['interface_id']."/adsl/'>ADSL</a> | ");
}
echo ("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/arp/'>ARP Table</a>$pagp");
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/arp/'>ARP Table</a>$pagp");
+1 -2
View File
@@ -29,8 +29,7 @@ if($_SESSION['userlevel'] >= "7") {
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
$geshi->set_overall_style('color: black;');
#$geshi->set_line_style('color: #999999');
echo $geshi->parse_code();
echo($geshi->parse_code());
}
?>
+1 -1
View File
@@ -5,7 +5,7 @@
<tr>
<td><img src="images/login-hamster.png" alt="Login required" /></td>
<td>
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post" name="logonform">
<form action="<?php echo($_SERVER['REQUEST_URI']) ?>" method="post" name="logonform">
<h3>Please log in:</h3>
<div style="height: 0px;"></div>
<table border="0" align="left">