Add captcheck captcha option
This commit is contained in:
parent
5de09b851b
commit
297d7f3cfd
@ -1439,6 +1439,7 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
|
|
||||||
$on = '';
|
$on = '';
|
||||||
$on2 = '';
|
$on2 = '';
|
||||||
|
$on3 = '';
|
||||||
$off = '';
|
$off = '';
|
||||||
$div = 'block';
|
$div = 'block';
|
||||||
|
|
||||||
@ -1446,6 +1447,9 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
$on = 'checked="checked"';
|
$on = 'checked="checked"';
|
||||||
} elseif ($hesk_settings['recaptcha_use'] == 2) {
|
} elseif ($hesk_settings['recaptcha_use'] == 2) {
|
||||||
$on2 = 'checked="checked"';
|
$on2 = 'checked="checked"';
|
||||||
|
} elseif ($hesk_settings['recaptcha_use'] == 3) {
|
||||||
|
$on3 = 'checked="checked"';
|
||||||
|
$div = 'none';
|
||||||
} else {
|
} else {
|
||||||
$off = 'checked="checked"';
|
$off = 'checked="checked"';
|
||||||
$div = 'none';
|
$div = 'none';
|
||||||
@ -1471,6 +1475,12 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
class="fa fa-question-circle settingsquestionmark"></i></a></div>
|
class="fa fa-question-circle settingsquestionmark"></i></a></div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<div class="radio"><label><input type="radio" name="s_recaptcha_use" value="3"
|
||||||
|
onclick="javascript:hesk_toggleLayer('recaptcha','none')" <?php echo $on3; ?> /> <?php echo $hesklang['sir3']; ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<div id="recaptcha" style="display: <?php echo $div; ?>;">
|
<div id="recaptcha" style="display: <?php echo $div; ?>;">
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -140,7 +140,7 @@ $set['secimg_sum'] = '';
|
|||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$set['secimg_sum'] .= substr('AEUYBDGHJLMNPQRSTVWXZ123456789', rand(0, 29), 1);
|
$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_public_key'] = hesk_input(hesk_POST('s_recaptcha_public_key'));
|
||||||
$set['recaptcha_private_key'] = hesk_input(hesk_POST('s_recaptcha_private_key'));
|
$set['recaptcha_private_key'] = hesk_input(hesk_POST('s_recaptcha_private_key'));
|
||||||
$set['question_use'] = empty($_POST['s_question_use']) ? 0 : 1;
|
$set['question_use'] = empty($_POST['s_question_use']) ? 0 : 1;
|
||||||
|
@ -221,6 +221,10 @@ if (is_dir(HESK_PATH . 'install')) {
|
|||||||
echo '<script src="https://www.google.com/recaptcha/api.js?hl=' . $hesklang['RECAPTCHA'] . '" async defer></script>';
|
echo '<script src="https://www.google.com/recaptcha/api.js?hl=' . $hesklang['RECAPTCHA'] . '" async defer></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined('CAPTCHECK')) {
|
||||||
|
echo '<script src="https://captcheck.netsyms.com/captcheck.js" async defer></script>';
|
||||||
|
}
|
||||||
|
|
||||||
if (defined('VALIDATOR')) {
|
if (defined('VALIDATOR')) {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/validation-scripts.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/validation-scripts.js"></script>
|
||||||
|
11
index.php
11
index.php
@ -216,6 +216,8 @@ function print_add_ticket()
|
|||||||
// Tell header to load reCaptcha API if needed
|
// Tell header to load reCaptcha API if needed
|
||||||
if ($hesk_settings['recaptcha_use'] == 2) {
|
if ($hesk_settings['recaptcha_use'] == 2) {
|
||||||
define('RECAPTCHA', 1);
|
define('RECAPTCHA', 1);
|
||||||
|
} else if ($hesk_settings['recaptcha_use'] == 3) {
|
||||||
|
define('CAPTCHECK', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get categories
|
// Get categories
|
||||||
@ -1058,6 +1060,15 @@ function print_add_ticket()
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
elseif ($hesk_settings['recaptcha_use'] == 3)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="captcheck_container">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
// At least use some basic PHP generated image (better than nothing)
|
// At least use some basic PHP generated image (better than nothing)
|
||||||
else {
|
else {
|
||||||
$cls = in_array('mysecnum', $_SESSION['iserror']) ? ' class="isError" ' : '';
|
$cls = in_array('mysecnum', $_SESSION['iserror']) ? ' class="isError" ' : '';
|
||||||
|
@ -1376,7 +1376,8 @@ $hesklang['nkba']='Knowledgebase search requires enough unique articles to work
|
|||||||
$hesklang['saa']='Sticky articles are displayed at the top of articles list';
|
$hesklang['saa']='Sticky articles are displayed at the top of articles list';
|
||||||
$hesklang['yhbr']='You have been locked out the system for %s minutes because of too many replies to a ticket.';
|
$hesklang['yhbr']='You have been locked out the system for %s minutes because of too many replies to a ticket.';
|
||||||
$hesklang['sir']='ReCaptcha V1 API (old)';
|
$hesklang['sir']='ReCaptcha V1 API (old)';
|
||||||
$hesklang['sir2']='ReCaptcha V2 API (recommended)';
|
$hesklang['sir2']='ReCaptcha V2 API';
|
||||||
|
$hesklang['sir3']='Captcheck';
|
||||||
$hesklang['rcpb']='Site key (Public key)';
|
$hesklang['rcpb']='Site key (Public key)';
|
||||||
$hesklang['rcpv']='Secret key (Private key)';
|
$hesklang['rcpv']='Secret key (Private key)';
|
||||||
|
|
||||||
|
@ -114,6 +114,29 @@ if ($hesk_settings['secimg_use'] && !isset($_SESSION['img_verified'])) {
|
|||||||
} else {
|
} else {
|
||||||
$hesk_error_buffer['mysecnum'] = $hesklang['recaptcha_error'];
|
$hesk_error_buffer['mysecnum'] = $hesklang['recaptcha_error'];
|
||||||
}
|
}
|
||||||
|
} // Using Netsyms Captcheck
|
||||||
|
elseif ($hesk_settings['recaptcha_use'] == 3) {
|
||||||
|
$url = 'https://captcheck.netsyms.com/api.php';
|
||||||
|
$data = [
|
||||||
|
'session_id' => $_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
|
} // Using PHP generated image
|
||||||
else {
|
else {
|
||||||
$mysecnum = intval(hesk_POST('mysecnum', 0));
|
$mysecnum = intval(hesk_POST('mysecnum', 0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user