diff options
author | the_systech <the_systech@users.sourceforge.net> | 2001-08-28 14:33:28 +0000 |
---|---|---|
committer | the_systech <the_systech@users.sourceforge.net> | 2001-08-28 14:33:28 +0000 |
commit | fac05e46a99fdec9a6453792e0220d7f635b303c (patch) | |
tree | 9fb1e82d223d1b90eff4444bd70916fd45dd110a /phpBB/includes/functions.php | |
parent | f844ff63a65734fd69479301e05bb163316a3717 (diff) | |
download | forums-fac05e46a99fdec9a6453792e0220d7f635b303c.tar forums-fac05e46a99fdec9a6453792e0220d7f635b303c.tar.gz forums-fac05e46a99fdec9a6453792e0220d7f635b303c.tar.bz2 forums-fac05e46a99fdec9a6453792e0220d7f635b303c.tar.xz forums-fac05e46a99fdec9a6453792e0220d7f635b303c.zip |
addition for sorting smiley codes so that they all work properly on all DBMS's
The smiley functions should probably be moved to bbcode.php at some point
git-svn-id: file:///svn/phpbb/trunk@937 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 05f8f1e5af..1245e9f311 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -820,6 +820,11 @@ function tz_select($default) // Smilies code ... would this be better tagged // on to the end of bbcode.php? // +// Probably so and I'll move it before B2 +// The_Systech +// + + function smilies_pass($message) { global $db, $board_config; @@ -834,7 +839,7 @@ function smilies_pass($message) $smilies = $db->sql_fetchrowset($result); } } - + usort($smilies, 'smiley_sort'); for($i = 0; $i < count($smilies); $i++) { $orig[] = "'(?<=.\\W|\\W.|^\\W)" . preg_quote($smilies[$i]['code']) . "(?=.\\W|\\W.|\\W$)'i"; @@ -848,5 +853,12 @@ function smilies_pass($message) } return($message); } - +function smiley_sort($a, $b) +{ + if (strlen($a['code']) == strlen($b['code'])) + { + return 0; + } + return (strlen($a['code']) > strlen($b['code'])) ? -1 : 1; +} ?> |