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

Размер файла: 4.37Kb
  1. <?php
  2.  
  3. include '../../engine/includes/start.php';
  4. if (!$creator)
  5. Core::stop();
  6.  
  7. $title = $set['title'];
  8. $set['title']='Настройки системы';
  9. include incDir . 'head.php';
  10.  
  11. if (isset($_POST['save']))
  12. {
  13. $set['title'] = $title = Core::form('title') ? Core::form('title') : $_SERVER['SERVER_NAME'];
  14. $set['antimat'] = isset($_POST['antimat']);
  15. $set['cache_time'] = (int) $_POST['cache_time'];
  16. $set['activation_acc'] = (int) $_POST['activation_account'];
  17.  
  18. if ($_POST['cache_time2'] == 'hour')
  19. $set['cache_time'] = 60 * 60 * $_POST['cache_time'];
  20. elseif ($_POST['cache_time2'] == 'min')
  21. $set['cache_time'] = 60 * $_POST['cache_time'];
  22.  
  23. if (is_dir(H.'style/themes/'.$_POST['theme']))
  24. {
  25. $set['theme'] = Core::form('theme');
  26. $sql->query('ALTER TABLE `user` CHANGE `set_them` `set_them` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT "'.$set['theme'].'"');
  27. }
  28. Core::save_settings(array('e-mail' => $_POST['dx_e-mail'], 'password' => $_POST['dx_password']), 'engine/files/data/dropbox.ini');
  29. Core::save_settings(array('id' => intval($_POST['sw_id']), 'password' => Core::form('sw_password')), 'engine/files/data/sw_login.ini');
  30.  
  31. Core::save_settings($set);
  32. Core::msg_show('Настройки успешно приняты', 'msg');
  33. }
  34. $dropbox = is_file(H . 'engine/files/data/dropbox.ini') ? parse_ini_file(H . 'engine/files/data/dropbox.ini') : array('e-mail' => '', 'password' => '');
  35. $sw_login = is_file(H . 'engine/files/data/sw_login.ini') ? parse_ini_file(H . 'engine/files/data/sw_login.ini') : array('id' => '', 'password' => '');
  36. Core::get('cache.class');
  37. $cache = new cache(tmpDir . 'themes.swc');
  38. if (!$cache->life())
  39. {
  40. $opendir = opendir(H.'style/themes/');
  41. while ($theme = readdir($opendir))
  42. {
  43. if ($theme == '.' || $theme == '..' || !is_dir(H.'style/themes/'.$theme))
  44. continue;
  45. $conf= parse_ini_file(H.'style/themes/'.$theme.'/theme.ini');
  46. $themes[$theme] = $conf['name'];
  47. }
  48. $cache->write(serialize($themes));
  49. }
  50. $themes = unserialize($cache->read());
  51. $activ = isset($set['activation_acc']) ? $set['activation_acc'] : 0;
  52. $c_time2 = 'sec';
  53. $c_time = isset($set['cache_time']) ? $set['cache_time'] : 3600;
  54.  
  55. if ($set['cache_time'] >= 3600)
  56. {
  57. $c_time2 = 'hour';
  58. $c_time = $set['cache_time'] / 3600;
  59. }
  60. elseif ($set['cache_time'] >= 60)
  61. {
  62. $c_time2 = 'min';
  63. $c_time = $set['cache_time'] / 60;
  64. }
  65.  
  66. ?>
  67. <form method="post">
  68. Название сайта:<br />
  69. <input name="title" value="<?=$title?>" type="text" /><br />
  70. Тема :<br />
  71. <select name='theme'>
  72. <?php
  73. foreach($themes as $theme => $name)
  74. {
  75. echo '<option value="'.$theme.'">'.$name.'</option>';
  76. }
  77. ?>
  78. </select><br />
  79. <label><input type='checkbox' <?=$set['antimat'] ? "checked='checked'":null?> name='antimat' value='1' /> Анти-Мат</label><br />
  80. (beta) Кеш является не актуальным через:<br />
  81. <input type="text" name="cache_time" value="<?=$c_time?>"/><br />
  82. <select name="cache_time2">
  83. <option value="sec" <?=$c_time2 == 'sec' ? 'selected="selected"' : ''?>>Секунд</option>
  84. <option value="min" <?=$c_time2 == 'min' ? 'selected="selected"' : ''?>>Минут</option>
  85. <option value="hour" <?=$c_time2 == 'hour' ? 'selected="selected"' : ''?>>Час</option>
  86. </select><br />
  87. Активация пользователей через e-mail:<br />
  88. <select name="activation_account">
  89. <option value="1">Да</option>
  90. <option value="0"<?=!$activ ? ' selected="selected"' : ''?>>Нет</option>
  91. </select><br />
  92. <hr />
  93. Dropbox e-mail:<br />
  94. <input type="text" name="dx_e-mail" value="<?=$dropbox['e-mail']?>"/><br />
  95. Dropbox пароль:<br />
  96. <input type="text" name="dx_password" value="<?=$dropbox['password']?>"/><br />
  97. <input value="Изменить" name='save' type="submit" />
  98. <hr />
  99. ID на secwind.ru:<br />
  100. <input type="text" name="sw_id" value="<?=$sw_login['id']?>"/><br />
  101. Пароль на secwind.ru:<br />
  102. <input type="text" name="sw_password" value="<?=$sw_login['password']?>"/><br />
  103. <input value="Изменить" name='save' type="submit" />
  104. </form>
  105. <div class="menu_razd">См. также</div>
  106. <div class="link"><a href="..?act=server">Сервер</a></div>
  107. <div class="link"><a href="..">Админка</a></div>
  108. <?php
  109. include incDir . 'foot.php';