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

Размер файла: 4.32Kb
<?
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_settings';
if(isset($user)) {
if(isset($_POST['save']) && $_GET['act']== 'save') {
$lnges = input($_POST['lang']);
$theme_w = input($_POST['theme']);
$fast_mess = input($_POST['fast_mess']);
$ames = abs(intval($_POST['ames']));
$timezone = input($_POST['timezone']);
$db->query("UPDATE `settings` SET  `lang` = '". $lnges."', `theme` = '". $theme_w."', `fast_mess` = '". $fast_mess."', `ames` = '". $ames."', `timezone` = '$timezone' WHERE `user_id` = '". $user['id']."' ");
setcookie('lang', $settings['lang'], time() + 86400 * 365, '/');
// print_r($db->errorInfo());
go('/user/settings/?act=edited');
	}
$title = $lang->word('settings');
require_once(SYS.'/view/header.php');
if($_GET['act']=='edited') {$tpl->div('block', $lang->word('succ_save'));}
$tpl->div('title',  $lang->word('settings'));
echo '<div class="post">
<form action="/user/settings/?act=save" method="post">
<b>'. $lang->word('slang') .'</b>:<br/>
<select name="lang" size="1">';
	$langs_dir = opendir(SYS .'/lang');
	while ($langs = readdir($langs_dir)) {
	if ($langs == '.' || $langs == '..') 
	continue;
	$lngs = parse_ini_file(SYS .'/lang/'.$langs.'/lang.ini');
	echo '<option value="'. $langs .'" '. ($settings['lang'] == $langs?' selected="selected"':NULL) .'>'. $lngs['lang_name'] .'</option>';
}
echo '</select><br />
<b>'. $lang->word('stheme') .'</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>'. $lang->word('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/Dublin' => '0',
         '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/Rangoon' => '+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>'. $lang->word('fast_mess') .'</b>:<br />
<input type="radio" name="fast_mess" value="yes"'. ($settings['fast_mess'] == 'yes'?' checked="checked"':NULL) .' />'. $lang->word('ons') .'
<input type="radio" name="fast_mess" value="no"'. ($settings['fast_mess'] == 'no'?' checked="checked"':NULL) .' />'. $lang->word('offs') .'<br />
<b>'. $lang->word('amess') .'</b>:<br />
<input type="text" size="2" name="ames" value="'. $settings['ames'] .'" /><br />
<input type="submit" name="save" value="'. $lang->word('save') .'" />
</form>
</div>';
$tpl->div('block', NAV.'<a href="/user/panel/">'.$lang->word('user_panel').'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
} else { go('/'); }
?>