本文整理汇总了PHP中get_hash_data_input函数的典型用法代码示例。如果您正苦于以下问题:PHP get_hash_data_input函数的具体用法?PHP get_hash_data_input怎么用?PHP get_hash_data_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_hash_data_input函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_hash_version
function &data_query_to_xml($data_query_id) {
global $fields_data_query_edit, $fields_data_query_item_edit;
$hash["data_query"] = get_hash_version("data_query") . get_hash_data_query($data_query_id);
$xml_text = "";
$snmp_query = db_fetch_row("select * from snmp_query where id=$data_query_id");
$snmp_query_graph = db_fetch_assoc("select * from snmp_query_graph where snmp_query_id=$data_query_id");
if (empty($snmp_query["id"])) {
return "Invalid data query.";
}
$xml_text .= "<hash_" . $hash["data_query"] . ">\n";
/* XML Branch: <> */
reset($fields_data_query_edit);
while (list($field_name, $field_array) = each($fields_data_query_edit)) {
if (($field_name == "data_input_id") && (!empty($snmp_query{$field_name}))) {
$xml_text .= "\t<$field_name>hash_" . get_hash_version("data_input_method") . get_hash_data_input($snmp_query{$field_name}) . "</$field_name>\n";
}else{
if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden")) {
$xml_text .= "\t<$field_name>" . xml_character_encode($snmp_query{$field_name}) . "</$field_name>\n";
}
}
}
/* XML Branch: <graphs> */
$xml_text .= "\t<graphs>\n";
$i = 0;
if (sizeof($snmp_query_graph) > 0) {
foreach ($snmp_query_graph as $item) {
$hash["data_query_graph"] = get_hash_version("data_query_graph") . get_hash_data_query($item["id"], "data_query_graph");
$xml_text .= "\t\t<hash_" . $hash["data_query_graph"] . ">\n";
reset($fields_data_query_item_edit);
while (list($field_name, $field_array) = each($fields_data_query_item_edit)) {
if (($field_name == "graph_template_id") && (!empty($item{$field_name}))) {
$xml_text .= "\t\t\t<$field_name>hash_" . get_hash_version("graph_template") . get_hash_graph_template($item{$field_name}) . "</$field_name>\n";
}else{
if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden")) {
$xml_text .= "\t\t\t<$field_name>" . xml_character_encode($item{$field_name}) . "</$field_name>\n";
}
}
}
$snmp_query_graph_rrd_sv = db_fetch_assoc("select * from snmp_query_graph_rrd_sv where snmp_query_graph_id=" . $item["id"] . " order by sequence");
$snmp_query_graph_sv = db_fetch_assoc("select * from snmp_query_graph_sv where snmp_query_graph_id=" . $item["id"] . " order by sequence");
$snmp_query_graph_rrd = db_fetch_assoc("select * from snmp_query_graph_rrd where snmp_query_graph_id=" . $item["id"] . " and data_template_id > 0");
/* XML Branch: <graphs/rrd> */
$xml_text .= "\t\t\t<rrd>\n";
$i = 0;
if (sizeof($snmp_query_graph_rrd) > 0) {
foreach ($snmp_query_graph_rrd as $item2) {
$xml_text .= "\t\t\t\t<item_" . str_pad(strval($i), 3, "0", STR_PAD_LEFT) . ">\n";
$xml_text .= "\t\t\t\t\t<snmp_field_name>" . $item2{"snmp_field_name"} . "</snmp_field_name>\n";
$xml_text .= "\t\t\t\t\t<data_template_id>hash_" . get_hash_version("data_template") . get_hash_data_template($item2{"data_template_id"}) . "</data_template_id>\n";
$xml_text .= "\t\t\t\t\t<data_template_rrd_id>hash_" . get_hash_version("data_template_item") . get_hash_data_template($item2{"data_template_rrd_id"}, "data_template_item") . "</data_template_rrd_id>\n";
$xml_text .= "\t\t\t\t</item_" . str_pad(strval($i), 3, "0", STR_PAD_LEFT) . ">\n";
$i++;
}
}
$xml_text .= "\t\t\t</rrd>\n";
/* XML Branch: <graphs/sv_graph> */
$xml_text .= "\t\t\t<sv_graph>\n";
$j = 0;
if (sizeof($snmp_query_graph_sv) > 0) {
foreach ($snmp_query_graph_sv as $item2) {
$hash["data_query_sv_graph"] = get_hash_version("data_query_sv_graph") . get_hash_data_query($item2["id"], "data_query_sv_graph");
$xml_text .= "\t\t\t\t<hash_" . $hash["data_query_sv_graph"] . ">\n";
$xml_text .= "\t\t\t\t\t<field_name>" . xml_character_encode($item2{"field_name"}) . "</field_name>\n";
$xml_text .= "\t\t\t\t\t<sequence>" . $item2{"sequence"} . "</sequence>\n";
$xml_text .= "\t\t\t\t\t<text>" . xml_character_encode($item2{"text"}) . "</text>\n";
$xml_text .= "\t\t\t\t</hash_" . $hash["data_query_sv_graph"] . ">\n";
$j++;
}
}
$xml_text .= "\t\t\t</sv_graph>\n";
/* XML Branch: <graphs/sv_data_source> */
$xml_text .= "\t\t\t<sv_data_source>\n";
//.........这里部分代码省略.........
示例2: upgrade_to_0_8_4
//.........这里部分代码省略.........
db_execute("update snmp_query set hash='8ffa36c1864124b38bcda2ae9bd61f46' where id=6;");
db_execute("update snmp_query_graph set hash='a0b3e7b63c2e66f9e1ea24a16ff245fc' where id=15;");
db_execute("update snmp_query_graph_rrd_sv set hash='cb09784ba05e401a3f1450126ed1e395' where id=69;");
db_execute("update snmp_query_graph_sv set hash='f21b23df740bc4a2d691d2d7b1b18dba' where id=30;");
db_execute("update snmp_query set hash='30ec734bc0ae81a3d995be82c73f46c1' where id=7;");
db_execute("update snmp_query_graph set hash='f6db4151aa07efa401a0af6c9b871844' where id=17;");
db_execute("update snmp_query_graph_rrd_sv set hash='42277993a025f1bfd85374d6b4deeb60' where id=92;");
db_execute("update snmp_query_graph_sv set hash='d99f8db04fd07bcd2260d246916e03da' where id=40;");
db_execute("update snmp_query set hash='9343eab1f4d88b0e61ffc9d020f35414' where id=8;");
db_execute("update snmp_query_graph set hash='46c4ee688932cf6370459527eceb8ef3' where id=18;");
db_execute("update snmp_query_graph_rrd_sv set hash='a3f280327b1592a1a948e256380b544f' where id=93;");
db_execute("update snmp_query_graph_sv set hash='9852782792ede7c0805990e506ac9618' where id=38;");
db_execute("update snmp_query set hash='0d1ab53fe37487a5d0b9e1d3ee8c1d0d' where id=9;");
db_execute("update snmp_query_graph set hash='4a515b61441ea5f27ab7dee6c3cb7818' where id=19;");
db_execute("update snmp_query_graph_rrd_sv set hash='b5a724edc36c10891fa2a5c370d55b6f' where id=94;");
db_execute("update snmp_query_graph_sv set hash='fa2f07ab54fce72eea684ba893dd9c95' where id=39;");
db_execute("update host_template set hash='4855b0e3e553085ed57219690285f91f' where id=1;");
db_execute("update host_template set hash='07d3fe6a52915f99e642d22e27d967a4' where id=3;");
db_execute("update host_template set hash='4e5dc8dd115264c2e9f3adb725c29413' where id=4;");
db_execute("update host_template set hash='cae6a879f86edacb2471055783bec6d0' where id=5;");
db_execute("update host_template set hash='9ef418b4251751e09c3c416704b01b01' where id=6;");
db_execute("update host_template set hash='5b8300be607dce4f030b026a381b91cd' where id=7;");
db_execute("update host_template set hash='2d3e47f416738c2d22c87c40218cc55e' where id=8;");
db_execute("update rra set hash='c21df5178e5c955013591239eb0afd46' where id=1;");
db_execute("update rra set hash='0d9c0af8b8acdc7807943937b3208e29' where id=2;");
db_execute("update rra set hash='6fc2d038fb42950138b0ce3e9874cc60' where id=3;");
db_execute("update rra set hash='e36f3adb9f152adfa5dc50fd2b23337e' where id=4;");
$item = db_fetch_assoc("select id from cdef");
for ($i=0; $i<count($item); $i++) {
db_execute("update cdef set hash='" . get_hash_cdef($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
$item2 = db_fetch_assoc("select id from cdef_items where cdef_id=" . $item[$i]["id"]);
for ($j=0; $j<count($item2); $j++) {
db_execute("update cdef_items set hash='" . get_hash_cdef($item2[$j]["id"], "cdef_item") . "' where id=" . $item2[$j]["id"] . ";");
}
}
$item = db_fetch_assoc("select id from graph_templates_gprint");
for ($i=0; $i<count($item); $i++) {
db_execute("update graph_templates_gprint set hash='" . get_hash_gprint($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
}
$item = db_fetch_assoc("select id from data_input");
for ($i=0; $i<count($item); $i++) {
db_execute("update data_input set hash='" . get_hash_data_input($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
$item2 = db_fetch_assoc("select id from data_input_fields where data_input_id=" . $item[$i]["id"]);
for ($j=0; $j<count($item2); $j++) {
db_execute("update data_input_fields set hash='" . get_hash_data_input($item2[$j]["id"], "data_input_field") . "' where id=" . $item2[$j]["id"] . ";");
}
}
$item = db_fetch_assoc("select id from data_template");
for ($i=0; $i<count($item); $i++) {
db_execute("update data_template set hash='" . get_hash_data_template($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
$item2 = db_fetch_assoc("select id from data_template_rrd where data_template_id=" . $item[$i]["id"] . " and local_data_id=0");
for ($j=0; $j<count($item2); $j++) {
db_execute("update data_template_rrd set hash='" . get_hash_data_template($item2[$j]["id"], "data_template_item") . "' where id=" . $item2[$j]["id"] . ";");
}
}
$item = db_fetch_assoc("select id from graph_templates");
for ($i=0; $i<count($item); $i++) {
db_execute("update graph_templates set hash='" . get_hash_graph_template($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
$item2 = db_fetch_assoc("select id from graph_templates_item where graph_template_id=" . $item[$i]["id"] . " and local_graph_id=0");
for ($j=0; $j<count($item2); $j++) {
db_execute("update graph_templates_item set hash='" . get_hash_graph_template($item2[$j]["id"], "graph_template_item") . "' where id=" . $item2[$j]["id"] . ";");
}
$item2 = db_fetch_assoc("select id from graph_template_input where graph_template_id=" . $item[$i]["id"]);
for ($j=0; $j<count($item2); $j++) {
db_execute("update graph_template_input set hash='" . get_hash_graph_template($item2[$j]["id"], "graph_template_input") . "' where id=" . $item2[$j]["id"] . ";");
}
}
$item = db_fetch_assoc("select id from snmp_query");
for ($i=0; $i<count($item); $i++) {
db_execute("update snmp_query set hash='" . get_hash_data_query($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
$item2 = db_fetch_assoc("select id from snmp_query_graph where snmp_query_id=" . $item[$i]["id"]);
for ($j=0; $j<count($item2); $j++) {
db_execute("update snmp_query_graph set hash='" . get_hash_data_query($item2[$j]["id"], "data_query_graph") . "' where id=" . $item2[$j]["id"] . ";");
$item3 = db_fetch_assoc("select id from snmp_query_graph_rrd_sv where snmp_query_graph_id=" . $item2[$j]["id"]);
for ($k=0; $k<count($item3); $k++) {
db_execute("update snmp_query_graph_rrd_sv set hash='" . get_hash_data_query($item3[$k]["id"], "data_query_sv_data_source") . "' where id=" . $item3[$k]["id"] . ";");
}
$item3 = db_fetch_assoc("select id from snmp_query_graph_sv where snmp_query_graph_id=" . $item2[$j]["id"]);
for ($k=0; $k<count($item3); $k++) {
db_execute("update snmp_query_graph_sv set hash='" . get_hash_data_query($item3[$k]["id"], "data_query_sv_graph") . "' where id=" . $item3[$k]["id"] . ";");
}
}
}
$item = db_fetch_assoc("select id from host_template");
for ($i=0; $i<count($item); $i++) {
db_execute("update host_template set hash='" . get_hash_host_template($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
}
$item = db_fetch_assoc("select id from rra");
for ($i=0; $i<count($item); $i++) {
db_execute("update rra set hash='" . get_hash_round_robin_archive($item[$i]["id"]) . "' where id=" . $item[$i]["id"] . ";");
}
}
示例3: form_save
function form_save()
{
global $registered_cacti_names;
if (isset($_POST['save_component_data_input'])) {
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post('id'));
/* ==================================================== */
$save['id'] = $_POST['id'];
$save['hash'] = get_hash_data_input($_POST['id']);
$save['name'] = form_input_validate($_POST['name'], 'name', '', false, 3);
$save['input_string'] = form_input_validate($_POST['input_string'], 'input_string', '', true, 3);
$save['type_id'] = form_input_validate($_POST['type_id'], 'type_id', '', true, 3);
if (!is_error_message()) {
$data_input_id = sql_save($save, 'data_input');
if ($data_input_id) {
raise_message(1);
/* get a list of each field so we can note their sequence of occurance in the database */
if (!empty($_POST['id'])) {
db_execute_prepared('UPDATE data_input_fields SET sequence = 0 WHERE data_input_id = ?', array(get_request_var_post('id')));
generate_data_input_field_sequences($_POST['input_string'], $_POST['id']);
}
push_out_data_input_method($data_input_id);
} else {
raise_message(2);
}
}
header('Location: data_input.php?action=edit&id=' . (empty($data_input_id) ? $_POST['id'] : $data_input_id));
} elseif (isset($_POST['save_component_field'])) {
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post('id'));
input_validate_input_number(get_request_var_post('data_input_id'));
input_validate_input_regex(get_request_var_post('input_output'), '^(in|out)$');
/* ==================================================== */
$save['id'] = $_POST['id'];
$save['hash'] = get_hash_data_input($_POST['id'], 'data_input_field');
$save['data_input_id'] = $_POST['data_input_id'];
$save['name'] = form_input_validate($_POST['name'], 'name', '', false, 3);
$save['data_name'] = form_input_validate($_POST['data_name'], 'data_name', '', false, 3);
$save['input_output'] = $_POST['input_output'];
$save['update_rra'] = form_input_validate(isset($_POST['update_rra']) ? $_POST['update_rra'] : '', 'update_rra', '', true, 3);
$save['sequence'] = $_POST['sequence'];
$save['type_code'] = form_input_validate(isset($_POST['type_code']) ? $_POST['type_code'] : '', 'type_code', '', true, 3);
$save['regexp_match'] = form_input_validate(isset($_POST['regexp_match']) ? $_POST['regexp_match'] : '', 'regexp_match', '', true, 3);
$save['allow_nulls'] = form_input_validate(isset($_POST['allow_nulls']) ? $_POST['allow_nulls'] : '', 'allow_nulls', '', true, 3);
if (!is_error_message()) {
$data_input_field_id = sql_save($save, 'data_input_fields');
if ($data_input_field_id) {
raise_message(1);
if (!empty($data_input_field_id) && $_POST['input_output'] == 'in') {
generate_data_input_field_sequences(db_fetch_cell_prepared('SELECT input_string FROM data_input WHERE id = ?', array(get_request_var_post('data_input_id'))), get_request_var_post('data_input_id'));
}
} else {
raise_message(2);
}
}
if (is_error_message()) {
header('Location: data_input.php?action=field_edit&data_input_id=' . $_POST['data_input_id'] . '&id=' . (empty($data_input_field_id) ? $_POST['id'] : $data_input_field_id) . (!empty($_POST['input_output']) ? '&type=' . $_POST['input_output'] : ''));
} else {
header('Location: data_input.php?action=edit&id=' . $_POST['data_input_id']);
}
}
}
示例4: data_query_to_xml
function data_query_to_xml($data_query_id)
{
global $fields_data_query_edit, $fields_data_query_item_edit, $export_errors;
$hash["data_query"] = get_hash_version("data_query") . get_hash_data_query($data_query_id);
$xml_text = "";
$snmp_query = db_fetch_row("select * from snmp_query where id={$data_query_id}");
$snmp_query_graph = db_fetch_assoc("select * from snmp_query_graph where snmp_query_id={$data_query_id}");
if (empty($snmp_query["id"])) {
$export_errors++;
raise_message(28);
cacti_log("ERROR: Invalid Data Query found during Export. Please run database repair script to identify and/or correct.", false, "WEBUI");
return;
}
$xml_text .= "<hash_" . $hash["data_query"] . ">\n";
/* XML Branch: <> */
reset($fields_data_query_edit);
while (list($field_name, $field_array) = each($fields_data_query_edit)) {
if ($field_name == "data_input_id" && !empty($snmp_query[$field_name])) {
$xml_text .= "\t<{$field_name}>hash_" . get_hash_version("data_input_method") . get_hash_data_input($snmp_query[$field_name]) . "</{$field_name}>\n";
} else {
if ($field_array["method"] != "hidden_zero" && $field_array["method"] != "hidden") {
$xml_text .= "\t<{$field_name}>" . xml_character_encode($snmp_query[$field_name]) . "</{$field_name}>\n";
}
}
}
/* XML Branch: <graphs> */
$xml_text .= "\t<graphs>\n";
$i = 0;
if (sizeof($snmp_query_graph) > 0) {
foreach ($snmp_query_graph as $item) {
$hash["data_query_graph"] = get_hash_version("data_query_graph") . get_hash_data_query($item["id"], "data_query_graph");
$xml_text .= "\t\t<hash_" . $hash["data_query_graph"] . ">\n";
reset($fields_data_query_item_edit);
while (list($field_name, $field_array) = each($fields_data_query_item_edit)) {
if ($field_name == "graph_template_id" && !empty($item[$field_name])) {
$xml_text .= "\t\t\t<{$field_name}>hash_" . get_hash_version("graph_template") . get_hash_graph_template($item[$field_name]) . "</{$field_name}>\n";
} else {
if ($field_array["method"] != "hidden_zero" && $field_array["method"] != "hidden") {
$xml_text .= "\t\t\t<{$field_name}>" . xml_character_encode($item[$field_name]) . "</{$field_name}>\n";
}
}
}
$snmp_query_graph_rrd_sv = db_fetch_assoc("select * from snmp_query_graph_rrd_sv where snmp_query_graph_id=" . $item["id"] . " order by sequence");
$snmp_query_graph_sv = db_fetch_assoc("select * from snmp_query_graph_sv where snmp_query_graph_id=" . $item["id"] . " order by sequence");
$snmp_query_graph_rrd = db_fetch_assoc("select * from snmp_query_graph_rrd where snmp_query_graph_id=" . $item["id"] . " and data_template_id > 0");
/* XML Branch: <graphs/rrd> */
$xml_text .= "\t\t\t<rrd>\n";
$i = 0;
if (sizeof($snmp_query_graph_rrd) > 0) {
foreach ($snmp_query_graph_rrd as $item2) {
$xml_text .= "\t\t\t\t<item_" . str_pad(strval($i), 3, "0", STR_PAD_LEFT) . ">\n";
$xml_text .= "\t\t\t\t\t<snmp_field_name>" . $item2["snmp_field_name"] . "</snmp_field_name>\n";
$xml_text .= "\t\t\t\t\t<data_template_id>hash_" . get_hash_version("data_template") . get_hash_data_template($item2["data_template_id"]) . "</data_template_id>\n";
$xml_text .= "\t\t\t\t\t<data_template_rrd_id>hash_" . get_hash_version("data_template_item") . get_hash_data_template($item2["data_template_rrd_id"], "data_template_item") . "</data_template_rrd_id>\n";
$xml_text .= "\t\t\t\t</item_" . str_pad(strval($i), 3, "0", STR_PAD_LEFT) . ">\n";
$i++;
}
}
$xml_text .= "\t\t\t</rrd>\n";
/* XML Branch: <graphs/sv_graph> */
$xml_text .= "\t\t\t<sv_graph>\n";
$j = 0;
if (sizeof($snmp_query_graph_sv) > 0) {
foreach ($snmp_query_graph_sv as $item2) {
$hash["data_query_sv_graph"] = get_hash_version("data_query_sv_graph") . get_hash_data_query($item2["id"], "data_query_sv_graph");
$xml_text .= "\t\t\t\t<hash_" . $hash["data_query_sv_graph"] . ">\n";
$xml_text .= "\t\t\t\t\t<field_name>" . xml_character_encode($item2["field_name"]) . "</field_name>\n";
$xml_text .= "\t\t\t\t\t<sequence>" . $item2["sequence"] . "</sequence>\n";
$xml_text .= "\t\t\t\t\t<text>" . xml_character_encode($item2["text"]) . "</text>\n";
$xml_text .= "\t\t\t\t</hash_" . $hash["data_query_sv_graph"] . ">\n";
$j++;
}
}
$xml_text .= "\t\t\t</sv_graph>\n";
/* XML Branch: <graphs/sv_data_source> */
$xml_text .= "\t\t\t<sv_data_source>\n";
$j = 0;
if (sizeof($snmp_query_graph_rrd_sv) > 0) {
foreach ($snmp_query_graph_rrd_sv as $item2) {
$hash["data_query_sv_data_source"] = get_hash_version("data_query_sv_data_source") . get_hash_data_query($item2["id"], "data_query_sv_data_source");
$xml_text .= "\t\t\t\t<hash_" . $hash["data_query_sv_data_source"] . ">\n";
$xml_text .= "\t\t\t\t\t<field_name>" . xml_character_encode($item2["field_name"]) . "</field_name>\n";
$xml_text .= "\t\t\t\t\t<data_template_id>hash_" . get_hash_version("data_template") . get_hash_data_template($item2["data_template_id"]) . "</data_template_id>\n";
$xml_text .= "\t\t\t\t\t<sequence>" . $item2["sequence"] . "</sequence>\n";
$xml_text .= "\t\t\t\t\t<text>" . xml_character_encode($item2["text"]) . "</text>\n";
$xml_text .= "\t\t\t\t</hash_" . $hash["data_query_sv_data_source"] . ">\n";
$j++;
}
}
$xml_text .= "\t\t\t</sv_data_source>\n";
$xml_text .= "\t\t</hash_" . $hash["data_query_graph"] . ">\n";
$i++;
}
}
$xml_text .= "\t</graphs>\n";
$xml_text .= "</hash_" . $hash["data_query"] . ">";
return $xml_text;
}
示例5: form_save
function form_save()
{
global $registered_cacti_names;
if (isset($_POST["save_component_data_input"])) {
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("id"));
/* ==================================================== */
$save["id"] = $_POST["id"];
$save["hash"] = get_hash_data_input($_POST["id"]);
$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
$save["input_string"] = form_input_validate($_POST["input_string"], "input_string", "", true, 3);
$save["type_id"] = form_input_validate($_POST["type_id"], "type_id", "", true, 3);
if (!is_error_message()) {
$data_input_id = sql_save($save, "data_input");
if ($data_input_id) {
raise_message(1);
/* get a list of each field so we can note their sequence of occurance in the database */
if (!empty($_POST["id"])) {
db_execute("update data_input_fields set sequence=0 where data_input_id=" . $_POST["id"]);
generate_data_input_field_sequences($_POST["input_string"], $_POST["id"]);
}
push_out_data_input_method($data_input_id);
} else {
raise_message(2);
}
}
if (is_error_message() || empty($_POST["id"])) {
header("Location: data_input.php?action=edit&id=" . (empty($data_input_id) ? $_POST["id"] : $data_input_id));
} else {
header("Location: data_input.php");
}
} elseif (isset($_POST["save_component_field"])) {
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("id"));
input_validate_input_number(get_request_var_post("data_input_id"));
input_validate_input_regex(get_request_var_post("input_output"), "^(in|out)\$");
/* ==================================================== */
$save["id"] = $_POST["id"];
$save["hash"] = get_hash_data_input($_POST["id"], "data_input_field");
$save["data_input_id"] = $_POST["data_input_id"];
$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
$save["data_name"] = form_input_validate($_POST["data_name"], "data_name", "", false, 3);
$save["input_output"] = $_POST["input_output"];
$save["update_rra"] = form_input_validate(isset($_POST["update_rra"]) ? $_POST["update_rra"] : "", "update_rra", "", true, 3);
$save["sequence"] = $_POST["sequence"];
$save["type_code"] = form_input_validate(isset($_POST["type_code"]) ? $_POST["type_code"] : "", "type_code", "", true, 3);
$save["regexp_match"] = form_input_validate(isset($_POST["regexp_match"]) ? $_POST["regexp_match"] : "", "regexp_match", "", true, 3);
$save["allow_nulls"] = form_input_validate(isset($_POST["allow_nulls"]) ? $_POST["allow_nulls"] : "", "allow_nulls", "", true, 3);
if (!is_error_message()) {
$data_input_field_id = sql_save($save, "data_input_fields");
if ($data_input_field_id) {
raise_message(1);
if (!empty($data_input_field_id) && $_POST["input_output"] == "in") {
generate_data_input_field_sequences(db_fetch_cell("select input_string from data_input where id=" . $_POST["data_input_id"]), $_POST["data_input_id"]);
}
} else {
raise_message(2);
}
}
if (is_error_message()) {
header("Location: data_input.php?action=field_edit&data_input_id=" . $_POST["data_input_id"] . "&id=" . (empty($data_input_field_id) ? $_POST["id"] : $data_input_field_id) . (!empty($_POST["input_output"]) ? "&type=" . $_POST["input_output"] : ""));
} else {
header("Location: data_input.php?action=edit&id=" . $_POST["data_input_id"]);
}
}
}