Example #1
0
 public static function filter($comment, $obj)
 {
     $userObj = $obj->widget('Widget_User');
     if ($userObj->hasLogin() && $userObj->pass('administrator', true)) {
         return $comment;
     }
     $privatekey = Typecho_Widget::widget('Widget_Options')->plugin('GeeTest')->privatekey;
     $geetest = new GeetestLib($privatekey);
     $validate_response = $geetest->geetest_validate(@$_POST['geetest_challenge'], @$_POST['geetest_validate'], @$_POST['geetest_seccode']);
     if ($validate_response) {
         return $comment;
     }
     throw new Typecho_Widget_Exception(_t('验证码不正确哦!'));
 }