if (is_uploaded_file($_FILES['sample_log']['tmp_name'])) { $conf = $GLOBALS["conf"]; $uploads_dir = $conf->get_conf("repository_upload_dir"); $sample_log = $uploads_dir . "/" . $_FILES['sample_log']['name']; move_uploaded_file($_FILES['sample_log']['tmp_name'], $sample_log); } if ($action == "new" && $id == "") { Collectors::insert($conn, $name, $description, $type, $plugin_id, $source_type, $enable, $source, $location, $create, $process, $start, $stop, $startup_command, $stop_command, $sample_log); } if ($action == "modify" && $id != "") { Collectors::update($conn, $id, $name, $description, $type, $plugin_id, $source_type, $enable, $source, $location, $create, $process, $start, $stop, $startup_command, $stop_command, $sample_log); } if ($action == "delete" && $id != "") { Collectors::delete($conn, $id); } $collectors = Collectors::get_list($conn); ?> <script> $(document).ready(function(){ }); </script> <center> <table width="90%" class="noborder" style="background:transparent;" cellspacing="0" cellpadding="0"> <tr><td style="text-align:right;" class="nobborder"> <form><input type="button" class="button" onclick="document.location.href='modifycollectors.php?action=new'" value="<?php echo _("Insert new collector"); ?> "></form> </td> </tr>
} if ($rule->get_userdata7() != "") { $out[] = "userdata7=" . $rule->get_userdata7() . "\n"; } if ($rule->get_userdata8() != "") { $out[] = "userdata8=" . $rule->get_userdata8() . "\n"; } if ($rule->get_userdata9() != "") { $out[] = "userdata9=" . $rule->get_userdata9() . "\n"; } $out[] = "\n\n"; } } // SQL if ($section == "sql") { $collectors = Collectors::get_list($conn, "WHERE id={$idc}"); $coll = $collectors[0]; $rules = CollectorRule::get_list($conn, "WHERE idc={$idc} ORDER BY name"); // PLUGIN_ID $out[] = "-- " . $coll->get_name() . "\n"; $out[] = "-- plugin_id: " . $coll->get_plugin_id() . "\n"; $out[] = "DELETE FROM plugin WHERE id = '" . $coll->get_plugin_id() . "';\n"; $out[] = "DELETE FROM plugin_sid where plugin_id = '" . $coll->get_plugin_id() . "';\n"; $out[] = "\n"; $out[] = "INSERT INTO plugin (id, type, name, description, source_type) VALUES (" . $coll->get_plugin_id() . "," . $coll->get_type() . ",'" . strtolower($coll->get_name()) . "','" . str_replace("'", "\\'", str_replace("\n", " ", $coll->get_description())) . "','" . str_replace("'", "\\'", $coll->get_source_type()) . "');\n"; $out[] = "\n"; // PLUGIN_SID => RULES foreach ($rules as $rule) { $cat_id = $rule->get_category_id() != "" && $rule->get_category_id() != 0 ? $rule->get_category_id() : "NULL"; $subcat_id = $rule->get_subcategory_id() != "" && $rule->get_subcategory_id() != 0 ? $rule->get_subcategory_id() : "NULL"; $out[] = "INSERT INTO plugin_sid (plugin_id, sid, category_id, class_id, name, priority, reliability, subcategory_id) VALUES (" . $coll->get_plugin_id() . ", " . $rule->get_plugin_sid() . ", {$cat_id}, NULL, '" . $coll->get_name() . ": " . $rule->get_name() . "' ," . $rule->get_prio() . ", " . $rule->get_rel() . ", {$subcat_id});\n";