Файл: modules/user/settings.php
Строк: 157
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_cabinet';
if(User::logged()) {
if(isset($_POST['save']) && $_GET['act']== 'save') {
$lnges = (file_exists(SYS.'/lang/'.input($_POST['lang'])) ? input($_POST['lang']) : $system['lang']);
$theme_w = (file_exists(TPL.'/themes/wap/'.input($_POST['theme'])) ? input($_POST['theme']) : 'default');
$web_theme = (file_exists(TPL.'/themes/web/'.input($_POST['web_theme'])) ? input($_POST['web_theme']) : 'default');
$fast_mess = substr(input($_POST['fast_mess']), 0, 3);
$ames = substr(abs(intval($_POST['ames'])), 0, 2);
$timezone = input($_POST['timezone']);
$db->query("UPDATE `settings` SET `lang` = '". $lnges."', `theme` = '". $theme_w."', `web_theme` = '". $web_theme."', `fast_mess` = '". $fast_mess."', `ames` = '". $ames."', `timezone` = '$timezone' WHERE `user_id` = '". $user['id']."' ");
setcookie('language', input($_POST['lang']), time() + 86400 * 365, '/');
// print_r($db->errorInfo());
redirect('/user/settings/?act=edited');
}
$title = _t('settings');
include_header($title);
if(@$_GET['act']=='edited') {$tpl->div('block', _t('succ_save'));}
$tpl->div('title', _t('settings'));
echo '<div class="post">
<form action="/user/settings/?act=save" method="post">
<b>'. _t('slang') .'</b>:<br/>
<select name="lang" size="1">';
$langs_dir = opendir(SYS .'/lang');
while ($langs = readdir($langs_dir)) {
if ($langs == '.' || $langs == '..')
continue;
$lngs = include(SYS .'/lang/'.$langs.'/lang.php');
echo '<option value="'. $langs .'" '. ($settings['lang'] == $langs?' selected="selected"':NULL) .'>'. $lngs['lang_name'] .'</option>';
}
echo '</select><br />
<b>'. _t('stheme') .' wap</b>:<br/>
<select name="theme" size="1">';
$themes_dir = opendir(TPL .'/themes/wap');
while ($themes = readdir($themes_dir)) {
if ($themes == '.' || $themes == '..')
continue;
$thems = parse_ini_file(TPL .'/themes/wap/'.$themes.'/manifest.ini');
echo '<option value="'. $themes .'" '. ($settings['theme'] == $themes?' selected="selected"':NULL) .'>'. $thems['name'] .'</option>';
}
echo '</select><br/>
<b>'. _t('stheme') .' web</b>:<br/>
<select name="web_theme" size="1">';
$themes_dir = opendir(TPL .'/themes/web');
while ($themes = readdir($themes_dir)) {
if ($themes == '.' || $themes == '..')
continue;
$thems = parse_ini_file(TPL .'/themes/web/'.$themes.'/manifest.ini');
echo '<option value="'. $themes .'" '. ($settings['web_theme_theme'] == $themes?' selected="selected"':NULL) .'>'. $thems['name'] .'</option>';
}
echo '</select><br/>
<b>'. _t('timezone') .'</b>:<br />
<select name="timezone">';
$zonelist =
array
(
'Kwajalein' => '-12:00',
'Pacific/Midway' => '-11:00',
'Pacific/Honolulu' => '-10:00',
'America/Anchorage' => '-09:00',
'America/Los_Angeles' => '-08:00',
'America/Denver' => '-07:00',
'America/Tegucigalpa' => '-06:00',
'America/New_York' => '-05:00',
'America/Caracas' => '-04:30',
'America/Halifax' => '-04:00',
'America/St_Johns' => '-03:30',
'America/Argentina/Buenos_Aires' => '-03:00',
'America/Sao_Paulo' => '-03:00',
'Atlantic/South_Georgia' => '-02:00',
'Atlantic/Azores' => '-01:00',
'Europe/London' => '00:00',
'Europe/Belgrade' => '+01:00',
'Europe/Kiev' => '+02:00',
'Asia/Kuwait' => '+03:00',
'Asia/Tehran' => '+03:30',
'Asia/Muscat' => '+04:00',
'Asia/Yekaterinburg' => '+05:00',
'Asia/Kolkata' => '+05:30',
'Asia/Katmandu' => '+05:45',
'Asia/Dhaka' => '+06:00',
'Asia/Krasnoyarsk' => '+07:00',
'Asia/Brunei' => '+08:00',
'Asia/Seoul' => '+09:00',
'Australia/Darwin' => '+09:30',
'Australia/Canberra' => '+10:00',
'Asia/Magadan' => '+11:00',
'Pacific/Fiji' => '+12:00',
'Pacific/Tongatapu' => '+13:00'
);
foreach($zonelist as $zone => $timez) {
echo '<option value="'.$zone.'" '.($zone == $settings['timezone'] ? 'selected="selected"' : NULL).'>'.$timez.'</option>'."n";
}
echo '</select><br/>
<b>'. _t('fast_mess') .'</b>:<br />
<input type="radio" name="fast_mess" value="1"'. ($settings['fast_mess'] == '1'?' checked="checked"':NULL) .' />'. _t('on') .'
<input type="radio" name="fast_mess" value="0"'. ($settings['fast_mess'] == '0'?' checked="checked"':NULL) .' />'. _t('off') .'<br />
<b>'. _t('amess') .'</b>:<br />
<input type="text" size="2" name="ames" value="'. $settings['ames'] .'" /><br />
<input type="submit" name="save" value="'. _t('save') .'" />
</form>
</div>';
$tpl->div('block', NAV.'<a href="/user/panel/">'._t('user_panel').'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
} else { go('/'); }
?>