mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Fixed error in recontasks. Ticket#2594
This commit is contained in:
parent
06e715b6db
commit
6b82b9674a
@ -155,29 +155,23 @@ if (isset($_GET["update"])) {
|
|||||||
|
|
||||||
$reason = '';
|
$reason = '';
|
||||||
if ($name != "") {
|
if ($name != "") {
|
||||||
if ((db_get_value_filter ('name', 'trecon_task', array ('name' => $name))) && (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network))){
|
if (empty($id_recon_script)) {
|
||||||
$reason = __('Recon-task name already exists and incorrect format in Subnet field');
|
if (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network)){
|
||||||
$result = false;
|
$reason = __('Wrong format in Subnet field');
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$result = db_process_sql_update('trecon_task', $values, $where);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(db_get_value_filter ('name', 'trecon_task', array ('name' => $name))){
|
else {
|
||||||
$reason = __('Recon-task name already exists');
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
else if ((empty($id_recon_script)) && preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network)){
|
|
||||||
$result = db_process_sql_update('trecon_task', $values, $where);
|
$result = db_process_sql_update('trecon_task', $values, $where);
|
||||||
}
|
}
|
||||||
elseif (!empty($id_recon_script)){
|
|
||||||
$result = db_process_sql_update('trecon_task', $values, $where);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network))
|
|
||||||
$reason = __('Incorrect format in Subnet field');
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
ui_print_success_message(__('Successfully updated recon task'));
|
ui_print_success_message(__('Successfully updated recon task'));
|
||||||
}
|
}
|
||||||
@ -222,30 +216,28 @@ if (isset($_GET["create"])) {
|
|||||||
$reason = "";
|
$reason = "";
|
||||||
|
|
||||||
if ($name != "") {
|
if ($name != "") {
|
||||||
if ((db_get_value_filter ('name', 'trecon_task', array ('name' => $name))) && (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network))){
|
|
||||||
$reason = __('Recon-task name already exists and incorrect format in Subnet field');
|
$name_exists = (bool) db_get_value ('name', 'trecon_task', 'name', $name);
|
||||||
$result = false;
|
|
||||||
|
if (empty($id_recon_script)) {
|
||||||
|
if ($name_exists && (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network))){
|
||||||
|
$reason = __('Recon-task name already exists and incorrect format in Subnet field');
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
else if (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network)){
|
||||||
|
$reason = __('Wrong format in Subnet field');
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
else if ($name_exists){
|
||||||
|
$reason = __('Recon-task name already exists');
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$result = db_process_sql_insert('trecon_task', $values);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network)){
|
else {
|
||||||
$reason = __('Incorrect format in Subnet field');
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
else if (db_get_value_filter ('name', 'trecon_task', array ('name' => $name))){
|
|
||||||
$reason = __('Recon-task name already exists');
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
else if (empty($id_recon_script) && preg_match("/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/", $network))
|
|
||||||
{
|
|
||||||
$result = db_process_sql_insert('trecon_task', $values);
|
$result = db_process_sql_insert('trecon_task', $values);
|
||||||
|
|
||||||
$reason = __("Network provided is not correct");
|
|
||||||
}
|
|
||||||
elseif (!empty($id_recon_script)) {
|
|
||||||
$result = db_process_sql_insert('trecon_task', $values);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$reason = __('Error');
|
|
||||||
$result = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user