diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 3c96344f48..cb0610c8c1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-02-28 Miguel de Dios + + * godmode/admin_access_logs.php: cleaned source code style. + + * include/functions_db.php: fixed the set ip in the function + "db_pandora_audit". + + Fixes: #3606276 + 2013-02-28 Miguel de Dios * operation/events/events.php: fixed the javascript to use the diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 389a4d5edd..cddf01da49 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -44,16 +44,17 @@ echo ''; echo '
'; echo ''.__('Filter').'

'; -$rows = db_get_all_rows_sql ("SELECT DISTINCT(accion) FROM tsesion"); +$rows = db_get_all_rows_sql ("SELECT DISTINCT(accion) + FROM tsesion"); if (empty ($rows)) { $rows = array (); } $actions = array (); foreach ($rows as $row) { - $actions[$row["accion"]] = $row["accion"]; + $actions[$row["accion"]] = $row["accion"]; } -echo '
'; +echo ''; $table = null; $table->width = '100%'; $table->data = array(); @@ -92,9 +93,9 @@ switch ($config['dbtype']) { if ($user_filter != 'all') { $filter .= sprintf(' AND id_usuario = "%s"', $user_filter); } - + $filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")'; - + if ($filter_ip != '') { $filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip); } @@ -104,9 +105,9 @@ switch ($config['dbtype']) { if ($user_filter != 'all') { $filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter); } - + $filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')'; - + if ($filter_ip != '') { $filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip); } @@ -135,16 +136,27 @@ ui_pagination ($count, $url); switch ($config["dbtype"]) { case "mysql": - $sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d, %d", $filter, $offset, $config["block_size"]); + $sql = sprintf ("SELECT * + FROM tsesion + %s + ORDER BY fecha DESC + LIMIT %d, %d", $filter, $offset, $config["block_size"]); break; case "postgresql": - $sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d OFFSET %d", $filter, $config["block_size"], $offset); + $sql = sprintf ("SELECT * + FROM tsesion + %s + ORDER BY fecha DESC + LIMIT %d OFFSET %d", $filter, $config["block_size"], $offset); break; case "oracle": $set = array(); $set['limit'] = $config["block_size"]; $set['offset'] = $offset; - $sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC", $filter); + $sql = sprintf ("SELECT * + FROM tsesion + %s + ORDER BY fecha DESC", $filter); $result = oracle_recode_query ($sql, $set); break; } @@ -154,7 +166,7 @@ $result = db_get_all_rows_sql ($sql); // Delete rnum row generated by oracle_recode_query() function if (($config["dbtype"] == 'oracle') && ($result !== false)){ for ($i=0; $i < count($result); $i++) { - unset($result[$i]['rnum']); + unset($result[$i]['rnum']); } } @@ -219,7 +231,7 @@ foreach ($result as $row) { $table->rowclass[$iterator] = 'rowOdd'; $rowPair = !$rowPair; $iterator++; - + $data = array (); switch ($config['dbtype']) { case "mysql": diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 24d32c366e..576b4f5e9e 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -118,7 +118,7 @@ function db_escape_string_sql($string) { * * @return int Return the id of row in tsesion or false in case of fail. */ -function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = false, $info = '') { +function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = true, $info = '') { global $config; if ($ip !== false) {