[ticket/11566] add error functionality

add $error which stores the captcha error when captcha validation fails

PHPBB3-11566
This commit is contained in:
Dhruv 2013-06-10 23:52:41 +05:30
parent 7a2e3b4354
commit eafd0ae29f

View file

@ -140,8 +140,18 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'])
$captcha->init(CONFIRM_POST);
}
$error = array();
// Submit report?
if ($submit && $reason_id)
{
$vc_response = $captcha->validate();
if ($vc_response)
{
$error[] = $vc_response;
}
if (!sizeof($error))
{
$sql = 'SELECT *
FROM ' . REPORTS_REASONS_TABLE . "
@ -225,20 +235,23 @@ if ($submit && $reason_id)
}
trigger_error($message);
}
}
// Generate the reasons
display_reasons($reason_id);
$page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST'];
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false))
if ((isset($captcha) && $captcha->is_solved() === false))
{
$template->assign_vars(array(
'S_CONFIRM_CODE' => true,
'CAPTCHA_TEMPLATE' => $captcha->get_template(),
));
}
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'S_REPORT_POST' => ($pm_id) ? false : true,
'REPORT_TEXT' => $report_text,
'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&amp;p=' . $post_id . '&amp;pm=' . $pm_id),