2008-06-26 Esteban Sanchez <estebans@artica.es>

* 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
This commit is contained in:
Esteban Sanchez 2008-06-26 14:57:11 +00:00
parent e28ac09264
commit 39dcecd957
5 changed files with 165 additions and 164 deletions

View File

@ -1,3 +1,15 @@
2008-06-26 Esteban Sanchez <estebans@artica.es>
* 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 <estebans@artica.es>
* ajax.php: Sed id_user in config array.

View File

@ -158,44 +158,36 @@ echo "</table>";
echo "<div id='activity'>";
// Show last activity from this user
echo "<h2>" . $lang_label["user_last_activity"] . "</h2>";
// Show table header
echo '<table cellpadding="4" cellspacing="4" width="700" class="databox"><tr>';
echo '<th>' . $lang_label["user"] . '</th>';
echo '<th>' . $lang_label["action"] . '</th>';
echo '<th width="130px">' . $lang_label["date"] . '</th>';
echo '<th>' . $lang_label["src_address"] . '</th>';
echo '<th width="200px">' . $lang_label["comments"] . '</th></tr>';
// 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 '<tr>';
echo '<td class="' . $tdcolor . 'f9"><b>' . $usuario . '</b></td>';
echo '<td class="' . $tdcolor . 'f9">' . $row["accion"]. '</td>';
echo '<td class="' . $tdcolor . 'f9">' . $row["fecha"]. '</td>';
echo '<td class="' . $tdcolor . 'f9">' . $row["IP_origen"]. '</td>';
echo '<td class="' . $tdcolor . 'f9">' . $row["descripcion"]. '</td>';
echo '</tr>';
$contador--;
}
echo "</table>";
$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] = '<strong>'.$session['ID_usuario'].'</strong>';
$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 "</div>"; // activity
echo '</div>'; // class "jus"

View File

@ -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] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'">'.$map['name'].'</a>';
$data[1] = '<img src="images/'.dame_grupo_icono ($map['id_group']).'" /> ';
$data[1] = '<img src="images/'.dame_grupo_icono ($map['id_group']).'.png" /> ';
$data[1] .= dame_nombre_grupo ($map['id_group']);
$data[2] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">
<img src="images/cross.png"></a>';

View File

@ -115,145 +115,143 @@ require "include/functions_db.php";
</head>
<?php
// Show custom background
if ($config["pure"] == 0)
echo '<body bgcolor="#555555">';
else
echo '<body bgcolor="#FFFFFF">';
// Show custom background
if ($config["pure"] == 0)
echo '<body bgcolor="#555555">';
else
echo '<body bgcolor="#FFFFFF">';
$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 '<div id="container">';
echo '<div id="head">';
require("general/header.php");
echo '</div>';
echo '<div id="page">';
echo ' <div id="menu">';
require ("general/main_menu.php");
echo ' </div>';
} else {
echo '<div id="main_pure">';
}
// Main block of content
if ($config["pure"] == 0){
echo '<div id="main">';
}
// 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 "<br><b class='error'>".lang_string("Sorry! I can't find the page!")."</b>";
}
} 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 '</div>'; // main
echo '<div style="clear:both"></div>';
echo '</div>'; // page
} else {
echo "</div>";
}
// Header
if ($config["pure"] == 0){
echo '<div id="container">';
echo '<div id="head">';
require("general/header.php");
echo '</div>';
echo '<div id="page">';
echo ' <div id="menu">';
require ("general/main_menu.php");
echo ' </div>';
} else {
echo '<div id="main_pure">';
}
// Main block of content
if ($config["pure"] == 0){
echo '<div id="main">';
}
if ($config["pure"] == 0) {
echo '<div id="foot">';
require("general/footer.php");
echo '</div>';
echo '</div>';
}
// Page loader / selector
if ($pagina != ""){
if (file_exists ($pagina . ".php")) {
require ($pagina . ".php");
} else {
echo "<br><b class='error'>".lang_string("Sorry! I can't find the page!")."</b>";
}
} else
require ("general/logon_ok.php"); //default
if ($config["pure"] == 0){
echo '</div>'; // main
echo '<div style="clear:both"></div>';
echo '</div>'; // page
} else {
echo "</div>";
}
if ($config["pure"] == 0){
echo '<div id="foot">';
require("general/footer.php");
echo '</div>';
echo '</div>';
}
echo '</body></html>';
echo '</body></html>';
?>

View File

@ -120,7 +120,6 @@ $(document).ready (function () {
<?php if ($refr) : ?>
t = new Date();
t.setTime (t.getTime() + <?=$refr * 1000?>);
console.log (t);
$.countdown.setDefaults($.countdown.regional["<?=$config['language']?>"]);
$("#countdown").countdown({until: t, format: 'MS', description: '<?=lang_string ("Until refresh")?>'});
<?php endif; ?>