$description)); $info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description; } else { $result = ''; } if ($result) { db_pandora_audit("Command management", "Create alert command " . $result, false, false, $info); } else { db_pandora_audit("Command management", "Fail try to create alert command", false, false); } ui_print_result_message ($result, __('Successfully created'), __('Could not be created')); } if ($update_command) { $id = (int) get_parameter ('id'); $alert = alerts_get_alert_command ($id); if ($alert['internal']) { db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; } $name = (string) get_parameter ('name'); $command = (string) get_parameter ('command'); $description = (string) get_parameter ('description'); $values = array (); $values['name'] = $name; $values['command'] = $command; $values['description'] = $description; $name_check = db_get_value ('name', 'talert_commands', 'name', $name); if (!$name || $name_check) { $result = ''; } else { $result = alerts_update_alert_command ($id, $values); $info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description; } if ($result) { db_pandora_audit("Command management", "Create alert command " . $id, false, false, $info); } else { db_pandora_audit("Command management", "Fail to create alert command " . $id, false, false); } ui_print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_command) { $id = (int) get_parameter ('id'); // Internal commands cannot be deleted if (alerts_get_alert_command_internal ($id)) { db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); return; } $result = alerts_delete_alert_command ($id); if ($result) { db_pandora_audit("Command management", "Delete alert command " . $id); } else { db_pandora_audit("Command management", "Fail to delete alert command " . $id); } ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); } $table->width = '98%'; $table->data = array (); $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('ID'); $table->head[2] = __('Description'); $table->head[3] = __('Delete'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); $table->size[3] = '40px'; $table->align = array (); $table->align[3] = 'center'; $commands = db_get_all_rows_in_table ('talert_commands'); if ($commands === false) $commands = array (); foreach ($commands as $command) { $data = array (); $data[0] = ''; if (! $command['internal']) $data[0] .= ''. $command['name'].''; else $data[0] .= $command['name']; $data[0] .= ''; $data[1] = $command['id']; $data[2] = $command['description']; $data[3] = ''; if (! $command['internal']) $data[3] = ''. html_print_image("images/cross.png", true) . ''; array_push ($table->data, $data); } if(isset($data)) { html_print_table ($table); } else { echo "