0) { process_sql ("ROLLBACK;"); echo "

".__('There was a problem deleting agent')."

"; } else { process_sql ("COMMIT;"); echo "

".__('Agent deleted successfully')."

"; } unset ($sql_delete, $del_error); //Clean up process_sql ("SET AUTOCOMMIT=1;"); audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management"); // Delete remote configuration $agent_md5 = md5($agent_name, FALSE); if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) { // Agent remote configuration editor $file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf"; unlink ($file_name); $file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5"; unlink ($file_name); } } else { // NO permissions. audit_db ($config["id_user"],$REMOTE_ADDR, "ACL Violation", "Trying to delete agent \'$agent_name\'"); require ("general/noaccess.php"); exit; } } echo "

".__('Agent configuration')." > ".__('Agents defined in Pandora')."

"; // Show group selector if (isset($_POST["ag_group"])){ $ag_group = get_parameter_post ("ag_group"); echo "
"; } else { echo ""; } echo ""; echo ""; echo "
".__('Group').""; echo ""; echo " "; echo __('Free text for search (*)'); echo ""; // Show group selector if (isset($_POST["ag_group"])){ $group_mod = "&ag_group_refresh=".get_parameter_post ("ag_group"); } else { $group_mod =""; } echo "
"; echo ""; echo "
"; echo ""; echo ""; echo "
"; if ($search != ""){ $search_sql = " nombre LIKE '%$search%' "; } else { $search_sql = " 1 = 1"; } // Show only selected groups if ($ag_group > 1){ $sql1="SELECT * FROM tagente WHERE id_grupo = $ag_group AND $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"]; $sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $ag_group AND $search_sql ORDER BY nombre"; } else { // Is admin user ?? if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='".$config["id_user"]."'", "nivel") == 1){ $sql1 = "SELECT * FROM tagente WHERE $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"]; $sql2="SELECT COUNT(id_agente) FROM tagente WHERE $search_sql ORDER BY nombre, id_grupo"; } else { $sql1="SELECT * FROM tagente WHERE $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."') ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"]; $sql2="SELECT COUNT(id_agente) FROM tagente WHERE $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."') ORDER BY nombre, id_grupo"; } } $result=mysql_query($sql1); $result2=mysql_query($sql2); $row2=mysql_fetch_array($result2); $total_events = $row2[0]; // Prepare pagination pagination ($total_events, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group", $offset); echo "
"; if (mysql_num_rows($result)){ echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $color=1; while ($row=mysql_fetch_array($result)){ $id_grupo = $row["id_grupo"]; if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } if (give_acl($config["id_user"], $id_grupo, "AW")==1){ // Agent name echo ""; echo ""; // Operating System icon echo ""; // Group icon and name echo ""; // Description echo ""; // Action echo ""; } } echo "
".__('Agent name')."".__('R')."".__('OS')."".__('Group')."".__('Description')."".__('Delete')."
"; if ($row["disabled"] == 1){ echo ""; } echo "".substr(strtoupper($row["nombre"]),0,20).""; if ($row["disabled"] == 1){ echo ""; } echo ""; // Has remote configuration ? $agent_md5 = md5($row["nombre"], FALSE); if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")){ echo ""; echo ""; echo ""; } echo ""; print_os_icon ($row["id_os"], false); echo "".print_group_icon ($id_grupo, true)."".$row["comentarios"]."'; echo "
"; echo "
"; } else { echo "
".__('There are no defined agents')."
"; echo " 
"; } // Create agent button echo "
"; echo ""; echo "
"; ?>