Skip to content
Snippets Groups Projects
Commit 98982c46 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #600 from greezybacon/issue/600


client email not being trimmed?

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents db68fe2d 9b89cd40
No related branches found
No related tags found
No related merge requests found
...@@ -1812,6 +1812,11 @@ class Ticket { ...@@ -1812,6 +1812,11 @@ class Ticket {
function create($vars, &$errors, $origin, $autorespond=true, $alertstaff=true) { function create($vars, &$errors, $origin, $autorespond=true, $alertstaff=true) {
global $ost, $cfg, $thisclient, $_FILES; global $ost, $cfg, $thisclient, $_FILES;
// Drop extra whitespace
foreach (array('email', 'phone', 'subject', 'name') as $f)
if (isset($vars[$f]))
$vars[$f] = trim($vars[$f]);
//Check for 403 //Check for 403
if ($vars['email'] && Validator::is_email($vars['email'])) { if ($vars['email'] && Validator::is_email($vars['email'])) {
......
...@@ -133,7 +133,7 @@ class Validator { ...@@ -133,7 +133,7 @@ class Validator {
/*** Functions below can be called directly without class instance. Validator::func(var..); ***/ /*** Functions below can be called directly without class instance. Validator::func(var..); ***/
function is_email($email) { function is_email($email) {
return (preg_match('/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i',trim(stripslashes($email)))); return preg_match('/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i',$email);
} }
function is_phone($phone) { function is_phone($phone) {
/* We're not really validating the phone number but just making sure it doesn't contain illegal chars and of acceptable len */ /* We're not really validating the phone number but just making sure it doesn't contain illegal chars and of acceptable len */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment