File size: 4.17Kb
<?
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Настройки
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
if(!$user_id){
echo 'Настроить могут только авторизованные пользователи';
}
registrat();
$user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$user_id"));
$shcmsengine['title'] = 'Пользовательские настройки';
include_once'../template/head.php';
if($_POST['submit']) {
$submit =$_POST['submit'];
}
if(isset($submit)) {
if($_POST['poc_email']){
$poc_email =$_POST['poc_email'];
}
if($_POST['poc_icq']) {
$poc_icq =$_POST['poc_icq'];
}
if($_POST['poc_wmid']){
$poc_wmid =$_POST['poc_wmid'];
}
if($_POST['time_dv']) {
$time_dv =$_POST['time_dv'];
}
if($_POST['wap_themes']) {
$wap_themes = $_POST['wap_themes'];
}
if($_POST['web_themes']) {
$web_themes = $_POST['web_themes'];
}
$user['poc_email'] = (isset ($poc_email) && $poc_email);
$user['poc_icq'] = (isset ($poc_icq) && $poc_icq);
$user['poc_wmid'] = (isset ($poc_wmid) && $poc_wmid);
$user['time_dv'] = (isset ($time_dv) && $time_dv);
$user['wap_themes'] = (isset ($wap_themes) && $wap_themes);
$user['web_themes'] = (isset ($web_themes) && $web_themes);
/*
==================
Вап тема
==================
*/
if (isset($wap_themes) and preg_match('#^([A-z0-9\-_\(\)]+)$#ui',$wap_themes) and is_dir(H.'template/designs/'.$wap_themes)) {
mysql_query("UPDATE `users` SET `wap` = '$wap_themes' WHERE `id` = '$user_id' LIMIT 1");
}
/*
==================
Веб тема
==================
*/
elseif (isset($web_themes) && preg_match('#^([A-z0-9\-_\(\)]+)$#ui',$web_themes) && is_dir(H.'template/designs/'.$web_themes)) {
mysql_query("UPDATE `users` SET `web` = '$web_themes' WHERE `id` = '$user_id' LIMIT 1");
} else {
echo 'Возникла ошибка при установки новой темы';
}
mysql_query("UPDATE `users` SET `time_dv`='$time_dv',`poc_email` ='$poc_email',`poc_icq` = '$poc_icq', `poc_wmid` = '$poc_wmid' WHERE `id`='$user_id'");
echo '<div class="actshcms">Настройки сохранены</div>';
header("Refresh: 1; url=settings.php");
}
echo '<form action="?'.$conservation.'" method="post">';
echo '<div class="posts">';
//
if($brodilka=="web") {
echo "Тема оформления (web):<br />\n<select name='web_themes'>\n";
$dir_them = opendir('../template/designs/');
while ($des_them = readdir( $dir_them)) {
if (($des_them != '.') && ($des_them != '..')) {
echo '<option' . ($users_nav['web_themes'] == $des_them ? ' selected="selected">' : '>') . $des_them . '</option>';
}}
closedir( $dir_them);
echo '</select>';
} elseif($brodilka == 'wap') {
echo "Тема оформления (wap):<br />\n<select name='wap_themes'>\n";
$dir_them = opendir('../template/designs/');
while ($des_them = readdir($dir_them)) {
if (($des_them != '.') && ($des_them != '..')) {
echo '<option' . ($users_nav['wap_themes'] == $des_them ? ' selected="selected">' : '>') . $des_them . '</option>';
}}
closedir($dir_them);
echo '</select>';
}
echo '</div>';
echo '<div class="posts">';
echo '<input name="poc_email" type="checkbox" value="1" ' .($user['poc_email']?'checked="checked"':'') . ' /> Показывать E-mail<br />';
echo '<input name="poc_icq" type="checkbox" value="1" ' .($user['poc_icq']?'checked="checked"':'') . ' /> Показывать ICQ<br />';
echo '<input name="poc_wmid" type="checkbox" value="1" '.($user['poc_wmid']?'checked="checked"':'') . ' /> Показывать WMID<br />';
echo '</div>';
echo '<input type="submit" name="submit">';
echo '</form>';
include_once'../template/foot.php';
?>