From 0f21ea1e90cec450f78c46ed2ddf1b15b2126710 Mon Sep 17 00:00:00 2001 From: the_systech Date: Wed, 15 Aug 2001 15:51:02 +0000 Subject: [PATCH] Hurray the smilies code appears to work :) git-svn-id: file:///svn/phpbb/trunk@883 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e09b01c763..0912a24207 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -777,8 +777,9 @@ function smilies_pass($message) if(empty($smilies)) { - $sql = "SELECT code, smile_url - FROM " . SMILIES_TABLE; + $sql = "SELECT code, smile_url, LENGTH(code) as length + FROM " . SMILIES_TABLE . " + ORDER BY length DESC"; if($result = $db->sql_query($sql)) { $smilies = $db->sql_fetchrowset($result); @@ -787,7 +788,7 @@ function smilies_pass($message) for($i = 0; $i < count($smilies); $i++) { - $orig[] = "'\B" . preg_quote($smilies[$i]['code']) . "\B'sxi"; + $orig[] = "'(?<=.\\W|\\W.|^\\W)" . preg_quote($smilies[$i]['code']) . "(?=.\\W|\\W.|\\W$)'i"; $repl[] = '' . $smilies[$i]['smile_url'] . ''; }