mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 22:41:59 +01:00
Fixed handling long emails
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
7d655b569d
commit
d38e5e281f
@ -843,6 +843,10 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
|
||||
public function fix_email_address_for_sphinx($email = '') {
|
||||
if(strlen($email) > MAX_EMAIL_LEN) {
|
||||
return md5($email . ' ');
|
||||
}
|
||||
|
||||
$email = preg_replace("/\|@/", "|", $email);
|
||||
return preg_replace("/[\@\.\+\-\_]/", "X", $email);
|
||||
}
|
||||
|
@ -147,16 +147,6 @@ function checkemail($email, $domains) {
|
||||
function validemail($email = '') {
|
||||
if($email == '') { return 0; }
|
||||
|
||||
// sphinxsearch supports tokens up to 41 characters long
|
||||
// If there's a longer token in the query, then sphinx
|
||||
// reports a query error even if the query is itself correct
|
||||
// So the workaround is to get rid of these email addresses
|
||||
if(strlen($email) > MAX_EMAIL_LEN) {
|
||||
$msg = sprintf("discarding email %s: longer than %d", $email, MAX_EMAIL_LEN);
|
||||
syslog(LOG_INFO, $msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(preg_match("/@local$/", $email)) { return 1; }
|
||||
|
||||
if(preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,10})$/', $email)) {
|
||||
|
Loading…
Reference in New Issue
Block a user