diff --git a/phpBB/adm/admin_profile.php b/phpBB/adm/admin_profile.php index 2d51219058..999a63dd1b 100644 --- a/phpBB/adm/admin_profile.php +++ b/phpBB/adm/admin_profile.php @@ -125,7 +125,7 @@ $cp = new custom_profile_admin(); // Based on this, we decide which elements need to be edited later and which language items are missing $lang_ids = $lang_entry = $lang_diff = array(); -$result = $db->sql_query('SELECT lang_id FROM phpbb_lang'); +$result = $db->sql_query('SELECT lang_id FROM ' . LANG_TABLE); while ($row = $db->sql_fetchrow($result)) { @@ -592,7 +592,7 @@ if ($mode == 'delete') $db->sql_query('DELETE FROM phpbb_profile_fields WHERE field_id = ' . $field_id); $db->sql_query('DELETE FROM phpbb_profile_fields_lang WHERE field_id = ' . $field_id); $db->sql_query('DELETE FROM phpbb_profile_lang WHERE field_id = ' . $field_id); - $db->sql_query('ALTER TABLE phpbb_profile_fields_data DROP ' . $field_ident); + $db->sql_query('ALTER TABLE ' . CUSTOM_PROFILE_DATA . ' DROP ' . $field_ident); $order = 0; @@ -633,7 +633,10 @@ if ($mode == 'activate') trigger_error('INVALID_MODE'); } - $result = $db->sql_query("SELECT lang_id FROM phpbb_lang WHERE lang_iso = '" . $config['default_lang'] . "'"); + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '{$config['default_lang']}'"; + $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result); $db->sql_freeresult($result); @@ -754,7 +757,9 @@ function build_language_options($field_type, $mode = 'new') { global $user, $config, $db, $cp; - $sql = 'SELECT lang_id, lang_iso FROM phpbb_lang' . (($mode == 'new') ? " WHERE lang_iso <> '" . $config['default_lang'] . "'" : ''); + $sql = 'SELECT lang_id, lang_iso + FROM ' . LANG_TABLE . + (($mode == 'new') ? " WHERE lang_iso <> '" . $config['default_lang'] . "'" : ''); $result = $db->sql_query($sql); $languages = array(); @@ -858,7 +863,10 @@ function save_profile_field($field_type, $field_ident) // Collect all informations, if something is going wrong, abort the operation $profile_sql = $profile_lang = $empty_lang = $profile_lang_fields = array(); - $result = $db->sql_query("SELECT lang_id FROM phpbb_lang WHERE lang_iso = '" . $config['default_lang'] . "'"); + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . ' + WHERE lang_iso = '" . $config['default_lang'] . "'"; + $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result); $db->sql_freeresult($result); @@ -888,7 +896,7 @@ function save_profile_field($field_type, $field_ident) $field_id = $db->sql_nextid(); - $sql = "ALTER TABLE phpbb_profile_fields_data ADD $field_ident "; + $sql = 'ALTER TABLE ' . CUSTOM_PROFILE_DATA . " ADD $field_ident "; switch ($field_type) { case FIELD_STRING: diff --git a/phpBB/adm/admin_users.php b/phpBB/adm/admin_users.php index 4dac8f1673..9cefdaeb78 100644 --- a/phpBB/adm/admin_users.php +++ b/phpBB/adm/admin_users.php @@ -614,7 +614,7 @@ if ($submit || $preview || $deleteall || $deletemark) // Update Custom Fields if (sizeof($cp_data)) { - $sql = 'UPDATE phpbb_profile_fields_data + $sql = 'UPDATE ' . CUSTOM_PROFILE_DATA . ' SET ' . $db->sql_build_array('UPDATE', $cp_data) . " WHERE user_id = $user_id"; $db->sql_query($sql); @@ -1557,15 +1557,15 @@ function marklist(match, status) // If we allow users to disable display of emoticons // we'll need an appropriate check and preg_replace here - $signature_preview = (empty($enable_smilies) || empty($config['allow_smilies'])) ? preg_replace('#(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature_preview . '<'), 1, -1)); - } + }*/ - $signature_preview = str_replace("\n", '
', $signature_preview); + $signature_preview = str_replace("\n", '
', censor_text($signature_preview)); } decode_text($user_sig, $user_sig_bbcode_uid); diff --git a/phpBB/adm/admin_words.php b/phpBB/adm/admin_words.php index e2f629290d..c53acc58dd 100644 --- a/phpBB/adm/admin_words.php +++ b/phpBB/adm/admin_words.php @@ -1,23 +1,15 @@ acl_get('a_words')) trigger_error($user->lang['NO_ADMIN']); } -// What do we want to do? -if (isset($_REQUEST['mode'])) +$mode = request_var('mode', ''); +$mode = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $mode); + +$s_hidden_fields = ''; +$word_info = array(); + +switch ($mode) { - $mode = $_REQUEST['mode']; -} -else -{ - // These could be entered via a form button - if (isset($_POST['add'])) - { - $mode = 'add'; - } - else if (isset($_POST['save'])) - { - $mode = 'save'; - } - else - { - $mode = ''; - } -} + case 'edit': + $word_id = request_var('id', 0); + + if (!$word_id) + { + trigger_error($user->lang['NO_WORD']); + } -if ($mode != '') -{ - switch ($mode) - { - case 'edit': - case 'add': - $word_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; + $sql = 'SELECT * + FROM ' . WORDS_TABLE . " + WHERE word_id = $word_id"; + $result = $db->sql_query_limit($sql, 1); - $s_hidden_fields = ''; - if ($mode == 'edit') - { - if (!$word_id) - { - trigger_error($user->lang['NO_WORD']); - } + $word_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - $sql = "SELECT * - FROM " . WORDS_TABLE . " - WHERE word_id = $word_id"; - $result = $db->sql_query($sql); + $s_hidden_fields .= ''; - $word_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $s_hidden_fields .= ''; - } - - adm_page_header($user->lang['WORDS_TITLE']); + case 'add': + adm_page_header($user->lang['WORDS_TITLE']); ?>

