$dom = $directive_editor->get_xml($filepath, "DOMXML"); $directive = $directive_editor->getDirectiveFromXML($dom, $directive_id); $node = $directive->directive; $node->setAttribute('name', $name); $node->setAttribute('priority', $prio); $directive_editor->save_xml($filepath, $dom, "DOMXML"); $directive_editor->update_directive_pluginsid($directive_id, 2, $prio, $name); $directive_editor->update_directive_taxonomy($directive_id, $intent, $strategy, $method); $infolog = array($directive_id, 'updated'); Log_action::log(86, $infolog); } else { if ($directive_editor->directive_exists($name, $filepath)) { die(ossim_error(_("This directive name already exists"))); } // Get new ID $id = $directive_editor->new_directive_id($file); if ($id < 1) { echo ossim_error(_("Unable to create a new directive in ") . "<b>{$file}</b>"); } // Create a Node (Do not create yet, at rule finish) // ... } // Back to MAIN if (POST('mode') == "saveclose") { Util::memcacheFlush(); ?> <script type="text/javascript"> var params = new Array(); params['xml'] = "<?php echo $file; ?>
$error_msg[] = _('Invalid source port value'); } if (!Directive_editor::valid_directive_port(POST("port_to")) || !Directive_editor::valid_directive_port(POST("port_to_list"))) { $error = TRUE; $error_msg[] = _('Invalid destination port value'); } if ($error) { die(ossim_error(implode('<br>', $error_msg))); } $directive_editor = new Directive_editor($engine_id); $attributes = array("name" => stripslashes(POST("name")), "plugin_id" => POST("plugin_id"), "type" => POST("type"), "plugin_sid" => POST("plugin_sid"), "product" => POST("product"), "category" => POST("category"), "subcategory" => POST("subcategory"), "entity" => POST("entity"), "from" => $assets_from, "port_from" => POST("port_from"), "to" => $assets_to, "port_to" => POST("port_to"), "from_rep" => POST("from_rep"), "to_rep" => POST("to_rep"), "from_rep_min_pri" => POST("from_rep_min_pri"), "to_rep_min_pri" => POST("to_rep_min_pri"), "from_rep_min_rel" => POST("from_rep_min_rel"), "to_rep_min_rel" => POST("to_rep_min_rel"), "protocol" => $protocol, "sensor" => POST("sensor"), "occurrence" => POST("occurrence"), "time_out" => POST("time_out"), "reliability" => POST("reliability"), "condition" => POST("condition"), "value" => POST("value"), "interval" => POST("interval"), "absolute" => POST("absolute"), "sticky" => POST("sticky"), "sticky_different" => POST("sticky_different"), "userdata1" => utf8_encode(stripslashes(POST("userdata1"))), "userdata2" => utf8_encode(stripslashes(POST("userdata2"))), "userdata3" => utf8_encode(stripslashes(POST("userdata3"))), "userdata4" => utf8_encode(stripslashes(POST("userdata4"))), "userdata5" => utf8_encode(stripslashes(POST("userdata5"))), "userdata6" => utf8_encode(stripslashes(POST("userdata6"))), "userdata7" => utf8_encode(stripslashes(POST("userdata7"))), "userdata8" => utf8_encode(stripslashes(POST("userdata8"))), "userdata9" => utf8_encode(stripslashes(POST("userdata9"))), "filename" => POST("filename"), "username" => utf8_encode(POST("username")), "password" => POST("password")); $rule = new Directive_rule(POST('id'), POST('level'), "", $attributes); $file = $directive_editor->engine_path . "/" . POST('xml_file'); $directive_error = false; if (POST('from_directive') != "") { $new_id = $directive_editor->new_directive_id(POST('xml_file')); if ($new_id && intval($new_id) != intval(POST('directive_id'))) { $_POST['directive_id'] = intval($new_id); } $dom = $directive_editor->get_xml($file, "DOMXML"); $node = $dom->createElement('directive'); $node->setAttribute('id', POST('directive_id')); $node->setAttribute('name', POST('directive_name')); $node->setAttribute('priority', POST('directive_prio')); $dom->appendChild($node); if (!$directive_editor->save_xml($file, $dom, "DOMXML", false)) { // DTD Validation = false $directive_error = true; } else { $directive_editor->update_directive_pluginsid(POST('directive_id'), 2, POST('directive_prio'), POST('directive_name')); $directive_editor->update_directive_taxonomy(POST('directive_id'), POST('directive_intent'), POST('directive_strategy'), POST('directive_method'));