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

Размер файла: 3.85Kb
<?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_set = load_lng('settings');
head($user['login'].' | '.$lng_set['1_1'].''); 
aut_off();
echo'<div class="hdr"><b>'.$lng_set['1_6'].'</b></div>';
if (isset($_POST['save']))
{
if (isset($_POST['timing']) && is_numeric($_POST['timing']) && $_POST['timing']>-6 && $_POST['timing']<=12)
{
$user['timing']=intval($_POST['timing']);
mysql_query("UPDATE `users` SET `timing` = '$user[timing]' WHERE `id` = '$user[id]' LIMIT 1");
}else{
$err[]='<div class="errmenu">'.$lng_set['1_10'].'</div>';
}
if (isset($_POST['set_p_count']) && is_numeric($_POST['set_p_count']) && $_POST['set_p_count']>0 && $_POST['set_p_count']<=99)
{
$user['set_p_count']=intval($_POST['set_p_count']);
$set['p_count']=$user['set_p_count'];
mysql_query("UPDATE `users` SET `set_p_count` = '$user[set_p_count]' WHERE `id` = '$user[id]' LIMIT 1");
}else{ 
$err[]='<div class="errmenu">'.$lng_set['1_2'].'</div>';
}
if (isset($_POST['set_them']) && preg_match('#^([A-z0-9\-_\(\)]+)$#ui', $_POST['set_them']) && is_dir($root_path.'themes/'.$_POST['set_them']))
{
$user['set_them']=$_POST['set_them'];
mysql_query("UPDATE `users` SET `set_them` = '$user[set_them]' WHERE `id` = '$user[id]' LIMIT 1");
}else{ 
$err[]='<div class="errmenu">'.$lng_set['1_3'].'</div>';
}
if (isset($_POST['set_lang']) && preg_match('#^([A-z0-9\-_\(\)]+)$#ui', $_POST['set_lang']) && is_dir($root_path.'/language/'.$_POST['set_lang']))
{
$user['set_lang']=$_POST['set_lang'];
mysql_query("UPDATE `users` SET `set_lang` = '$user[set_lang]' WHERE `id` = '$user[id]' LIMIT 1");
}else{ 
$err[]='<div class="errmenu">'.$lng_set['1_4'].'</div>';
}
if (!isset($err))msg('<div class="menu">'.$lng_set['1_5'].'</div>');
}
err();
echo'<form method="POST" action="settings.php"><div class="egmenu">';
echo''.$lng_set['1_7'].':<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.'"'.($user['set_them']==$themes?'selected="selected"':null).'>'.$theme_ini[name].'</option>';
}
closedir($opendirthem);
echo'</select><br/>';
echo''.$lng_set['1_8'].':<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['1_11'].':<br/><input type="text" name="timing" size="2" maxlength="3" value="'.$user['timing'].'"/>(+-12)<br/>' .
''.$lng_set['1_9'].':<br/><input type="text" name="set_p_count" value="'.$set['p_count'].'" maxlength="2" /><br/>';
echo'<input type="submit" name="save" value="'.$lng['1_53'].'" />';
echo'</div></form>';
echo'<a href="'.htmlspecialchars($_SERVER['HTTP_REFERER']).'"> '.$lng['1_50'].'</a>';
require $root_path.'includes/end.php'; // დასასრული
?>