2008-08-04 Esteban Sanchez <estebans@artica.es>
* index.php: Set id_user in config array when login. This fixes errors and notices on login screen. * operation/menu.php: Replaced use of id_user on SESSION array with config. * general/logon_ok.php: Replaced lang_label with lang_string(). Use id_user on config array. Style correction and code cleanup. * godmode/extensions.php: It was showing main functions of extensions instead of godmode ones. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1000 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
af105fa845
commit
00bb3be3f1
|
@ -1,3 +1,17 @@
|
|||
2008-08-04 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* index.php: Set id_user in config array when login. This fixes errors
|
||||
and notices on login screen.
|
||||
|
||||
* operation/menu.php: Replaced use of id_user on SESSION array with
|
||||
config.
|
||||
|
||||
* general/logon_ok.php: Replaced lang_label with lang_string(). Use
|
||||
id_user on config array. Style correction and code cleanup.
|
||||
|
||||
* godmode/extensions.php: It was showing main functions of extensions
|
||||
instead of godmode ones.
|
||||
|
||||
2008-08-04 Esteban Sánchez <estebans@artica.es>
|
||||
|
||||
* extensions/hello.php: Fixed old function name. Activate the
|
||||
|
|
|
@ -21,9 +21,9 @@ require ("include/functions_reporting.php");
|
|||
|
||||
echo "<div class='jus'>";
|
||||
$nick = $_SESSION['id_usuario'];
|
||||
echo "<h1>" . $lang_label["welcome_title"] . "</h1>";
|
||||
echo "<h1>" . lang_string ("welcome_title") . "</h1>";
|
||||
echo "<p>";
|
||||
echo $lang_label["main_text"];
|
||||
echo lang_string ("main_text");
|
||||
echo "</p>";
|
||||
|
||||
// Private messages pending to read !
|
||||
|
@ -31,10 +31,10 @@ echo "</p>";
|
|||
$sql=sprintf("SELECT COUNT(id_mensaje) AS count FROM tmensajes WHERE id_usuario_destino='%s' AND estado='FALSE';",$nick);
|
||||
$resultado = get_db_sql ($sql);
|
||||
if ($resultado != 0){
|
||||
echo "<h2>". $lang_label["new_message_bra"] . '
|
||||
echo "<h2>". lang_string ("new_message_bra") . '
|
||||
<a href="index.php?sec=messages&sec2=operation/messages/message">'
|
||||
.$row["count"] . ' <img src="images/email.png" border="0">'
|
||||
.$lang_label["new_message_ket"] . '</a></h2>';
|
||||
.lang_string ("new_message_ket") . '</a></h2>';
|
||||
}
|
||||
|
||||
echo "<table width=95%>";
|
||||
|
@ -42,14 +42,14 @@ echo "<tr><td valign='top'>";
|
|||
|
||||
// Site news !
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo '<h2>' . $lang_label["site_news"] . '</h2>';
|
||||
echo '<h2>' . lang_string ("site_news") . '</h2>';
|
||||
$sql_news = "SELECT subject,timestamp,text,author FROM tnews ORDER by timestamp DESC LIMIT 3";
|
||||
if ($result_news = mysql_query ($sql_news)){
|
||||
echo '<table cellpadding="4" cellspacing="4" width="270" class="databox">';
|
||||
while ($row = mysql_fetch_array ($result_news)) {
|
||||
echo '<tr>';
|
||||
echo "<th><b>".$row["subject"]."</b>";
|
||||
echo "<tr><td>".$lang_label["by"]." <b>".$row["author"]. "</b> ".$lang_label["at"]." <i>".$row["timestamp"]."</i>";
|
||||
echo "<tr><td>".lang_string ("by")." <b>".$row["author"]. "</b> ".lang_string ("at")." <i>".$row["timestamp"]."</i>";
|
||||
echo '<tr><td class=datos>';
|
||||
echo clean_output_breaks($row["text"]);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ echo "<td align='center'>";
|
|||
// Site stats
|
||||
// Summary
|
||||
// ~~~~~~~~~~~~~~~
|
||||
$data = general_stats($id_user,0);
|
||||
$data = general_stats ($config['id_user'],0);
|
||||
$monitor_checks = $data[0];
|
||||
$monitor_ok = $data[1];
|
||||
$monitor_bad = $data[2];
|
||||
|
@ -87,13 +87,13 @@ if ( $total_fired_alerts > 0) {
|
|||
}
|
||||
|
||||
if ($monitor_checks > 0){
|
||||
$monitor_health = format_numeric ( 100- (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)) , 1);
|
||||
$monitor_health = format_numeric (100 - (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)), 1);
|
||||
} else {
|
||||
$monitor_health = 100;
|
||||
}
|
||||
|
||||
if ($data_checks > 0) {
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
$data_health = format_numeric ((($data_checks - ($data_unknown + $data_alert)) / $data_checks ) * 100, 1);
|
||||
} else {
|
||||
$data_health = 100;
|
||||
}
|
||||
|
@ -108,23 +108,21 @@ if ($global_health < 0)
|
|||
$global_health;
|
||||
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
//echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
|
||||
//echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Monitor health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$monitor_health' title='$monitor_health % ".lang_string("of monitors UP")."'>";
|
||||
echo "<tr><td colspan='2'>".lang_string ("Monitor health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$monitor_health' title='$monitor_health % ".lang_string ("of monitors UP")."'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Data health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$data_health' title='$data_health % ".lang_string("of modules with updated data")."'>";
|
||||
echo "<tr><td colspan='2'>".lang_string ("Data health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$data_health' title='$data_health % ".lang_string ("of modules with updated data")."'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Global health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$global_health' title='$global_health % ".lang_string("of modules with good data")."'>";
|
||||
echo "<tr><td colspan='2'>".lang_string ("Global health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$global_health' title='$global_health % ".lang_string ("of modules with good data")."'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Module sanity")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$module_sanity ' title='$module_sanity % ".lang_string("of well initialized modules")."'>";
|
||||
echo "<tr><td colspan='2'>".lang_string ("Module sanity")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$module_sanity ' title='$module_sanity % ".lang_string ("of well initialized modules")."'>";
|
||||
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Alert level")."</th>";
|
||||
echo "<tr><td colspan='2'>".lang_string ("Alert level")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$alert_level' title='$alert_level % ".lang_string("of non-fired alerts")."'>";
|
||||
echo "</table>";
|
||||
|
||||
|
@ -132,7 +130,7 @@ $query1 = "SELECT COUNT(id_usuario) FROM tusuario";
|
|||
$users_defined = get_db_sql ($query1);
|
||||
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan=2>".$lang_label["Pandora_FMS_summary"]."</th>";
|
||||
echo "<th colspan=2>".lang_string ("Pandora_FMS_summary")."</th>";
|
||||
echo "<tr><td class='datos2'><b>"."Total agents"."</b></td>";
|
||||
echo "<td class='datos2' style='font: bold 2em Arial, Sans-serif; color: #000;'>".$total_agents."</td>";
|
||||
echo "</tr><tr><td class='datos'><b>"."Total checks"."</b></td>";
|
||||
|
@ -153,7 +151,7 @@ echo "</table>";
|
|||
|
||||
echo "<div id='activity'>";
|
||||
// Show last activity from this user
|
||||
echo "<h2>" . $lang_label["user_last_activity"] . "</h2>";
|
||||
echo "<h2>" . lang_string ("user_last_activity") . "</h2>";
|
||||
|
||||
$color = 1;
|
||||
|
||||
|
@ -169,11 +167,14 @@ $table->head[2] = lang_string ('date');
|
|||
$table->head[3] = lang_string ('src_address');
|
||||
$table->head[4] = lang_string ('comments');
|
||||
|
||||
$sql = sprintf ("SELECT ID_usuario,accion,fecha,IP_origen,descripcion FROM `tsesion` WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
|
||||
AND `ID_usuario` = '%s' ORDER BY `fecha` DESC LIMIT 5", $nick);
|
||||
$sql = sprintf ("SELECT ID_usuario,accion,fecha,IP_origen,descripcion
|
||||
FROM `tsesion`
|
||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
|
||||
AND `ID_usuario` = '%s' ORDER BY `fecha` DESC LIMIT 5",
|
||||
$nick);
|
||||
$sessions = get_db_all_rows_sql ($sql);
|
||||
if($sessions === false)
|
||||
$sessions = array();
|
||||
if ($sessions === false)
|
||||
$sessions = array ();
|
||||
|
||||
foreach ($sessions as $session) {
|
||||
$data = array ();
|
||||
|
|
|
@ -35,7 +35,7 @@ $table->head[0] = lang_string ('Name');
|
|||
$table->data = array ();
|
||||
|
||||
foreach ($config['extensions'] as $extension) {
|
||||
if ($extension['main_function'] == '')
|
||||
if ($extension['godmode_function'] == '')
|
||||
continue;
|
||||
$data = array ();
|
||||
$data[0] = '<a href="index.php?sec=gextensions&sec2='.$menu['sec2'].'" class="mn">'.$menu['name'];
|
||||
|
|
|
@ -131,16 +131,16 @@ else
|
|||
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// Login process
|
||||
if ( (! isset ($_SESSION['id_usuario'])) && (isset ($_GET["login"]))) {
|
||||
if (! isset ($_SESSION['id_usuario']) && isset ($_GET["login"])) {
|
||||
$nick = get_parameter_post ("nick");
|
||||
$pass = get_parameter_post ("pass");
|
||||
// Connect to Database
|
||||
$sql1 = sprintf("SELECT `id_usuario`, `password` FROM `tusuario` WHERE `id_usuario` = '%s'",$nick);
|
||||
$row = get_db_row_sql ($sql1);
|
||||
$sql = sprintf("SELECT `id_usuario`, `password` FROM `tusuario` WHERE `id_usuario` = '%s'",$nick);
|
||||
$row = get_db_row_sql ($sql);
|
||||
|
||||
// For every registry
|
||||
if ($row !== false){
|
||||
if ($row["password"] == md5 ($pass)){
|
||||
if ($row !== false) {
|
||||
if ($row["password"] == md5 ($pass)) {
|
||||
// Login OK
|
||||
// Nick could be uppercase or lowercase (select in MySQL
|
||||
// is not case sensitive)
|
||||
|
@ -153,7 +153,7 @@ if ( (! isset ($_SESSION['id_usuario'])) && (isset ($_GET["login"]))) {
|
|||
update_user_contact ($nick);
|
||||
logon_db ($nick, $REMOTE_ADDR);
|
||||
$_SESSION['id_usuario'] = $nick;
|
||||
|
||||
$config['id_user'] = $nick;
|
||||
} else {
|
||||
// Login failed (bad password)
|
||||
unset ($_GET["sec2"]);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
?>
|
||||
|
||||
<?php
|
||||
if (! isset ($_SESSION["id_usuario"])) {
|
||||
if (! isset ($config['id_user'])) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
@ -33,7 +33,7 @@ $sec = get_parameter ('sec');
|
|||
$sec2 = get_parameter ('sec2');
|
||||
|
||||
// Agent read, Server read
|
||||
if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
|
||||
if (give_acl ($config['id_user'], 0, "AR")) {
|
||||
if ($sec2 == "operation/agentes/tactical") {
|
||||
$selected = ' menu-selected';
|
||||
} else {
|
||||
|
@ -132,7 +132,7 @@ if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
|
|||
|
||||
|
||||
// Check access for incident
|
||||
if (give_acl ($_SESSION["id_usuario"], 0, "IR") == 1) {
|
||||
if (give_acl ($config['id_user'], 0, "IR") == 1) {
|
||||
if (($sec2 == "operation/incidents/incident" || $sec2 == "operation/incidents/incident_detail"|| $sec2 == "operation/incidents/incident_note")) {
|
||||
$selected = ' menu-selected';
|
||||
} else {
|
||||
|
@ -160,7 +160,7 @@ if (give_acl ($_SESSION["id_usuario"], 0, "IR") == 1) {
|
|||
|
||||
|
||||
// Rest of options, all with AR privilege
|
||||
if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
|
||||
if (give_acl ($config['id_user'], 0, "AR")) {
|
||||
// Events
|
||||
if($sec2 == "operation/events/events") {
|
||||
$selected = ' menu-selected';
|
||||
|
@ -211,15 +211,15 @@ if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
|
|||
|
||||
// User edit (submenu)
|
||||
if ($sec == "usuarios") {
|
||||
if(isset($_GET["ver"]) && $_GET["ver"] == $_SESSION["id_usuario"]) {
|
||||
if(isset($_GET["ver"]) && $_GET["ver"] == $config['id_user']) {
|
||||
echo "<div class='operation-submenu submenu-selected'>";
|
||||
} else {
|
||||
echo "<div class='operation-submenu'>";
|
||||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&sec2=operation/users/user_edit&ver=".$_SESSION["id_usuario"]."' class='mn'>".lang_string ("index_myuser")."</a></li></ul></div>";
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&sec2=operation/users/user_edit&ver=".$config['id_user']."' class='mn'>".lang_string ("index_myuser")."</a></li></ul></div>";
|
||||
|
||||
// User statistics require UM
|
||||
if (give_acl($_SESSION["id_usuario"], 0, "UM")==1) {
|
||||
if (give_acl($config['id_user'], 0, "UM")==1) {
|
||||
if($sec2 == "operation/users/user_statistics") {
|
||||
echo "<div class='operation-submenu submenu-selected'>";
|
||||
} else {
|
||||
|
@ -238,7 +238,7 @@ if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
|
|||
echo '<div id="op6" class="operation-menu'.$selected.'">';
|
||||
echo '<ul class="mn"><li><a href="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr=30" class="mn">'.lang_string ("SNMP_console").'</a></li></ul></div>';
|
||||
|
||||
if ((give_acl($_SESSION["id_usuario"], 0, "AW")==1)){
|
||||
if ((give_acl($config['id_user'], 0, "AW")==1)){
|
||||
// SNMP Console alert (submenu)
|
||||
if ($sec == "snmpconsole"){
|
||||
if($sec2 == "operation/snmpconsole/snmp_alert") {
|
||||
|
|
Loading…
Reference in New Issue