Просмотр файла apanel/settings.php

Размер файла: 4.62Kb
<?php
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
// Sitchi CMS - Mobile Content Management System //
// The author:  Nikoloz Sitchinava [sitchi]      //
// Link:        http://sitchicms.num.ge          //
// Skype:       SitchiCMS                        //
// License:     LICENSE.txt (see attached file)  //
// Version:     VERSION.txt (see attached file)  //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
define('_SITCHICMS', 1);
$root_path='../';
require $root_path.'includes/db_connect.php';
require $root_path.'includes/start.php';
require $root_path.'includes/header.php';
require $root_path.'includes/functions.php';
require $root_path.'includes/head.php'; // თავი
$lng_a = load_lng('admin');
if($user['level']<10)
header("Location: /");
head(''.$lng['1_54'].' | '.$lng_a['1_1'].'');
echo'<div class="hdr"><b>'.$lng_a['1_1'].'</b></div>';
if (isset($_POST['save']))
{
$set['title']=mres($_POST['title']);
$set['timeshift']=intval($_POST['timeshift']);
$set['p_count']=intval($_POST['p_count']);
mysql_query("ALTER TABLE `users` CHANGE `set_p_count` `set_p_count` INT( 11 ) DEFAULT '$set[p_count]'");
if (!preg_match('/^\.\./i',$_POST['set_them']) && is_dir($root_path.'themes/'.$_POST['set_them']))
{
$set['set_them']=$_POST['set_them'];
mysql_query("ALTER TABLE `users` CHANGE `set_them` `set_them` CHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '$set[set_them]'");
}
if (isset($_POST['set_lang']) && preg_match('#^([A-z0-9\-_\(\)]+)$#ui', $_POST['set_lang']) && is_dir($root_path.'/language/'.$_POST['set_lang']))
{
$set['set_lang']=$_POST['set_lang'];
mysql_query("ALTER TABLE `users` CHANGE `set_lang` `set_lang` CHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '$set[set_lang]'"); 
}
if ($_POST['show_err_php']==1 || $_POST['show_err_php']==0)
{
$set['show_err_php']=intval($_POST['show_err_php']);
}
if (isset($_POST['meta_key']) && preg_match('#^[a-zა-ჰ0-9\,\ ]+$#ui', $_POST['meta_key']))
{
$set['meta_key']=$_POST['meta_key'];
}
if (isset($_POST['meta_desc']) && preg_match('#^[a-zა-ჰ0-9\,\ ]+$#ui', $_POST['meta_desc']))
{
$set['meta_desc']=$_POST['meta_desc'];
}
if (mysql_query("UPDATE `settings` SET `title` ='".$set['title']."',`timeshift` ='".$set['timeshift']."', `p_count` ='".$set['p_count']."', `set_them` ='".$set['set_them']."', `set_lang` ='".$set['set_lang']."', `show_err_php` ='".$set['show_err_php']."', `meta_key` ='".$set['meta_key']."', `meta_desc` ='".$set['meta_desc']."' WHERE `id` = '1' LIMIT 1"))
{
msg('<div class="menu">'.$lng_a['1_10'].'</div>');
}else{
$err[] = '<div class="errmenu">'.$lng_a['1_11'].'</div>';
}
}
err();
echo'<form method="post" action=""><div class="egmenu">' .
''.$lng_a['1_2'].':<br/><input name="title" value='.$set['title'].' type="text" /><br/>' .
''.$lng['1_11'].':<br/><input type="text" name="timeshift" size="2" maxlength="3" value="'.$set['timeshift'].'"/>(+-12)<br/>' .
''.$lng_a['1_3'].':<br/><input name="p_count" value='.$set['p_count'].' type="text" /><br/>' .
''.$lng_a['1_4'].':<br/><select name="set_them">';
$opendirthem=opendir($root_path.'/themes');
while ($themes=readdir($opendirthem))
{
if ($themes=='.' || $themes=='..' || !is_dir($root_path.'/themes/'.$themes.''))continue;
$theme_ini=parse_ini_file($root_path.'/themes/'.$themes.'/config.ini');
echo'<option value="'.$themes.'"'.($set['set_them']==$themes?'selected="selected">':null.'>').$theme_ini['name'].'</option>';
}
closedir($opendirthem);
echo'</select><br/>';
echo''.$lng_a['1_5'].':<br/><select name="set_lang">';
$opendirthem=opendir($root_path.'/language');
while ($lang=readdir($opendirthem))
{
if ($lang=='.' || $lang=='..' || !is_dir($root_path.'/language/'.$lang.''))continue;
$lang_ini=parse_ini_file($root_path.'/language/'.$lang.'/config.ini');
echo'<option value="'.$lang.'"'.($set['set_lang']==$lang?'selected="selected">':null.'>').$lang_ini['name'].'</option>';
}
closedir($opendirthem);
echo'</select><br/>';
echo''.$lng_a['1_6'].':<br/><select name="show_err_php">' .
'<option value="0"'.($set['show_err_php']==0?' selected="selected"':null).'>'.$lng_a['1_7'].'</option>' .
'<option value="1"'.($set['show_err_php']==1?' selected="selected"':null).'>'.$lng_a['1_8'].' </option>' .
'</select><br/>';
echo'<h3>'.$lng_a['1_15'].'</h3>'.
''.$lng_a['1_16'].':<br/><textarea  name="meta_key">'.$set['meta_key'].'</textarea><br/>'.
''.$lng_a['1_18'].':<br/><textarea  name="meta_desc">'.$set['meta_desc'].'</textarea><br/>'.
'<input value="'.$lng_a['1_9'].'" name="save" type="submit" /></div></form>';
echo'<a href="/apanel">'.$lng['1_54'].'</a>';
require $root_path.'includes/end.php'; // დასასრული
?>