Page 21 of 68 FirstFirst ... 11192021222331 ... LastLast
Results 201 to 210 of 676
  1. #201
    Join Date
    Aug 2010
    Location
    Hartland, MI
    Posts
    288
    Plugin Contributions
    3

    Default Re: Support Thread for Google reCAPTCHA plugin

    Quote Originally Posted by David Allen View Post
    Hi Mike
    Just had a quick look at it (nice site btw). I think what you need to do is in the class.faq_request.php file:

    Add at the beginning of the function update (just after the global $messagestack):
    Code:
    $error=false;
    $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK');
    then change the line 2 below from
    Code:
    if(isset($_POST['email_address']) && !empty($_POST['email_address']) && isset($_POST['fullname']) && !empty($_POST['fullname']) && isset($_POST['message']) && !empty($_POST['message']) && isset($_POST['subject']) && !empty($_POST['subject'])) {
    to
    Code:
    if(isset($_POST['email_address']) && !empty($_POST['email_address']) && isset($_POST['fullname']) && !empty($_POST['fullname']) && isset($_POST['message']) && !empty($_POST['message']) && isset($_POST['subject']) && !empty($_POST['subject']) && $error==false) {
    in the class.google_recaptcha.php file add (line 23 ish)
    Code:
    $pages_to_check[] =  'NOTIFY_FAQ_CAPTCHA_CHECK';
    Hopefully that should sort it - if not I'll have another look

    Regards
    David
    David,
    Thanks. I finally got a chance to get back to this (one of the many challenges of being a small business and doing our own site development!). After the changes you suggested are put in place the product info page dies with the following error:
    PHP Fatal error: Call to a member function notify() on a non-object in /home3/wwwsica/public_html/store-1st_1-5-4/includes/classes/observers/class.faq_request.php on line 38

    That is the $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK'); line I added in. I am gong to commect the line out for now intil I can find the solution.
    Thanks again

    Mike
    Last edited by DrByte; 24 Sep 2015 at 04:51 PM. Reason: edited as requested

  2. #202
    Join Date
    Aug 2010
    Location
    Hartland, MI
    Posts
    288
    Plugin Contributions
    3

    Default Re: Support Thread for Google reCAPTCHA plugin

    Ok so I have made a few more attempts at putting this in to the Ajax FAQ module, with no luck. Everything shows, but the check doesn't happen, and the question is sent regardless of the reCaptcha.
    Like I said b4 the $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK'); inside of the class.faq_request.php kills the page with an error, so I tried moving the notify to the tpl_modules_faq_questions.php file. Top or bottom of the file this didn't work.

    Also as this is an ajax pop-up how would I add it to the $event_array line in the class.google_recaptcha.php file?

    Thanks for any ideas

  3. #203
    Join Date
    May 2008
    Location
    United States
    Posts
    471
    Plugin Contributions
    1

    Default Re: Support Thread for Google reCAPTCHA plugin

    Quote Originally Posted by mikestaps View Post
    Ok so I have made a few more attempts at putting this in to the Ajax FAQ module, with no luck. Everything shows, but the check doesn't happen, and the question is sent regardless of the reCaptcha.
    Like I said b4 the $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK'); inside of the class.faq_request.php kills the page with an error, so I tried moving the notify to the tpl_modules_faq_questions.php file. Top or bottom of the file this didn't work.

    Also as this is an ajax pop-up how would I add it to the $event_array line in the class.google_recaptcha.php file?

    Thanks for any ideas
    mikestaps did you ever get this working on the FAQ page? I'm having a similar problem.

  4. #204
    Join Date
    Feb 2008
    Location
    Amersham, Buckinghamshire, United Kingdom
    Posts
    141
    Plugin Contributions
    1

    Default Re: Support Thread for Google reCAPTCHA plugin

    Hi. To fix the $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK') error, I think all you need to do is add
    Code:
    global $zco_notofier;
    just before it
    Regards

  5. #205
    Join Date
    May 2008
    Location
    United States
    Posts
    471
    Plugin Contributions
    1

    Default Re: Support Thread for Google reCAPTCHA plugin

    Quote Originally Posted by David Allen View Post
    Hi. To fix the $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK') error, I think all you need to do is add
    Code:
    global $zco_notofier;
    just before it
    Regards
    Hmm I have the code there however it's still ignoring the reCAPTCHA no matter if checked or unchecked. My issue sounded like the same issue as mikestaps was having so I was hopping he resolved it and would share how he was able to make it work.

  6. #206
    Join Date
    Aug 2010
    Location
    Hartland, MI
    Posts
    288
    Plugin Contributions
    3

    Default Re: Support Thread for Google reCAPTCHA plugin

    I have not be able to get it fully working, as I had moved this one to the back burner temporarily as I have other upgrades, etc. to make before going live.
    Adding the
    Code:
    global $zco_notifier;
    fixed that error, but then I found some other issues...
    I now having it working, except for the error message when you do not check the "I'm not a robot" box,
    It will currently show the "Please fill in the required information and submit it again. Thank you." error, then when you check the box it sends properly.
    Almost there...

    This is what I have in the class.faq_request.php file:
    Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2007-2008 Numinix Technology http://www.numinix.com    |
    // |                                                                      |
    // | Portions Copyright (c) 2003-2006 Zen Cart Development Team           |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    //  $Id: class.store_credit.php 12 2010-09-03 20:44:47Z numinix $
    //
    /**
     * Observer class used to handle reward points in an order
     *
     */
    class faqRequest extends base 
    {
    	function faqRequest() {
    		global $zco_notifier;
    		$zco_notifier->attach($this, array('NOTIFY_HEADER_END_PRODUCT_INFO'));
    	}
    	
    	function update(&$class, $eventID, $paramsArray) {
    		global $messageStack;
    		
        //bof google recaptcha
    		global $zco_notifier, $error;
    		$error = false;
    		$zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK');
    	//eof google rcaptcha
    	
        $fullname = zen_db_prepare_input($_POST['fullname']);
        $email_address = zen_db_prepare_input($_POST['email_address']);
        $subject = zen_db_prepare_input($_POST['subject']);
        $message = zen_db_prepare_input($_POST['message']);
        //$captcha = (int)zen_db_prepare_input($_POST['captcha']);
        $extra_info = email_collect_extra_info($name, $email_address, $customer_name, $customer_email);
        
    		if(isset($_GET['action']) && $_GET['action'] == 'faq_request') {
    			if(isset($_POST['email_address']) && !empty($_POST['email_address']) && isset($_POST['fullname']) && !empty($_POST['fullname']) && isset($_POST['message']) && !empty($_POST['message']) && $error==false) {
    
    				// captcha
    				//if($captcha !== (int)$_SESSION['simpleCaptcha']) {
    				 // echo json_encode(array('status' => 'error', 'message' => 'You have entered a wrong code. Please edit it and try again!'));
    				 // exit();
    				//}
    				
    				//bof google recaptcha
    				//$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
        
    				if (!$resp->is_valid) {
    				// set the error code so that we can display it
    				//$messageStack->add($event_array[$eventID], $resp->getErrors());
    				$error = true;
    				//echo json_encode(array('status' => 'error', 'message' => 'Please confirm you are not a robot.'));
    				//exit();
    				}
    				//eof google recaptcha
    				
    			  $sql_data_array = array(
    					'products_id' => (int)$_GET['products_id'],
    					'products_model' => zen_get_products_model ((int)$_GET['products_id']),
    					'products_name' => zen_get_products_name((int)$_GET['products_id']),
    					'fullname' => $fullname,
    					'email_address' => $email_address,
    					'subject' => $subject,
    					'message' => $message,
    					'date_created' => 'now()'
    				);
    				zen_db_perform(DB_PREFIX . 'faq_questions', $sql_data_array);
    				
    				$subject = sprintf('You have a new question about the %s', zen_get_products_name((int)$_GET['products_id'], $_SESSION['languages_id']));
    				$textmsg = $message . "\n\n" . $extra_info['TEXT'];
            // Prepare HTML-portion of message
            $html_msg['EMAIL_MESSAGE_HTML'] = $message;
            $html_msg['CONTACT_US_OFFICE_FROM'] = '';
            $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
        
    				zen_mail(STORE_NAME, EMAIL_FROM, $subject, $textmsg, $fullname, $email_address, $html_msg, 'contact_us');
    				if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
              echo json_encode(array('status' => 'success', 'message' => 'We have received your question. We will respond to you as quickly as possible. Thank you for asking.'));
    				} else {
              $messageStack->add_session('product_info', 'Your question has been sent, we will reply as soon as possible. Thank you!', 'success');
              zen_redirect(zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$_GET['products_id']));
            }
    			} else {
            if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
              echo json_encode(array('status' => 'error', 'message' => 'Please fill in the required information and submit it again. Thank you.'));
            } else {
              $messageStack->add_session('product_info', 'Please fill in all information and try again!', 'warning');
              zen_redirect(zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$_GET['products_id']));
            }
    			}
    			exit();
    		}
    	}
    }
    and these are the changes I made to the class.google_recaptcha.php file:
    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';
    		$pages_to_check[] =  'NOTIFY_FAQ_CAPTCHA_CHECK';
    		$pages_to_check[] =  'NOTIFY_FAQ_PAGE_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;
    	}
    }

  7. #207
    Join Date
    May 2008
    Location
    United States
    Posts
    471
    Plugin Contributions
    1

    Default Re: Support Thread for Google reCAPTCHA plugin

    Thanks for the reply I fixed my issue I had the:
    PHP Code:
    && $error==false 
    in the wrong place.

  8. #208
    Join Date
    May 2008
    Location
    United States
    Posts
    471
    Plugin Contributions
    1

    Default Re: Support Thread for Google reCAPTCHA plugin

    mikestaps's if you trying to get it to display a messagestack error for example "Please check the the reCAPTCHA form." then you probably have to add a
    PHP Code:
              $messageStack->add('WHATEVER-PAGE-NAME'GOOGLE_RECAPTCHA_CHECK_ERROR); 
    to the:
    class.google_recaptcha.php file at the bottom for that page. My file is different since I'm not using what is available for download. I added the 2.0 reCAPTCHA myself before it was available for download by David so my implantation is slightly different. Below is how I did it so you can get an idea:

    PHP Code:
    // Zencart stuff
    class google_recaptcha extends base {
        function 
    __construct() {
                
    $this->attach($this, array('NOTIFY_CONTACT_US_CAPTCHA_CHECK''NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK''NOTIFY_TRACKING_CAPTCHA_CHECK'));
        }

        function 
    update(&$class$eventID$paramsArray = array()) {
            global 
    $messageStack$error$secret;
            
    $event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact''NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account''NOTIFY_TRACKING_CAPTCHA_CHECK' => 'tracking');
            
    // reCAPTCHA response?
            
    if(isset($_POST['g-recaptcha-response'])){
              
    $captcha=$_POST['g-recaptcha-response'];
            }
            if(!
    $captcha){
              
    $messageStack->add('contact'GOOGLE_RECAPTCHA_CHECK_ERROR);
              
    $messageStack->add('create_account'GOOGLE_RECAPTCHA_CHECK_ERROR);
              
    $messageStack->add('tracking'GOOGLE_RECAPTCHA_CHECK_ERROR);
              
    $error true;
            }
        return 
    $error;
        }


  9. #209
    Join Date
    May 2008
    Location
    United States
    Posts
    471
    Plugin Contributions
    1

    Default Re: Support Thread for Google reCAPTCHA plugin

    mikestaps's try the below for your class.google_recaptcha.php file:

    PHP 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';
            
    $pages_to_check[] =  'NOTIFY_FAQ_CAPTCHA_CHECK';
            
    $pages_to_check[] =  'NOTIFY_FAQ_PAGE_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''NOTIFY_FAQ_CAPTCHA_CHECK' => 'faq''NOTIFY_FAQ_PAGE_CAPTCHA_CHECK' => 'faq_page');
                
    $messageStack->add($event_array[$eventID], $resp->getErrors());
                
    $error true;
            }
            return 
    $error;
        }
    }

  10. #210
    Join Date
    Aug 2010
    Location
    Hartland, MI
    Posts
    288
    Plugin Contributions
    3

    Default Re: Support Thread for Google reCAPTCHA plugin

    Quote Originally Posted by marcopolo View Post
    mikestaps's if you trying to get it to display a messagestack error for example "Please check the the reCAPTCHA form." then you probably have to add a
    PHP Code:
              $messageStack->add('WHATEVER-PAGE-NAME'GOOGLE_RECAPTCHA_CHECK_ERROR); 
    Quote Originally Posted by marcopolo View Post
    mikestaps's try the below for your class.google_recaptcha.php file:
    I tried both with no luck. When I added the mesage stack error it locked things up and the FAQ wouldn't submit, and the class file had no effect.
    Thanks

 

 
Page 21 of 68 FirstFirst ... 11192021222331 ... LastLast

Similar Threads

  1. Support Thread for CKEditor Plugin
    By DivaVocals in forum Addon Admin Tools
    Replies: 213
    Last Post: 18 Nov 2024, 04:17 AM
  2. Back to Top Plugin [Support Thread]
    By picaflor-azul in forum All Other Contributions/Addons
    Replies: 31
    Last Post: 6 Feb 2016, 10:52 PM
  3. v151 Plug 'n' Pay plugin [Support Thread]
    By KetchRescue in forum Addon Payment Modules
    Replies: 5
    Last Post: 28 Nov 2015, 04:56 AM
  4. Justuno Plugin [Support Thread]
    By JustunoApp in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 24 May 2015, 11:00 PM
  5. VendingBox Plugin Support Thread
    By vb_support in forum All Other Contributions/Addons
    Replies: 31
    Last Post: 10 Feb 2013, 07:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR