update ver 3.31

This commit is contained in:
2026-03-06 15:28:56 +05:00
parent eeb73ad541
commit 51d83a3832
7 changed files with 285 additions and 213 deletions

View File

@@ -1,8 +1,6 @@
### editcaptcha
## Модуль Настройки captcha
![Модуль Настройки captcha](https://gitget.ru/img/3.png "Модуль Настройки captcha")
## Модуль Настройки captcha v 3.31
### Модуль позволяет настроить визуальный вывод captcha.
@@ -12,6 +10,8 @@
### Changelog:
06.03.2026 - Адаптация для версии ave.cms 3.31 ALT, добавлены настройки фона.
02.09.2019 - Адаптация для версии ave.cms 3.26
12.10.2016 - начальная версия 1.0

View File

@@ -1,19 +1,96 @@
<?
<?php
/**
* @autor Repellent
* AVE.cms - Модуль Настройки captcha
* @author Repellent
* @package AVE.cms
* @subpackage editcaptcha
* @filesource
*/
class ModuleEditcaptcha
{
var $tpl_dir;
function editCaptcha ()
{
global $AVE_Template;
$imports = "ASD";
$AVE_Template->assign('captchas',$captcha);
$AVE_Template->assign('content', $AVE_Template->fetch($this->tpl_dir . 'editcaptcha.tpl'));
}
}
?>
public $tpl_dir;
private function checkAccess()
{
return (defined('ACP') && check_permission('modules'));
}
public function editCaptcha()
{
global $AVE_Template;
$config_file = BASE_DIR . '/lib/kcaptcha/kcaptcha_config.php';
// Дефолты
$allowed_symbols = "23456789abcdegikpqsvxyz";
$length = "4,6";
$fluctuation_amplitude = 8;
$white_noise_density = "1/30";
$black_noise_density = "1/30";
$no_spaces = true;
$background_color = array(255, 255, 255);
if (file_exists($config_file)) {
include($config_file);
}
// Преобразуем массив RGB в HEX для инпута в админке
$bg_hex = sprintf("#%02x%02x%02x", $background_color[0], $background_color[1], $background_color[2]);
$AVE_Template->assign([
'allow_symbols' => $allowed_symbols,
'count_symbols' => $length,
'fluct_amplit' => $fluctuation_amplitude,
'white_noise' => $white_noise_density,
'black_noise' => $black_noise_density,
'no_spaces' => ($no_spaces == true) ? 'true' : 'false',
'bg_color' => $bg_hex
]);
$AVE_Template->assign('content', $AVE_Template->fetch($this->tpl_dir . 'editcaptcha.tpl'));
}
public function saveCaptcha()
{
if (!$this->checkAccess()) exit("Access Denied");
$a = preg_replace('/[^a-z0-9]/i', '', $_POST['a'] ?? '');
$b = preg_replace('/[^0-9,]/', '', $_POST['b'] ?? '4,6');
$c = (int)($_POST['c'] ?? 8);
$d = strip_tags($_POST['d'] ?? '0');
$e = strip_tags($_POST['e'] ?? '0');
$f = ($_POST['f'] === 'true') ? 'true' : 'false';
// Обработка цвета фона (из #ffffff в array(255,255,255))
$hex = $_POST['g'] ?? '#ffffff';
list($r, $g, $b_rgb) = sscanf($hex, "#%02x%02x%02x");
$length_val = (strpos($b, ',') !== false) ? "mt_rand({$b})" : (int)$b;
$text = "<?php\n\n";
$text .= "# KCAPTCHA configuration file\n";
$text .= "\$alphabet = \"0123456789abcdefghijklmnopqrstuvwxyz\";\n";
$text .= "\$allowed_symbols = \"{$a}\";\n";
$text .= "\$fontsdir = 'fonts';\n";
$text .= "\$length = {$length_val};\n";
$text .= "\$width = 160;\n";
$text .= "\$height = 80;\n";
$text .= "\$fluctuation_amplitude = {$c};\n";
$text .= "\$white_noise_density = {$d};\n";
$text .= "\$black_noise_density = {$e};\n";
$text .= "\$no_spaces = {$f};\n";
$text .= "\$show_credits = false;\n";
$text .= "\$foreground_color = array(mt_rand(0,80), mt_rand(0,80), mt_rand(0,80));\n";
$text .= "\$background_color = array({$r}, {$g}, {$b_rgb});\n";
$text .= "\$jpeg_quality = 95;\n";
$text .= "?>";
$file_path = BASE_DIR . "/lib/kcaptcha/kcaptcha_config.php";
if (is_writable($file_path) || @chmod($file_path, 0666)) {
file_put_contents($file_path, $text);
echo "success";
} else {
echo "Ошибка прав доступа к файлу конфига!";
}
exit;
}
}

