From 5d2e4e88ab3266b44101714a101d337e0053361e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 21 Aug 2009 09:44:55 +0000 Subject: [PATCH] Allow "0" as censor word and replacement. Only obtain word censor list if text is not empty. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10039 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_words.php | 12 +++++++----- phpBB/includes/functions_content.php | 6 ++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/acp/acp_words.php b/phpBB/includes/acp/acp_words.php index 596c2fc743..1cb9545967 100644 --- a/phpBB/includes/acp/acp_words.php +++ b/phpBB/includes/acp/acp_words.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) class acp_words { var $u_action; - + function main($id, $mode) { global $db, $user, $auth, $template, $cache; @@ -47,8 +47,9 @@ class acp_words switch ($action) { case 'edit': + $word_id = request_var('id', 0); - + if (!$word_id) { trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); @@ -73,7 +74,7 @@ class acp_words 'REPLACEMENT' => (isset($word_info['replacement'])) ? $word_info['replacement'] : '', 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); - + return; break; @@ -84,11 +85,12 @@ class acp_words { trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } + $word_id = request_var('id', 0); $word = utf8_normalize_nfc(request_var('word', '', true)); $replacement = utf8_normalize_nfc(request_var('replacement', '', true)); - - if (!$word || !$replacement) + + if ($word === '' || $replacement === '') { trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 7a30f0069e..c265d0ae41 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -685,6 +685,12 @@ function censor_text($text) { static $censors; + // Nothing to do? + if ($text === '') + { + return ''; + } + // We moved the word censor checks in here because we call this function quite often - and then only need to do the check once if (!isset($censors) || !is_array($censors)) {