public function sendmailAction() { if (!(Mage::getStoreConfig("fontis_recaptcha/recaptcha/when_loggedin") && Mage::getSingleton('customer/session')->isLoggedIn())) { if (Mage::getStoreConfig("fontis_recaptcha/recaptcha/sendfriend")) { $privatekey = Mage::getStoreConfig("fontis_recaptcha/setup/private_key"); // check response $resp = Mage::helper("fontis_recaptcha")->recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); $data = $this->getRequest()->getPost(); if ($resp == true) { // if recaptcha response is correct, use core functionality parent::sendmailAction(); } else { // if recaptcha response is incorrect, reload the page Mage::getSingleton('catalog/session')->addError($this->__('Your reCAPTCHA entry is incorrect. Please try again.')); Mage::getSingleton('catalog/session')->setSendfriendFormData($data); $this->_redirectReferer(); return; } } else { // if recaptcha is not enabled, use core function alone parent::sendmailAction(); } } else { // if recaptcha is not enabled, use core function alone parent::sendmailAction(); } }
public function sendmailAction() { if (!(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && Mage::getSingleton('customer/session')->isLoggedIn())) { if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/sendfriend")) { // check response $resp = Mage::helper("outsourceonline_captcha")->validate(); $data = $this->getRequest()->getPost(); //validate botscout $sender = Mage::helper("outsourceonline_captcha")->validateBotScout(Mage::getSingleton('core/app')->getRequest()->getParam('sender')); $XNAME = $sender['email']; Mage::helper("outsourceonline_captcha")->validateBotScout($XNAME); if ($resp == true) { // if captcha response is correct, use core functionality parent::sendmailAction(); } else { // if captcha response is incorrect, reload the page Mage::getSingleton('catalog/session')->addError($this->__('Your CAPTCHA entry is incorrect. Please try again.')); Mage::getSingleton('catalog/session')->setFormData($data); $this->_redirectReferer(); return; } } else { // if captcha is not enabled, use core function alone parent::sendmailAction(); } } else { // if captcha is not enabled, use core function alone parent::sendmailAction(); } }