<?php
/*
=====================
Модуль скачан с сайта:
Понедельников НЕТ! - Сайт альтернативной поддержки Slaed CMS! (http://www.ponedelnikov.net)
=====================
SHAKA1, 2009
e-mail: seregam007@mail.ru
=====================
*/
if (!defined("ADMIN_FILE") || !is_admin_god($aid)) die("Illegal File Access");

function Configure_captcha() {
	global $admin_file;
	head();
	GraphicAdmin();
	include("config/config_captcha.php");
	title(""._SITECONFIG."");
	$permtest = end_chmod("config/config_captcha.php", 666);
	if ($permtest) warning($permtest, "", "", 1);
	$defis = urldecode($defis);
    OpenTable();

	echo "<center><font class='option'>"._GENSITEINFO."</font></center>"
	."<form action='".$admin_file.".php' method='post'>"
	."<table border='0' align='center'><tr><td>";

	echo "Укажите папку со шрифтами:</td><td><input type='text' name='xfontsdir' value='$fontsdir' maxlength='255' size='65' style='width:400px'>"
	."</td></tr><tr><td>";

	echo "Разрешенные символы:</td><td><input type='text' name='xallowed_symbols' value='$allowed_symbols' maxlength='255' size='65' style='width:400px'>"
	."</td></tr><tr><td>";

	echo "Ширина капчи:</td><td><input type='text' name='xwidth' value='$width' maxlength='255' size='65' style='width:400px'> <font class='tiny'>"
	."</td></tr><tr><td>";

	echo "Высота капчи:</td><td><input type='text' name='xheight' value='$height' maxlength='255' size='65' style='width:400px'>"
	."</td></tr><tr><td>";

	echo "Вертикальная амплитуда колебания символа, разделенная на 2:</td><td><input type='text' name='xfluctuation_amplitude' value='$fluctuation_amplitude' maxlength='255' size='65' style='width:400px'>"
	."</td></tr><tr><td>";


	echo "<tr><td>Слитное написание символов:</td><td>";
    if ($no_spaces == true) {
		echo "<input type='radio' name='xno_spaces' value='true' checked>Да &nbsp;<input type='radio' name='xno_spaces' value='false'>Нет";
    } else {
        echo "<input type='radio' name='xno_spaces' value='true'>Да &nbsp;<input type='radio' name='xno_spaces' value='false' checked>Нет";
    }
	echo "</td></tr>";


	echo "<tr><td>Показывать полосу 2px c адресом сайта:</td><td>";
    if ($show_credits == true) {
		echo "<input type='radio' name='xshow_credits' value='true' checked>Да &nbsp;<input type='radio' name='xshow_credits' value='false'>Нет";
    } else {
        echo "<input type='radio' name='xshow_credits' value='true'>Да &nbsp;<input type='radio' name='xshow_credits' value='false' checked>Нет";
    }
	echo "</td></tr>";


	echo "Надпись на полосе 2px(если оставите пустым на полосе будет отображаться адрес сайта):</td><td><input type='text' name='xcredits' value='$credits' maxlength='255' size='65' style='width:400px'>"
	."</td></tr><tr><td>";


	echo "Качество картинки(от 10 до 100):</td><td><input type='text' name='xjpeg_quality' value='$jpeg_quality' maxlength='50' size='65' style='width:400px'>"
	."</td></tr><tr><td>";

	echo "<tr><td>Количество символов от:</td><td><select name='xotlength' style='width:400px'>"
	."<option value='1'";
    if ($otlength == "1") echo " selected";
	echo "></option>"
	."<option value='2'";
    if ($otlength == "2") echo " selected";
	echo "></option>"
	."<option value='3'";
    if ($otlength == "3") echo " selected";
	echo "></option>"
	."<option value='4'";
    if ($otlength == "4") echo " selected";
	echo "></option>"
	."<option value='5'";
    if ($otlength == "5") echo " selected";
	echo "></option>"
	."<option value='6'";
    if ($otlength == "6") echo " selected";
	echo "></option>"
	."</select></td></tr>";



	echo "<tr><td>Количество символов до:</td><td><select name='xdolength' style='width:400px'>"
	."<option value='1'";
    if ($dolength == "1") echo " selected";
	echo "></option>"
	."<option value='2'";
    if ($dolength == "2") echo " selected";
	echo "></option>"
	."<option value='3'";
    if ($dolength == "3") echo " selected";
	echo "></option>"
	."<option value='4'";
    if ($dolength == "4") echo " selected";
	echo "></option>"
	."<option value='5'";
    if ($dolength == "5") echo " selected";
	echo "></option>"
	."<option value='6'";
    if ($dolength == "6") echo " selected";
	echo "></option>"
	."</select></td></tr>";

echo "</form></table>";
	CloseTable();
	foot();
}

function ConfigSave_captcha($xfontsdir, $xallowed_symbols, $xwidth, $xheight, $xfluctuation_amplitude, $xno_spaces, $xshow_credits, $xcredits, $xjpeg_quality, $xotlength, $xdolength
) {
	global $admin_file;
	include("config/config_captcha.php");



	$content .= "\$fontsdir = \"$xfontsdir\";\n";
	$content .= "\$allowed_symbols = \"$xallowed_symbols\";\n";
	$content .= "\$width = \"$xwidth\";\n";
	$content .= "\$height = \"$xheight\";\n";
	$content .= "\$fluctuation_amplitude = \"$xfluctuation_amplitude\";\n";
	$content .= "\$no_spaces = \"$xno_spaces\";\n";
	$content .= "\$show_credits = \"$xshow_credits\";\n";
	$content .= "\$credits = \"$xcredits\";\n";
	$content .= "\$otlength = \"$xotlength\";\n";
	$content .= "\$dolength = \"$xdolength\";\n";
	$content .= "\$jpeg_quality = \"$xjpeg_quality\";\n";

	save_conf("config/config_captcha.php", $content);
	Header("Location: ".$admin_file.".php?op=Configure_captcha");
}

switch($op) {
	case "Configure_captcha":
    Configure_captcha();
    break;

    case "ConfigSave_captcha":
    ConfigSave_captcha($xfontsdir, $xallowed_symbols, $xwidth, $xheight, $xfluctuation_amplitude, $xno_spaces, $xshow_credits, $xcredits, $xjpeg_quality, $xotlength, $xdolength
);
    break;
}
?>