
Originally Posted by
mc12345678
What are the contents of: includes/classes/observers/class.google_recaptcha.php?
As far as disabling all warning messages, yes you can, but it is not advisable per se. Instead that issue should be resolved.
Said that they were all pretty much the same, was/is it that everything from #2 and down has been the same or are different notifiers at play?
Correct, everything from line 2 on down is the same except for the timestamps. There seems to be a wide variety of IP addresses, so it might be normal website traffic that is triggering something on every page hit. My previous estimate of "hundreds per minute" turned out to be a bit high.
Here are the contents of class.google_recaptcha.php - I believe we were having some trouble getting CAPTCHA working in v1.5.5, so I removed it from the pages. There might still be some hooks to it, though.
Code:
<?php
/**
*
* @package plugins
* @copyright Copyright 2003-2012 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
*
* Designed for v1.5.4
* Observer class for Google reCaptcha
*/
class google_recaptcha extends base {
/**
* @var array
*/
private $pages_to_checkcheck = array();
function __construct() {
//comment out any pages you do NOT want to check
//$pages_to_check[] = 'NOTIFY_CONTACT_US_CAPTCHA_CHECK';
//$pages_to_check[] = 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK';
//$pages_to_check[] = 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK';
$this->attach($this,$pages_to_check);
}
function update(&$class, $eventID, $paramsArray = array()) {
global $messageStack, $error, $privatekey;
require_once __DIR__ . '/google/autoload.php';
$recaptcha = new \ReCaptcha\ReCaptcha($privatekey);
// If file_get_contents() is locked down on your PHP installation to disallow
// its use with URLs, then you can use the alternative request method instead.
// This makes use of fsockopen() instead.
//$recaptcha = new \ReCaptcha\ReCaptcha($privatekey, new \ReCaptcha\RequestMethod\SocketPost());
// This makes use of curl instead
//$recaptcha = new \ReCaptcha\ReCaptcha($privatekey, new \ReCaptcha\RequestMethod\Curl());
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if (!$resp->isSuccess()) {
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');
$messageStack->add($event_array[$eventID], $resp->getErrors());
$error = true;
}
return $error;
}
}