From df0dfb724ebdffd8996906db20eed0d727406965 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Tue, 22 Nov 2011 15:19:05 +0000 Subject: [PATCH] 2011-11-22 Juan Manuel Ramon * godmode/servers/manage_recontask.php godmode/servers/manage_recontask_form.php: Fixed bug due to autorefresh in these views. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5152 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 + .../godmode/servers/manage_recontask.php | 2 +- .../godmode/servers/manage_recontask_form.php | 128 +++++++++++------- 3 files changed, 83 insertions(+), 53 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2a4cf88547..eb751d1a51 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-11-22 Juan Manuel Ramon + + * godmode/servers/manage_recontask.php + godmode/servers/manage_recontask_form.php: Fixed bug due to + autorefresh in these views. + 2011-11-22 Juan Manuel Ramon * godmode/alerts/configure_alert_template.php: Fixed template diff --git a/pandora_console/godmode/servers/manage_recontask.php b/pandora_console/godmode/servers/manage_recontask.php index a414fc943f..e13910c86a 100644 --- a/pandora_console/godmode/servers/manage_recontask.php +++ b/pandora_console/godmode/servers/manage_recontask.php @@ -227,7 +227,7 @@ if ($result !== false) { foreach ($result as $row) { $data = array(); - $data[0] = ''.$row["name"].''; + $data[0] = ''.$row["name"].''; if ($row["id_recon_script"] == 0) $data[1] = $row["subnet"]; diff --git a/pandora_console/godmode/servers/manage_recontask_form.php b/pandora_console/godmode/servers/manage_recontask_form.php index aa0c83015a..03809f05d6 100644 --- a/pandora_console/godmode/servers/manage_recontask_form.php +++ b/pandora_console/godmode/servers/manage_recontask_form.php @@ -42,58 +42,83 @@ if (is_ajax ()) { return; } -if (isset ($_GET["update"])) { // Edit mode - $id_rt = (int) get_parameter_get ("update"); - $row = db_get_row ("trecon_task","id_rt",$id_rt); - $name = $row["name"]; - $network = $row["subnet"]; - $id_recon_server = $row["id_recon_server"]; - $description = $row["description"]; - $interval = $row["interval_sweep"]; - $id_group = $row["id_group"]; - $create_incident = $row["create_incident"]; - $id_network_profile = $row["id_network_profile"]; - $id_os = $row["id_os"]; - $recon_ports = $row["recon_ports"]; - $snmp_community = $row["snmp_community"]; - $id_recon_script = $row["id_recon_script"]; - $field1 = $row["field1"]; - $field2 = $row["field2"]; - $field3 = $row["field3"]; - $field4 = $row["field4"]; - if ($id_recon_script == 0) +if (isset ($_GET["update"]) or ($_GET["crt"])) { // Edit mode + + $update_recon = true; + if (isset ($_GET["crt"])){ + if ($_GET["crt"] != "update"){ + $update_recon = false; + } + else{ + $id_rt = get_parameter("upd"); + } + } + + if ($update_recon){ + if (!isset($id_rt)){ + $id_rt = (int) get_parameter_get ("update"); + } + $row = db_get_row ("trecon_task","id_rt",$id_rt); + $name = $row["name"]; + $network = $row["subnet"]; + $id_recon_server = $row["id_recon_server"]; + $description = $row["description"]; + $interval = $row["interval_sweep"]; + $id_group = $row["id_group"]; + $create_incident = $row["create_incident"]; + $id_network_profile = $row["id_network_profile"]; + $id_os = $row["id_os"]; + $recon_ports = $row["recon_ports"]; + $snmp_community = $row["snmp_community"]; + $id_recon_script = $row["id_recon_script"]; + $field1 = $row["field1"]; + $field2 = $row["field2"]; + $field3 = $row["field3"]; + $field4 = $row["field4"]; + if ($id_recon_script == 0) + $mode = "network_sweep"; + else + $mode = "recon_script"; + $os_detect = $row["os_detect"]; + $resolve_names = $row["resolve_names"]; + $os_detect = $row["os_detect"]; + $resolve_names = $row["resolve_names"]; + $parent_detection = $row["parent_detection"]; + $parent_recursion = $row["parent_recursion"]; + } + +} elseif (isset ($_GET["create"]) or isset($_GET["crt"])) { + $create_recon = true; + if (isset ($_GET["crt"])){ + if ($_GET["crt"] != "Create"){ + $create_recon = false; + } + } + + if ($create_recon){ + $id_rt = -1; + $name = ""; + $network = ""; + $description = ""; + $id_recon_server = 0; + $interval = 0; + $id_group = 0; + $create_incident = 1; + $snmp_community = "public"; + $id_network_profile = 0; + $id_os = -1; // Any + $recon_ports = ""; // Any + $field1 = ""; + $field2 = ""; + $field3 = ""; + $field4 = ""; + $id_recon_script = 0; $mode = "network_sweep"; - else - $mode = "recon_script"; - $os_detect = $row["os_detect"]; - $resolve_names = $row["resolve_names"]; - $os_detect = $row["os_detect"]; - $resolve_names = $row["resolve_names"]; - $parent_detection = $row["parent_detection"]; - $parent_recursion = $row["parent_recursion"]; -} elseif (isset ($_GET["create"])) { - $id_rt = -1; - $name = ""; - $network = ""; - $description = ""; - $id_recon_server = 0; - $interval = 0; - $id_group = 0; - $create_incident = 1; - $snmp_community = "public"; - $id_network_profile = 0; - $id_os = -1; // Any - $recon_ports = ""; // Any - $field1 = ""; - $field2 = ""; - $field3 = ""; - $field4 = ""; - $id_recon_script = 0; - $mode = "network_sweep"; - $os_detect = 0; - $resolve_names = 0; - $parent_detection = 1; - $parent_recursion = 5; + $os_detect = 0; + $resolve_names = 0; + $parent_detection = 1; + $parent_recursion = 5; + } } // Headers @@ -244,7 +269,6 @@ $table->data[21][1] = html_print_input_text ('parent_recursion', $parent_recurs // Different Form url if it's a create or if it's a update form echo '
'; - html_print_table ($table); echo '
'; if ($id_rt != -1)