Commit 02f437a2 authored by Dries's avatar Dries

- Renamed 'validate_email_address' to 'valid_email_address'.

- Added a 'form_radio' function.
parent b7ddc3a4
......@@ -261,7 +261,7 @@ function table($header, $rows) {
*
* @param $mail a email address
*/
function validate_email_address($mail) {
function valid_email_address($mail) {
$user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+';
$domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+';
$ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}';
......@@ -767,6 +767,10 @@ function form_item($title, $value, $description = 0) {
return "<p>". ($title ? "<b>$title:</b><br />" : "") . $value . ($description ? "<br /><small><i>$description</i></small>" : "") ."</p>\n";
}
function form_radio($title, $name, $value = 1, $checked = 0, $description = 0) {
return form_item(0, "<input type=\"radio\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") ." /> $title", $description);
}
function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0) {
return form_hidden($name, 0) . form_item(0, "<input type=\"checkbox\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") ." /> $title", $description);
}
......
......@@ -182,7 +182,7 @@ function user_validate_name($name) {
function user_validate_mail($mail) {
if ($mail && !validate_email_address($mail)) {
if ($mail && !valid_email_address($mail)) {
return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail));
}
}
......
......@@ -182,7 +182,7 @@ function user_validate_name($name) {
function user_validate_mail($mail) {
if ($mail && !validate_email_address($mail)) {
if ($mail && !valid_email_address($mail)) {
return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment