Файл: www/admin/function/function_settings.php
Строк: 151
<?
/*-----------------------------------------------------------
Product: BBlog 2.0
License: GNU General Public License (http://www.gnu.org/licenses/gpl.html)
Copyright: (c) 2007 Batia.info
Version: 2.0 RC1
-------------------------------------------------------------*/
if ( !defined('INDEX') ) die("Эта страницу для вас недоступна!");
##################################################################
## Функция выводит форму редактирования настроек ##
##################################################################
function edit_settings() {
$admin_login = get_param('admin_login');
$admin_pass = get_param('admin_pass');
$admin_email = get_param('admin_email');
$admin_name = get_param('admin_name');
$count_news_main = get_param('count_news_main');
$count_news_last_top = get_param('count_news_last_top');
$site_name = get_param('site_name');
$site_description = get_param('site_description');
$site_keywords = get_param('site_keywords');
$copyright = get_param('copyright');
$c = '
<table cellpadding="4px">
<form action="settings.php?action=save" method="POST">
<tr><td valign="top">
<small>Логин администратора</small><br>
<input type="text" name="admin_login" value="'.$admin_login.'"><br>
<small>Пароль администратора</small><br>
<input type="text" name="admin_pass" value="'.$admin_pass.'"><br>
<small>Email администратора</small><br>
<input type="text" name="admin_email" value="'.$admin_email.'"><br>
<small>Имя администратора</small><br>
<input type="text" name="admin_name" value="'.$admin_name.'"><br>
</td><td valign="top">
<small>Название блогасайта</small><br>
<input type="text" name="site_name" size="50" value="'.$site_name.'"><br>
<small>Описание блога (META)</small><br>
<input type="text" name="site_description" size="50" value="'.$site_description.'"><br>
<small>Ключевые слова блога (META)</small><br>
<input type="text" name="site_keywords" size="50" value="'.$site_keywords.'"><br>
<small>Копирайт</small><br>
<input type="text" name="copyright" size="50" value="'.$copyright.'"><br>
</td></tr>
</table>
<table cellpadding="4px">
<tr><td >
Количество записей на главной странице:
</td><td><input type="text" name="count_news_main" size="2" value="'.$count_news_main.'"></td></tr>
<tr><td>
Количество записей блоке (Последние Записи):
</td><td><input type="text" name="count_news_last_top" size="2"value="'.$count_news_last_top.'"></td></tr>
</table>
<input type="submit" value="Обновить настройки">
';
return $c;
}
##################################################################
## Функция сохраняет настройки ##
##################################################################
function save_settings() {
db_connect();
$admin_login = trim(addslashes(strip_tags($_POST['admin_login'])));
$admin_pass = trim(addslashes(strip_tags($_POST['admin_pass'])));
$admin_email = trim(addslashes(strip_tags($_POST['admin_email'])));
$admin_name = trim(addslashes(strip_tags($_POST['admin_name'])));
$site_name = trim(addslashes(strip_tags($_POST['site_name'])));
$site_description = trim(addslashes(strip_tags($_POST['site_description'])));
$site_keywords = trim(addslashes(strip_tags($_POST['site_keywords'])));
$copyright = trim(addslashes(strip_tags($_POST['copyright'])));
$count_news_main = trim(addslashes(strip_tags($_POST['count_news_main'])));
$count_news_last_top = trim(addslashes(strip_tags($_POST['count_news_last_top'])));
mysql_query("UPDATE settings SET
admin_login = '$admin_login',
admin_pass = '$admin_pass',
admin_email = '$admin_email',
admin_name = '$admin_name',
site_name = '$site_name',
site_description = '$site_description',
site_keywords = '$site_keywords',
copyright = '$copyright',
count_news_main = '$count_news_main',
count_news_last_top = '$count_news_last_top'
") or die("MySQL ERROR");
}
?>