diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c3dc279ab0..b69ae10cbe 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2008-08-04 Esteban Sanchez + + * 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 * extensions/hello.php: Fixed old function name. Activate the diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 17e41b5f56..dd4c057b09 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -21,9 +21,9 @@ require ("include/functions_reporting.php"); echo "
"; $nick = $_SESSION['id_usuario']; -echo "

" . $lang_label["welcome_title"] . "

"; +echo "

" . lang_string ("welcome_title") . "

"; echo "

"; -echo $lang_label["main_text"]; +echo lang_string ("main_text"); echo "

"; // Private messages pending to read ! @@ -31,10 +31,10 @@ echo "

"; $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 "

". $lang_label["new_message_bra"] . ' + echo "

". lang_string ("new_message_bra") . ' ' .$row["count"] . ' ' - .$lang_label["new_message_ket"] . '

'; + .lang_string ("new_message_ket") . ''; } echo ""; @@ -42,14 +42,14 @@ echo "
"; // Site news ! // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -echo '

' . $lang_label["site_news"] . '

'; +echo '

' . lang_string ("site_news") . '

'; $sql_news = "SELECT subject,timestamp,text,author FROM tnews ORDER by timestamp DESC LIMIT 3"; if ($result_news = mysql_query ($sql_news)){ echo ''; while ($row = mysql_fetch_array ($result_news)) { echo ''; echo "
".$row["subject"].""; - echo "
".$lang_label["by"]." ".$row["author"]. " ".$lang_label["at"]." ".$row["timestamp"].""; + echo "
".lang_string ("by")." ".$row["author"]. " ".lang_string ("at")." ".$row["timestamp"].""; echo '
'; echo clean_output_breaks($row["text"]); } @@ -59,7 +59,7 @@ echo ""; // 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 ""; -//echo "

".$lang_label["tactical_indicator"]."

"; -//echo ""; -echo "
".lang_string("Monitor health").""; -echo "
"; +echo "
".lang_string ("Monitor health").""; +echo "
"; -echo "
".lang_string("Data health").""; -echo "
"; +echo "
".lang_string ("Data health").""; +echo "
"; -echo "
".lang_string("Global health").""; -echo "
"; +echo "
".lang_string ("Global health").""; +echo "
"; -echo "
".lang_string("Module sanity").""; -echo "
"; +echo "
".lang_string ("Module sanity").""; +echo "
"; -echo "
".lang_string("Alert level").""; +echo "
".lang_string ("Alert level").""; echo "
"; echo "
"; @@ -132,7 +130,7 @@ $query1 = "SELECT COUNT(id_usuario) FROM tusuario"; $users_defined = get_db_sql ($query1); echo ""; -echo ""; +echo ""; echo ""; echo ""; echo ""; @@ -153,7 +151,7 @@ echo "
".$lang_label["Pandora_FMS_summary"]."".lang_string ("Pandora_FMS_summary")."
"."Total agents"."".$total_agents."
"."Total checks"."
"; echo "
"; // Show last activity from this user -echo "

" . $lang_label["user_last_activity"] . "

"; +echo "

" . lang_string ("user_last_activity") . "

"; $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 (); diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index 37c65640ee..b749d8d5da 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -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] = ''.$menu['name']; diff --git a/pandora_console/index.php b/pandora_console/index.php index d0ce49758c..4366823f65 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -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"]); diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index bfc338758d..65c9697548 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -21,7 +21,7 @@ ?> @@ -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 ""; // 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 "