Файл: modules/dpanel/settings.php
Строк: 124
<?php
/****
* @package LiveCMS
* @link livecms.org
* @author MyZik
* @version See attached file VERSION.txt
* @license See attached file LICENSE.txt
* @copyright Copyright (C) LiveCMS Development Team
****/
$lang_set = load_lng('cms_settings'); // Подключаем файл языка
$title = $lang_set['system_settings']; // Заголовок страницы
$module = 'set_user'; // Модуль
/**
* Проверка прав доступа
**/
if (!isset($user) || $user['rights'] < 10) {
require_once(HOME .'/incfiles/header.php');
echo '<div class="error">' . $lang['error_rights'] . '</div>';
echo '<div class="home">' .
'<img src="/design/themes/' . $set_user['theme'] . '/images/back.png" alt="" /> <a href="/index.php">' . $lang['back'] . '</a>' .
'</div>';
require_once(HOME .'/incfiles/footer.php');
}
$cmsSet = mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_settings` WHERE `id` = 1"));
require_once(HOME .'/incfiles/header.php'); // Подключаем шапку
echo '<div class="title"><a href="index.php">' . $lang['direct_panel'] . '</a> | <b>' . $lang_set['system_settings'] . '</b></div>';
if (isset($_POST['save'])) {
$cmsSet['language'] = isset($_POST['language']) ? input($_POST['language']) : $cms_set['language'];
$cmsSet['title'] = isset($_POST['title']) ? input($_POST['title']) : $cms_set['title'];
$cmsSet['sex_view'] = isset($_POST['sex_view']) && $_POST['sex_view'] == 'text' ? 'text' : 'icons';
$cmsSet['antiflood_time'] = isset($_POST['antiflood_time']) ? intval($_POST['antiflood_time']) : 30;
$cmsSet['num_pages'] = isset($_POST['num_pages']) ? intval($_POST['num_pages']) : 10;
$cmsSet['theme'] = isset($_POST['theme']) ? txt($_POST['theme']) : 'default';
$arr = array();
$dir = opendir(HOME . '/design/themes');
while ($oTheme = readdir($dir)) {
if (($oTheme != '.') && ($oTheme != '..') && ($oTheme != '.svn'))
$arr[] = str_replace('.css', '', $oTheme);
}
closedir($dir);
if (!in_array($cmsSet['theme'], $arr))
$cmsSet['theme'] = 'default';
mysql_query("UPDATE `cms_settings` SET
`language` = '" . $cmsSet['language'] . "',
`title` = '" . $cmsSet['title'] . "',
`antiflood_time` = '" . $cmsSet['antiflood_time'] . "',
`num_pages` = '" . $cmsSet['num_pages'] . "',
`sex_view` = '" . $cmsSet['sex_view'] . "',
`theme` = '" . $cmsSet['theme'] . "' WHERE `id` = '1'");
echo display_message($lang_set['edit_success']);
}
/**
* Форма
**/
echo '<div class="main"><form action="settings.php" method="post">' .
$lang_set['title'] . '<br />' .
'<input type="text" name="title" value="' . $cmsSet['title'] . '" /><br />' .
$lang_set['sex_view'] . '<br />' .
'<input type="radio" name="sex_view" value="icons" ' . ($cmsSet['sex_view'] == 'icons' ? 'checked="checked"' : '') . ' /> ' . $lang_set['sex_view_icons'] . ' <input type="radio" name="sex_view" value="text" ' . ($cmsSet['sex_view'] == 'text' ? 'checked="checked"' : '') . ' /> ' . $lang_set['sex_view_text'] . '<br />' .
$lang_set['antiflood_time'] . '<br />' .
'<input type="text" name="antiflood_time" value="' . $cmsSet['antiflood_time'] . '" /><br />' .
$lang_set['num_pages'] . '<br />' .
'<input type="text" name="num_pages" value="' . $cmsSet['num_pages'] . '" /><br />' .
$lang_set['theme_skin'] . '<br />' .
'<select name="theme">';
$dir = opendir(HOME . '/design/themes');
while ($oTheme = readdir($dir)) {
if (($oTheme != '.') && ($oTheme != '..') && ($oTheme != '.svn')) {
$oTheme = str_replace('.css', '', $oTheme);
echo '<option' . ($cmsSet['theme'] == $oTheme ? ' selected="selected">' : '>') . $oTheme . '</option>';
}
}
closedir($dir);
echo '</select><br />';
echo $lang['select_language'] . ':<br />';
$Dir = opendir(HOME . '/incfiles/languages');
while ($oLang = readdir($Dir)) {
if (($oLang != '.') && ($oLang != '..') && ($oLang != '.svn')) {
$oLang = str_replace('_core.lng', '', $oLang);
echo '<input type="radio" name="language" value="' . $oLang . '"' . ($setUser['language'] == $oLang ? ' checked="checked"' : '') . ' /> <img src="/design/icons/languages/' . $oLang . '.png" alt="' . $oLang . '" /> ' . $oLang . '<br />';
}
}
closedir($Dir);
echo '<input type="submit" name="save" value="' . $lang['save'] . '" /></form></div>';
require_once(HOME .'/incfiles/footer.php'); // Подключаем ноги
?>