From 703b222d8a549fcc3b6c9f00b22599c9bf0b5411 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 10 Dec 2009 17:46:25 +0000 Subject: [PATCH] 2009-12-09 Miguel de Dios * include/functions_db.php: change the function "get_db_all_row_by_steps_sql", now it support more connection with parameter $new for new conection and $result for connection. * operation/events/export_csv.php: rewrite to adapt the new "get_db_all_row_by_steps_sql". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2190 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ pandora_console/include/functions_db.php | 8 ++++---- pandora_console/operation/events/export_csv.php | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4bffb07a1b..23bbc5eb7e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2009-12-09 Miguel de Dios + + * include/functions_db.php: change the function + "get_db_all_row_by_steps_sql", now it support more connection with + parameter $new for new conection and $result for connection. + + * operation/events/export_csv.php: rewrite to adapt the new + "get_db_all_row_by_steps_sql". + 2009-12-09 Raul Mateos * images/god9.png: New image. diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 27c3200d80..261c37e187 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1876,13 +1876,13 @@ function get_db_all_rows_filter ($table, $filter, $fields = false, $where_join = * rest of times pass none for iterate in table and extract row by row, and * the end return false. * + * @param bool $new Default true, if true start to query. + * @param resource $result The resource of mysql for access to query. * @param string $sql * @return mixed The row or false in error. */ -function get_db_all_row_by_steps_sql($sql = null) { - static $result; - - if ($sql !== null) +function get_db_all_row_by_steps_sql($new = true, &$result, $sql = null) { + if ($new == true) $result = mysql_query($sql); return mysql_fetch_assoc($result); diff --git a/pandora_console/operation/events/export_csv.php b/pandora_console/operation/events/export_csv.php index 57c2ef4410..14e64371e7 100644 --- a/pandora_console/operation/events/export_csv.php +++ b/pandora_console/operation/events/export_csv.php @@ -73,9 +73,10 @@ $fields = array ('id_grupo', 'id_agente', 'evento', 'estado', 'id_usuario', 'event_type', 'criticity', 'timestamp'); $sql = get_db_all_rows_filter ('tevento', $filter, $fields, 'AND', true); -get_db_all_row_by_steps_sql($sql); -while ($event = get_db_all_row_by_steps_sql()) { +$new = true; +while ($event = get_db_all_row_by_steps_sql($new, $result, $sql)) { + $new = false; if (! give_acl ($config["id_user"], $event["id_grupo"], "AR")) continue;