@@ 1505-1532 (lines=28) @@ | ||
1502 | } |
|
1503 | ||
1504 | // Validate field (string). |
|
1505 | elseif ($field_type == FIELD_TYPE_STRING) |
|
1506 | { |
|
1507 | $regex_check = ustrcut($field['regex_check'], MAX_FIELD_REGEX); |
|
1508 | $regex_search = ustrcut($field['regex_search'], MAX_FIELD_REGEX); |
|
1509 | $regex_replace = ustrcut($field['regex_replace'], MAX_FIELD_REGEX); |
|
1510 | $param1 = ustrcut($field['length'], ustrlen(MAX_FIELD_STRING)); |
|
1511 | ||
1512 | switch (field_validate_string($field_name, $param1)) |
|
1513 | { |
|
1514 | case NO_ERROR: |
|
1515 | $default = ustrcut($field['default'], $param1); |
|
1516 | $default = (ustrlen($default) == 0) ? NULL : value_find_string($default); |
|
1517 | break; // nop |
|
1518 | case ERROR_INCOMPLETE_FORM: |
|
1519 | $error = get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID); |
|
1520 | return FALSE; |
|
1521 | case ERROR_INVALID_INTEGER_VALUE: |
|
1522 | $error = get_html_resource(RES_ALERT_INVALID_INTEGER_VALUE_ID); |
|
1523 | return FALSE; |
|
1524 | case ERROR_INTEGER_VALUE_OUT_OF_RANGE: |
|
1525 | $error = ustrprocess(get_html_resource(RES_ALERT_INTEGER_VALUE_OUT_OF_RANGE_ID), 1, MAX_FIELD_STRING); |
|
1526 | return FALSE; |
|
1527 | default: |
|
1528 | debug_write_log(DEBUG_WARNING, '[fields_import] Field validation failure (string).'); |
|
1529 | $error = get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID); |
|
1530 | return FALSE; |
|
1531 | } |
|
1532 | } |
|
1533 | ||
1534 | // Validate field (multilined). |
|
1535 | elseif ($field_type == FIELD_TYPE_MULTILINED) |
|
@@ 1535-1565 (lines=31) @@ | ||
1532 | } |
|
1533 | ||
1534 | // Validate field (multilined). |
|
1535 | elseif ($field_type == FIELD_TYPE_MULTILINED) |
|
1536 | { |
|
1537 | $regex_check = ustrcut($field['regex_check'], MAX_FIELD_REGEX); |
|
1538 | $regex_search = ustrcut($field['regex_search'], MAX_FIELD_REGEX); |
|
1539 | $regex_replace = ustrcut($field['regex_replace'], MAX_FIELD_REGEX); |
|
1540 | $param1 = ustrcut($field['length'], ustrlen(MAX_FIELD_MULTILINED)); |
|
1541 | ||
1542 | switch (field_validate_multilined($field_name, $param1)) |
|
1543 | { |
|
1544 | case NO_ERROR: |
|
1545 | if (isset($field->default)) |
|
1546 | { |
|
1547 | $default = ustrcut($field->default, $param1); |
|
1548 | $default = (ustrlen($default) == 0) ? NULL : value_find_multilined($default); |
|
1549 | } |
|
1550 | break; // nop |
|
1551 | case ERROR_INCOMPLETE_FORM: |
|
1552 | $error = get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID); |
|
1553 | return FALSE; |
|
1554 | case ERROR_INVALID_INTEGER_VALUE: |
|
1555 | $error = get_html_resource(RES_ALERT_INVALID_INTEGER_VALUE_ID); |
|
1556 | return FALSE; |
|
1557 | case ERROR_INTEGER_VALUE_OUT_OF_RANGE: |
|
1558 | $error = ustrprocess(get_html_resource(RES_ALERT_INTEGER_VALUE_OUT_OF_RANGE_ID), 1, MAX_FIELD_MULTILINED); |
|
1559 | return FALSE; |
|
1560 | default: |
|
1561 | debug_write_log(DEBUG_WARNING, '[fields_import] Field validation failure (multilined).'); |
|
1562 | $error = get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID); |
|
1563 | return FALSE; |
|
1564 | } |
|
1565 | } |
|
1566 | ||
1567 | // Validate field (check). |
|
1568 | elseif ($field_type == FIELD_TYPE_CHECKBOX) |