Commit 0bfbaafe authored by Marius Cramer's avatar Marius Cramer
Browse files

Added: new validator ISASCII to forbid non-ascii characters

parent 2ed8f05c
...@@ -511,6 +511,15 @@ class remoting_lib { ...@@ -511,6 +511,15 @@ class remoting_lib {
} }
} }
break; break;
case 'ISASCII':
if(preg_match("/[^\x20-\x7F]/", $field_value)) {
$errmsg = $validator['errmsg'];
if(isset($this->wordbook[$errmsg])) {
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
} else {
$this->errorMessage .= $errmsg."<br />\r\n";
}
}
case 'ISEMAIL': case 'ISEMAIL':
if(function_exists('filter_var')) { if(function_exists('filter_var')) {
if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) { if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
......
...@@ -845,6 +845,15 @@ class tform { ...@@ -845,6 +845,15 @@ class tform {
} }
} }
break; break;
case 'ISASCII':
if(preg_match("/[^\x20-\x7F]/", $field_value)) {
$errmsg = $validator['errmsg'];
if(isset($this->wordbook[$errmsg])) {
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
} else {
$this->errorMessage .= $errmsg."<br />\r\n";
}
}
case 'ISEMAIL': case 'ISEMAIL':
if(function_exists('filter_var')) { if(function_exists('filter_var')) {
if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) { if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
......
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