diff --git a/lib/functions/formfields/function.getFormFieldData.php b/lib/functions/formfields/function.getFormFieldData.php index fb298582..84903ae5 100644 --- a/lib/functions/formfields/function.getFormFieldData.php +++ b/lib/functions/formfields/function.getFormFieldData.php @@ -39,5 +39,5 @@ function getFormFieldData($fieldname, $fielddata, &$input) } } - return $newfieldvalue; + return trim($newfieldvalue); } diff --git a/lib/functions/validate/function.checkHostname.php b/lib/functions/validate/function.checkHostname.php index d12b404d..2c4ff585 100644 --- a/lib/functions/validate/function.checkHostname.php +++ b/lib/functions/validate/function.checkHostname.php @@ -17,8 +17,9 @@ function checkHostname($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { - if (0 == strlen(trim($newfieldvalue))) - { + if (0 == strlen(trim($newfieldvalue)) + || validateDomain($newfieldvalue) === false + ) { return array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'invalidhostname'); } else { return array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); diff --git a/lib/functions/validate/function.validateDomain.php b/lib/functions/validate/function.validateDomain.php index 52e39fb1..c0c372ae 100644 --- a/lib/functions/validate/function.validateDomain.php +++ b/lib/functions/validate/function.validateDomain.php @@ -22,7 +22,7 @@ * it consists only of the following characters ([a-z0-9][a-z0-9\-]+\.)+[a-z]{2,4} * * @param string The domainname which should be checked. - * @return boolean True if the domain is valid, false otherwise + * @return string|boolean the domain-name if the domain is valid, false otherwise * @author Florian Lippert * @author Michael Duergner *