From b15f4aca1615ce06a298b00f8b2dfa87b069a53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 23 Dec 2011 20:28:09 +0100 Subject: [PATCH] Use Regex-class --- file/lib/util/ChatUtil.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index 85cddc2..1b4cc64 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -72,7 +72,10 @@ public static function str_split($string, $length = 1) { * @return integer */ public static function timeModifier($time) { - preg_match_all('!([0-9]+[s|h|d|w|m|y]?)!i', $time, $matches); + $regex = new \wcf\system\Regex('([0-9]+[s|h|d|w|m|y]?)', \wcf\system\Regex::CASE_INSENSITIVE); + if (!$regex->match($time, true)) return 0; + $matches = $regex->getMatches(); + $result = 0; foreach ($matches[1] as $time) { // 60 seconds a minute