";
if (! isset ($id_agente))
return;
$multiple_delete = get_parameter('multiple_delete');
if ($multiple_delete) {
$id_agent_modules_delete = (array)get_parameter('id_delete');
foreach($id_agent_modules_delete as $id_agent_module_del) {
$id_grupo = (int) dame_id_grupo ($id_agente);
if (! give_acl ($config["id_user"], $id_grupo, "AW")) {
audit_db($config["id_user"],$_SERVER['REMOTE_ADDR'], "ACL Violation",
"Trying to delete a module without admin rights");
require ("general/noaccess.php");
exit;
}
if ($id_agent_module_del < 1) {
audit_db ($config["id_user"],$_SERVER['REMOTE_ADDR'], "HACK Attempt",
"Expected variable from form is not correct");
die ("Nice try buddy");
exit;
}
//Init transaction
$error = 0;
process_sql_begin ();
// First delete from tagente_modulo -> if not successful, increment
// error. NOTICE that we don't delete all data here, just marking for deletion
// and delete some simple data.
if (process_sql ("UPDATE tagente_modulo
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del) === false)
$error++;
if (process_sql ("DELETE FROM tagente_estado WHERE id_agente_modulo = ".$id_agent_module_del) === false)
$error++;
if (process_sql ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ".$id_agent_module_del) === false)
$error++;
//Check for errors
if ($error != 0) {
process_sql_rollback ();
print_error_message (__('There was a problem deleting the module'));
} else {
process_sql_commit ();
print_success_message (__('Module deleted succesfully'));
}
}
}
// ==========================
// MODULE VISUALIZATION TABLE
// ==========================
echo "