From c74d2538ec68fa1c6f3da6d26e31a09f2045557b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 21 Feb 2004 12:47:35 +0000 Subject: - put consoring and smilie processing into functions (we use them all over the place) for better changing and consistency. - changed docs/AUTHORS to reflect the recent code re-use in functions_messenger.php - pleasing the users a little bit more by using table constants. :D - login box if "mode" is not allowed -> posting (thought about trigger_error integration, but we do not need this that often). git-svn-id: file:///svn/phpbb/trunk@4836 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4390b1be36..1885a66d02 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1049,7 +1049,7 @@ function login_forum_box(&$forum_data) if ($password == $forum_data['forum_password']) { - $sql = 'INSERT INTO phpbb_forum_access (forum_id, user_id, session_id) + $sql = 'INSERT INTO ' . FORUMS_ACCESS_TABLE . ' (forum_id, user_id, session_id) VALUES (' . $forum_data['forum_id'] . ', ' . $user->data['user_id'] . ", '" . $db->sql_escape($user->session_id) . "')"; $db->sql_query($sql); @@ -1066,7 +1066,7 @@ function login_forum_box(&$forum_data) page_footer(); } -// Bump Topic Check - used by posting and viewtopic (do not want another included file) +// Bump Topic Check - used by posting and viewtopic function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster) { global $config, $auth, $user; @@ -1097,6 +1097,38 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po return $bump_time; } +// Censoring +function censor_text($text) +{ + global $censors, $user; + + if (!isset($censors)) + { + $censors = array(); + + // For ANONYMOUS, this option should be enabled by default + if ($user->optionget('viewcensors')) + { + obtain_word_list($censors); + } + } + + if (sizeof($censors) && $user->optionget('viewcensors')) + { + return preg_replace($censors['match'], $censors['replace'], $text); + } + + return $text; +} + +// Smilie processing +function smilie_text($text, $force_option = false) +{ + global $config, $user, $phpbb_root_path; + + return ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) ? preg_replace('#