is_configured()) return; $this->get_language(); if ($this->enabled_location('register')) { $manager->bind('register_after_validation', array($this, 'hook_after_validation')); $manager->bind('register_before_submit', array($this, 'hook_before_submit')); } if ($this->enabled_location('login')) { $manager->bind('login_after_validation', array($this, 'hook_after_validation')); $manager->bind('login_before_submit', array($this, 'hook_before_submit')); } if ($this->enabled_location('guestpost') && $pun_user['is_guest']) { $manager->bind('post_after_validation', array($this, 'hook_after_validation')); $manager->bind('post_before_submit', array($this, 'hook_before_submit')); $manager->bind('quickpost_before_submit', array($this, 'hook_before_submit')); } } function is_configured() { global $pun_config; return !empty($pun_config['recaptcha_enabled']) && !empty($pun_config['recaptcha_site_key']) && !empty($pun_config['recaptcha_secret_key']); } function enabled_location($page) { global $pun_config; return !empty($pun_config['recaptcha_location_'.$page]); } function get_language() { global $pun_user; if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/recaptcha_addon.php')) require PUN_ROOT.'lang/'.$pun_user['language'].'/recaptcha_addon.php'; else require PUN_ROOT.'lang/English/recaptcha_addon.php'; } function hook_after_validation() { global $errors, $lang_recaptcha; if (empty($errors) && !$this->verify_user_response()) { $errors[] = $lang_recaptcha['Error']; } } function hook_before_submit() { global $pun_config, $lang_recaptcha; $site_key = $pun_config['recaptcha_site_key']; ?>