From 88570ae91923e251ce7189545ac4486b532023c4 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 9 Aug 2001 23:32:52 +0000 Subject: Moved smilies code into functions, would it be better in bbcode.php? git-svn-id: file:///svn/phpbb/trunk@828 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 02b5b25dee..5e9a6bebfc 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -623,7 +623,6 @@ function sync($type, $id) return(TRUE); } - function language_select($default, $dirname="language/") { global $phpEx; @@ -767,5 +766,39 @@ function tz_select($default) return($tz_select); } +// +// Smilies code ... would this be better tagged +// on to the end of bbcode.php? +// +function smilies_pass($message) +{ + global $db, $board_config; + static $smilies; + + if(empty($smilies)) + { + $sql = "SELECT code, smile_url + FROM " . SMILIES_TABLE; + if($result = $db->sql_query($sql)) + { + $smilies = $db->sql_fetchrowset($result); + } + } + + for($i = 0; $i < count($smilies); $i++) + { + $orig[] = "'([\s\.\>\ +\(])" . preg_quote($smilies[$i]['code']) . "([\<\s\\).\ +])'si"; + $repl[] = '\1' . $smilies[$i]['smile_url'] . '\2'; + } + + if($i > 0) + { + $message = preg_replace($orig, $repl, ' ' . $message . ' '); + $message = substr($message, 1, -1); + } + return($message); +} ?> \ No newline at end of file -- cgit v1.2.1