if (POST("product") == "LIST") { $_POST["product"] = POST("product_list"); } ossim_valid(POST('plugin_id'), OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("plugin ID")); ossim_valid(POST("plugin_sid"), OSS_PLUGIN_SID, '_', '!', OSS_NULLABLE, 'illegal:' . _("plugin sid")); ossim_valid(POST("plugin_sid_list"), OSS_PLUGIN_SID_LIST, OSS_NULLABLE, 'illegal:' . _("plugin sid list")); ossim_valid(POST("product"), OSS_ALPHA, OSS_NULLABLE, ',', 'illegal:' . _("Product Type")); ossim_valid(POST("product_list"), OSS_DIGIT, OSS_NULLABLE, ',', 'illegal:' . _("Product Type")); ossim_valid(POST("category"), OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Category")); ossim_valid(POST("subcategory"), OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Subcategory")); ossim_valid(POST('type'), OSS_LETTER, OSS_NULLABLE, 'illegal:' . _("type")); if (ossim_error()) { die(ossim_error()); } $directive_editor = new Directive_editor($engine_id); $directive_editor->save_rule_attrib($rule_id, $directive_id, $xml_file, array("plugin_id", "type", "plugin_sid", "product", "category", "subcategory"), array(POST("plugin_id"), POST("type"), POST("plugin_sid"), POST("product"), POST("category"), POST("subcategory"))); ?> <script type="text/javascript"> var params = new Array(); params['xml'] = "<?php echo $xml_file; ?> "; params['directive'] = "<?php echo $directive_id; ?> "; params['reload'] = true; parent.GB_hide(params); </script><?php exit;
} elseif ($attrib == "password") { ossim_valid($value, OSS_NULLABLE, OSS_PASSWORD, 'illegal:' . _("password")); } elseif (preg_match("/^userdata\\d+\$/", $attrib)) { ossim_valid($value, OSS_NULLABLE, OSS_ALPHA, OSS_PUNC_EXT, 'illegal:' . _("userdata1")); } else { echo json_encode(array("error" => 1, "msg" => _("Attribute not found"), "current_value" => $current_value, "new_value" => $value)); exit; } if (ossim_error()) { echo json_encode(array("error" => 1, "msg" => ossim_get_error(), "current_value" => $current_value, "new_value" => $value)); exit; } elseif ($another_error != "") { echo json_encode(array("error" => 1, "msg" => $another_error, "current_value" => $current_value, "new_value" => $value)); exit; } if ($directive_editor->save_rule_attrib($rule, $dir_id, $file, $attrib, $value)) { if ($attrib == "password") { $value = preg_replace("/./", "*", $value); } // Hide password field if ($attrib == "timeout" && $value == "") { $value = "None"; } if ($attrib == "protocol" && $value == "") { $value = "ANY"; } echo json_encode(array("error" => 0, "msg" => _("File successfully updated"), "current_value" => $current_value, "new_value" => $value)); } else { if ($attrib == "password") { $current_value = preg_replace("/./", "*", $current_value); }
ossim_valid(GET("to_rep_min_rel"), OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("Reputation to min reliability")); if (ossim_error()) { die(ossim_error()); } // Secondary validation if (!Directive_editor::valid_directive_port(GET("port_from")) || !Directive_editor::valid_directive_port(GET("port_from_list"))) { $error = TRUE; $error_msg[] = _('Invalid source port value'); } if (!Directive_editor::valid_directive_port(GET("port_to")) || !Directive_editor::valid_directive_port(GET("port_to_list"))) { $error = TRUE; $error_msg[] = _('Invalid destination port value'); } if (!$error) { $directive_editor = new Directive_editor($engine_id); $directive_editor->save_rule_attrib($rule_id, $directive_id, $xml_file, array("from", "to", "port_from", "port_to", "from_rep", "to_rep", "from_rep_min_pri", "to_rep_min_pri", "from_rep_min_rel", "to_rep_min_rel"), array(GET('from'), GET('to'), GET('port_from'), GET('port_to'), GET('from_rep'), GET('to_rep'), GET('from_rep_min_pri'), GET('to_rep_min_pri'), GET('from_rep_min_rel'), GET('to_rep_min_rel'))); ?> <script type="text/javascript"> var params = new Array(); params['xml'] = "<?php echo $xml_file; ?> "; params['directive'] = "<?php echo $directive_id; ?> "; params['reload'] = true; parent.GB_hide(params); </script> <?php
ossim_valid($xml_file, OSS_ALPHA, OSS_DOT, OSS_SCORE, 'illegal:' . _("xml_file")); ossim_valid($engine_id, OSS_HEX, OSS_SCORE, 'illegal:' . _("Engine ID")); if (ossim_error()) { die(ossim_error()); } if (GET('mode') != "") { if (GET("sensor") == "LIST") { $_GET["sensor"] = GET("sensor_list"); } ossim_valid(GET("sensor_list"), OSS_HEX, ',', '-', OSS_NULLABLE, 'illegal:' . _("sensor list")); ossim_valid(GET("sensor"), OSS_SENSOR, OSS_NULLABLE, 'illegal:' . _("sensor")); if (ossim_error()) { die(ossim_error()); } $directive_editor = new Directive_editor($engine_id); $directive_editor->save_rule_attrib($rule_id, $directive_id, $xml_file, "sensor", GET('sensor')); ?> <script type="text/javascript"> var params = new Array(); params['xml'] = "<?php echo $xml_file; ?> "; params['directive'] = "<?php echo $directive_id; ?> "; params['reload'] = true; parent.GB_hide(params); </script> <?php