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();
     }
 }
 public function preDispatch()
 {
     parent::preDispatch();
     Mage::getSingleton('core/session', array("name" => "frontend"))->setFromEmail('1');
     /* @var $helper Mage_Sendfriend_Helper_Data */
     $helper = Mage::helper('sendfriend');
     /* @var $session Mage_Customer_Model_Session */
     $session = Mage::getSingleton('customer/session');
     if (!$helper->isEnabled()) {
         $this->norouteAction();
         return $this;
     }
     if (!$helper->isAllowForGuest() && !$session->authenticate($this)) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         if ($this->getRequest()->getActionName() == 'sendemail') {
             $session->setBeforeAuthUrl(Mage::getUrl('*/*/send', array('_current' => true)));
             Mage::getSingleton('catalog/session')->setSendfriendFormData($this->getRequest()->getPost());
         }
     }
     return $this;
 }