2011-06-29 Ramon Novoa <rnovoa@artica.es>

* 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
This commit is contained in:
ramonn 2011-06-29 15:35:02 +00:00
parent a154c840fa
commit ad6a22c3c7

View File

@ -158,16 +158,14 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
$id_event = (array) safe_int ($id_event, 1); $id_event = (array) safe_int ($id_event, 1);
/* We must validate all events like the selected */ /* We must validate all events like the selected */
if ($similars && $new_status == 1) {
if ($similars) {
foreach ($id_event as $id) { foreach ($id_event as $id) {
$id_event = array_merge ($id_event, events_get_similar_ids ($id)); $id_event = array_merge ($id_event, events_get_similar_ids ($id));
} }
$id_event = array_unique($id_event); $id_event = array_unique($id_event);
} }
db_process_sql_begin (); db_process_sql_begin ();
$errors = 0;
switch($new_status) { switch($new_status) {
case 1: case 1:
@ -187,10 +185,12 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
} }
foreach ($id_event as $event) { foreach ($id_event as $event) {
$comment = '<b>-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox; if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) {
db_pandora_audit("ACL Violation", "Attempted updating event #".$event);
}
$comment = '<b>-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox;
$fullevent = events_get_event($event); $fullevent = events_get_event($event);
if($fullevent['user_comment'] != ''){ if($fullevent['user_comment'] != ''){
$comment .= '<br>'.$fullevent['user_comment']; $comment .= '<br>'.$fullevent['user_comment'];
} }
@ -201,31 +201,17 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
'user_comment' => $comment); 'user_comment' => $comment);
$ret = db_process_sql_update('tevento', $values, array('id_evento' => $event), 'AND', false); $ret = db_process_sql_update('tevento', $values, array('id_evento' => $event), 'AND', false);
if ($ret === false) {
if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) { process_sql_rollback ();
//Check ACL return false;
db_pandora_audit("ACL Violation", "Attempted updating event #".$event); }
}
elseif ($ret !== false) {
//ACL didn't fail nor did return
continue;
}
$errors++;
break;
} }
if ($errors > 1) { foreach ($id_event as $event) {
db_process_sql_rollback (); db_pandora_audit("Event validated", "Validated event #".$event);
return false;
}
else {
foreach ($id_event as $event) {
db_pandora_audit("Event validated", "Validated event #".$event);
}
db_process_sql_commit ();
return true;
} }
db_process_sql_commit ();
return true;
} }
/** /**