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

Размер файла: 1.37Kb
  1. <?php
  2. include '../engine/includes/start.php';
  3.  
  4. if (!$user_id)
  5. Core::stop();
  6.  
  7. $set['title'] = 'Мои настройки';
  8. Core::get('cache.class');
  9. $cache = new cache(tmpDir . 'themes.swc');
  10. if (!$cache->life())
  11. {
  12. $opendir = opendir(H.'style/themes/');
  13. while ($theme = readdir($opendir))
  14. {
  15. if ($theme == '.' || $theme == '..' || !is_dir(H.'style/themes/'.$theme))
  16. continue;
  17. $config = parse_ini_file(H.'style/themes/'.$theme.'/theme.ini');
  18. $themes[$theme] = $config['name'];
  19. }
  20. $cache->write(serialize($themes));
  21. }
  22. $themes = unserialize($cache->read());
  23.  
  24.  
  25. if (isset($_POST['save']))
  26. {
  27. if (isset($_POST['theme']) && is_dir(H.'style/themes/'.$_POST['theme']))
  28. {
  29. $_COOKIE['set_theme'] = $user['set_them'] = Core::form('theme');
  30. $sql->query("UPDATE `user` SET `set_them` = '".$user['set_them']."' WHERE `id` = ".$user_id." LIMIT 1");
  31. setcookie('set_theme', $user['set_them'] , 0, '/');
  32. }
  33. $user = Core::get_user($user_id, true);
  34. }
  35.  
  36. include incDir . 'head.php';
  37.  
  38. ?>
  39. <form method='post'>
  40. Тема:<br />
  41. <select name='theme'>
  42. <?php
  43. foreach($themes as $theme => $name)
  44. {
  45. echo '<option value="'.$theme.'">'.$name.'</option>';
  46. }
  47. ?>
  48. </select><br />
  49. <input type='submit' name='save' value='Сохранить'/>
  50. </form>
  51. <div class='link'>
  52. &laquo;<a href='menu.php'>Кабинет</a><br />
  53. </div>
  54. <?php
  55. include incDir . 'foot.php';