View File

@@ -4,7 +4,7 @@
$module = array(
'ModuleSysName' => 'editcaptcha',
'ModuleVersion' => '1.26.0',
'ModuleVersion' => '3.31',
'ModuleAutor' => 'Repellent',
'ModuleCopyright' => '&copy; 2007-' . date('Y') . ' AVE.cms',
'ModuleStatus' => 1,

View File

@@ -1,6 +1,6 @@
[name]
MODULE_NAME = "Настройки captcha"
MODULE_DESCRIPTION = "Модуль позволяет настроить визуальный вывод captcha"
MODULE_NAME = "Настройки captcha"
MODULE_DESCRIPTION = "Модуль позволяет настроить визуальный вывод captcha"
[admin]
mod_name = "Управление модулем Настройки captcha"
@@ -8,17 +8,21 @@ e_cap_title = "Настройки captcha"
e_cap_infomod = "В данном разделе Вы можете настроить визуальный вывод captcha."
e_cap_infomod1 = "<strong>Перед сохранением, обязательно заполните все поля !</strong>"
e_cap_infomod2 = "Настройки captcha успешно изменены. Вы можете продолжать ими пользоваться. Для просмотра созданных настроек - нажмите Обновить код captcha"
e_cap_on = "captcha включена"
e_cap_of = "captcha выключена"
e_cap_on_info = "Функция ' Использовать captcha при входе в панель администратора включена. '"
e_cap_of_info = "Внимание: Функция ' Использовать captcha при входе в панель администратора выключена! '<br /> Для включения captcha перейдите в раздел ' Системные настройки '"
e_cap_ref = "Обновить код<br />captcha"
e_cap_real = "Просмотр настроек<br />captcha"
e_cap_on = "captcha включена"
e_cap_of = "captcha выключена"
e_cap_on_info = "Функция ' Использовать captcha при входе в панель администратора включена. '"
e_cap_of_info = "Внимание: Функция ' Использовать captcha при входе в панель администратора выключена! '<br /> Для включения captcha перейдите в раздел ' Системные настройки '"
e_cap_ref = "Обновить код<br />captcha"
e_cap_real = "Просмотр настроек<br />captcha"
e_cap_allow_symbol = "Разрешенные символы <span class='topDir' style='cursor: help;' title='Используйте только разрешенные символы! Вы можете выбрать только цифры или только буквы или то и другое или всего несколько разрешенных символов, например 4579cgkxz'>(?)</span><br />23456789abcdegikpqsvxyz"
e_cap_count_symbol = "Количество <span class='topDir' style='cursor: help;' title='Вы можете делать рандомный вывод количества символов от 4 до 5 или 6, тогда в поле нужно ввести следующее значение 4,5 если вы хотите постоянное количество, тогда в поле нужно ввести 4,4 это означает, что будет выводиться только 4 символа. Разделителем является запятая.'>(?)</span><br /> символов"
e_cap_fluc_amplit = "Амплитуда <span class='topDir' style='cursor: help;' title='Здесь настраивается уровень изгиба символов по горизонтали. Вы можете ввести число от нуля до, например, восьми. Например 2'>(?)</span><br />изгиба ~"
e_cap_white_noise = "Белый шум <span class='topDir' style='cursor: help;' title='Белый шум - это белые точки вокруг символов. Вы можете выключить их, просто введите в поле значение 0, или включить, тогда введите в поле 1/30 , где 1 означает включено, а 30 будет значением плотности белого шума - это значение можно менять. Например 1/24 и т.д.'>(?)</span><br />выкл=0 вкл=1/30"
e_cap_black_noise = "Черный шум <span class='topDir' style='cursor: help;' title='Черный шум - это черные точки вокруг символов. Вы можете выключить их, просто введите в поле значение 0, или включить, тогда введите в поле 1/30 , где 1 означает включено, а 30 будет значением плотности черного шума - это значение можно менять. Например 1/24 и т.д.'>(?)</span><br />выкл=0 вкл=1/30"
e_cap_spaces_symb = "Пробелы <span class='topDir' style='cursor: help;' title='Вы можете включить пробелы между символами, для этого введите в поле значение false если вы не хотите пробелов между символами тогда введите в поле true'>(?)</span><br />да=false нет=true"
e_cap_bg_color = "Цвет фона"
e_cap_actions = "Действия"
e_cap_submit = "Применить"
e_cap_submit = "Применить"
e_cap_field = "Заполните все поля!"
e_cap_err = "Ошибка:"
e_cap_err_crit = "Критическая ошибка сервера:"

View File

@@ -2,40 +2,35 @@
/**
* AVE.cms - Модуль Настройки captcha
* @autor Repellent
* @author Repellent
* @package AVE.cms
* @subpackage editcaptcha
* @filesource
*/
if(!defined('BASE_DIR')) exit;
/**
* Админка
*/
if (defined('ACP') && (isset($_REQUEST['moduleaction'])))
{
// класс
require_once(BASE_DIR . '/modules/editcaptcha/class/editcaptcha.php');
require_once(BASE_DIR . '/modules/editcaptcha/class/editcaptcha.php');
$captcha = new ModuleEditcaptcha;
$captcha = new ModuleEditcaptcha;
$captcha->tpl_dir = BASE_DIR . '/modules/editcaptcha/templates/';
// папка с шаблонами
$captcha->tpl_dir = BASE_DIR . '/modules/editcaptcha/templates/';
// Загрузка языкового файла
$AVE_Template->config_load(BASE_DIR . '/modules/editcaptcha/lang/' . $_SESSION['admin_language'] . '.txt', 'admin');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
// ленги
$AVE_Template->config_load(BASE_DIR . '/modules/editcaptcha/lang/' . $_SESSION['admin_language'] . '.txt', 'admin');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
switch($_REQUEST['moduleaction'])
{
case '1': // Основная страница настроек
$captcha->editCaptcha();
break;
switch($_REQUEST['moduleaction'])
{
case '1':
$captcha->editCaptcha();
break;
}
case 'save': // AJAX-сохранение настроек
$captcha->saveCaptcha();
break;
}
}
?>

43
res.php
View File

@@ -1,43 +0,0 @@
<?php
ob_start();
ob_implicit_flush(0);
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))));
require_once(BASE_DIR . '/inc/init.php');
if (! check_permission('adminpanel'))
{
header('Location:/index.php');
exit;
}
$a = stripslashes($_POST['a']);
$b = $_POST['b'];
$c = $_POST['c'];
$d = $_POST['d'];
$e = $_POST['e'];
$f = $_POST['f'];
$text = '<?php
$alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
$allowed_symbols = "'.$a.'";
$fontsdir = "fonts";
$length = mt_rand('.$b.');
$width = 160;
$height = 80;
$fluctuation_amplitude = '.$c.';
$white_noise_density='.$d.';
$black_noise_density='.$e.';
$no_spaces = '.$f.';
$show_credits = false;
$credits = "www.captcha.ru";
$foreground_color = array(mt_rand(0,80), mt_rand(0,80), mt_rand(0,80));
$background_color = array(250, 250, 250);
$jpeg_quality = 95;
?>';
chmod(BASE_DIR . "/lib/kcaptcha/kcaptcha_config.php", 0755);
$fp = fopen(BASE_DIR . "/lib/kcaptcha/kcaptcha_config.php", "w");
fwrite($fp, $text);
fclose($fp);
?>

