// se if the user are to be banned, if so do it ...
if ( ($the_user['user_warnings'] + 1) >= $board_config['max_user_bancard'] )
{
$sql = 'SELECT ban_userid FROM ' . BANLIST_TABLE . ' WHERE ban_userid="' . $poster_id . '"';
if( $result = $db->sql_query($sql) )
{
if ( (!$db->sql_fetchrowset($result)) && ($poster_id != ANONYMOUS) )
{
// insert the user in the ban list
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) VALUES ($poster_id)";
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
}
// update the user table with new status
$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET session_logged_in="0" WHERE session_user_id="' . $poster_id . '"';
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update banned sessions from database", "", __LINE__, __FILE__, $sql);
}
$no_error_ban=true;
$message = $lang['Ban_update_red'];
$e_temp = 'ban_block';
// $e_subj = $lang['Ban_blocked'];
}
else
{
$no_error_ban = true;
$message = $lang['user_already_banned'];
}
}
else
{
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
}
}
else
{
// the user shall not be baned this time, update the counter
$message = sprintf($lang['Ban_update_yellow'], ($the_user['user_warnings'] + 1), $board_config['max_user_bancard']) . '<br /><br />' . sprintf($lang['Send_PM_user'], '<a href="' . append_sid('privmsg.' . $phpEx . '?mode=post&u=' . $poster_id) . '">', '</a>');
$no_error_ban = true;
$e_temp = 'ban_warning';
// $e_subj = $lang['Ban_warning'];
$db->clear_cache();
}
}
if ($no_error_ban)
{
$sql = 'SELECT username, user_warnings, user_email, user_lang FROM ' . USERS_TABLE . ' WHERE user_id="' . $poster_id . '"';
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't find the users personal information", "", __LINE__, __FILE__, $sql);
}
$warning_data = $db->sql_fetchrow($result);
if (!empty($warning_data['user_email']))
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$script_name = preg_replace('/^/?(.*?)/?$/', '1', trim($board_config['script_path'])). '/' . VIEWTOPIC_MG;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$emailer = new emailer($board_config['smtp_delivery']);
$email_headers = "TO: '". $warning_data['username']. "' <" . $warning_data['user_email'] . ">rn";
$email_headers .= ($userdata['user_email'] && $userdata['user_viewemail']) ? "FROM: "" . $userdata['username'] . "" <" . $userdata['user_email'] . ">rn" : "FROM: "" . $board_config['sitename'] . "" <" . $board_config['board_email'] . ">rn";
$emailer->use_template($e_temp, stripslashes($warning_data['user_lang']));
$emailer->email_address($warning_data['user_email']);
//$emailer->set_subject($e_subj);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'WARNINGS' => $warning_data['user_warnings'],
'TOTAL_WARN' => $board_config['max_user_bancard'],
'POST_URL' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . '=' . $post_id . '#p' . $post_id,
'EMAIL_SIG' => str_replace("<br />", "n", "-- n" . $board_config['board_email_sig']),
'WARNER' => $userdata['username'],
'BLOCK_TIME' => $block_time,
'WARNED_POSTER' => $warning_data['username'])
);
$emailer->send();
$emailer->reset();
}
else
{
$message .= '<br/><br/>' . $lang['user_no_email'];
}
}
else
{
$message = 'Error card.php file';
}
$message .= ( $post_id != '-1' ) ? '<br /><br />' . sprintf($lang['Click_return_viewtopic'], '<a href="' . append_sid(VIEWTOPIC_MG . '?' . POST_POST_URL . '=' . $post_id . '#p' . $post_id) . '">', '</a>') : '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(FORUM_MG). '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
?>