' . $lng['common_settings'] . '' : '' . $lng['common_settings'] . ''),
($mod == 'forum' ? '' . $lng['forum'] . '' : '' . $lng['forum'] . ''),
);
/*
-----------------------------------------------------------------
Пользовательские настройки
-----------------------------------------------------------------
*/
switch ($mod) {
case 'forum':
/*
-----------------------------------------------------------------
Настройки Форума
-----------------------------------------------------------------
*/
echo '
' . $lng['settings'] . ' | ' . $lng['forum'] . ' сообществ
' .
'';
$set_forum = array();
$set_forum = unserialize($datauser['set_forum']);
if (isset($_POST['submit'])) {
$set_forum['farea'] = isset($_POST['farea']);
$set_forum['upfp'] = isset($_POST['upfp']);
$set_forum['preview'] = isset($_POST['preview']);
$set_forum['postclip'] = isset($_POST['postclip']) ? intval($_POST['postclip']) : 1;
$set_forum['postcut'] = isset($_POST['postcut']) ? intval($_POST['postcut']) : 1;
if ($set_forum['postclip'] < 0 || $set_forum['postclip'] > 2)
$set_forum['postclip'] = 1;
if ($set_forum['postcut'] < 0 || $set_forum['postcut'] > 3)
$set_forum['postcut'] = 1;
mysql_query("UPDATE `users` SET `set_forum` = '" . mysql_real_escape_string(serialize($set_forum)) . "' WHERE `id` = '$user_id'");
echo '';
}
if (isset($_GET['reset']) || empty($set_forum)) {
$set_forum = array();
$set_forum['farea'] = 0;
$set_forum['upfp'] = 0;
$set_forum['preview'] = 1;
$set_forum['postclip'] = 1;
$set_forum['postcut'] = 2;
mysql_query("UPDATE `users` SET `set_forum` = '" . mysql_real_escape_string(serialize($set_forum)) . "' WHERE `id` = '$user_id'");
echo '';
}
echo '' .
'' .
'' . $lng['to_forum'] . '
';
break;
default:
echo '' . $lng['settings'] . ' | ' . $lng['common_settings'] . '
' .
'';
if (isset($_POST['submit'])) {
/*
-----------------------------------------------------------------
Записываем новые настройки, заданные пользователем
-----------------------------------------------------------------
*/
$set_user['timeshift'] = isset($_POST['timeshift']) ? intval($_POST['timeshift']) : 0;
$set_user['avatar'] = isset($_POST['avatar']);
$set_user['smileys'] = isset($_POST['smileys']);
$set_user['translit'] = isset($_POST['translit']);
$set_user['digest'] = isset($_POST['digest']);
$set_user['direct_url'] = isset($_POST['direct_url']);
$set_user['field_h'] = isset($_POST['field_h']) ? abs(intval($_POST['field_h'])) : 3;
$set_user['kmess'] = isset($_POST['kmess']) ? abs(intval($_POST['kmess'])) : 10;
$set_user['quick_go'] = isset($_POST['quick_go']);
$set_user['guests'] = isset($_POST['guests']);
if ($set_user['timeshift'] < -12)
$set_user['timeshift'] = -12;
elseif ($set_user['timeshift'] > 12)
$set_user['timeshift'] = 12;
if ($set_user['kmess'] < 5)
$set_user['kmess'] = 5;
elseif ($set_user['kmess'] > 99)
$set_user['kmess'] = 99;
if ($set_user['field_w'] < 10)
$set_user['field_w'] = 10;
elseif ($set_user['field_w'] > 80)
$set_user['field_w'] = 80;
if ($set_user['field_h'] < 1)
$set_user['field_h'] = 1;
elseif ($set_user['field_h'] > 9)
$set_user['field_h'] = 9;
// Устанавливаем скин Wap
foreach (glob('../theme/*/*.css') as $val)
$theme_list[] = array_pop(explode('/', dirname($val)));
$set_user['skin'] = isset($_POST['skin']) && in_array($_POST['skin'], $theme_list) ? functions::check($_POST['skin']) : $set['skindef'];
// Устанавливаем скин Web
foreach (glob('../theme/*/*.css') as $val)
$theme_list[] = array_pop(explode('/', dirname($val)));
$set_user['skinweb'] = isset($_POST['skinweb']) && in_array($_POST['skinweb'], $theme_list) ? functions::check($_POST['skinweb']) : $set['skinweb'];
$access = isset($_POST['access']) ? abs(intval($_POST['access'])) : NULL;
// Устанавливаем язык
$lng_select = isset($_POST['iso']) ? trim($_POST['iso']) : false;
if ($lng_select && array_key_exists($lng_select, core::$lng_list)) {
$set_user['lng'] = $lng_select;
unset($_SESSION['lng']);
}
// Записываем настройки
mysql_query("INSERT INTO `users` SET
`access` = '$access'
");
mysql_query("UPDATE `users` SET `access` = '$access'");
mysql_query("UPDATE `users` SET `access` = '$access'
");
mysql_query("UPDATE `users` SET `set_user` = '" . mysql_real_escape_string(serialize($set_user)) . "' WHERE `id` = '$user_id'");
$_SESSION['set_ok'] = 1;
header('Location: profile.php?act=settings');
exit;
} elseif (isset($_GET['reset']) || empty($set_user)) {
/*
-----------------------------------------------------------------
Задаем настройки по-умолчанию
-----------------------------------------------------------------
*/
mysql_query("UPDATE `users` SET `set_user` = '' WHERE `id` = '$user_id'");
$_SESSION['reset_ok'] = 1;
header('Location: profile.php?act=settings');
exit;
}
/*
-----------------------------------------------------------------
Форма ввода пользовательских настроек
-----------------------------------------------------------------
*/
if (isset($_SESSION['set_ok'])) {
echo '';
unset($_SESSION['set_ok']);
}
if (isset($_SESSION['reset_ok'])) {
echo '';
unset($_SESSION['reset_ok']);
}
echo '' .
'';
}
?>