aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2004-02-21 12:47:35 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2004-02-21 12:47:35 +0000
commitc74d2538ec68fa1c6f3da6d26e31a09f2045557b (patch)
treebe1c11d7d9e403c7b884c7d08e34111f0806d350 /phpBB
parent9c12fe83db3914b4e35bdcef75cc70e2f75044d6 (diff)
downloadforums-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')
-rw-r--r--phpBB/adm/admin_profile.php20
-rw-r--r--phpBB/adm/admin_users.php10
-rw-r--r--phpBB/adm/admin_words.php160
-rw-r--r--phpBB/docs/AUTHORS3
-rw-r--r--phpBB/includes/functions.php36
-rw-r--r--phpBB/includes/functions_admin.php12
-rw-r--r--phpBB/includes/functions_display.php10
-rw-r--r--phpBB/includes/functions_messenger.php4
-rw-r--r--phpBB/includes/functions_posting.php21
-rw-r--r--phpBB/includes/functions_profile_fields.php15
-rw-r--r--phpBB/includes/mcp/mcp_main.php16
-rw-r--r--phpBB/includes/session.php11
-rw-r--r--phpBB/includes/ucp/ucp_activate.php2
-rw-r--r--phpBB/includes/ucp/ucp_confirm.php2
-rw-r--r--phpBB/includes/ucp/ucp_main.php6
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php2
-rw-r--r--phpBB/includes/ucp/ucp_profile.php12
-rw-r--r--phpBB/includes/ucp/ucp_register.php4
-rw-r--r--phpBB/includes/ucp/ucp_remind.php2
-rw-r--r--phpBB/includes/ucp/ucp_zebra.php2
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/posting.php45
-rw-r--r--phpBB/search.php14
-rwxr-xr-xphpBB/ucp.php5
-rw-r--r--phpBB/viewforum.php9
-rw-r--r--phpBB/viewtopic.php38
26 files changed, 210 insertions, 253 deletions
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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $signature_preview) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $signature_preview);
+ $signature_preview = smilie_text($signature_preview, !$enable_smilies);
// Replace naughty words such as farty pants
- if (sizeof($censors))
+/* if (sizeof($censors))
{
$signature_preview = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature_preview . '<'), 1, -1));
- }
+ }*/
- $signature_preview = str_replace("\n", '<br />', $signature_preview);
+ $signature_preview = str_replace("\n", '<br />', 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 @@
<?php
-/***************************************************************************
- * admin_words.php
- * -------------------
- * begin : Thursday, Jul 12, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- ***************************************************************************/
-
-/***************************************************************************
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- ***************************************************************************/
+// -------------------------------------------------------------
+//
+// $Id$
+//
+// FILENAME : admin_words.php
+// STARTED : Thu Jul 12, 2001
+// COPYRIGHT : © 2001, 2003 phpBB Group
+// WWW : http://www.phpbb.com/
+// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
+//
+// -------------------------------------------------------------
if (!empty($setmodules))
{
@@ -32,7 +24,7 @@ if (!empty($setmodules))
define('IN_PHPBB', 1);
// Include files
-$phpbb_root_path = '../';
+$phpbb_root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
@@ -42,57 +34,35 @@ if (!$auth->acl_get('a_words'))
trigger_error($user->lang['NO_ADMIN']);
}
-// What do we want to do?
-if (isset($_REQUEST['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 = '';
- }
-}
+$mode = request_var('mode', '');
+$mode = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $mode);
+
+$s_hidden_fields = '';
+$word_info = array();
-if ($mode != '')
+switch ($mode)
{
- switch ($mode)
- {
- case 'edit':
- case 'add':
- $word_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
+ case 'edit':
+ $word_id = request_var('id', 0);
+
+ if (!$word_id)
+ {
+ trigger_error($user->lang['NO_WORD']);
+ }
- $s_hidden_fields = '';
- if ($mode == 'edit')
- {
- if (!$word_id)
- {
- trigger_error($user->lang['NO_WORD']);
- }
+ $sql = 'SELECT *
+ FROM ' . WORDS_TABLE . "
+ WHERE word_id = $word_id";
+ $result = $db->sql_query_limit($sql, 1);
- $sql = "SELECT *
- FROM " . WORDS_TABLE . "
- WHERE word_id = $word_id";
- $result = $db->sql_query($sql);
+ $word_info = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- $word_info = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ $s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
- $s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
- }
-
- adm_page_header($user->lang['WORDS_TITLE']);
+ case 'add':
+ adm_page_header($user->lang['WORDS_TITLE']);
?>
<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1>
@@ -104,11 +74,11 @@ if ($mode != '')
<th colspan="2"><?php echo $user->lang['EDIT_WORD']; ?></th>
</tr>
<tr>
- <td class="row1"><?php echo $user->lang['WORD']; ?></td>
+ <td class="row1"><b><?php echo $user->lang['WORD']; ?></b>:</td>
<td class="row2"><input class="post" type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td>
</tr>
<tr>
- <td class="row1"><?php echo $user->lang['REPLACEMENT']; ?></td>
+ <td class="row1"><b><?php echo $user->lang['REPLACEMENT']; ?></b>:</td>
<td class="row2"><input class="post" type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td>
</tr>
<tr>
@@ -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']);
?>
<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1>
@@ -189,16 +153,16 @@ else
<?php
- $sql = "SELECT *
- FROM " . WORDS_TABLE . "
- ORDER BY word";
- $result = $db->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';
?>
<tr>
@@ -209,10 +173,10 @@ else
</tr>
<?php
+ }
+ while ($row = $db->sql_fetchrow($result));
}
- while ($row = $db->sql_fetchrow($result));
- }
- $db->sql_freeresult($result);
+ $db->sql_freeresult($result);
?>
<tr>
@@ -222,8 +186,8 @@ else
<?php
- adm_page_footer();
-
+ adm_page_footer();
+ break;
}
?> \ 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 © 2001, 2002 by ispi of Lincoln, Inc, http://smarty.php.net/
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('#<!\-\- 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)
{
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 6309dda87d..865be1065e 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1745,12 +1745,6 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$profile_url = (defined('IN_ADMIN')) ? "admin_users.$phpEx$SID" : "memberlist.$phpEx$SID&amp;mode=viewprofile";
- $censors = array();
- if ($user->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", '<br />', $log_data);
+ $log_data = str_replace("\n", '<br />', 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", '<br />', $attachment['comment'])) : str_replace("\n", '<br />', $attachment['comment']);
+ $comment = str_replace("\n", '<br />', 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-]+)=("[^"]+(?<!\\\)"|[^,]+)/i', $md5_challenge, $matches))
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 9a0aa1bd48..2383558100 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -91,22 +91,21 @@ function generate_smilies($mode, $forum_id)
// Format text to be displayed - from viewtopic.php - centralizing this would be nice ;)
function format_display(&$message, &$signature, $uid, $siguid, $html, $bbcode, $url, $smilies, $sig)
{
- global $auth, $forum_id, $config, $censors, $user, $bbcode, $phpbb_root_path;
+ global $auth, $forum_id, $config, $user, $bbcode, $phpbb_root_path;
// Second parse bbcode here
$bbcode->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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
+ $message = smilie_text($message, !$smilies);
// Replace naughty words such as farty pants
- if (sizeof($censors))
+/* if (sizeof($censors))
{
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $message . '<'), 1, -1));
- }
-
- $message = str_replace("\n", '<br />', $message);
+ }*/
+ $message = str_replace("\n", '<br />', 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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $signature) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $signature);
-
- if (sizeof($censors))
+/* if (sizeof($censors))
{
$signature = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature . '<'), 1, -1));
- }
-
- $signature = str_replace("\n", '<br />', $signature);
+ }*/
+ $signature = str_replace("\n", '<br />', 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&amp;t=" . $row['topic_id'] . '&amp;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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
+ $message = smilie_text($message);
$message = nl2br($message);
@@ -1364,7 +1356,7 @@ class mcp_main extends mcp
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
- $message = (empty($config['allow_smilies']) || !$user->optionget('viewsmilies')) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
+ $message = smilie_text($message);
$template->assign_vars(array(
'S_MCP_ACTION' => $this->url . '&amp;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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $signature_preview) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $signature_preview);
+ $signature_preview = smilie_text($signature_preview, !$enable_smilies);
// Replace naughty words such as farty pants
- if (sizeof($censors))
+/* if (sizeof($censors))
{
$signature_preview = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature_preview . '<'), 1, -1));
- }
-
- $signature_preview = str_replace("\n", '<br />', $signature_preview);
+ }*/
+ $signature_preview = str_replace("\n", '<br />', 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('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $member['user_sig']) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $member['user_sig']);
+ $member['user_sig'] = smilie_text($member['user_sig']);
}
$poster_avatar = '';
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 325a5f07c9..5f4e0d57d3 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -110,9 +110,6 @@ switch ($mode)
trigger_error('NO_POST_MODE');
}
-$censors = array();
-obtain_word_list($censors);
-
if ($sql)
{
$result = $db->sql_query($sql);
@@ -252,10 +249,14 @@ else
$notify_set = 0;
}
-
if (!$auth->acl_get('f_' . $mode, $forum_id) && $forum_type == FORUM_POST)
{
- trigger_error('USER_CANNOT_' . strtoupper($mode));
+ if ($user->data['user_id'] != ANONYMOUS)
+ {
+ trigger_error('USER_CANNOT_' . strtoupper($mode));
+ }
+
+ login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['USER_CANNOT_' . strtoupper($mode)]);
}
@@ -784,7 +785,7 @@ if (!sizeof($error) && $preview)
{
$post_time = ($mode == 'edit') ? $post_time : $current_time;
- $preview_subject = (sizeof($censors['match'])) ? preg_replace($censors['match'], $censors['replace'], $subject) : $subject;
+ $preview_subject = censor_text($preview_subject);
$preview_signature = ($mode == 'edit') ? $user_sig : $user->data['user_sig'];
$preview_signature_uid = ($mode == 'edit') ? $user_sig_bbcode_uid : $user->data['user_sig_bbcode_uid'];
@@ -849,13 +850,13 @@ if (count($poll_options))
if ($mode == 'quote' && !$preview && !$refresh)
{
- $post_text = '[quote="' . $quote_username . '"]' . ((sizeof($censors['match'])) ? preg_replace($censors['match'], $censors['replace'], trim($post_text)) : trim($post_text)) . "[/quote]\n";
+ $post_text = '[quote="' . $quote_username . '"]' . censor_text(trim($post_text)) . "[/quote]\n";
}
if (($mode == 'reply' || $mode == 'quote') && !$preview && !$refresh)
{
- $post_subject = ((!preg_match('/^Re:/', $post_subject)) ? 'Re: ' : '') . ((sizeof($censors['match'])) ? preg_replace($censors['match'], $censors['replace'], $post_subject) : $post_subject);
+ $post_subject = ((!preg_match('/^Re:/', $post_subject)) ? 'Re: ' : '') . censor_text($post_subject);
}
@@ -1168,7 +1169,7 @@ page_footer();
// User Notification
function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id)
{
- global $db, $user, $censors, $config, $phpbb_root_path, $phpEx, $auth;
+ global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
$topic_notification = ($mode == 'reply' || $mode == 'quote');
$forum_notification = ($mode == 'post');
@@ -1178,15 +1179,9 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
trigger_error('WRONG_NOTIFICATION_MODE');
}
- if (!$censors)
- {
- $censors = array();
- obtain_word_list($censors);
- }
-
$topic_title = ($topic_notification) ? $topic_title : $subject;
decode_text($topic_title);
- $topic_title = (sizeof($censors['match'])) ? preg_replace($censors['match'], $censors['replace'], $topic_title) : $topic_title;
+ $topic_title = censor_text($topic_title);
// Get banned User ID's
$sql = 'SELECT ban_userid
@@ -1394,14 +1389,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0)
{
global $user, $auth, $db, $template, $bbcode, $template;
- global $censors, $config, $phpbb_root_path, $phpEx, $SID;
-
- // Define censored word matches
- if (!$censors)
- {
- $censors = array();
- obtain_word_list($censors);
- }
+ global $config, $phpbb_root_path, $phpEx, $SID;
// Go ahead and pull all data for this topic
$sql = 'SELECT u.username, u.user_id, u.user_karma, p.post_id, p.post_username, p.post_subject, p.post_text, p.enable_smilies, p.bbcode_uid, p.bbcode_bitfield, p.post_time
@@ -1454,13 +1442,10 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
- $message = (!$row['enable_smilies'] || !$config['allow_smilies']) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
+ $message = smilie_text($message, !$row['enable_smilies']);
- if (sizeof($censors['match']))
- {
- $post_subject = preg_replace($censors['match'], $censors['replace'], $post_subject);
- $message = preg_replace($censors['match'], $censors['replace'], $message);
- }
+ $post_subject = censor_text($post_subject);
+ $message = censor_text($message);
$template->assign_block_vars($mode . '_row', array(
'KARMA_IMG' => '<img src="images/karma' . $row['user_karma'] . '.gif" alt="' . $user->lang['KARMA_LEVEL'] . ': ' . $user->lang['KARMA'][$row['user_karma']] . '" title="' . $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', '<span class=\"posthilit\">\\\\1</span>', '\\0')", '>' . $row['post_text'] . '<'), 1, -1));
- $row['post_text'] = (empty($config['allow_smilies']) || !$user->data['user_viewsmilies']) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $row['post_text']) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $row['post_text']);
+ $row['post_text'] = smilie_text($row['post_text']);
}
$template->assign_block_vars('searchresults', array(
@@ -769,11 +769,11 @@ if ($search_keywords || $search_author || $search_id)
'TOPIC_REPLIES' => ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'],
'TOPIC_VIEWS' => $row['topic_views'],
'FORUM_TITLE' => $row['forum_name'],
- '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,
'POSTER_NAME' => ($row['poster_id'] == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'],
- 'POST_SUBJECT' => (!empty($row['post_subject'])) ? ((!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['post_subject']) : $row['post_subject']) : '',
+ 'POST_SUBJECT' => censor_text($row['post_subject']),
'POST_DATE' => (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '',
'MESSAGE' => (!empty($row['post_text'])) ? str_replace("\n", '<br />', $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)) ? '<option value="viewlogs">' .
$pagination_url = "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;sk=$sort_key&amp;st=$sort_days&amp;sd=$sort_dir" . (($highlight_match) ? "&amp;hilit=$highlight" : '');
$pagination = generate_pagination($pagination_url, $total_posts, $config['posts_per_page'], $start);
-// Grab censored words
-$censors = array();
-obtain_word_list($censors);
-
// Navigation links
generate_forum_nav($topic_data);
@@ -447,10 +443,7 @@ get_moderators($forum_moderators, $forum_id);
$server_path = (!$view) ? '' : generate_board_url() . '/';
// Replace naughty words in title
-if (sizeof($censors))
-{
- $topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
-}
+$topic_title = censor_text($topic_title);
// Send vars to template
$template->assign_vars(array(
@@ -640,7 +633,8 @@ if (!empty($poll_start))
foreach ($poll_info as $poll_option)
{
- $poll_option['poll_option_text'] = (sizeof($censors)) ? preg_replace($censors['match'], $censors['replace'], $poll_option['poll_option_text']) : $poll_option['poll_option_text'];
+ $poll_option['poll_option_text'] = censor_text($poll_option['poll_option_text']);
+
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
@@ -655,7 +649,7 @@ if (!empty($poll_start))
}
$template->assign_vars(array(
- 'POLL_QUESTION' => (sizeof($censors)) ? preg_replace($censors['match'], $censors['replace'], $poll_title) : $poll_title,
+ 'POLL_QUESTION' => censor_text($poll_title),
'TOTAL_VOTES' => $poll_total,
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
@@ -1090,19 +1084,18 @@ for ($i = 0; $i < count($post_list); ++$i)
// End signature parsing, only if needed
if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed']))
{
- $user_cache[$poster_id]['sig'] = (!$config['allow_smilies'] || !$user->optionget('viewsmilies')) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $user_cache[$poster_id]['sig']) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $user_cache[$poster_id]['sig']);
-
if ($user_cache[$poster_id]['sig_bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']);
}
- if (count($censors))
+ $user_cache[$poster_id]['sig'] = smilie_text($user_cache[$poster_id]['sig']);
+
+ /*if (count($censors))
{
$user_cache[$poster_id]['sig'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $user_cache[$poster_id]['sig'] . '<'), 1, -1));
- }
-
- $user_cache[$poster_id]['sig'] = str_replace("\n", '<br />', $user_cache[$poster_id]['sig']);
+ }*/
+ $user_cache[$poster_id]['sig'] = str_replace("\n", '<br />', censor_text($user_cache[$poster_id]['sig']));
$user_cache[$poster_id]['sig_parsed'] = TRUE;
}
@@ -1124,9 +1117,8 @@ for ($i = 0; $i < count($post_list); ++$i)
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
- // If we allow users to disable display of emoticons
- // we'll need an appropriate check and preg_replace here
- $message = (empty($config['allow_smilies']) || !$user->optionget('viewsmilies')) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
+ // Always process smilies after parsing bbcodes
+ $message = smilie_text($message);
// Highlight active words (primarily for search)
if ($highlight_match)
@@ -1137,13 +1129,13 @@ for ($i = 0; $i < count($post_list); ++$i)
}
// Replace naughty words such as farty pants
- if (sizeof($censors))
+/* if (sizeof($censors))
{
$row['post_subject'] = preg_replace($censors['match'], $censors['replace'], $row['post_subject']);
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $message . '<'), 1, -1));
- }
-
- $message = str_replace("\n", '<br />', $message);
+ }*/
+ $row['post_subject'] = censor_text($row['post_subject']);
+ $message = str_replace("\n", '<br />', censor_text($message));
// Editing information
if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason'])