View file panel/config.php

File size: 3.49Kb
<?php
// by mides, wmclub.mobi

$title = 'Админка';
require('../config.php');
require('../includes/sys.php');
require('../includes/start.php');
require('../includes/auth.php');
require('../includes/header.php');

switch($_GET['act']){

###############################################################################
##                    Форма редактирования настроек                          ##
###############################################################################
default:

tp('Админка > Настройки');

$main_config = mysql_fetch_assoc(mysql_query("SELECT * FROM `config` WHERE `id` = 1"));

echo '<form action="config.php?act=edited" method="post" name="form">';

echo 'Стиль:<br/><select name="style">';
echo '<option value="'.$main_config['style'].'">'.$main_config['style'].'</option>';
foreach (glob("../styles/*./styles.css") as $styles){
	if (basename($styles) != $main_config['style']){
		echo '<option value="'.basename($styles).'">'.basename($styles).'</option>';
	}
}
echo '</select><br />';

echo 'Заголовок:<br/><input name="title" type="text" value="'.$main_config['title'].'" maxlength="50" /><br/>';
echo 'Описание:<br/><input name="desc" type="text" value="'.$main_config['desc'].'" maxlength="50" /><br/>';
echo 'Копирайт:<br/><input name="copy" type="text" value="'.$main_config['copy'].'" maxlength="50" /><br/>';
echo 'Элементов на страницу:<br/><input name="onpage" type="text" value="'.$main_config['onpage'].'" maxlength="50" /><br/>';
echo 'Антиспам (в сек.):<br/><input name="antispam" type="text" value="'.$main_config['antispam'].'" maxlength="3" /><br/>';
echo 'Мин. кармы для отправки привата:<br/><input name="min_points" type="text" value="'.$main_config['min_points'].'" maxlength="3" /><br/>';
echo 'Макс. сообщений в привате:<br/><input name="max_priv" type="text" value="'.$main_config['max_priv'].'" maxlength="3" /><br/>';
echo 'Обратная связь:<br/><textarea name="feedback" cols="" rows="5">'.$main_config['feedback'].'</textarea><br/>';
echo '<input name="submit" type="submit" value="Сохранить" /></form>';
nav('./');

break;

###############################################################################
##                       Редактирования настроек                             ##
###############################################################################
case 'edited':

if(!empty($_POST['style']) && !empty($_POST['title']) && !empty($_POST['desc']) && !empty($_POST['onpage']) && !empty($_POST['antispam'])){
	$style = check($_POST['style']);
	$title = check($_POST['title']);
	$desc = check($_POST['desc']);
	$copy = check($_POST['copy']);
	$onpage = intval($_POST['onpage']);
	$antispam = intval($_POST['antispam']);
	$min_points = intval($_POST['min_points']);
	$max_priv = intval($_POST['max_priv']);
	$feedback = check($_POST['feedback']);
 
	mysql_query("UPDATE `config` SET `style` = '$style', `title` = '$title', `desc` = '$desc', `copy` = '$copy', `onpage` = '$onpage', `antispam` = '$antispam', `min_points` = '$min_points', `max_priv` = '$max_priv', `feedback` = '$feedback' WHERE `id` = 1");
	info('Настройки успешно сохранены!');
	nav2('./', 'Назад в панель');
}else{
	error('Вы не заполнили поля!');
	nav('?');
}

break;

}

require('../includes/tail.php');
?>