View file panel/config.php

File size: 4.59Kb
<?php
// by Mike O. (mides), coolcms.org
require_once '../includes/sys.php';
require_once '../includes/auth_a.php';
require_once '../includes/header.php';

if (!access(3)) {
    redirect(HTTPHOME);
}

switch ($act) {
    default:
        if (empty($ok)) {
            tp('<a href="./">'.$lang['cp'].'</a>&raquo; '.$lang['site_settings']);
			echo '<div class="body">';
            note();
            $conf_r = mysql_query("SELECT * FROM `config` WHERE `id` = 1");
            $conf = mysql_fetch_assoc($conf_r);
            echo '<form name="form" action="?ok=1" method="post">
            '.$lang['default_style'].':<br /><select name="style">';
            $styles = glob('../styles/*', GLOB_ONLYDIR);
            foreach ($styles as $style) {
                $selected = ($conf['style'] == basename($style)) ? ' selected="selected"' : '';
                echo '<option value="'.basename($style).'"'.$selected.'>'.basename($style).'</option>';
            } 
            echo '</select><br />
            '.$lang['elements_per_page'].'(1-99):<br /><input name="onpage" type="text" value="'.$conf['onpage'].'" maxlength="2" /><br />
            '.$lang['time_out'].'(1-999сек):<br /><input name="antispam" type="text" value="'.$conf['antispam'].'" maxlength="3" /><br />
            '.$lang['edit_time'].'(0-9999 sec):<br /><input name="edit_time" type="text" value="'.$conf['edit_time'].'" maxlength="4" /><br />
            '.$lang['kick_time'].'(1-999 sec):<br /><input name="kick" type="text" value="'.$conf['kick'].'" maxlength="3" /><br />
            '.$lang['allowed_file_extensions_in_dl'].' (use "|"):<br /><input name="allowed_ext" type="text" value="'.$conf['allowed_ext'].'" maxlength="200" /><br />
            '.$lang['signing_up_form_is_off'].'(1 - yes, 0 - no):<br /><input name="regoff" type="text" value="'.$conf['regoff'].'" maxlength="1" /><br /> 
            Время кеша счетчиков(раз в 0-99999 сек; 0 - откл):<br /><input name="cache_counters" type="text" value="'.$conf['cache_counters'].'" maxlength="5" /><br />
			Активация включена(1 - да, 0 - нет):<br /><input name="activation" type="text" value="'.$conf['activation'].'" maxlength="1" /><br /> 
			Проверка Email включена(1 - да, 0 - нет):<br /><input name="email_ver" type="text" value="'.$conf['email_ver'].'" maxlength="1" /><br /> 
			Дублирование сообщений запрещено(1 - да, 0 - нет):<br /><input name="duplicate" type="text" value="'.$conf['duplicate'].'" maxlength="1" /><br /> 
			
<!--			Импорт файлов в ЗЦ юзерами(1 - да, 0 - нет):<br /><input name="userimport" type="text" value="'.$conf['userimport'].'" maxlength="1" /><br /> 
-->
			Ссылка на "Рекламодателям"(<del>http://</del>):<br /><input name="advertiser" type="text" value="'.$conf['advertiser'].'" maxlength="50" /><br /> 
			<input name="submit" type="submit" value="Ok" />
            </form><br />
			<a href="./">В админку</a>
			</div>';
        } else {
             if ($_POST['onpage'] and $_POST['antispam'] and $_POST['kick']) {
                $style = check($_POST['style']);
                $onpage = abs(intval($_POST['onpage']));
                $antispam = abs(intval($_POST['antispam']));
                $edit_time = abs(intval($_POST['edit_time']));
                $kick = abs(intval($_POST['kick']));
                $allowed_ext = check($_POST['allowed_ext']);
                $regoff = abs(intval($_POST['regoff']));
                $cache_counters = abs(intval($_POST['cache_counters']));
				$activation = !empty($_POST['activation']) ? 1 : 0;
				$email_ver = !empty($_POST['email_ver']) ? 1 : 0;
				$duplicate = !empty($_POST['duplicate']) ? 1 : 0;
				$userimport = !empty($_POST['userimport']) ? 1 : 0;
				$advertiser = !empty($_POST['advertiser']) ? check($_POST['advertiser']) : FALSE;
                mysql_query("UPDATE `config` SET `style` = '$style', `onpage` = '$onpage', `antispam` = '$antispam', `edit_time` = '$edit_time', `kick` = '$kick', `allowed_ext` = '$allowed_ext', `regoff` = '$regoff', `cache_counters` = '$cache_counters', `activation` = '$activation', `email_ver` = '$email_ver', `duplicate` = '$duplicate', `userimport` = '$userimport', `advertiser` = '$advertiser' WHERE `id` = 1");
                $_SESSION['note'] = $lang['all_changes_saved'];
                redirect('?');
            } else {
                error($lang['the_fields_cant_be_blank']);
                nav('?');
            }
        }
    break;
}

require_once '../includes/tail.php';
?>