From cdedbccc6e3b78063ff0ec1299365ae128a059ae Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Fri, 22 Dec 2006 00:46:14 +0000 Subject: [PATCH] Bug #3511 - utf8 detection function in lancheck was causing apache to reset on some systems. --- e107_admin/lancheck.php | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/e107_admin/lancheck.php b/e107_admin/lancheck.php index cd10ee005..bb0ff2f88 100644 --- a/e107_admin/lancheck.php +++ b/e107_admin/lancheck.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/lancheck.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:33:23 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2006-12-22 00:46:14 $ +| $Author: e107coders $ | With code from Izydor and Lolo. +----------------------------------------------------------------------------+ */ @@ -628,25 +628,19 @@ function fill_phrases_array($data,$type) { return $retloc; } +//-------------------------------------------------------------------- -function is_utf8($string) { - // From http://w3.org/International/questions/qa-forms-utf-8.html - if(strtolower(CHARSET) != "utf-8" || $string == "") + +function is_utf8($str) { + /* + * @see http://hsivonen.iki.fi/php-utf8/ validation.php + */ + if(strtolower(CHARSET) != "utf-8" || $str == "") { return TRUE; } - return preg_match('%^(?: - [\x09\x0A\x0D\x20-\x7E] - | [\xC2-\xDF][\x80-\xBF] - | \xE0[\xA0-\xBF][\x80-\xBF] - | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} - | \xED[\x80-\x9F][\x80-\xBF] - | \xF0[\x90-\xBF][\x80-\xBF]{2} - | [\xF1-\xF3][\x80-\xBF]{3} - | \xF4[\x80-\x8F][\x80-\xBF]{2} - )*$%xs', $string); - + return (preg_match('/^.{1}/us',$str,$ar) == 1); }