diff --git a/admin/admin_settings.php b/admin/admin_settings.php
index f9a13a35..1e96c3d6 100644
--- a/admin/admin_settings.php
+++ b/admin/admin_settings.php
@@ -1439,6 +1439,7 @@ $modsForHesk_settings = mfh_getSettings();
$on = '';
$on2 = '';
+ $on3 = '';
$off = '';
$div = 'block';
@@ -1446,6 +1447,9 @@ $modsForHesk_settings = mfh_getSettings();
$on = 'checked="checked"';
} elseif ($hesk_settings['recaptcha_use'] == 2) {
$on2 = 'checked="checked"';
+ } elseif ($hesk_settings['recaptcha_use'] == 3) {
+ $on3 = 'checked="checked"';
+ $div = 'none';
} else {
$off = 'checked="checked"';
$div = 'none';
@@ -1471,6 +1475,12 @@ $modsForHesk_settings = mfh_getSettings();
class="fa fa-question-circle settingsquestionmark">
+
+
+
+
diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php
index 4eb15627..cea517f2 100644
--- a/admin/admin_settings_save.php
+++ b/admin/admin_settings_save.php
@@ -140,7 +140,7 @@ $set['secimg_sum'] = '';
for ($i = 1; $i <= 10; $i++) {
$set['secimg_sum'] .= substr('AEUYBDGHJLMNPQRSTVWXZ123456789', rand(0, 29), 1);
}
-$set['recaptcha_use'] = hesk_checkMinMax(intval(hesk_POST('s_recaptcha_use')), 0, 2, 0);
+$set['recaptcha_use'] = hesk_checkMinMax(intval(hesk_POST('s_recaptcha_use')), 0, 3, 0);
$set['recaptcha_public_key'] = hesk_input(hesk_POST('s_recaptcha_public_key'));
$set['recaptcha_private_key'] = hesk_input(hesk_POST('s_recaptcha_private_key'));
$set['question_use'] = empty($_POST['s_question_use']) ? 0 : 1;
diff --git a/inc/header.inc.php b/inc/header.inc.php
index d88626b0..1a90619c 100644
--- a/inc/header.inc.php
+++ b/inc/header.inc.php
@@ -221,6 +221,10 @@ if (is_dir(HESK_PATH . 'install')) {
echo '';
}
+ if (defined('CAPTCHECK')) {
+ echo '';
+ }
+
if (defined('VALIDATOR')) {
?>
diff --git a/index.php b/index.php
index 4185a27a..a41b52df 100644
--- a/index.php
+++ b/index.php
@@ -216,6 +216,8 @@ function print_add_ticket()
// Tell header to load reCaptcha API if needed
if ($hesk_settings['recaptcha_use'] == 2) {
define('RECAPTCHA', 1);
+ } else if ($hesk_settings['recaptcha_use'] == 3) {
+ define('CAPTCHECK', 1);
}
// Get categories
@@ -1058,6 +1060,15 @@ function print_add_ticket()
+
+ $_POST['captcheck_session_code'],
+ 'answer_id' => $_POST['captcheck_selected_answer'],
+ 'action' => "verify"
+ ];
+ $options = [
+ 'http' => [
+ 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
+ 'method' => 'POST',
+ 'content' => http_build_query($data)
+ ]
+ ];
+ $context = stream_context_create($options);
+ $result = file_get_contents($url, false, $context);
+ $resp = json_decode($result, TRUE);
+ if ($resp['result'] === true) {
+ $_SESSION['img_verified'] = true;
+ } else {
+ $hesk_error_buffer['mysecnum'] = $hesklang['recaptcha_error'];
+ }
} // Using PHP generated image
else {
$mysecnum = intval(hesk_POST('mysecnum', 0));