[-] Core: fix regular expression patterns for some hosting which don't support unicode
This commit is contained in:
@@ -2247,6 +2247,18 @@ FileETag INode MTime Size
|
|||||||
else
|
else
|
||||||
return array_unique($array, SORT_REGULAR);
|
return array_unique($array, SORT_REGULAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete unicode class from regular expression patterns
|
||||||
|
* @param string $pattern
|
||||||
|
* @return pattern
|
||||||
|
*/
|
||||||
|
public static function cleanNonUnicodeSupport($pattern)
|
||||||
|
{
|
||||||
|
if (!defined('PREG_BAD_UTF8_OFFSET'))
|
||||||
|
return $pattern;
|
||||||
|
return preg_replace('/\\\[px]\{[a-z]\}{1,2}|(\/[a-z]*)u([a-z]*)$/i', "$1$2", $pattern);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isEmail($email)
|
public static function isEmail($email)
|
||||||
{
|
{
|
||||||
return !empty($email) && preg_match('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z0-9]+$/ui', $email);
|
return !empty($email) && preg_match(Tools::cleanNonUnicodeSupport('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z0-9]+$/ui'), $email);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +131,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isCarrierName($name)
|
public static function isCarrierName($name)
|
||||||
{
|
{
|
||||||
return empty($name) || preg_match('/^[^<>;=#{}]*$/u', $name);
|
return empty($name) || preg_match(Tools::cleanNonUnicodeSupport('/^[^<>;=#{}]*$/u'), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,7 +153,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isName($name)
|
public static function isName($name)
|
||||||
{
|
{
|
||||||
return preg_match('/^[^0-9!<>,;?=+()@#"°{}_$%:]*$/u', stripslashes($name));
|
return preg_match(Tools::cleanNonUnicodeSupport('/^[^0-9!<>,;?=+()@#"°{}_$%:]*$/u'), stripslashes($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -175,7 +175,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isMailName($mail_name)
|
public static function isMailName($mail_name)
|
||||||
{
|
{
|
||||||
return preg_match('/^[^<>;=#{}]*$/u', $mail_name);
|
return preg_match(Tools::cleanNonUnicodeSupport('/^[^<>;=#{}]*$/u'), $mail_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +186,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isMailSubject($mail_subject)
|
public static function isMailSubject($mail_subject)
|
||||||
{
|
{
|
||||||
return preg_match('/^[^<>]*$/u', $mail_subject);
|
return preg_match(Tools::cleanNonUnicodeSupport('/^[^<>]*$/u'), $mail_subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user