From 39dcecd957597464a4b40faff6e648ebc2311c55 Mon Sep 17 00:00:00 2001 From: Esteban Sanchez Date: Thu, 26 Jun 2008 14:57:11 +0000 Subject: [PATCH] 2008-06-26 Esteban Sanchez * general/logon_ok.php: Use pandora functions to show last sessions. * index.php: Tab and blankspaces style correction. * godmode/reporting/map_builder.php: Fixed field name when inserting a layout_data. Fixed group icon on list. * operation/visual_console/render_view.php: Deleted firebug debug which was causing not to work on browsers without that extension. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@900 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 + pandora_console/general/logon_ok.php | 62 ++--- .../godmode/reporting/map_builder.php | 4 +- pandora_console/index.php | 250 +++++++++--------- .../operation/visual_console/render_view.php | 1 - 5 files changed, 165 insertions(+), 164 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0712fb8c97..a145cb1c96 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2008-06-26 Esteban Sanchez + + * general/logon_ok.php: Use pandora functions to show last sessions. + + * index.php: Tab and blankspaces style correction. + + * godmode/reporting/map_builder.php: Fixed field name when inserting a + layout_data. Fixed group icon on list. + + * operation/visual_console/render_view.php: Deleted firebug debug + which was causing not to work on browsers without that extension. + 2008-06-26 Esteban Sanchez * ajax.php: Sed id_user in config array. diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 367f5b8dad..992ca91821 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -158,44 +158,36 @@ echo ""; echo "
"; // Show last activity from this user echo "

" . $lang_label["user_last_activity"] . "

