diff --git a/create.php b/create.php
index 59134bd8..309ac9eb 100644
--- a/create.php
+++ b/create.php
@@ -1,35 +1,17 @@
'._('Game').' | ' . $ayah->getPublisherHTML() . ' | ';
-}
-
-if (!$cbRecaptcha){
- $recapcha_html = '';
-} else {
- $recapcha_html = 'reCaptcha | ' . recaptcha_get_html($config['recaptcha_public'], NULL, TRUE) . ' |
';
-}
-
+include '8chan-captcha/functions.php';
$password = base64_encode(openssl_random_pseudo_bytes(9));
-$body = Element("8chan/create.html", array("config" => $config, "password" => $password, "game_html" => $game_html, "recapcha_html" => $recapcha_html));
+$captcha = generate_captcha($config['captcha']['extra']);
+
+$body = Element("8chan/create.html", array("config" => $config, "password" => $password, "captcha" => $captcha));
echo Element("page.html", array("config" => $config, "body" => $body, "title" => _("Create your board"), "subtitle" => _("before someone else does")));
}
@@ -41,26 +23,13 @@ $subtitle = $_POST['subtitle'];
$username = $_POST['username'];
$password = $_POST['password'];
- $resp = ($cbRecaptcha) ? recaptcha_check_answer ($config['recaptcha_private'],
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"]):false;
+$resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([
+ 'mode' => 'check',
+ 'text' => $_POST['captcha_text'],
+ 'extra' => $config['captcha']['extra'],
+ 'cookie' => $_POST['captcha_cookie']
+]));
-if ($resp != false){
-$passedCaptcha = $resp->is_valid;
-} else {
-$passedCaptcha = true;
-}
-
-if (!$ayah){
-$score = true;
-} else {
-$score = $ayah->scoreResult();
-}
-if (!$score)
- error(_('You failed the game'));
-if (!$passedCaptcha)
- error(_('You failed to enter the reCaptcha correctly'));
if (!preg_match('/^[a-z0-9]{1,30}$/', $uri))
error(_('Invalid URI'));
if (!(strlen($title) < 40))
@@ -69,6 +38,8 @@ if (!(strlen($subtitle) < 200))
error(_('Invalid subtitle'));
if (!preg_match('/^[a-zA-Z0-9._]{1,30}$/', $username))
error(_('Invalid username'));
+if ($resp !== '1')
+ error($config['error']['captcha']);
foreach (listBoards() as $i => $board) {
if ($board['uri'] == $uri)
diff --git a/dnsbls_bypass.php b/dnsbls_bypass.php
index a37f1ca0..cf289b67 100644
--- a/dnsbls_bypass.php
+++ b/dnsbls_bypass.php
@@ -1,31 +1,26 @@
array('8.8.8.8')));
-$result = $dns->query(RECAPTCHA_VERIFY_SERVER, "A");
-if ($result and $result->answer[0]) {
- $RECAPTCHA_VERIFY_SERVER_IP = $result->answer[0]->address;
-} else {
- $RECAPTCHA_VERIFY_SERVER_IP = RECAPTCHA_VERIFY_SERVER;
-}
+include '8chan-captcha/functions.php';
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
- $ayah_html = recaptcha_get_html($config['recaptcha_public'], NULL, TRUE);
- $body = Element("8chan/dnsbls.html", array("config" => $config, "ayah_html" => $ayah_html));
+ $captcha = generate_captcha($config['captcha']['extra']);
+
+ $html = "{$captcha['html']}
+
+
";
+
+ $body = Element("8chan/dnsbls.html", array("config" => $config, "ayah_html" => $html));
echo Element("page.html", array("config" => $config, "body" => $body, "title" => _("Bypass DNSBL"), "subtitle" => _("Post even if blocked")));
} else {
- $score = recaptcha_check_answer($config['recaptcha_private'],
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"],
- array(),
- $RECAPTCHA_VERIFY_SERVER_IP);
+ $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([
+ 'mode' => 'check',
+ 'text' => $_POST['captcha_text'],
+ 'extra' => $config['captcha']['extra'],
+ 'cookie' => $_POST['captcha_cookie']
+ ]));
- if ($score->is_valid) {
+ if ($resp === '1') {
$tor = checkDNSBL($_SERVER['REMOTE_ADDR']);
if (!$tor) {
$query = prepare('INSERT INTO ``dnsbl_bypass`` VALUES(:ip, NOW()) ON DUPLICATE KEY UPDATE `created`=NOW()');
diff --git a/templates/8chan/create.html b/templates/8chan/create.html
index b6470709..be0cf4b7 100644
--- a/templates/8chan/create.html
+++ b/templates/8chan/create.html
@@ -7,8 +7,9 @@
Subtitle | {% trans %}(must be < 200 chars){% endtrans %} |
{% trans %}Username{% endtrans %} | {% trans %}(must contain only alphanumeric, periods and underscores){% endtrans %} |
{% trans %}Password{% endtrans %} | {% trans %}(write this down){% endtrans %} |
-{{ game_html }}
-{{ recapcha_html }}
+{% trans %}CAPTCHA{% endtrans %} | {{ captcha['html'] }}
+
+
|
diff --git a/templates/8chan/dnsbls.html b/templates/8chan/dnsbls.html
index 49c54efc..0e346a00 100644
--- a/templates/8chan/dnsbls.html
+++ b/templates/8chan/dnsbls.html
@@ -1,5 +1,6 @@