<?php
##########################################################
#########          by Elektroshok               ##########
#########      E-mail: awsdaa@gmail.com         ##########
#########           ICQ: 308410                 ##########
#########     Модуль вывода на главной          ##########
#########      Назначение catindex.php          ##########
##########################################################
if(!defined('DATALIFEENGINE'))
{
  die("Hacking attempt!");
}
include_once ENGINE_DIR.'/modules/catindex/lang/admin.lng';
include_once ENGINE_DIR.'/modules/catindex/catindexconf.php';

   function showRow($title="", $description="", $field="")
    {
        echo"<tr>
        <td style=\"padding:4px\" class=\"option\">
        <b>$title</b><br /><span class=small>$description</span>
        <td width=394 align=middle >
        $field
        </tr><tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=2></td></tr>";
        $bg = ""; $i++;
    }

    function makeDropDown($options, $name, $selected)
    {
        $output = "<select name=\"$name\">\r\n";
        foreach($options as $value=>$description)
        {
          $output .= "<option value=\"$value\"";
          if($selected == $value){ $output .= " selected "; }
          $output .= ">$description</option>\n";
        }
        $output .= "</select>";
        return $output;
    }
    if($action == "savecon")
{
        	$find[] 	= "'\r'";
			$replace[] 	= "";
        	$find[] 	= "'\n'";
			$replace[] 	= "";

	$save_con = $save_con + $conf;

    if($member_db[1] != 1){ msg("error", $lang['opt_denied'], $lang['opt_denied']); }
    $handler = fopen(ENGINE_DIR.'/modules/catindex/catindexconf.php', "w");
    fwrite($handler, "<?PHP \n\n//System Configurations\n\n\$conf = array (\n\n");
    foreach($save_con as $name => $value)
    {
	$value=trim(stripslashes ($value));
	$value=htmlspecialchars ($value, ENT_QUOTES);
	$value = preg_replace($find,$replace,$value);
    fwrite($handler, "'{$name}' => \"{$value}\",\n\n");
    }
    fwrite($handler, ");\n\n?>");
    fclose($handler);

	clear_cache ();
    msg("info", $lang['opt_sysok'], "$lang[opt_sysok_1]<br /><br /><a href=$PHP_SELF?mod=catindex>Вернуться</a>");
}
echoheader("", "");
echo <<<HTML
<form action="" method="post">
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
    <tr>
        <td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="engine/skins/images/tl_lb.gif"><img src="engine/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">Настройка модуля CatIndex 1.9 (CreoStyle)</div></td>
    </tr>
</table>
<div class="unterline"></div>
<table width="100%">
    <tr>
        <td style="padding:2px;" colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td style="padding:2px;" colspan="2">
