0) { foreach ($input_fields as $input_field) { /* save the data into the 'data_input_data' table */ $form_name = "value_" . $input_field["data_name"]; $form_value = $_POST[$form_name]; if (isset($_POST[$form_name])) { if ($input_field["allow_nulls"] == "on") { $allow_nulls = true; }elseif (empty($input_field["allow_nulls"])) { $allow_nulls = false; } /* run regexp match on input string */ $form_value = form_input_validate($form_value, $form_name, $input_field["regexp_match"], $allow_nulls, 3); /* make sure we don't overwrite 'host fields' */ if ((!is_error_message()) && ((empty($input_field["host_id"]) || (empty($input_field["type_code"]))))) { db_execute("replace into data_input_data (data_input_field_id,data_template_data_id,t_value,value) values (" . $input_field["id"] . "," . $_POST["data_template_data_id"] . ",'" . db_fetch_cell("select t_value from data_input_data where data_input_field_id=" . $input_field["id"] . " and data_template_data_id=" . $_POST["data_template_data_id"]) . "','$form_value')"); } } } } if ((read_config_option("full_view_data_source") == "") && (is_error_message())) { /* ds data edit page */ } } if ((is_error_message()) || ($_POST["data_template_id"] != $_POST["_data_template_id"]) || ($_POST["host_id"] != $_POST["_host_id"])) { header ("Location: data_sources.php?action=ds_edit&local_data_id=" . (empty($local_data_id) ? $_POST["local_data_id"] : $local_data_id) . "&host_id=" . $_POST["host_id"] . "&view_rrd=" . (isset($_POST["view_rrd"]) ? $_POST["view_rrd"] : "0")); }else{ header ("Location: data_sources.php"); } } /* -------------------------- Global Form Functions -------------------------- */ function draw_data_form_select($main_action) { global $colors; ?>