<?php

/**
*
* @package Free Tube Script
* @version v1.0
* @copyright (c) 2011 Agriz
* @license GNU Public License Under Certain Conditions [Powered by should remain unchanged]
* @contact http://www.agrizlive.com
*
*/

	class CaptchaComponent extends Object {
		function initialize(&$controller, $settings = array()) {
			
		}
		function startup(&$controller) {
			$controller->params['private_key'] = Configure::read('MyApp.private_key');
			$controller->params['public_key'] = Configure::read('MyApp.public_key');
		}
		
		public function validate() {
			App::import('vendor', 'recaptcha/recaptchalib');
		
			$resp = recaptcha_check_answer(Configure::read('MyApp.private_key'), $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
			$error = $resp->error;		
			return $resp->is_valid;
		}
	}
?>