mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Вынос рендеринга каптчи в экшен Ajax, удаление из шаблонов переменных SESSION_ID и SESSION_NAME
This commit is contained in:
parent
3c15ecd05c
commit
7b58498391
|
@ -93,7 +93,8 @@ class ActionAjax extends Action {
|
|||
|
||||
$this->AddEventPreg('/^property$/i','/^tags$/','/^autocompleter$/','/^$/','EventPropertyTagsAutocompleter');
|
||||
|
||||
$this->AddEventPreg('/^validate$/i','/^captcha$/','/^$/','EventValidateCaptcha');
|
||||
$this->AddEventPreg('/^captcha$/i','/^$/','EventCaptcha');
|
||||
$this->AddEventPreg('/^captcha$/i','/^validate$/','/^$/','EventCaptchaValidate');
|
||||
|
||||
$this->AddEventPreg('/^poll$/i','/^modal-create$/','/^$/','EventPollModalCreate');
|
||||
$this->AddEventPreg('/^poll$/i','/^modal-update/','/^$/','EventPollModalUpdate');
|
||||
|
@ -400,15 +401,33 @@ class ActionAjax extends Action {
|
|||
$this->Viewer_AssignAjax('sText',$oViewer->Fetch("modals/modal.poll_create.tpl"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Отображение каптчи
|
||||
*/
|
||||
protected function EventCaptcha() {
|
||||
$this->Viewer_SetResponseAjax(null);
|
||||
/**
|
||||
* Подключаем каптчу
|
||||
*/
|
||||
require_once(Config::Get('path.framework.libs_vendor.server').'/kcaptcha/kcaptcha.php');
|
||||
/**
|
||||
* Определяем уникальное название (возможность нескольких каптч на одной странице)
|
||||
*/
|
||||
$sName='';
|
||||
if (isset($_GET['name']) and is_string($_GET['name']) and $_GET['name']) {
|
||||
$sName=$_GET['name'];
|
||||
}
|
||||
/**
|
||||
* Генерируем каптчу и сохраняем код в сессию
|
||||
*/
|
||||
$oCaptcha=new KCAPTCHA();
|
||||
$this->Session_Set('captcha_keystring'.($sName ? '_'.$sName : ''),$oCaptcha->getKeyString());
|
||||
$this->SetTemplate(false);
|
||||
}
|
||||
/**
|
||||
* Ajax валидация каптчи
|
||||
*/
|
||||
protected function EventValidateCaptcha() {
|
||||
/**
|
||||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
|
||||
protected function EventCaptchaValidate() {
|
||||
$sName=isset($_REQUEST['params']['name']) ? $_REQUEST['params']['name'] : '';
|
||||
$sValue=isset($_REQUEST['fields'][0]['value']) ? $_REQUEST['fields'][0]['value'] : '';
|
||||
$sField=isset($_REQUEST['fields'][0]['field']) ? $_REQUEST['fields'][0]['field'] : '';
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
{$_aRules = [
|
||||
'required' => true,
|
||||
'remote' => {router page='ajax/validate/captcha'},
|
||||
'remote' => {router page='ajax/captcha/validate'},
|
||||
'remote-method' => 'POST',
|
||||
'remote-param-name' => $smarty.local.sCaptchaName
|
||||
]}
|
||||
|
|
|
@ -61,8 +61,6 @@
|
|||
DIR_ENGINE_LIBS = '{cfg name="path.framework.web"}/libs',
|
||||
|
||||
LIVESTREET_SECURITY_KEY = '{$LIVESTREET_SECURITY_KEY}',
|
||||
SESSION_ID = '{$_sPhpSessionId}',
|
||||
SESSION_NAME = '{$_sPhpSessionName}',
|
||||
LANGUAGE = '{Config::Get('lang.current')}',
|
||||
WYSIWYG = {if Config::Get('view.wysiwyg')}true{else}false{/if},
|
||||
USER_PROFILE_LOGIN = {if $oUserProfile}{json var=$oUserProfile->getLogin()}{else}''{/if};
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b61f4b9b03f0a3024638e273e5cb811524959d8b
|
||||
Subproject commit ae0354c41f5a276a0c12764e5cc2bada0f9c9342
|
Loading…
Reference in a new issue