HTML;
        showRow($lng['allow_index_content_top'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[allow_index_content_top]", "{$conf['allow_index_content_top']}")); 

//Отображение 1 категории 
        showRow($lng['index_allow_top_read_cat_1'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_1]", "{$conf['index_allow_top_read_cat_1']}")); 
    
	    showRow($lng['cat_num_1'], $lng['cat_num_1d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_1]' value=\"{$conf['cat_num_1']}\" size=10>"); 
//Отображение 2 категории     
            showRow($lng['index_allow_top_read_cat_2'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_2]", "{$conf['index_allow_top_read_cat_2']}")); 
    
        showRow($lng['cat_num_2'], $lng['cat_num_2d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_2]' value=\"{$conf['cat_num_2']}\" size=10>");
//Отображение 3 категории  
            showRow($lng['index_allow_top_read_cat_3'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_3]", "{$conf['index_allow_top_read_cat_3']}")); 
    
        showRow($lng['cat_num_3'], $lng['cat_num_3d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_3]' value=\"{$conf['cat_num_3']}\" size=10>");
//Отображение 4 категории 
       showRow($lng['index_allow_top_read_cat_4'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_4]", "{$conf['index_allow_top_read_cat_4']}")); 
    
        showRow($lng['cat_num_4'], $lng['cat_num_4d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_4]' value=\"{$conf['cat_num_4']}\" size=10>");
//Отображение 5 категории 
 showRow($lng['index_allow_top_read_cat_5'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_5]", "{$conf['index_allow_top_read_cat_5']}")); 
    
        showRow($lng['cat_num_5'], $lng['cat_num_5d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_5]' value=\"{$conf['cat_num_5']}\" size=10>");
//Отображение 6 категории 
 showRow($lng['index_allow_top_read_cat_6'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_6]", "{$conf['index_allow_top_read_cat_6']}")); 
    
        showRow($lng['cat_num_6'], $lng['cat_num_6d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_6]' value=\"{$conf['cat_num_6']}\" size=10>");
//Количество 7 категории 
 showRow($lng['index_allow_top_read_cat_7'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_7]", "{$conf['index_allow_top_read_cat_7']}")); 
 showRow($lng['cat_num_7'], $lng['cat_num_7d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_7]' value=\"{$conf['cat_num_7']}\" size=10>");;
//Количество 8 категории 
showRow($lng['index_allow_top_read_cat_8'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_8]", "{$conf['index_allow_top_read_cat_8']}"));  
showRow($lng['cat_num_8'], $lng['cat_num_8d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_8]' value=\"{$conf['cat_num_8']}\" size=10>");
//Количество 9 категории 
showRow($lng['index_allow_top_read_cat_9'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_9]", "{$conf['index_allow_top_read_cat_9']}"));   
showRow($lng['cat_num_9'], $lng['cat_num_9d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_9]' value=\"{$conf['cat_num_9']}\" size=10>");
//Количество 10 категории 
showRow($lng['index_allow_top_read_cat_10'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[index_allow_top_read_cat_10]", "{$conf['index_allow_top_read_cat_10']}"));    
showRow($lng['cat_num_10'], $lng['cat_num_10d'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[cat_num_10]' value=\"{$conf['cat_num_10']}\" size=10>");
//Количество отображаемых новостей в списке ТОП
showRow($lng['index_top_number_mod'], $lng['index_top_number_modd'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[top_number_mod]' value=\"{$conf['top_number_mod']}\" size=10>");
//Количество символов в Заголовке новости
showRow($lng['index_top_title'], $lng['index_top_titled'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[index_top_title]' value=\"{$conf['index_top_title']}\" size=10>");
//Вид отображение новости 
showRow($lng['allow_index_metka_lng'],  makeDropDown(array("1"=>$lng['opt_sys_1'],"0"=>$lng['opt_sys_0']), "save_con[allow_index_metka]", "{$conf['allow_index_metka']}")); 
//Включить ли отображение краткой новости 
showRow($lng['allow_short_story'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[allow_short_story]", "{$conf['allow_short_story']}")); 
//Включить ли отображение Short.story?
showRow($lng['catindex_shortstory_allow']."<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lng[catindex_shortstory_allow_hint]}', this, event, '220px')\">[?]</a>",  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[allow_short_news_catndex]", "{$conf['allow_short_news_catndex']}"));   
//Показ модуля после модуля Short Story?
showRow($lng['catindex_shortstory_top']."<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lng[catindex_shortstory_top_hint]}', this, event, '220px')\">[?]</a>",  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[short_news_top]", "{$conf['short_news_top']}")); 
 //Включить ли отображение картинки в модуле 
showRow($lng['catindex_image_allow'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[allow_images_catindex]", "{$conf['allow_images_catindex']}")); 
    //Кликабельные ли картинки 
showRow($lng['images_click'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[img_click_allow]", "{$conf['img_click_allow']}")); 
    //Показ картинок (в новом окне, или в том же) 
showRow($lng['images_sow'],  makeDropDown(array("yes"=>$lng['opt_sys_new'],"no"=>$lng['opt_sys_top']), "save_con[img_blank]", "{$conf['img_blank']}")); 
    //Включить ли отображение ссылки в конце краткой новсти
showRow($lng['allow_dalee'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[allow_dalee]", "{$conf['allow_dalee']}")); 
    //Включить ли отображение количества просмотров
showRow($lng['allow_read_num'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[allow_read_num]", "{$conf['allow_read_num']}")); 
    //Включить ли отображение даты публикации новости
showRow($lng['date_story'],  makeDropDown(array("yes"=>$lng['opt_sys_yes'],"no"=>$lng['opt_sys_no']), "save_con[date_story]", "{$conf['date_story']}")); 
//Ширина изображения
        showRow($lng['Catindex_image_wight'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[img_catindex_wigth]' value=\"{$conf['img_catindex_wigth']}\" size=10>");
//Высота изображения
showRow($lng['Catindex_image_hieght'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[img_catindex_hieght]' value=\"{$conf['img_catindex_hieght']}\" size=10>");
//Положение картинки
showRow($lng['Catindex_image_align']."<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lng[img_catindex_align_hint]}', this, event, '220px')\">[?]</a>","<input class=edit type=text style=\"text-align: center;\"  name='save_con[img_catindex_align]' value=\"{$conf['img_catindex_align']}\" size=10>");
//Количество символов в краткой новости
    showRow($lng['index_top_symbol_mod'], $lng['index_top_symbol_modd'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[index_top_symbol]' value=\"{$conf['index_top_symbol']}\" size=10>");
//Стиль в фале CSS для короткой новости
    showRow($lng['index_top_css_mod'], $lng['index_top_css_modd'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[index_top_css]' value=\"{$conf['index_top_css']}\" size=10>");
    //Стиль в фале CSS для заголовка новости
    showRow($lng['index_top_css_mod_title'], $lng['index_top_css_mod_titled'], "<input class=edit type=text style=\"text-align: center;\"  name='save_con[index_top_css_mod_title]' value=\"{$conf['index_top_css_mod_title']}\" size=10>");
// End Top Cat INDEX
echo <<<HTML
    <tr>
        <td style="padding-top:10px; padding-bottom:10px;padding-right:10px;"><input type=hidden name=mod value=catindex>
    <input type=hidden name=action value=savecon><input type="submit" class="buttons" value="{$lang['user_save']}"></td>
    </tr>
</table>
</td>
        <td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</table>
</div></form>
HTML;
echofooter();


?>