<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}

	$member_id['user_group'] = $member_id['user_group'];
	
	if($member_id['user_group'] != 1){ msg("error", $lang['opt_denied'], $lang['opt_denied']); }

	include_once SYSTEM_DIR.'/classes/parse.class.php';
	$parse = new ParseFilter(Array(), Array(), 1, 1);

    echoheader("options", $lang['opt_all']);

    if(!$handle = opendir("./language")){ die("Невозможно открыть директорию ./data/language/"); }
    while (false !== ($file = readdir($handle))) {
        if(is_dir(ROOT_DIR."/language/$file") and ($file != "." and $file!="..")){
            $sys_con_langs_arr[$file] = $file;
        }
    }
    closedir($handle);

	foreach ($user_group as $group)
		$sys_group_arr[$group['id']] = $group['group_name'];

	echo <<<HTML
<table width="100%">
    <tr>
        <td width="4"><img src="system/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="system/skins/images/tl_oo.gif"><img src="system/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="system/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="system/skins/images/tl_lb.gif"><img src="system/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
        <td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">Меню</div></td>
    </tr>
</table>
<div class="unterline"></div>
<table width="100%">
    <tr>
HTML;
	echo  "<td width=\"260\" style=\"padding:4px;\"><a href=\"".$config['http_home_url'].$config['admin_path']."?mod=repa\"><b>Главное меню</b></a></td>";
	echo <<<HTML
     </tr>
    <tr>
        <td colspan="2"><div class="hr_line"></div></td>
    </tr>
</table>
</td>
        <td background="system/skins/images/tl_rb.gif"><img src="system/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="system/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="system/skins/images/tl_ub.gif"><img src="system/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="system/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</table>
</div>
HTML;

echo <<<HTML
<script language='JavaScript' type="text/javascript">

        function ChangeOption(selectedOption) {

                document.getElementById('general').style.display = "none";
                document.getElementById('controls').style.display = "none";
                document.getElementById('mail').style.display = "none";
		document.getElementById('ban').style.display = "none";

                if(selectedOption == 'general') {document.getElementById('general').style.display = "";}
                if(selectedOption == 'controls') {document.getElementById('controls').style.display = "";}
                if(selectedOption == 'mail') {document.getElementById('mail').style.display = "";}
        		if(selectedOption == 'ban') {document.getElementById('ban').style.display = "";}

       }

</script>
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
    <tr>
        <td width="4"><img src="system/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="system/skins/images/tl_oo.gif"><img src="system/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="system/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="system/skins/images/tl_lb.gif"><img src="system/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
        <td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang_repa['opt_general_repa']}</div></td>
    </tr>
</table>
<div class="unterline"></div>
<table width="100%">
    <tr>
        <td style="padding:2px;">
<table style="text-align:center;" width="100%" height="35px">
<tr style="vertical-align:middle;" >
 <td class=tableborder><a href="javascript:ChangeOption('general');"><img title="{$lang_repa['repa_opts']}" src="system/skins/images/repa_general.png" border="0"></a>
 <td class=tableborder><a href="javascript:ChangeOption('controls');"><img title="{$lang_repa['repa_cts']}" src="system/skins/images/repa_ct_opts.png" border="0"></a>
 <td class=tableborder><a href="javascript:ChangeOption('mail');"><img title="{$lang_repa['repa_mop']}" src="system/skins/images/repa_m_opts.png" border="0"></a>
  <td class=tableborder><a href="javascript:ChangeOption('ban');"><img title="{$lang_repa['repa_ban']}" src="system/skins/images/repa_b_opts.png" border="0"></a>
 </tr>
</table>
</td>
    </tr>
</table>
</td>
        <td background="system/skins/images/tl_rb.gif"><img src="system/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="system/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="system/skins/images/tl_ub.gif"><img src="system/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="system/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</table>
</div>
HTML;

echo <<<HTML
<form action="" method="post">
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
    <tr>
        <td width="4"><img src="system/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="system/skins/images/tl_oo.gif"><img src="system/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="system/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="system/skins/images/tl_lb.gif"><img src="system/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
        <td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
HTML;

echo <<<HTML
<tr style='' id="general"><td>
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang_repa['repa_opts']}</div></td>
    </tr>
</table>
<div class="unterline"></div><table width="100%">
HTML;

