diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2004-02-21 12:47:35 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-02-21 12:47:35 +0000 |
commit | c74d2538ec68fa1c6f3da6d26e31a09f2045557b (patch) | |
tree | be1c11d7d9e403c7b884c7d08e34111f0806d350 /phpBB/includes/functions.php | |
parent | 9c12fe83db3914b4e35bdcef75cc70e2f75044d6 (diff) | |
download | forums-c74d2538ec68fa1c6f3da6d26e31a09f2045557b.tar forums-c74d2538ec68fa1c6f3da6d26e31a09f2045557b.tar.gz forums-c74d2538ec68fa1c6f3da6d26e31a09f2045557b.tar.bz2 forums-c74d2538ec68fa1c6f3da6d26e31a09f2045557b.tar.xz forums-c74d2538ec68fa1c6f3da6d26e31a09f2045557b.zip |
- 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
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 36 |
1 files changed, 34 insertions, 2 deletions
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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $text); +} + // Error and message handler, call with trigger_error if reqd function msg_handler($errno, $msg_text, $errfile, $errline) { |