diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-12-17 00:46:54 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-12-17 00:46:54 +0000 |
commit | 4201b9af2ae3558782c009fe96e72f7ccc47c8e8 (patch) | |
tree | 666a379da735c42d1569c56e82ec07df6089be33 /phpBB/includes/functions.php | |
parent | 699a4ccaad96fdbecf37bb49fc69aab8b01a3413 (diff) | |
download | forums-4201b9af2ae3558782c009fe96e72f7ccc47c8e8.tar forums-4201b9af2ae3558782c009fe96e72f7ccc47c8e8.tar.gz forums-4201b9af2ae3558782c009fe96e72f7ccc47c8e8.tar.bz2 forums-4201b9af2ae3558782c009fe96e72f7ccc47c8e8.tar.xz forums-4201b9af2ae3558782c009fe96e72f7ccc47c8e8.zip |
Oops, another file I forgot to commit, perhaps I should commit myself ...
git-svn-id: file:///svn/phpbb/trunk@1617 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 96aa6c14b5..39ac46c59f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -833,15 +833,23 @@ function smilies_pass($message) global $db, $board_config; static $smilies; - if(empty($smilies)) + if( empty($smilies) ) { $sql = "SELECT code, smile_url FROM " . SMILIES_TABLE; - if($result = $db->sql_query($sql)) + if( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql); + } + + if( !$db->sql_numrows($result) ) { - $smilies = $db->sql_fetchrowset($result); + return $message; } + + $smilies = $db->sql_fetchrowset($result); } + usort($smilies, 'smiley_sort'); for($i = 0; $i < count($smilies); $i++) { @@ -849,20 +857,22 @@ function smilies_pass($message) $repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '" border="0">'; } - if($i > 0) + if( $i > 0 ) { $message = preg_replace($orig, $repl, ' ' . $message . ' '); $message = substr($message, 1, -1); } - return($message); + + return $message; } function smiley_sort($a, $b) { - if (strlen($a['code']) == strlen($b['code'])) + if ( strlen($a['code']) == strlen($b['code']) ) { return 0; } - return (strlen($a['code']) > strlen($b['code'])) ? -1 : 1; + + return ( strlen($a['code']) > strlen($b['code']) ) ? -1 : 1; } |