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

Размер файла: 4.5Kb
  1. <?
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.pp.ua *
  7. **********************************/
  8. $locate = 'in_settings';
  9. if(isset($user)) {
  10. if(isset($_POST['save']) && $_GET['act']== 'save') {
  11. $lnges = (file_exists(SYS.'/lang/'.input($_POST['lang']).'/lang.ini') ? input($_POST['lang']) : $system['lang']);
  12. $theme_w = (file_exists(TPL.'/themes/wap/'.input($_POST['theme'])) ? input($_POST['theme']) : 'default');
  13. $fast_mess = substr(input($_POST['fast_mess']), 0, 3);
  14. $ames = substr(abs(intval($_POST['ames'])), 0, 2);
  15. $timezone = input($_POST['timezone']);
  16. $db->query("UPDATE `settings` SET `lang` = '". $lnges."', `theme` = '". $theme_w."', `fast_mess` = '". $fast_mess."', `ames` = '". $ames."', `timezone` = '$timezone' WHERE `user_id` = '". $user['id']."' ");
  17. setcookie('lang', $settings['lang'], time() + 86400 * 365, '/');
  18. // print_r($db->errorInfo());
  19. go('/user/settings/?act=edited');
  20. }
  21. $title = $lang->word('settings');
  22. require_once(SYS.'/view/header.php');
  23. if($_GET['act']=='edited') {$tpl->div('block', $lang->word('succ_save'));}
  24. $tpl->div('title', $lang->word('settings'));
  25. echo '<div class="post">
  26. <form action="/user/settings/?act=save" method="post">
  27. <b>'. $lang->word('slang') .'</b>:<br/>
  28. <select name="lang" size="1">';
  29. $langs_dir = opendir(SYS .'/lang');
  30. while ($langs = readdir($langs_dir)) {
  31. if ($langs == '.' || $langs == '..')
  32. continue;
  33. $lngs = parse_ini_file(SYS .'/lang/'.$langs.'/lang.ini');
  34. echo '<option value="'. $langs .'" '. ($settings['lang'] == $langs?' selected="selected"':NULL) .'>'. $lngs['lang_name'] .'</option>';
  35. }
  36. echo '</select><br />
  37. <b>'. $lang->word('stheme') .'</b>:<br/>
  38. <select name="theme" size="1">';
  39. $themes_dir = opendir(TPL .'/themes/wap');
  40. while ($themes = readdir($themes_dir)) {
  41. if ($themes == '.' || $themes == '..')
  42. continue;
  43. $thems = parse_ini_file(TPL .'/themes/wap/'.$themes.'/manifest.ini');
  44. echo '<option value="'. $themes .'" '. ($settings['theme'] == $themes?' selected="selected"':NULL) .'>'. $thems['name'] .'</option>';
  45. }
  46. echo '</select><br/>
  47. <b>'. $lang->word('timezone') .'</b>:<br />
  48. <select name="timezone">';
  49. $zonelist =
  50. array
  51. (
  52. 'Kwajalein' => '-12:00',
  53. 'Pacific/Midway' => '-11:00',
  54. 'Pacific/Honolulu' => '-10:00',
  55. 'America/Anchorage' => '-09:00',
  56. 'America/Los_Angeles' => '-08:00',
  57. 'America/Denver' => '-07:00',
  58. 'America/Tegucigalpa' => '-06:00',
  59. 'America/New_York' => '-05:00',
  60. 'America/Caracas' => '-04:30',
  61. 'America/Halifax' => '-04:00',
  62. 'America/St_Johns' => '-03:30',
  63. 'America/Argentina/Buenos_Aires' => '-03:00',
  64. 'America/Sao_Paulo' => '-03:00',
  65. 'Atlantic/South_Georgia' => '-02:00',
  66. 'Atlantic/Azores' => '-01:00',
  67. 'Europe/Dublin' => '0',
  68. 'Europe/Belgrade' => '+01:00',
  69. 'Europe/Kiev' => '+02:00',
  70. 'Asia/Kuwait' => '+03:00',
  71. 'Asia/Tehran' => '+03:30',
  72. 'Asia/Muscat' => '+04:00',
  73. 'Asia/Yekaterinburg' => '+05:00',
  74. 'Asia/Kolkata' => '+05:30',
  75. 'Asia/Katmandu' => '+05:45',
  76. 'Asia/Dhaka' => '+06:00',
  77. 'Asia/Rangoon' => '+06:00',
  78. 'Asia/Krasnoyarsk' => '+07:00',
  79. 'Asia/Brunei' => '+08:00',
  80. 'Asia/Seoul' => '+09:00',
  81. 'Australia/Darwin' => '+09:30',
  82. 'Australia/Canberra' => '+10:00',
  83. 'Asia/Magadan' => '+11:00',
  84. 'Pacific/Fiji' => '+12:00',
  85. 'Pacific/Tongatapu' => '+13:00'
  86. );
  87. foreach($zonelist as $zone => $timez) {
  88. echo '<option value="'.$zone.'" '.($zone == $settings['timezone'] ? 'selected="selected"' : NULL).'>'.$timez.'</option>'."\n";
  89. }
  90. echo '</select><br/>
  91. <b>'. $lang->word('fast_mess') .'</b>:<br />
  92. <input type="radio" name="fast_mess" value="yes"'. ($settings['fast_mess'] == 'yes'?' checked="checked"':NULL) .' />'. $lang->word('ons') .'
  93. <input type="radio" name="fast_mess" value="no"'. ($settings['fast_mess'] == 'no'?' checked="checked"':NULL) .' />'. $lang->word('offs') .'<br />
  94. <b>'. $lang->word('amess') .'</b>:<br />
  95. <input type="text" size="2" name="ames" value="'. $settings['ames'] .'" /><br />
  96. <input type="submit" name="save" value="'. $lang->word('save') .'" />
  97. </form>
  98. </div>';
  99. $tpl->div('block', NAV.'<a href="/user/panel/">'.$lang->word('user_panel').'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
  100. require_once(SYS.'/view/footer.php');
  101. } else { go('/'); }
  102. ?>