showRow($lang_repa['opt_gen_st'], $lang_repa['opt_gen_st_sub'], makeDropDown(array("yes"=>$lang_repa['repa_on'],"no"=>$lang_repa['repa_off']), "save_config[status]", "{$repa_cf['status']}", ""), "");
showRow($lang_repa['bl_period'], $lang_repa['bl_per_su'], "<input maxlength=15 type=text style='text-align: center;' size=15 class=edit name='save_config[bl_period]' value='{$repa_cf['bl_period']}'>");
showRow($lang_repa['repa_stop_change_min'], $lang_repa['repa_stop_change_min_sub'], "<input maxlength=15 type=text style='text-align: center;' size=15 class=edit name='save_config[repa_stop_change_min]' value='{$repa_cf['repa_stop_change_min']}'>");
showRow($lang_repa['opt_gen_page'], $lang_repa['opt_gen_page_sub'], makeDropDown(array("1"=>$lang_repa['repa_yes'],"0"=>$lang_repa['repa_no']), "save_config[comm_page]", "{$repa_cf['comm_page']}", ""), "");
showRow($lang_repa['opt_site_res'], $lang_repa['opt_site_sub'], "<input maxlength=5 type=text style='text-align: center;' size=15 class=edit name='save_config[res_site]' value='{$repa_cf['res_site']}'>", "");
showRow($lang_repa['opt_cp_res'], $lang_repa['opt_cp_sub'], "<input maxlength=5 type=text style='text-align: center;' size=15 class=edit name='save_config[res_cp]' value='{$repa_cf['res_cp']}'>", "");
showRow("Переводить в группу при достижении:", "Колличество очков рейтинга для перехода в группу", "<input maxlength=3 type=text style='text-align: center;' size=15 class=edit name='save_config[num_repa_group]' value='{$repa_cf['num_repa_group']}'>");

$groups = get_groups();
$groups = get_groups(explode(',', $repa_cf['move_grouplevel']));

showRow("Переводить в группу:", "Переводить в указанную группу при достижении N очков рейтинга", "<select name='save_config[move_grouplevel]'>{$groups}</select>");

echo "</table></td></tr>";

echo <<<HTML
<tr style='display:none' id="controls"><td>
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang_repa['repa_cts']}</div></td>
    </tr>
</table>
<div class="unterline"></div><table width="100%">
HTML;
showRow($lang_repa['repa_adm'], $lang_repa['repa_adm_sub'], "<input maxlength=5 type=text style='text-align: center;' size=15 class=edit name='save_config[adm_minus]' value='{$repa_cf['adm_minus']}'>", "");
showRow($lang_repa['repa_adm_plus'], $lang_repa['repa_adm_plus_sub'], "<input maxlength=5 type=text style='text-align: center;' size=15 class=edit name='save_config[adm_plus]' value='{$repa_cf['adm_plus']}'>", "");
showRow($lang_repa['repa_robot'], $lang_repa['repa_robo_sub'], "<input maxlength=15 type=text style='text-align: center;' size=15 class=edit name='save_config[robot]' value='{$repa_cf['robot']}'>", "");
showRow($lang_repa['repa_adm_msg'], $lang_repa['repa_adm_com'], "<textarea style='width: 300px; height: 40px;' class=edit name='save_config[adm_msg]'>{$repa_cf['adm_msg']}</textarea>","");
showRow($lang_repa['repa_adm_plus_msg'], $lang_repa['repa_adm_plus_com'], "<textarea style='width: 300px; height: 40px;' class=edit name='save_config[adm_msg_plus]'>{$repa_cf['adm_msg_plus']}</textarea>","");
showRow($lang_repa['repa_replace'], $lang_repa['repa_adm_rpm'], "<textarea style='width: 300px; height: 40px;' class=edit name='save_config[ch_com]'>{$repa_cf['ch_com']}</textarea>");

	echo "</table></td></tr>";

echo <<<HTML
<tr style='display:none' id="mail"><td>
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang_repa['repa_mop']}</div></td>
    </tr>
</table>
<div class="unterline"></div><table width="100%">
HTML;

$repa_rules = $parse->decodeBBCodes( $repa_cf['repa_rules_tpl_tsu'], false );

