1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 19:24:01 +02:00

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
This commit is contained in:
Paul S. Owen
2001-08-09 23:32:52 +00:00
parent 3ed35bfd6f
commit 88570ae919
2 changed files with 34 additions and 38 deletions

View File

@@ -25,43 +25,6 @@ include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
//
// Start functions
//
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);
}
//
// End functions
//
//
// Start initial var setup
//