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
This commit is contained in:
Andreas Fischer 2009-08-21 09:44:55 +00:00
parent 14b11152c6
commit 5d2e4e88ab
2 changed files with 13 additions and 5 deletions

View file

@ -47,6 +47,7 @@ class acp_words
switch ($action) switch ($action)
{ {
case 'edit': case 'edit':
$word_id = request_var('id', 0); $word_id = request_var('id', 0);
if (!$word_id) if (!$word_id)
@ -84,11 +85,12 @@ class acp_words
{ {
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
} }
$word_id = request_var('id', 0); $word_id = request_var('id', 0);
$word = utf8_normalize_nfc(request_var('word', '', true)); $word = utf8_normalize_nfc(request_var('word', '', true));
$replacement = utf8_normalize_nfc(request_var('replacement', '', 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); trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING);
} }

View file

@ -685,6 +685,12 @@ function censor_text($text)
{ {
static $censors; 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 // 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)) if (!isset($censors) || !is_array($censors))
{ {