View File

@@ -1,132 +1,171 @@
<div class="title">
<h5>{#mod_name#}</h5>
<h5>{#mod_name#}</h5>
</div>
<div class="widget" style="margin-top:0">
<div class="body">
<ul style="list-style: none; margin-left:0px;">
<li>{#e_cap_infomod#}</li>
<li>{#e_cap_infomod1#}</li>
</ul>
</div>
<div class="body">
<ul style="list-style: none; margin-left:0px;">
<li>{#e_cap_infomod#}</li>
<li>{#e_cap_infomod1#}</li>
</ul>
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB">
<a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a>
</li>
<li>
<a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a>
</li>
<li>
<strong class="code">{#e_cap_title#}</strong>
</li>
</ul>
</div>
<div class="breadCrumb module">
<ul>
<li class="firstB">
<a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a>
</li>
<li>
<a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a>
</li>
<li>
<strong class="code">{#e_cap_title#}</strong>
</li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#e_cap_title#}</h5>
<div style="float:right; margin-right:15px; margin-top:10px;">
{if ADMIN_CAPTCHA == true}<a title="{#e_cap_on_info#}" style="cursor: default" class="topleftDir btn greenBtn" href="javascript:void(0);">{#e_cap_on#}</a>{else}<a title="{#e_cap_of_info#}" style="cursor: default" class="topleftDir btn redBtn" href="javascript:void(0);">{#e_cap_of#}</a>{/if}
</div>
</div>
<div class="head">
<h5 class="iFrames">{#e_cap_title#}</h5>
<div style="float:right; margin-right:15px; margin-top:10px;">
{if ADMIN_CAPTCHA == true}<a title="{#e_cap_on_info#}" style="cursor: default" class="topleftDir btn greenBtn" href="javascript:void(0);">{#e_cap_on#}</a>{else}<a title="{#e_cap_of_info#}" style="cursor: default" class="topleftDir btn redBtn" href="javascript:void(0);">{#e_cap_of#}</a>{/if}
</div>
</div>
</div>
<div class="mainForm" id="form">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="180" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
</colgroup>
<thead>
<tr class="noborder">
<td>{#e_cap_real#}</td>
<td>{#e_cap_ref#}</td>
<td>{#e_cap_allow_symbol#}</td>
<td>{#e_cap_count_symbol#}</td>
<td>{#e_cap_fluc_amplit#}</td>
<td>{#e_cap_white_noise#}</td>
<td>{#e_cap_black_noise#}</td>
<td>{#e_cap_spaces_symb#}</td>
<td>{#e_cap_actions#}</td>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><span id="captcha"><img src="{$ABS_PATH}inc/captcha.php" alt="" width="120" height="60" border="0" /></span></td>
<td align="center"><img id="captcha-ref" style="cursor: pointer;" src="{$ABS_PATH}modules/editcaptcha/img/ref.png" width="30" height="30" border="0" /></td>
<td align="center"><input id="allow_symbols" class="mousetrap" name="allow_symbols" type="text" value="{$allow_symbols|escape}" placeholder="23456789abcdegikpqsvxyz" style="width:148px;"/><br /><br />
<strong><a href="javascript:void(0);" onclick = "allow_symbols.value = '23456789abcdegikpqsvxyz'; return false;">23456789abcdegikpqsvxyz</a></strong>
</td>
<td align="center"><input required id="count_symbols"class="mousetrap" name="count_symbols" type="text" value="{$count_symbols|escape}" placeholder="4,6" style="width:30px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick = "count_symbols.value = '4,4'; return false;">4,4</a></strong> |
<strong><a href="javascript:void(0);" onclick = "count_symbols.value = '4,5'; return false;">4,5</a></strong> |
<strong><a href="javascript:void(0);" onclick = "count_symbols.value = '5,5'; return false;">5,5</a></strong> |
<strong><a href="javascript:void(0);" onclick = "count_symbols.value = '5,6'; return false;">5,6</a></strong> |
</td>
<td align="center"><input required id="fluct_amplit" class="mousetrap" name="fluct_amplit" type="text" value="{$fluct_amplit|escape}" placeholder="8" style="width:21px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '0'; return false;">0</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '1'; return false;">1</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '2'; return false;">2</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '3'; return false;">3</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '4'; return false;">4</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '5'; return false;">5</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '6'; return false;">6</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '7'; return false;">7</a></strong> |
<strong><a href="javascript:void(0);" onclick = "fluct_amplit.value = '8'; return false;">8</a></strong> |
</td>
<td align="center"><input required id="white_noise" class="mousetrap" name="white_noise" type="text" value="{$white_noise|escape}" placeholder="1/30" style="width:36px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick = "white_noise.value = '0'; return false;">0</a></strong> |
<strong><a href="javascript:void(0);" onclick = "white_noise.value = '1/6'; return false;">1/6</a></strong> |
</td>
<td align="center"><input required id="black_noise" class="mousetrap" name="black_noise" type="text" value="{$black_noise|escape}" placeholder="1/30" style="width:36px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick = "black_noise.value = '0'; return false;">0</a></strong> |
<strong><a href="javascript:void(0);" onclick = "black_noise.value = '1/30'; return false;">1/30</a></strong> |
</td>
<td align="center"><input required id="no_spaces" class="mousetrap" name="no_spaces" type="text" value="{$no_spaces|escape}" placeholder="true" style="width:39px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick = "no_spaces.value = 'false'; return false;">false</a></strong> |
<strong><a href="javascript:void(0);" onclick = "no_spaces.value = 'true'; return false;">true</a></strong> |
</td>
<td align="center">
<a id="btn_sub" title="{#e_cap_of_info#}" class="btn blueBtn" href="javascript:void(0);">{#e_cap_submit#}</a>
</td>
</tr>
</tbody>
</table>
<div class="mainForm" id="form">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="180" />
<col width="50" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="70" /> <col width="*" />
</colgroup>
<thead>
<tr class="noborder">
<td>{#e_cap_real#}</td>
<td>{#e_cap_ref#}</td>
<td>{#e_cap_allow_symbol#}</td>
<td>{#e_cap_count_symbol#}</td>
<td>{#e_cap_fluc_amplit#}</td>
<td>{#e_cap_white_noise#}</td>
<td>{#e_cap_black_noise#}</td>
<td>{#e_cap_spaces_symb#}</td>
<td>{#e_cap_bg_color#}</td>
<td>{#e_cap_actions#}</td>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><span id="captcha"><img src="{$ABS_PATH}inc/captcha.php" alt="" width="120" height="60" border="0" /></span></td>
<td align="center"><img id="captcha-ref" style="cursor: pointer;" src="{$ABS_PATH}modules/editcaptcha/img/ref.png" width="30" height="30" border="0" /></td>
<td align="center">
<input id="allow_symbols" class="mousetrap" name="allow_symbols" type="text" value="{$allow_symbols|escape}" style="width:148px;"/><br /><br />
<strong><a href="javascript:void(0);" onclick="allow_symbols.value = '23456789abcdegikpqsvxyz'; return false;">23456789abcdegikpqsvxyz</a></strong>
</td>
<td align="center">
<input required id="count_symbols" class="mousetrap" name="count_symbols" type="text" value="{$count_symbols|escape}" style="width:30px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick="count_symbols.value = '4,4'; return false;">4,4</a></strong> |
<strong><a href="javascript:void(0);" onclick="count_symbols.value = '4,5'; return false;">4,5</a></strong> |
<strong><a href="javascript:void(0);" onclick="count_symbols.value = '5,5'; return false;">5,5</a></strong> |
<strong><a href="javascript:void(0);" onclick="count_symbols.value = '5,6'; return false;">5,6</a></strong> |
</td>
<td align="center">
<input required id="fluct_amplit" class="mousetrap" name="fluct_amplit" type="text" value="{$fluct_amplit|escape}" style="width:21px;"/><br /><br />
{section name=foo start=0 loop=9 step=1}
<strong><a href="javascript:void(0);" onclick="fluct_amplit.value = '{$smarty.section.foo.index}'; return false;">{$smarty.section.foo.index}</a></strong> |
{/section}
</td>
<td align="center">
<input required id="white_noise" class="mousetrap" name="white_noise" type="text" value="{$white_noise|escape}" style="width:36px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick="white_noise.value = '0'; return false;">0</a></strong> |
<strong><a href="javascript:void(0);" onclick="white_noise.value = '1/6'; return false;">1/6</a></strong> |
</td>
<td align="center">
<input required id="black_noise" class="mousetrap" name="black_noise" type="text" value="{$black_noise|escape}" style="width:36px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick="black_noise.value = '0'; return false;">0</a></strong> |
<strong><a href="javascript:void(0);" onclick="black_noise.value = '1/30'; return false;">1/30</a></strong> |
</td>
<td align="center">
<input required id="no_spaces" class="mousetrap" name="no_spaces" type="text" value="{$no_spaces|escape}" style="width:39px;"/><br /><br />
| <strong><a href="javascript:void(0);" onclick="no_spaces.value = 'false'; return false;">false</a></strong> |
<strong><a href="javascript:void(0);" onclick="no_spaces.value = 'true'; return false;">true</a></strong> |
</td>
<td align="center">
<input id="bg_color" type="color" value="{$bg_color}" style="width:40px; height:30px; border:none; cursor:pointer;" /><br /><br />
<strong>HEX</strong>
</td>
<td align="center">
<a id="btn_sub" title="{#e_cap_submit#}" class="btn blueBtn" href="javascript:void(0);">{#e_cap_submit#}</a>
</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript" language="javascript">
$("#captcha-ref").click(function() {ldelim} $("#captcha img").attr("src", '{$ABS_PATH}inc/captcha.php?refresh=' + new Date().getTime()); {rdelim});
$("#btn_sub").on('click', function call() {ldelim}
var allow_symbols = $("#allow_symbols").val();
var count_symbols = $("#count_symbols").val();
var fluct_amplit = $("#fluct_amplit").val();
var white_noise = $("#white_noise").val();
var black_noise = $("#black_noise").val();
var no_spaces = $("#no_spaces").val();
if (allow_symbols.length == 0 || count_symbols.length == 0 || fluct_amplit.length == 0 || white_noise.length == 0 || black_noise.length == 0 || no_spaces.length == 0) {ldelim}alert ('Заполните все поля!'){rdelim}
else {ldelim}
$.ajax({ldelim}
type: 'POST',
url: '{$ABS_PATH}modules/editcaptcha/res.php',
data: {ldelim}a:allow_symbols,b:count_symbols,c:fluct_amplit,d:white_noise,e:black_noise,f:no_spaces{rdelim},
success: function(data) {ldelim}
$.alerts._overlay('hide');
$.jGrowl("{#e_cap_infomod2#}", {ldelim}
header: data['header'],
theme: data['theme']
{rdelim});
{rdelim},
error: function(xhr, str){ldelim}
alert('Возникла ошибка: ' + xhr.responseCode);
{rdelim}
{rdelim});
{rdelim}
{rdelim});
<script type="text/javascript">
$(document).ready(function() {
$("#captcha-ref").click(function() {
$("#captcha img").attr("src", '{$ABS_PATH}inc/captcha.php?refresh=' + new Date().getTime());
});
$("#btn_sub").on('click', function() {
var allow_symbols = $("#allow_symbols").val();
var count_symbols = $("#count_symbols").val();
var fluct_amplit = $("#fluct_amplit").val();
var white_noise = $("#white_noise").val();
var black_noise = $("#black_noise").val();
var no_spaces = $("#no_spaces").val();
var bg_color = $("#bg_color").val();
if (allow_symbols.length == 0 || count_symbols.length == 0 || fluct_amplit.length == 0 || white_noise.length == 0 || black_noise.length == 0 || no_spaces.length == 0) {
$.jGrowl("{#e_cap_field#}", {
theme: 'error',
life: 5000
});
return false;
}
$.ajax({
type: 'POST',
url: 'index.php?do=modules&action=modedit&mod=editcaptcha&moduleaction=save&cp={$sess}',
data: {
a: allow_symbols,
b: count_symbols,
c: fluct_amplit,
d: white_noise,
e: black_noise,
f: no_spaces,
g: bg_color
},
success: function(data) {
$.alerts._overlay('hide');
if (data.trim() === "success") {
$.jGrowl("{#e_cap_infomod2#}", {
theme: 'accept',
life: 3000
});
$("#captcha-ref").click();
} else {
$.jGrowl("{#e_cap_err#} " + data, {
theme: 'error',
life: 5000
});
}
},
error: function(xhr) {
$.alerts._overlay('hide');
$.jGrowl("{#e_cap_err_crit#} " + xhr.status, {
theme: 'error',
life: 5000
});
}
});
});
});
</script>