lang['WORDS_TITLE']; ?>

@@ -104,11 +74,11 @@ if ($mode != '') lang['EDIT_WORD']; ?> - lang['WORD']; ?> + lang['WORD']; ?>: - lang['REPLACEMENT']; ?> + lang['REPLACEMENT']; ?>: @@ -122,11 +92,11 @@ if ($mode != '') break; case 'save': - $word_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0; - $word = (isset($_POST['word'])) ? trim($_POST['word']) : ''; - $replacement = (isset($_POST['replacement'])) ? trim($_POST['replacement']) : ''; + $word_id = request_var('id', 0); + $word = request_var('word', ''); + $replacement = request_var('replacement', ''); - if ($word == '' || $replacement == '') + if (!$word || !$replacement) { trigger_error($user->lang['ENTER_WORD']); } @@ -140,20 +110,19 @@ if ($mode != '') add_log('admin', $log_action, stripslashes($word)); $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; + trigger_error($message); break; case 'delete': - if (isset($_POST['id']) || isset($_GET['id'])) - { - $word_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']); - } - else + $word_id = request_var('id', 0); + + if (!$word_id) { trigger_error($user->lang['NO_WORD']); } - $sql = "DELETE FROM " . WORDS_TABLE . " + $sql = 'DELETE FROM ' . WORDS_TABLE . " WHERE word_id = $word_id"; $db->sql_query($sql); @@ -162,18 +131,13 @@ if ($mode != '') add_log('admin', 'log_delete_word'); $message = $user->lang['WORD_REMOVE']; + trigger_error($message); + break; - } - - trigger_error($message); - -} -else -{ - - adm_page_header($user->lang['WORDS_TITLE']); + default: + adm_page_header($user->lang['WORDS_TITLE']); ?>

lang['WORDS_TITLE']; ?>

@@ -189,16 +153,16 @@ else sql_query($sql); + $sql = 'SELECT * + FROM ' . WORDS_TABLE . ' + ORDER BY word'; + $result = $db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) - { - do + if ($row = $db->sql_fetchrow($result)) { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + do + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; ?> @@ -209,10 +173,10 @@ else sql_fetchrow($result)); } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); + $db->sql_freeresult($result); ?> @@ -222,8 +186,8 @@ else \ No newline at end of file diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index db61ce87d4..3a12f772b8 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -28,3 +28,6 @@ Smarty GPL licenced: phpMyAdmin © 2001,2003 phpMyAdmin Devel team, http://www.phpmyadmin.net/ Jabber class © 2003 Carlo Zottmann, http://phpjabber.g-blog.net + +PHP License, version 3.0: +Pear © 2001-2004 PHP Group, http://pear.php.net \ No newline at end of file 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('#optionget('viewcensors')) - { - obtain_word_list($censors); - } - switch ($mode) { case 'admin': @@ -1824,11 +1818,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id { foreach ($log_data_ary as $log_data) { - if (sizeof($censors) && $user->optionget('viewcensors')) - { - $log_data = preg_replace($censors['match'], $censors['replace'], $log_data); - } - $log_data = str_replace("\n", '
', $log_data); + $log_data = str_replace("\n", '
', censor_text($log_data)); $log[$i]['action'] = preg_replace('#%s#', $log_data, $log[$i]['action'], 1); } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3f0bee5d39..dc86e48ec9 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -334,7 +334,7 @@ function display_forums($root_data = '', $display_moderators = TRUE) function display_attachments($blockname, $attachment_data, &$update_count, $force_physical = false, $return = false) { global $extensions, $template, $cache, $attachment_tpl; - global $config, $user, $phpbb_root_path, $phpEx, $SID, $censors; + global $config, $user, $phpbb_root_path, $phpEx, $SID; // $starttime = explode(' ', microtime()); // $starttime = $starttime[1] + $starttime[0]; @@ -377,12 +377,6 @@ function display_attachments($blockname, $attachment_data, &$update_count, $forc } } - if (empty($censors)) - { - $censors = array(); - obtain_word_list($censors); - } - if (empty($extensions) || !is_array($extensions)) { $extensions = array(); @@ -413,7 +407,7 @@ function display_attachments($blockname, $attachment_data, &$update_count, $forc $filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize); $display_name = $attachment['real_filename']; - $comment = (sizeof($censors)) ? preg_replace($censors['match'], $censors['replace'], str_replace("\n", '
', $attachment['comment'])) : str_replace("\n", '
', $attachment['comment']); + $comment = str_replace("\n", '
', censor_text($attachment['comment'])); $denied = FALSE; diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index d758539bae..89e192a6e0 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -810,6 +810,8 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '', $log return true; } +// SMTP Class +// Auth Mechanisms originally taken from the AUTH Modules found within the PHP Extension and Application Repository (PEAR) class smtp_class { var $server_response = ''; @@ -1099,7 +1101,7 @@ class smtp_class $md5_challenge = base64_decode($this->responses[0]); - // Parse the md5 challenge - from PEAR + // Parse the md5 challenge - from AUTH_SASL (PEAR) $tokens = array(); while (preg_match('/^([a-z-]+)=("[^"]+(?bbcode_second_pass($message, $uid); // If we allow users to disable display of emoticons we'll need an appropriate // check and preg_replace here - $message = (!$smilies || !$config['allow_smilies']) ? preg_replace('#(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $message . '<'), 1, -1)); - } - - $message = str_replace("\n", '
', $message); + }*/ + $message = str_replace("\n", '
', censor_text($message)); // Signature if ($sig && $config['allow_sig'] && $signature && $auth->acl_get('f_sigs', $forum_id)) @@ -114,15 +113,13 @@ function format_display(&$message, &$signature, $uid, $siguid, $html, $bbcode, $ $signature = trim($signature); $bbcode->bbcode_second_pass($signature, $siguid); + $signature = smilie_text($signature); - $signature = (!$config['allow_smilies']) ? preg_replace('#(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature . '<'), 1, -1)); - } - - $signature = str_replace("\n", '
', $signature); + }*/ + $signature = str_replace("\n", '
', censor_text($signature)); } else { diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index d59a150db3..c706508c52 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -568,7 +568,10 @@ class custom_profile_admin extends custom_profile { global $user, $config, $db; - $result = $db->sql_query("SELECT lang_id FROM phpbb_lang WHERE lang_iso = '" . $config['default_lang'] . "'"); + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $config['default_lang'] . "'"; + $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result); $db->sql_freeresult($result); @@ -602,7 +605,10 @@ class custom_profile_admin extends custom_profile { global $user, $config, $db; - $result = $db->sql_query("SELECT lang_id FROM phpbb_lang WHERE lang_iso = '" . $config['default_lang'] . "'"); + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $config['default_lang'] . "'"; + $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result); $db->sql_freeresult($result); @@ -639,7 +645,10 @@ class custom_profile_admin extends custom_profile { global $user, $config, $db; - $result = $db->sql_query("SELECT lang_id FROM phpbb_lang WHERE lang_iso = '" . $config['default_lang'] . "'"); + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $config['default_lang'] . "'"; + $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result); $db->sql_freeresult($result); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 3f7b752c26..d9b88eca67 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -349,10 +349,6 @@ class mcp_main extends mcp )); - // Define censored word matches - $censors = array(); - obtain_word_list($censors); - $topic_rows = array(); // TODO: no global announcements here @@ -438,12 +434,8 @@ class mcp_main extends mcp $topic_type .= $user->lang['VIEW_TOPIC_POLL'] . ' '; } - $topic_title = $row['topic_title']; - if (count($censors['match'])) - { - $topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title); - } - + $topic_title = censor_text($row['topic_title']); + $template->assign_block_vars('topicrow', array( 'U_VIEW_TOPIC' => "mcp.$phpEx$SID&t=" . $row['topic_id'] . '&mode=topic_view', @@ -841,7 +833,7 @@ class mcp_main extends mcp $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); } - $message = (empty($config['allow_smilies']) || !$user->data['user_viewsmilies']) ? preg_replace('##', '\1', $message) : str_replace('assign_vars(array( 'S_MCP_ACTION' => $this->url . '&mode=modoptions', diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index d6c561f872..81700c7415 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -622,9 +622,9 @@ class user extends session $this->lang_name = $config['default_lang']; } - $sql = "SELECT lang_id - FROM phpbb_lang - WHERE lang_iso = '" . $this->lang_name . "'"; + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '{$this->lang_name}'"; $result = $db->sql_query($sql); return (int) $db->sql_fetchfield('lang_id', 0, $result); @@ -640,9 +640,8 @@ class user extends session return; } - $sql = 'SELECT * FROM - phpbb_profile_fields_data - WHERE user_id = ' . $user_id; + $sql = 'SELECT * FROM ' . CUSTOM_PROFILE_DATA . " + WHERE user_id = $user_id"; $result = $db->sql_query_limit($sql, 1); $user->profile_fields = (!($row = $db->sql_fetchrow($result))) ? array() : $row; diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index 43d04eda4a..0667f4dfa9 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -15,7 +15,7 @@ class ucp_activate extends module { function ucp_activate($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; $user_id = request_var('u', 0); $key = request_var('k', ''); diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index 2d44fc943a..cec4e18be1 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -22,7 +22,7 @@ class ucp_confirm extends module { function ucp_confirm($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; // Do we have an id? No, then just exit if (empty($_GET['id'])) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 96eddfe3de..c7783b88b9 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -15,7 +15,7 @@ class ucp_main extends module { function ucp_main($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; switch ($mode) { @@ -127,7 +127,7 @@ class ucp_main extends module 'TOPIC_ID' => $topic_id, 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_POST_AUTHOR' => $last_post_author, - 'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'], + 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'LAST_POST_IMG' => $last_post_img, @@ -483,7 +483,7 @@ class ucp_main extends module 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_POST_AUTHOR' => $last_post_author, 'GOTO_PAGE' => $goto_page, - 'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'], + 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'LAST_POST_IMG' => $last_post_img, diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 11efb5a64d..c2ebef5438 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -15,7 +15,7 @@ class ucp_prefs extends module { function ucp_prefs($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; $submit = (isset($_POST['submit'])) ? true : false; $error = $data = array(); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 4e7ccc7d23..fcfbd8336d 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -15,7 +15,7 @@ class ucp_profile extends module { function ucp_profile($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; $preview = (!empty($_POST['preview'])) ? true : false; $submit = (!empty($_POST['submit'])) ? true : false; @@ -420,18 +420,16 @@ class ucp_profile extends module $bbcode->bbcode_second_pass($signature_preview, $message_parser->bbcode_uid); } - // If we allow users to disable display of emoticons // we'll need an appropriate check and preg_replace here - $signature_preview = (empty($enable_smilies) || empty($config['allow_smilies'])) ? preg_replace('#(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature_preview . '<'), 1, -1)); - } - - $signature_preview = str_replace("\n", '
', $signature_preview); + }*/ + $signature_preview = str_replace("\n", '
', censor_text($signature_preview)); } $html_status = ($config['allow_html']) ? true : false; diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index b0440cedad..c1da4aa0a5 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -15,7 +15,7 @@ class ucp_register extends module { function ucp_register($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; // if ($config['require_activation'] == USER_ACTIVATION_DISABLE) @@ -200,7 +200,7 @@ class ucp_register extends module if (sizeof($cp_data)) { $cp_data['user_id'] = (int) $user_id; - $sql = 'INSERT INTO phpbb_profile_fields_data ' . $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data)); + $sql = 'INSERT INTO ' CUSTOM_PROFILE_DATA . ' ' . $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data)); $db->sql_query($sql); } diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 80b863b321..f119633c82 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -15,7 +15,7 @@ class ucp_remind extends module { function ucp_remind($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; $submit = (isset($_POST['submit'])) ? true : false; diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 9807837729..c599effe38 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -15,7 +15,7 @@ class ucp_zebra extends module { function ucp_zebra($id, $mode) { - global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; $submit = (!empty($_POST['submit']) || !empty($_GET['add'])) ? true : false; diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index e208533d59..d95222fbbb 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -335,7 +335,7 @@ switch ($mode) if ($member['user_sig']) { - $member['user_sig'] = ($config['allow_smilies']) ? preg_replace('#bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); } - $message = (!$row['enable_smilies'] || !$config['allow_smilies']) ? preg_replace('#' . $user->lang['KARMA_LEVEL'] . ': ' . $user->lang['KARMA'][$row['user_karma']] . '', diff --git a/phpBB/search.php b/phpBB/search.php index 6cbf4d4208..803444c376 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -584,9 +584,8 @@ if ($search_keywords || $search_author || $search_id) $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; // Grab icons - $icons = $censors = array(); + $icons = array(); obtain_icons($icons); - obtain_word_list($censors); // Output header $l_search_matches = ($total_match_count == 1) ? sprintf($user->lang['FOUND_SEARCH_MATCH'], $total_match_count) : sprintf($user->lang['FOUND_SEARCH_MATCHES'], $total_match_count); @@ -733,10 +732,11 @@ if ($search_keywords || $search_author || $search_id) continue; } - if (!empty($censors)) +/* if (!empty($censors)) { $row['post_text'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $row['post_text'] . '<'), 1, -1)); - } + }*/ + $row['post_text'] = censor_text($row['post_text']); if ($row['bbcode_bitfield']) { @@ -752,7 +752,7 @@ if ($search_keywords || $search_author || $search_id) // via php.net's annotated manual $row['post_text'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . $hilit . ")\b#i', '\\\\1', '\\0')", '>' . $row['post_text'] . '<'), 1, -1)); - $row['post_text'] = (empty($config['allow_smilies']) || !$user->data['user_viewsmilies']) ? preg_replace('#', $row['post_text']) : '', diff --git a/phpBB/ucp.php b/phpBB/ucp.php index ddd595ce99..b85ceee562 100755 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -298,11 +298,6 @@ if ($user->data['user_id'] == ANONYMOUS || $user->data['user_type'] == USER_INAC } -// Word censors $censors['match'] & $censors['replace'] -$censors = array(); -obtain_word_list($censors); - - // Output listing of friends online $update_time = $config['load_online_time'] * 60; diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 2b1f6fc7ab..ce1583d324 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -112,7 +112,7 @@ if ($forum_data['forum_password']) } // Redirect to login upon emailed notification links -if (!empty($_GET['e']) && $user->data['user_id'] == ANONYMOUS) +if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS) { login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_NOTIFY_FORUM']); } @@ -183,7 +183,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) } } - // Forum rules, subscription info and word censors + // Forum rules amd subscription info $s_watching_forum = $s_watching_forum_img = ''; if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) { @@ -194,9 +194,6 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) $s_forum_rules = ''; gen_forum_rules('forum', $forum_id); - $censors = array(); - obtain_word_list($censors); - // Topic ordering options $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']); @@ -539,7 +536,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) 'GOTO_PAGE' => $goto_page, 'REPLIES' => ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'], 'VIEWS' => $row['topic_views'], - 'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'], + 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'LAST_POST_IMG' => $last_post_img, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b3608a8982..89bded1cd5 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -432,10 +432,6 @@ $topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '