$field1, 'field2' => $field2, 'field3' => $field3, 'id_group' => $group, 'action_threshold' => $action_threshold)); $info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command . ' Field1: ' . $field1 . ' Field2: ' . $field2 . ' Field3: ' . $field3 . ' Group: ' . $group . ' Action threshold: ' . $action_threshold; if ($result) { db_pandora_audit("Command management", "Create alert action " . $result, false, false, $info); } else { db_pandora_audit("Command management", "Fail try to create alert action", false, false, $info); } ui_print_result_message ($result, __('Successfully created'), __('Could not be created')); } if ($update_action) { $id = (string) get_parameter ('id'); $al_action = alerts_get_alert_action ($id); if ($al_action !== false){ if ($al_action['id_group'] == 0){ if (! check_acl ($config['id_user'], 0, "PM")) { db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; }else // Header ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true); } }else // Header ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true); $name = (string) get_parameter ('name'); $id_alert_command = (int) get_parameter ('id_command'); $field1 = (string) get_parameter ('field1'); $field2 = (string) get_parameter ('field2'); $field3 = (string) get_parameter ('field3'); $group = get_parameter ('group'); $action_threshold = (int) get_parameter ('action_threshold'); $values = array (); $values['name'] = $name; $values['id_alert_command'] = $id_alert_command; $values['field1'] = $field1; $values['field2'] = $field2; $values['field3'] = $field3; $values['id_group'] = $group; $values['action_threshold'] = $action_threshold; $result = alerts_update_alert_action ($id, $values); $info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command . ' Field1: ' . $field1 . ' Field2: ' . $field2 . ' Field3: ' . $field3 . ' Group: ' . $group . ' Action threshold: ' . $action_threshold; if ($result) { db_pandora_audit("Command management", "Update alert action " . $id, false, false, json_encode($values)); } else { db_pandora_audit("Command management", "Fail try to update alert action " . $id, false, false, json_encode($values)); } ui_print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_action) { $id = get_parameter ('id'); $al_action = alerts_get_alert_action ($id); if ($al_action !== false){ // If user tries to delete an action with group=ALL if ($al_action['id_group'] == 0){ // then must have "PM" access privileges if (! check_acl ($config['id_user'], 0, "PM")) { db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; }else // Header ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true); // If user tries to delete an action of others groups } else{ $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "LM")); else $own_groups = array_keys(users_get_groups($config['id_user'], "LM", false)); $is_in_group = in_array($al_action['id_group'], $own_groups); // Then action group have to be in his own groups if ($is_in_group) // Header ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true); else{ db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; } } } else // Header ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true); $result = alerts_delete_alert_action ($id); if ($result) { db_pandora_audit("Command management", "Delete alert action " . $id); } else { db_pandora_audit("Command management", "Fail try to delete alert action " . $id); } ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); } $table->width = '90%'; $table->data = array (); $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('Group'); $table->head[2] = __('Copy'); $table->head[3] = __('Delete'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); $table->size[2] = '40px'; $table->size[3] = '40px'; $table->align = array (); $table->align[2] = 'center'; $table->align[3] = 'center'; $actions = db_get_all_rows_in_table ('talert_actions'); if ($actions === false) $actions = array (); $rowPair = true; $iterator = 0; foreach ($actions as $action) { if ($rowPair) $table->rowclass[$iterator] = 'rowPair'; else $table->rowclass[$iterator] = 'rowOdd'; $rowPair = !$rowPair; $iterator++; $data = array (); $data[0] = ''. $action['name'].''; $data[1] = ui_print_group_icon ($action["id_group"], true) .' '. ui_print_truncate_text(groups_get_name ($action["id_group"], true)); $data[2] = '' . html_print_image("images/copy.png", true) . ''; $data[3] = ''. html_print_image("images/cross.png", true) . ''; array_push ($table->data, $data); } if (isset($data)){ html_print_table ($table); } else { echo "