AntonLV há 11 anos atrás
pai
commit
a37bb8d231

+ 1 - 1
install/sql/system.sql

@@ -243,7 +243,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_redirect_after_account_added', '', 'page.php?i=create-persons-profile', 'digit', '', '', '', 50),
 
 (@iCategoryId, 'sys_editor_default', '', 'sys_tinymce', 'digit', '', '', '', 60),
-(@iCategoryId, 'sys_captcha_default', '', 'sys_recaptcha_new', 'digit', '', '', '', 61),
+(@iCategoryId, 'sys_captcha_default', '', 'sys_recaptcha', 'digit', '', '', '', 61),
 
 (@iCategoryId, 'sys_live_updates_interval', '', '10000', 'digit', '', '', '', 70);
 

+ 10 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -1571,6 +1571,16 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_form_account"><![CDATA[Account]]></string>
 	<string name="_sys_form_account_input_captcha"><![CDATA[Security Image]]></string>
 	<string name="_sys_form_account_input_captcha_error"><![CDATA[Security image input failed. Please, try again.]]></string>
+	<string name="_sys_form_account_input_captcha_label_text_image"><![CDATA[Type the text:]]></string>
+	<string name="_sys_form_account_input_captcha_label_text_audio"><![CDATA[Type the text you hear:]]></string>
+	<string name="_sys_form_account_input_captcha_action_refresh"><![CDATA[refresh]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_refresh"><![CDATA[Get another CAPTCHA]]></string>
+	<string name="_sys_form_account_input_captcha_action_audio"><![CDATA[audio]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_audio"><![CDATA[Get an audio CAPTCHA]]></string>
+	<string name="_sys_form_account_input_captcha_action_image"><![CDATA[image]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_image"><![CDATA[Get an image CAPTCHA]]></string>
+	<string name="_sys_form_account_input_captcha_action_help"><![CDATA[help]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_help"><![CDATA[Get Help]]></string>
 	<string name="_sys_form_account_input_delete_confirm"><![CDATA[I'm sure that I want to delete the account with content.]]></string>
 	<string name="_sys_form_account_input_delete_confirm_error"><![CDATA[Please check this checkbox if you really want to delete your account and your content.]]></string>
 	<string name="_sys_form_account_input_delete_confirm_info"><![CDATA[This action can not be undone.]]></string>

+ 10 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -1571,6 +1571,16 @@
 	<string name="_sys_form_account"><![CDATA[Аккаунт]]></string>
 	<string name="_sys_form_account_input_captcha"><![CDATA[Капча]]></string>
 	<string name="_sys_form_account_input_captcha_error"><![CDATA[Проверка капчи не удалась. Попытайтесь ещё раз.]]></string>
+	<string name="_sys_form_account_input_captcha_label_text_image"><![CDATA[Введите текст:]]></string>
+	<string name="_sys_form_account_input_captcha_label_text_audio"><![CDATA[Введите услышанный текст:]]></string>
+	<string name="_sys_form_account_input_captcha_action_refresh"><![CDATA[обновить]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_refresh"><![CDATA[Получить другую CAPTCHA]]></string>
+	<string name="_sys_form_account_input_captcha_action_audio"><![CDATA[аудио]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_audio"><![CDATA[Прослушать CAPTCHA]]></string>
+	<string name="_sys_form_account_input_captcha_action_image"><![CDATA[изображение]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_image"><![CDATA[Получить CAPTCHA в виде изображения]]></string>
+	<string name="_sys_form_account_input_captcha_action_help"><![CDATA[помощь]]></string>
+	<string name="_sys_form_account_input_captcha_action_title_help"><![CDATA[Получить помощь]]></string>
 	<string name="_sys_form_account_input_delete_confirm"><![CDATA[Я уверен, что хочу удалить аккаунт вместе с содержимым.]]></string>
 	<string name="_sys_form_account_input_delete_confirm_error"><![CDATA[Пожалуйста, отметьте этот флажок, если Вы действительно хотите удалить свой аккаунт вместе с содержимым.]]></string>
 	<string name="_sys_form_account_input_delete_confirm_info"><![CDATA[Это действие не может быть отменено.]]></string>

+ 91 - 0
template/css/forms.css

@@ -363,3 +363,94 @@
     font-weight:bold;
 }
 
+
+/****************************************
+*		Custom reCaptcha Theme
+****************************************/
+.bx-form-input-captcha {
+	background-color: #b71800;
+	padding: 0.5em;
+	border-radius: 1em;
+	position: relative;
+	overflow: auto;
+	max-width: 480px;
+	font: 0.75em/1em "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+	color: #ffffff;
+}
+.bx-form-input-captcha a {
+	color: #ffffff;
+	text-decoration: none;
+}
+.bx-form-input-captcha img,
+.bx-form-input-captcha #recaptcha_image {
+	width: 100% !important;
+	height: auto !important;
+	-webkit-border-radius: 0.5em;
+	-moz-border-radius: 0.5em;
+	border-radius: 0.5em;
+	-moz-background-clip: padding;
+	-webkit-background-clip: padding-box;
+	background-clip: padding-box;
+}
+.bx-form-input-captcha .solution {
+	position: relative;
+	float: left;
+	width: 75%;
+}
+.bx-form-input-captcha .solution-cnt {
+	margin-top: 0.5em;
+	padding: 1.2em 1em;
+	-webkit-border-radius: 0.5em;
+	-moz-border-radius: 0.5em;
+	border-radius: 0.5em;
+	-moz-background-clip: padding;
+	-webkit-background-clip: padding-box;
+	background-clip: padding-box;
+	background-color: #fbe098;
+	color: #000000;
+	display: block;
+}
+.bx-form-input-captcha .solution-cnt input {
+	display: block;
+	width: calc(90% - 2px);
+	margin: 0.35em auto;
+	-webkit-appereance: none;
+	border: 1px solid #f7c236;
+	font: inherit;
+	font-size: 150%;
+	outline: none;
+}
+.bx-form-input-captcha .solution-cnt input:focus {
+	border-color: #b71800;
+}
+.bx-form-input-captcha .options {
+	position: relative;
+	float: right;
+	width: 25%;
+	
+}
+.bx-form-input-captcha .options-cnt {
+	margin-top: 0.5em;
+	padding-left: 0.5em;
+	-webkit-border-radius: 0.5em;
+	-moz-border-radius: 0.5em;
+	border-radius: 0.5em;
+	-moz-background-clip: padding;
+	-webkit-background-clip: padding-box;
+	background-clip: padding-box;
+}
+.bx-form-input-captcha .options-cnt a {
+	background-color: #c5523d;
+	display: block;
+	padding: 0.5em 1.0em;
+	border-top: 1px solid #000000;
+	border-left: 1px solid #000000;
+	border-right: 1px solid #000000;
+}
+.bx-form-input-captcha .options-cnt a:first-child {
+	border-radius: 0.5em 0.5em 0 0;
+}
+.bx-form-input-captcha .options-cnt a:last-child {
+	border-radius: 0 0 0.5em 0.5em;
+	border-bottom: 1px solid #000000;
+}

+ 36 - 0
template/reCaptcha.html

@@ -0,0 +1,36 @@
+<div id="__id__" class="form_input_captcha" style="display:none">
+	<div id="recaptcha_image"></div>
+	<div class="recaptcha_only_if_incorrect_sol" style="color:red"><bx_text:_sys_form_account_input_captcha_error /></div>
+	<div class="solution">
+		<div class="solution-cnt">
+			<span class="recaptcha_only_if_image"><bx_text:_sys_form_account_input_captcha_label_text_image /></span>
+			<span class="recaptcha_only_if_audio"><bx_text:_sys_form_account_input_captcha_label_text_audio /></span>
+			<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
+		</div>
+	</div>
+	<div class="options">
+		<div class="options-cnt">
+			<a href="javascript:__js_object__.reload()" id="icon-reload" title="<bx_text_attribute:_sys_form_account_input_captcha_action_title_refresh />"><i class="sys-icon refresh"> <bx_text:_sys_form_account_input_captcha_action_refresh /></i></a>
+			<a class="recaptcha_only_if_image" href="javascript:__js_object__.switch_type('audio')" id="icon-audio" title="<bx_text_attribute:_sys_form_account_input_captcha_action_title_audio />"><i class="sys-icon volume-up"> <bx_text:_sys_form_account_input_captcha_action_audio /></i></a>
+			<a class="recaptcha_only_if_audio" href="javascript:__js_object__.switch_type('image')" id="icon-image" title="<bx_text_attribute:_sys_form_account_input_captcha_action_title_image />"><i class="sys-icon picture-o"> <bx_text:_sys_form_account_input_captcha_action_image /></i></a>
+			<a href="javascript:__js_object__.showhelp()" id="icon-help" title="<bx_text_attribute:_sys_form_account_input_captcha_action_title_help />"><i class="sys-icon question-circle"> <bx_text:_sys_form_account_input_captcha_action_help /></i></a>
+		</div>
+	</div>
+</div>
+<script type="text/javascript" language="javascript">
+	<bx_if:show_common>
+		$(document).ready(function () {
+			__js_init__
+		});
+	</bx_if:show_common>
+	<bx_if:show_dynamic>
+		if ('undefined' == typeof(window.__js_object__)) {
+	        $.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js', function(data, textStatus, jqxhr) {
+	            __js_init__
+	        });
+	    }
+		else {
+	    	__js_init__
+	    }
+	</bx_if:show_dynamic>
+</script>

+ 27 - 34
template/scripts/BxBaseCaptchaReCAPTCHA.php

@@ -16,7 +16,7 @@ class BxBaseCaptchaReCAPTCHA extends BxDolCaptcha
     protected $_bJsCssAdded = false;
     protected $_oTemplate;
 
-    protected $_sSkin = 'white';
+    protected $_sSkin = 'custom';
     protected $_error = null;
     protected $_sKeyPublic;
     protected $_sKeyPrivate;
@@ -42,39 +42,32 @@ class BxBaseCaptchaReCAPTCHA extends BxDolCaptcha
         // TODO: captcha don't display error in javascript mode, try to find the way on how to pass error code in this mode
 
         $sId = 'sys-captcha-' . time() . rand(0, PHP_INT_MAX);
-        $sInit = "
-            Recaptcha.create('" . $this->_sKeyPublic . "', '" . $sId . "', {
-                lang: '" . BxDolLanguages::getInstance()->getCurrentLanguage() . "',
-                theme: '" . $this->_sSkin . "',
-                callback: Recaptcha.focus_response_field
-            });
-        ";
-
-        if ($bDynamicMode) {
-
-            $sCode = "
-            <script>
-                if ('undefined' == typeof(window.Recaptcha)) {
-                    $.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js', function(data, textStatus, jqxhr) {
-                        $sInit
-                    });
-                } else {
-                    $sInit
-                }
-            </script>";
-
-        } else {
-
-            $sCode = "
-            <script>
-                $(document).ready(function () {
-                    $sInit
-                });
-            </script>";
-
-        }
-
-        return $this->_addJsCss($bDynamicMode) . '<div id="' . $sId . '"></div>' . $sCode;
+        $sJsObject = 'Recaptcha';
+
+        $sInit = $sJsObject . ".create('" . $this->_sKeyPublic . "', '" . $sId . "', {
+			lang: '" . BxDolLanguages::getInstance()->getCurrentLanguage() . "',
+			theme: '" . $this->_sSkin . "',
+			custom_theme_widget: '" . $sId . "',
+			callback: " . $sJsObject . ".focus_response_field
+		});";
+
+        return $this->_addJsCss($bDynamicMode) . $this->_oTemplate->parseHtmlByName('reCaptcha.html', array(
+        	'js_object' => $sJsObject, 
+        	'id' => $sId,
+        	'bx_if:show_common' => array(
+        		'condition' => !$bDynamicMode,
+        		'content' => array(
+        			'js_init' => $sInit,
+        		)
+        	),
+        	'bx_if:show_dynamic' => array(
+        		'condition' => $bDynamicMode,
+        		'content' => array(
+        			'js_object' => $sJsObject,
+        			'js_init' => $sInit,
+        		)
+        	),
+        ));
     }
 
     /**