diff --git a/include/class.ticket.php b/include/class.ticket.php index 327560c551579d232ada7f16a1a833d2d0f9cc64..7fc660f7f37b5a2e8041dd06ad3957d25584b5b2 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1812,6 +1812,11 @@ class Ticket { function create($vars, &$errors, $origin, $autorespond=true, $alertstaff=true) { 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 if ($vars['email'] && Validator::is_email($vars['email'])) { diff --git a/include/class.validator.php b/include/class.validator.php index 611d8032fe921361dd9af5c09caea62a0198629e..91b0d3d64b9d15b808966cebef595fd2814b1c4a 100644 --- a/include/class.validator.php +++ b/include/class.validator.php @@ -133,7 +133,7 @@ class Validator { /*** Functions below can be called directly without class instance. Validator::func(var..); ***/ 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) { /* We're not really validating the phone number but just making sure it doesn't contain illegal chars and of acceptable len */