View file panel/config.php

File size: 3.75Kb
<?php
// by Mike O. (mides), coolcms.mobi

require_once '../system/sys.php';
require_once '../system/auth_a.php';
require_once '../system/header.php';

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

switch ($act) {
    default:
        if (empty($ok)) {
            tp('<a href="./">'.$lang['cp'].'</a> &gt; '.$lang['site_settings']);
            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('../inc/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 /> 
			Дублирование сообщений запрещено(1 - да, 0 - нет):<br /><input name="duplicate" type="text" value="'.$conf['duplicate'].'" maxlength="1" /><br /> 
            <input name="submit" type="submit" value="Ok" />
            </form>';
            nav('./');
        } 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;
				$duplicate = !empty($_POST['duplicate']) ? 1 : 0;
                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', `duplicate` = '$duplicate' WHERE `id` = 1");
                $_SESSION['note'] = $lang['all_changes_saved'];
                redirect('?');
            } else {
                error($lang['the_fields_cant_be_blank']);
                nav('?');
            }
        }
    break;
}

require_once '../system/tail_p.php';
?>