"; -// Show table header -echo ''; -echo ''; -echo ''; -echo ''; -echo ''; -echo ''; -// Skip offset records -$query1="SELECT * FROM tsesion WHERE (TO_DAYS(fecha) > TO_DAYS(NOW()) - 7) -AND ID_usuario = '" . $nick . "' ORDER BY fecha DESC limit 15"; - -$result = mysql_query ($query1); -$contador = 5; // Max items $color = 1; -while ($row = mysql_fetch_array ($result) && $contador > 0) { - - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } else { - $tdcolor = "datos2"; - $color = 1; - } - - $usuario = $row["ID_usuario"]; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - $contador--; -} -echo "
' . $lang_label["user"] . '' . $lang_label["action"] . '' . $lang_label["date"] . '' . $lang_label["src_address"] . '' . $lang_label["comments"] . '
' . $usuario . '' . $row["accion"]. '' . $row["fecha"]. '' . $row["IP_origen"]. '' . $row["descripcion"]. '
"; +$table->width = '700px'; +$table->data = array (); +$table->size = array (); +$table->size[2] = '130px'; +$table->size[4] = '200px'; +$table->head = array (); +$table->head[0] = lang_string ('user'); +$table->head[1] = lang_string ('action'); +$table->head[2] = lang_string ('date'); +$table->head[3] = lang_string ('src_address'); +$table->head[4] = lang_string ('comments'); + +$sql = sprintf ('SELECT * FROM tsesion WHERE (TO_DAYS(fecha) > TO_DAYS(NOW()) - 7) + AND ID_usuario = "%s" ORDER BY fecha DESC LIMIT 5', $nick); +$sessions = get_db_all_rows_sqlfree ($sql); +foreach ($sessions as $session) { + $data = array (); + + $data[0] = ''.$session['ID_usuario'].''; + $data[1] = $session['accion']; + $data[2] = $session['fecha']; + $data[3] = $session['IP_origen']; + $data[4] = $session['descripcion']; + + array_push ($table->data, $data); +} +print_table ($table); echo "
"; // activity echo ''; // class "jus" diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index f1b6404d86..3de9dad1c3 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -147,7 +147,7 @@ if ($create_layout_data) { $layout_data_map_linked = (int) get_parameter ("map_linked"); $sql = sprintf ('INSERT INTO tlayout_data (id_layout, label, id_layout_linked, - label_color, image, type, id_agente_modulo, parent_item, period, link_color) + label_color, image, type, id_agente_modulo, parent_item, period, no_link_color) VALUES (%d, "%s", %d, "%s", "%s", %d, %d, %d, %d, 1)', $id_layout, $layout_data_label, $layout_data_map_linked, @@ -259,7 +259,7 @@ if (! $edit_layout && ! $id_layout) { $data = array (); $data[0] = ''.$map['name'].''; - $data[1] = ' '; + $data[1] = ' '; $data[1] .= dame_nombre_grupo ($map['id_group']); $data[2] = ' '; diff --git a/pandora_console/index.php b/pandora_console/index.php index f400df9e33..6137c8774c 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -115,145 +115,143 @@ require "include/functions_db.php"; '; - else - echo ''; +// Show custom background +if ($config["pure"] == 0) +echo ''; +else +echo ''; - $REMOTE_ADDR = getenv ("REMOTE_ADDR"); +$REMOTE_ADDR = getenv ("REMOTE_ADDR"); - // Login process - if ( (! isset ($_SESSION['id_usuario'])) AND (isset ($_GET["login"]))) { - $nick = get_parameter_post ("nick"); - $pass = get_parameter_post ("pass"); - - // Connect to Database - $sql1 = 'SELECT * FROM tusuario WHERE id_usuario = "'.$nick.'"'; - $result = mysql_query ($sql1); - - // For every registry - if ($row = mysql_fetch_array ($result)){ - if ($row["password"] == md5 ($pass)){ - // Login OK - // Nick could be uppercase or lowercase (select in MySQL - // is not case sensitive) - // We get DB nick to put in PHP Session variable, - // to avoid problems with case-sensitive usernames. - // Thanks to David Muñiz for Bug discovery :) - $nick = $row["id_usuario"]; - unset ($_GET["sec2"]); - $_GET["sec"] = "general/logon_ok"; - update_user_contact ($nick); - logon_db ($nick, $REMOTE_ADDR); - $_SESSION['id_usuario'] = $nick; - - } else { - // Login failed (bad password) - unset ($_GET["sec2"]); - include "general/logon_failed.php"; - // change password to do not show all string - $primera = substr ($pass,0,1); - $ultima = substr ($pass, strlen ($pass) - 1, 1); - $pass = $primera . "****" . $ultima; - audit_db ($nick, $REMOTE_ADDR, "Logon Failed", - "Incorrect password: " . $nick . " / " . $pass); - exit; - } - } - else { - // User not known +// Login process +if ( (! isset ($_SESSION['id_usuario'])) && (isset ($_GET["login"]))) { + $nick = get_parameter_post ("nick"); + $pass = get_parameter_post ("pass"); + + // Connect to Database + $sql1 = 'SELECT * FROM tusuario WHERE id_usuario = "'.$nick.'"'; + $result = mysql_query ($sql1); + + // For every registry + if ($row = mysql_fetch_array ($result)){ + if ($row["password"] == md5 ($pass)){ + // Login OK + // Nick could be uppercase or lowercase (select in MySQL + // is not case sensitive) + // We get DB nick to put in PHP Session variable, + // to avoid problems with case-sensitive usernames. + // Thanks to David Muñiz for Bug discovery :) + $nick = $row["id_usuario"]; + unset ($_GET["sec2"]); + $_GET["sec"] = "general/logon_ok"; + update_user_contact ($nick); + logon_db ($nick, $REMOTE_ADDR); + $_SESSION['id_usuario'] = $nick; + + } else { + // Login failed (bad password) unset ($_GET["sec2"]); include "general/logon_failed.php"; - $primera = substr ($pass, 0, 1); + // change password to do not show all string + $primera = substr ($pass,0,1); $ultima = substr ($pass, strlen ($pass) - 1, 1); $pass = $primera . "****" . $ultima; audit_db ($nick, $REMOTE_ADDR, "Logon Failed", - "Invalid username: " . $nick . " / " . $pass); + "Incorrect password: " . $nick . " / " . $pass); exit; } - } elseif (! isset ($_SESSION['id_usuario'])) { - // There is no user connected - include "general/login_page.php"; + } + else { + // User not known + unset ($_GET["sec2"]); + include "general/logon_failed.php"; + $primera = substr ($pass, 0, 1); + $ultima = substr ($pass, strlen ($pass) - 1, 1); + $pass = $primera . "****" . $ultima; + audit_db ($nick, $REMOTE_ADDR, "Logon Failed", + "Invalid username: " . $nick . " / " . $pass); exit; + } +} elseif (! isset ($_SESSION['id_usuario'])) { + // There is no user connected + include "general/login_page.php"; + exit; +} else { + // There is session for id_usuario + $config["id_user"] = $_SESSION["id_usuario"]; +} + +// Log off +if (isset ($_GET["bye"])) { + include "general/logoff.php"; + $iduser = $_SESSION["id_usuario"]; + logoff_db ($iduser, $REMOTE_ADDR); + session_unregister ("id_usuario"); + exit; +} +$pagina = ""; +if (isset ($_GET["sec2"])){ + $sec2 = get_parameter_get ('sec2'); + $sec2 = parameter_extra_clean ($sec2); + $pagina = $sec2; +} else + $sec2 = ""; + +if (isset ($_GET["sec"])){ + $sec = get_parameter_get ('sec'); + $sec = parameter_extra_clean ($sec); + $pagina = $sec2; +} +else + $sec = ""; +// http://es2.php.net/manual/en/ref.session.php#64525 +// Session locking concurrency speedup! +session_write_close(); + +// Header +if ($config["pure"] == 0){ + echo '
'; + echo ''; + echo '
'; + echo ' '; +} else { + echo '
'; +} + +// Main block of content +if ($config["pure"] == 0){ + echo '
'; +} + +// Page loader / selector +if ($pagina != ""){ + if (file_exists ($pagina . ".php")) { + require ($pagina . ".php"); } else { - // There is session for id_usuario - $config["id_user"] = $_SESSION["id_usuario"]; - //$id_usuario = entrada_limpia ($_SESSION["id_usuario"]); - //$id_user = entrada_limpia ($_SESSION["id_usuario"]); - } + echo "
".lang_string("Sorry! I can't find the page!").""; + } +} else + require ("general/logon_ok.php"); //default - // Log off - if (isset ($_GET["bye"])) { - include "general/logoff.php"; - $iduser = $_SESSION["id_usuario"]; - logoff_db ($iduser, $REMOTE_ADDR); - session_unregister ("id_usuario"); - exit; - } - $pagina = ""; - if (isset ($_GET["sec2"])){ - $sec2 = get_parameter_get ('sec2'); - $sec2 = parameter_extra_clean ($sec2); - $pagina = $sec2; - } else - $sec2 = ""; - - if (isset ($_GET["sec"])){ - $sec = get_parameter_get ('sec'); - $sec = parameter_extra_clean ($sec); - $pagina = $sec2; - } - else - $sec = ""; - // http://es2.php.net/manual/en/ref.session.php#64525 - // Session locking concurrency speedup! - session_write_close(); +if ($config["pure"] == 0){ + echo '
'; // main + echo '
'; + echo '
'; // page +} else { + echo "
"; +} - // Header - if ($config["pure"] == 0){ - echo '
'; - echo ''; - echo '
'; - echo ' '; - } else { - echo '
'; - } - - // Main block of content - if ($config["pure"] == 0){ - echo '
'; - } +if ($config["pure"] == 0) { + echo ''; + echo '
'; +} - // Page loader / selector - if ($pagina != ""){ - if (file_exists ($pagina . ".php")) { - require ($pagina . ".php"); - } else { - echo "
".lang_string("Sorry! I can't find the page!").""; - } - } else - require ("general/logon_ok.php"); //default - - if ($config["pure"] == 0){ - echo '
'; // main - echo '
'; - echo '
'; // page - } else { - echo "
"; - } - - if ($config["pure"] == 0){ - echo ''; - echo '
'; - } - - echo ''; +echo ''; ?> diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 1c596f0a29..770466022a 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -120,7 +120,6 @@ $(document).ready (function () { t = new Date(); t.setTime (t.getTime() + ); - console.log (t); $.countdown.setDefaults($.countdown.regional[""]); $("#countdown").countdown({until: t, format: 'MS', description: ''});