From ced97f4f4dae25097f2a540b1a1041f33725b064 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 1 Oct 2020 15:29:32 +0900 Subject: [PATCH] Remove reCAPTCHA addon --- addons/recaptcha/conf/info.xml | 131 --------------------------- addons/recaptcha/lang/en.php | 4 - addons/recaptcha/lang/ko.php | 4 - addons/recaptcha/recaptcha.addon.php | 61 ------------- addons/recaptcha/recaptcha.class.php | 70 -------------- addons/recaptcha/recaptcha.js | 40 -------- 6 files changed, 310 deletions(-) delete mode 100644 addons/recaptcha/conf/info.xml delete mode 100644 addons/recaptcha/lang/en.php delete mode 100644 addons/recaptcha/lang/ko.php delete mode 100644 addons/recaptcha/recaptcha.addon.php delete mode 100644 addons/recaptcha/recaptcha.class.php delete mode 100644 addons/recaptcha/recaptcha.js diff --git a/addons/recaptcha/conf/info.xml b/addons/recaptcha/conf/info.xml deleted file mode 100644 index e6b0eaa42..000000000 --- a/addons/recaptcha/conf/info.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - reCAPTCHA - reCAPTCHA - 구글 reCAPTCHA 서비스를 사용하여 자동 가입 스팸을 방지합니다. - Prevent automated signups and spam with Google's reCAPTCHA service. - 1.0.0 - 2016-05-27 - - Kijin Sung - Kijin Sung - - - - Site Key - Site Key - - - Secret Key - Secret Key - - - 회원가입에 사용 - Use on Signup Form - - - Yes - - - 아니오 - No - - - - 로그인에 사용 - Use on Login Form - - - Yes - - - 아니오 - No - - - - ID/PW찾기에 사용 - Use on Account Recovery Form - - - Yes - - - 아니오 - No - - - - 글쓰기에 사용 - Use on New Document - - 아니오 - No - - - - Yes - - - - 댓글쓰기에 사용 - Use on New Comment - - 아니오 - No - - - - Yes - - - - 사용 대상 - Target Users - - 비회원만 사용 - Non-members Only - - - 모든 방문자에게 사용 - Everyone - - - - 사용 빈도 - Target Frequency - - 매번 사용 - Every Time - - - 방문자당 최초 1회만 사용 - First Time Only - - - - 테마 - Theme - - 밝은 테마 - Light - - - 어두운 테마 - Dark - - - - 크기 - Size - - 보통 - Normal - - - 작게 - Compact - - - - diff --git a/addons/recaptcha/lang/en.php b/addons/recaptcha/lang/en.php deleted file mode 100644 index 02baffd5a..000000000 --- a/addons/recaptcha/lang/en.php +++ /dev/null @@ -1,4 +0,0 @@ -msg_recaptcha_connection_error = 'An error occurred while connecting to the reCAPTCHA verification server.'; -$lang->msg_recaptcha_server_error = 'An error occurred while verifying your reCAPTCHA response.'; -$lang->msg_recaptcha_invalid_response = 'Please check reCAPTCHA.'; diff --git a/addons/recaptcha/lang/ko.php b/addons/recaptcha/lang/ko.php deleted file mode 100644 index e26e413f3..000000000 --- a/addons/recaptcha/lang/ko.php +++ /dev/null @@ -1,4 +0,0 @@ -msg_recaptcha_connection_error = 'reCAPTCHA 스팸방지 서버에 접속하는 도중 오류가 발생했습니다.'; -$lang->msg_recaptcha_server_error = 'reCAPTCHA 스팸방지 서버와 통신하는 도중 오류가 발생했습니다.'; -$lang->msg_recaptcha_invalid_response = 'reCAPTCHA 스팸방지 기능을 체크해 주십시오.'; diff --git a/addons/recaptcha/recaptcha.addon.php b/addons/recaptcha/recaptcha.addon.php deleted file mode 100644 index 816580bb9..000000000 --- a/addons/recaptcha/recaptcha.addon.php +++ /dev/null @@ -1,61 +0,0 @@ -site_key || !$addon_info->secret_key || $called_position !== 'before_module_init') -{ - return; -} - -$current_action = Context::get('act'); -$current_member = Context::get('logged_info'); - -if ($current_member->is_admin === 'Y') -{ - $enable_captcha = false; -} -elseif ($addon_info->target_users !== 'everyone' && $current_member->member_srl) -{ - $enable_captcha = false; -} -elseif ($addon_info->target_frequency !== 'every_time' && isset($_SESSION['recaptcha_authenticated']) && $_SESSION['recaptcha_authenticated']) -{ - $enable_captcha = false; -} -elseif ($addon_info->use_signup === 'Y' && preg_match('/^(?:disp|proc)Member(?:SignUp|Insert)/i', $current_action)) -{ - $enable_captcha = true; -} -elseif ($addon_info->use_login === 'Y' && preg_match('/^(?:disp|proc)MemberLogin(?:Form)?/i', $current_action)) -{ - $enable_captcha = true; -} -elseif ($addon_info->use_recovery === 'Y' && preg_match('/^(?:disp|proc)Member(?:FindAccount|ResendAuthMail)/i', $current_action)) -{ - $enable_captcha = true; -} -elseif ($addon_info->use_document === 'Y' && preg_match('/^(?:disp|proc)Board(Write|InsertDocument)/i', $current_action)) -{ - $enable_captcha = true; -} -elseif ($addon_info->use_comment === 'Y' && (preg_match('/^(?:disp|proc)Board(Content|InsertComment)/i', $current_action) || (!$current_action && Context::get('document_srl')))) -{ - $enable_captcha = true; -} -else -{ - $enable_captcha = false; -} - -if ($enable_captcha) -{ - include_once __DIR__ . '/recaptcha.class.php'; - reCAPTCHA::init($addon_info); - - if (strncasecmp('proc', $current_action, 4) === 0) - { - getController('module')->addTriggerFunction('moduleObject.proc', 'before', 'reCAPTCHA::check'); - } - else - { - Context::set('captcha', new reCAPTCHA()); - } -} diff --git a/addons/recaptcha/recaptcha.class.php b/addons/recaptcha/recaptcha.class.php deleted file mode 100644 index 11177627b..000000000 --- a/addons/recaptcha/recaptcha.class.php +++ /dev/null @@ -1,70 +0,0 @@ - self::$config->secret_key, - 'response' => $response, - 'remoteip' => \RX_CLIENT_IP, - )); - } - catch (\Requests_Exception $e) - { - throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_connection_error'); - } - - $verify = @json_decode($verify_request->body, true); - if ($verify && isset($verify['error-codes']) && in_array('invalid-input-response', $verify['error-codes'])) - { - throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_invalid_response'); - } - elseif (!$verify || !$verify['success'] || (isset($verify['error-codes']) && $verify['error-codes'])) - { - throw new Rhymix\Framework\Exception('recaptcha.msg_recaptcha_server_error'); - } - else - { - $_SESSION['recaptcha_authenticated'] = true; - return true; - } - } - - public function __construct() - { - if (!self::$scripts_added) - { - self::$scripts_added = true; - Context::loadFile(array('./addons/recaptcha/recaptcha.js', 'body')); - Context::addHtmlFooter(''); - $html = '
'; - $html = sprintf($html, escape(self::$config->site_key), self::$config->theme ?: 'light', self::$config->size ?: 'normal'); - Context::addHtmlFooter($html); - } - } - - public function __toString() - { - return sprintf('
', self::$instances_inserted++); - } -} diff --git a/addons/recaptcha/recaptcha.js b/addons/recaptcha/recaptcha.js deleted file mode 100644 index a1e5ae1cb..000000000 --- a/addons/recaptcha/recaptcha.js +++ /dev/null @@ -1,40 +0,0 @@ - -function reCaptchaCallback() { - var recaptcha_config = $("#recaptcha-config"); - var recaptcha_instances = $(".g-recaptcha"); - var recaptcha_instance_id = 1; - - if (recaptcha_instances.size() === 0) { - var autoinsert_candidates = $("form").filter(function() { - var actinput = $("input[name='act']", this); - if (actinput.size() && actinput.val() && actinput.val().match(/^proc.+(Insert(Document|Comment|)|Login|FindAccount|ResendAuthMail)/i)) { - return true; - } - var procfilter = $(this).attr("onsubmit"); - if (procfilter && procfilter.match(/procFilter\b.+\binsert/i)) { - return true; - } - return false; - }); - autoinsert_candidates.each(function() { - var new_instance = $('
'); - new_instance.attr("id", "recaptcha-instance-" + recaptcha_instance_id++); - var autoinsert_point = $(this).find("button[type='submit'],input[type='submit']").parent(); - if (autoinsert_point.size()) { - new_instance.insertBefore(autoinsert_point); - } else { - new_instance.appendTo($(this)); - } - }); - var recaptcha_instances = $(".g-recaptcha"); - } - - recaptcha_instances.each(function() { - var instance = $(this); - grecaptcha.render(instance.attr("id"), { - sitekey: recaptcha_config.data("sitekey"), - size: recaptcha_config.data("size"), - theme: recaptcha_config.data("theme") - }); - }); -}