$id_reconscript)); echo htmlentities (safe_output($description), ENT_QUOTES, "UTF-8", true); return; } // Load global vars global $config; check_login (); if (! check_acl ($config['id_user'], 0, "LM")) { pandora_audit("ACL Violation", "Trying to access recon script Management"); require ("general/noaccess.php"); return; } $view = get_parameter ("view", ""); $create = get_parameter ("create", ""); if ($view != ""){ $form_id = $view; $reconscript = get_db_row ("trecon_script", "id_recon_script", $form_id); $form_name = $reconscript["name"]; $form_description = $reconscript["description"]; $form_script = $reconscript ["script"]; } if ($create != ""){ $form_name = ""; $form_description = ""; $form_script = ""; } // SHOW THE FORM // ================================================================= if (($create != "") OR ($view != "")){ if ($create != "") print_page_header (__('Recon script creation'), "", false, "", true); else { print_page_header (__('Recon script update'), "", false, "", true); $id_recon_script = get_parameter ("view",""); } print_help_icon("reconscript_definition"); if ($create == "") echo "
"; else echo ""; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.__('Name'); echo ''; echo '
'.__('Script fullpath'); echo ''; echo '
'.__('Description').'
'; echo ''; echo '
'; if ($create != ""){ echo ""; } else { echo ""; } echo '
'; } else { print_page_header (__('Recon scripts registered in Pandora FMS'), "", false, "", true); // Update reconscript if (isset($_GET["update_reconscript"])) { // if modified any parameter $id_recon_script = get_parameter ("update_reconscript", 0); $reconscript_name = get_parameter ("form_name", ""); $reconscript_description = get_parameter ("form_description", ""); $reconscript_script = get_parameter ("form_script", ""); $sql_update ="UPDATE trecon_script SET name = '$reconscript_name', description = '$reconscript_description', script = '$reconscript_script' WHERE id_recon_script = $id_recon_script"; $result = process_sql ($sql_update); if (! $result) { echo "

".__('Problem updating')."

"; } else { echo "

".__('Updated successfully')."

"; } } // Create reconscript if (isset($_GET["create_reconscript"])) { $reconscript_name = get_parameter ("form_name", ""); $reconscript_description = get_parameter ("form_description", ""); $reconscript_script = get_parameter ("form_script", ""); $values = array( 'name' => $reconscript_name, 'description' => $reconscript_description, 'script' => $reconscript_script); $result = process_sql_insert('trecon_script', $values); if (! $result){ echo "

".__('Problem creating')."

"; echo $sql_insert; } else { echo "

".__('Created successfully')."

"; } } if (isset($_GET["kill_reconscript"])){ // if delete alert $reconscript_id = get_parameter ("kill_reconscript", 0); $sql_delete= "DELETE FROM trecon_script WHERE id_recon_script = ".$reconscript_id; $result = process_sql($sql_delete); if (! $result){ echo "

".__('Problem deleting reconscript')."

"; } else { echo "

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

"; } if ($reconscript_id != 0){ $sql_delete2 = "DELETE FROM trecon_task WHERE id_recon_script = ".$reconscript_id; $result = process_sql ($sql_delete2); } } // If not edition or insert, then list available reconscripts $rows = get_db_all_rows_in_table('trecon_script'); if ($rows !== false) { echo ''; echo ""; echo ""; echo ""; echo ""; $color = 0; foreach ($rows as $row) { if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo ""; echo ""; echo ""; } echo "
".__('Name')."".__('Command')."".__('Description')."".__('Delete')."
"; echo ""; echo $row["name"]; echo ""; echo $row["script"]; echo ""; echo $row["description"]; echo ""; echo "" . print_image("images/cross.png", true, array("border" => '0')) . ""; echo "
"; } else { echo '
'. __('There are no recon scripts in the system'); echo "
"; } echo ""; echo "
"; echo "
"; echo ""; echo "
"; } ?>