From 581bb9e7e1fabb976e5fc318f93a92289d48946f Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 29 Jun 2011 15:35:02 +0000 Subject: [PATCH] 2011-06-29 Ramon Novoa * include/functions_events.php: Do not update validated events. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4501 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/include/functions_events.php | 42 +++++++------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index d0ef7ad118..eade9ecc6c 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -158,16 +158,14 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new $id_event = (array) safe_int ($id_event, 1); /* We must validate all events like the selected */ - - if ($similars) { + if ($similars && $new_status == 1) { foreach ($id_event as $id) { $id_event = array_merge ($id_event, events_get_similar_ids ($id)); } $id_event = array_unique($id_event); } - + db_process_sql_begin (); - $errors = 0; switch($new_status) { case 1: @@ -187,10 +185,12 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new } foreach ($id_event as $event) { - $comment = '-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --
'.$commentbox; + if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) { + db_pandora_audit("ACL Violation", "Attempted updating event #".$event); + } + $comment = '-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --
'.$commentbox; $fullevent = events_get_event($event); - if($fullevent['user_comment'] != ''){ $comment .= '
'.$fullevent['user_comment']; } @@ -201,31 +201,17 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new 'user_comment' => $comment); $ret = db_process_sql_update('tevento', $values, array('id_evento' => $event), 'AND', false); - - if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) { - //Check ACL - db_pandora_audit("ACL Violation", "Attempted updating event #".$event); - } - elseif ($ret !== false) { - //ACL didn't fail nor did return - continue; - } - - $errors++; - break; + if ($ret === false) { + process_sql_rollback (); + return false; + } } - if ($errors > 1) { - db_process_sql_rollback (); - return false; - } - else { - foreach ($id_event as $event) { - db_pandora_audit("Event validated", "Validated event #".$event); - } - db_process_sql_commit (); - return true; + foreach ($id_event as $event) { + db_pandora_audit("Event validated", "Validated event #".$event); } + db_process_sql_commit (); + return true; } /**