Example #1
0
 /**
  * Reloads the captcha image
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function reload()
 {
     // dump(func_get_args());
     $config = EasyBlogHelper::getConfig();
     $adapters = EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'captcha';
     // If no captcha is enabled, ignore it.
     if (!$config->get('comment_recaptcha') && !$config->get('comment_captcha')) {
         return true;
     }
     $public = $config->get('comment_recaptcha_public');
     $private = $config->get('comment_recaptcha_private');
     if ($config->get('comment_recaptcha') && $config->get('comment_recaptcha') && $config->get('comment_recaptcha_public')) {
         require_once $adapters . DIRECTORY_SEPARATOR . 'recaptcha.php';
         $ajax->script(EasyBlogRecaptcha::getReloadScript($ajax, $post));
         return true;
     }
     // @task: If recaptcha is not enabled, we assume that the built in captcha is used.
     // Generate a new captcha
     if (isset($post['captcha-id'])) {
         $ref = EB::table('Captcha');
         $ref->load($post['captcha-id']);
         $state = $ref->delete();
         if ($state) {
             // we need to unset this variable so that when calling EasyBlogCaptcha::getReloadScript, EB will not run the deletion again.
             unset($post['captcha-id']);
         }
     }
     require_once $adapters . DIRECTORY_SEPARATOR . 'captcha.php';
     $ajax->script(EasyBlogCaptcha::getReloadScript($ajax, $post));
     return true;
 }
Example #2
0
 public static function getError($ajax, $post)
 {
     $ajax->script('eblog.comment.displayInlineMsg( "error" , "' . JText::_('COM_EASYBLOG_RECAPTCHA_INVALID_RESPONSE') . '");');
     $ajax->script('eblog.spinner.hide();');
     $ajax->script('eblog.loader.doneLoading();');
     $ajax->script(EasyBlogRecaptcha::getReloadScript($ajax, $post));
     return $ajax->send();
 }