aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-08-09 23:32:52 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-08-09 23:32:52 +0000
commit88570ae91923e251ce7189545ac4486b532023c4 (patch)
treec606a21647c9ceae5d9631d6c29e93d10606198d /phpBB/includes/functions.php
parent3ed35bfd6ff815a41c9365cac15ca67401f8c9fb (diff)
downloadforums-88570ae91923e251ce7189545ac4486b532023c4.tar
forums-88570ae91923e251ce7189545ac4486b532023c4.tar.gz
forums-88570ae91923e251ce7189545ac4486b532023c4.tar.bz2
forums-88570ae91923e251ce7189545ac4486b532023c4.tar.xz
forums-88570ae91923e251ce7189545ac4486b532023c4.zip
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
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php35
1 files changed, 34 insertions, 1 deletions
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<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $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