$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"; } $out[] = "\n";
</td> <td height="30" class="plfieldhdr ptop pbottom pright"><?php echo _("Source"); ?> </td> </tr> <?php $i = 0; foreach ($collectors as $coll) { $color = $i % 2 == 0 ? "lightgray" : "blank"; $type = $coll->get_type(); $type = $type == 1 ? "Detector" : ($type == 2 ? "Monitor" : ($type == 3 ? "Scanner" : "Data")); $plugin_id = $coll->get_plugin_id(); $rules = CollectorRule::get_list($conn, "WHERE idc={$idc} ORDER BY name"); $categories = CollectorRule::get_categories($conn); $subcategories = CollectorRule::get_subcategories($conn, $categories); ?> <tr class="<?php echo $color; ?> " height="22"> <td class="pleft"><?php echo $coll->get_name(); ?> </td> <td style="text-align:left;padding-left:10px"><?php echo $coll->get_description(); ?> </td> <td><?php echo $type;