showRow($lang_repa['repa_msgs_st'], $lang_repa['repa_msgs_su'], makeDropDown(array("yes"=>$lang_repa['repa_yes'],"no"=>$lang_repa['repa_no']), "save_config[msgs_status]", "{$repa_cf['msgs_status']}", ""), "");
showRow($lang_repa['repa_msg_tpl'], $lang_repa['repa_msg_tsu'], "<textarea style='width: 300px; height: 65px;' class=edit name='save_config[msgs_template]'>{$repa_cf['msgs_template']}</textarea>", "");
showRow($lang_repa['repa_rules'], $lang_repa['repa_rules_su'], makeDropDown(array("1"=>$lang_repa['repa_yes'],"0"=>$lang_repa['repa_no']), "save_config[repa_rules]", "{$repa_cf['repa_rules']}", ""), "");
showRow($lang_repa['repa_rules_tpl'], $lang_repa['repa_rules_tpl_su'], "<textarea style='width: 300px; height: 65px;' class=edit name='save_config[repa_rules_tpl_tsu]'>{$repa_rules}</textarea>", "");
showRow($lang_repa['repa_msgs_del_st'], $lang_repa['repa_msgs_del_su'], makeDropDown(array("yes"=>$lang_repa['repa_yes'],"no"=>$lang_repa['repa_no']), "save_config[msgs_del_status]", "{$repa_cf['msgs_del_status']}", ""), "");
showRow($lang_repa['repa_msg_del_tpl'], $lang_repa['repa_msg_del_tsu'], "<textarea style='width: 300px; height: 65px;' class=edit name='save_config[msgs_del_template]'>{$repa_cf['msgs_del_template']}</textarea>", "");
showRow($lang_repa['repa_msgs_adm_st'], $lang_repa['repa_msgs_adm_su'], makeDropDown(array("yes"=>$lang_repa['repa_yes'],"no"=>$lang_repa['repa_no']), "save_config[msgs_status_adm]", "{$repa_cf['msgs_status_adm']}", ""), "");
showRow($lang_repa['repa_msg_adm_tpl'], $lang_repa['repa_msg_adm_tsu'], "<textarea style='width: 300px; height: 65px;' class=edit name='save_config[msgs_template_adm]'>{$repa_cf['msgs_template_adm']}</textarea>", "");

	echo "</table></td></tr>";


echo <<<HTML
<tr style='display:none' id="ban"><td>
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang_repa['repa_ban']}</div></td>
    </tr>
</table>
<div class="unterline"></div><table width="100%">
HTML;

$repa_ban_desc = $parse->decodeBBCodes( $repa_cf['repa_ban_desc'], false );
showRow($lang_repa['repa_ban'], $lang_repa['repa_ban_sub'], makeDropDown(array("1"=>$lang_repa['repa_on'],"0"=>$lang_repa['repa_off']), "save_config[repa_ban]", "{$repa_cf['repa_ban']}", ""), "");
showRow($lang_repa['repa_ban_num'], $lang_repa['repa_ban_num_sub'], "<input maxlength=15 type=text style='text-align: center;' size=15 class=edit name='save_config[repa_ban_num]' value='{$repa_cf['repa_ban_num']}'>");
showRow($lang_repa['repa_ban_days'], $lang_repa['repa_ban_days_sub'], "<input maxlength=15 type=text style='text-align: center;' size=15 class=edit name='save_config[repa_ban_days]' value='{$repa_cf['repa_ban_days']}'>");
showRow($lang_repa['repa_ban_desc'], $lang_repa['repa_ban_desc_sub'], "<textarea style='width: 300px; height: 65px;' class=edit name='save_config[repa_ban_desc]'>{$repa_ban_desc}</textarea>", "");
	echo "</table></td></tr>";

echo <<<HTML
    <tr>
        <td style="padding-top:10px; padding-bottom:10px;padding-right:10px;">
        <input type=hidden name=mod value=repa>
    <input type=hidden name=action value=save>
    <input type=hidden name=savecfg value="savecfg">
    <input type="submit" class="buttons" value="{$lang_repa['repa_save']}"></td>
    </tr>
</table>
</td>
        <td background="system/skins/images/tl_rb.gif"><img src="system/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="system/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="system/skins/images/tl_ub.gif"><img src="system/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="system/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</table>
</div></form>
HTML;

    echofooter();

?>