From 9048aed1635db2c5f1d3f16ce44aa5becb894210 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 4 Jul 2023 14:48:21 +0200 Subject: [PATCH] [ticket/9687] Use new array entries for bans PHPBB3-9687 --- phpBB/includes/functions_user.php | 2 +- phpBB/phpbb/session.php | 2 +- phpBB/phpbb/user.php | 6 ++--- tests/functions/fixtures/validate_email.xml | 25 ++++++++++++--------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b3bdcf1480..d11f7cbfeb 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1493,7 +1493,7 @@ function validate_user_email($email, $allowed_email = false) $ban = $user->check_ban(false, false, $email, true); if (!empty($ban)) { - return !empty($ban['ban_give_reason']) ? $ban['ban_give_reason'] : 'EMAIL_BANNED'; + return !empty($ban['reason']) ? $ban['reason'] : 'EMAIL_BANNED'; } if (!$config['allow_emailreuse']) diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 9fd2db349a..813a156726 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1204,7 +1204,7 @@ class session } // Determine which message to output - $till_date = ($ban_row['end'] > 0) ? $this->format_date($ban_row['end']) : ''; + $till_date = ($ban_row && $ban_row['end'] > 0) ? $this->format_date($ban_row['end']) : ''; $message = $this->get_ban_message($ban_row, $ban_triggered_by); $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 52427d2915..bf4f10c15a 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -879,12 +879,12 @@ class user extends \phpbb\session { global $config, $phpbb_root_path, $phpEx; - $till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : ''; - $message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; + $till_date = ($ban_row['end']) ? $this->format_date($ban_row['end']) : ''; + $message = ($ban_row['end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); $message = $this->language->lang($message, $till_date, '', ''); - $message .= ($ban_row['ban_give_reason']) ? '

' . $this->language->lang('BOARD_BAN_REASON', $ban_row['ban_give_reason']) : ''; + $message .= ($ban_row['reason']) ? '

' . $this->language->lang('BOARD_BAN_REASON', $ban_row['reason']) : ''; $message .= '

' . $this->language->lang('BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)) . ''; return $message; diff --git a/tests/functions/fixtures/validate_email.xml b/tests/functions/fixtures/validate_email.xml index 985050cedc..4fa9bd03d0 100644 --- a/tests/functions/fixtures/validate_email.xml +++ b/tests/functions/fixtures/validate_email.xml @@ -1,26 +1,29 @@ - +
ban_id - ban_userid - ban_exclude + ban_mode + ban_item + ban_startban_end - ban_email - ban_give_reason + ban_reason + ban_reason_display 1 - 0 - 0 - 0 + email banned@example.com + 0 + 0 + 2 - 0 - 0 - 0 + email banned2@example.com + 0 + 0 + just because just because