public function ShowAdminForm() { global $bd_names, $config; $info = $this->answer; if (isset($_POST['sp_config_set'])) { $bd_skins = InputGet('bd_skins', 'POST', 'str'); $bd_bad_skins = InputGet('bd_bad_skins', 'POST', 'str'); $bd_skins_ratio = InputGet('bd_skins_ratio', 'POST', 'str'); $rebuild_items = InputGet('rebuild_items', 'POST', 'bool'); $find_items = InputGet('find_items', 'POST', 'bool'); $sp_offline = InputGet('sp_offline', 'POST', 'bool'); $sp_upload = InputGet('sp_upload', 'POST', 'bool'); $config['sp_online'] = $sp_offline ? false : true; $config['sp_upload'] = $sp_upload; if ($bd_skins) { if (!self::BD_CheckExist($bd_skins, 'fname')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins . ' ) <br />'; } else { $bd_names['sp_skins'] = $bd_skins; } } if ($bd_bad_skins) { if (!self::BD_CheckExist($bd_bad_skins, 'hash')) { $this->answer .= 'Таблица не найдена ( ' . $bd_bad_skins . ' ) <br />'; } else { $bd_names['sp_bad_skins'] = $bd_bad_skins; } } if ($bd_skins_ratio) { if (!self::BD_CheckExist($bd_skins_ratio, 'num')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins_ratio . ' ) <br />'; } else { $bd_names['sp_skins_ratio'] = $bd_skins_ratio; } } if ($bd_skins or $bd_bad_skins or $bd_skins_ratio) { $this->answer .= 'Настройки изменены <br />'; } loadTool('alist.class.php'); if (!MainConfig::SaveOptions()) { $this->answer .= 'Ошибка применения настроек <br />'; } if ($find_items) { $this->FindNewSkins(); } if ($rebuild_items) { $this->RebuildAll(); } $info = $this->answer; } ob_start(); include $this->GetView('admin/constants.html'); return ob_get_clean(); }
public static function DeleteTheme($theme_id) { global $config; if ($theme_id === View::def_theme) { return false; } $theme_dir = self::GetThemeDir($theme_id); if (!is_dir($theme_dir)) { return false; } self::deleteDir($theme_dir); if ($config['s_theme'] === $theme_id) { $config['s_theme'] = View::def_theme; MainConfig::SaveOptions(); } return true; }
ThemeManager::DeleteTheme($theme_delete); } if ($theme_old != $config['s_theme']) { loadTool('ajax.php'); } // headers for prompt refresh cookies $config['s_name'] = $site_name; $config['s_about'] = $site_about; $config['s_keywords'] = $keywords; $config['sbuffer'] = $sbuffer; $config['rewrite'] = $rewrite; $config['log'] = $log; $config['comm_revers'] = $comm_revers; $config['offline'] = $site_offline; $config['smtp'] = $smtp; if (MainConfig::SaveOptions()) { $info .= lng('OPTIONS_COMPLETE'); } else { $info .= lng('WRITE_FAIL') . ' ( ' . MCR_ROOT . 'config.php )'; } sqlConfigSet('email-name', $email_name); sqlConfigSet('email-mail', $email_mail); if ($config['smtp']) { $smtp_user = Filter::input('smtp_user'); $smtp_pass = Filter::input('smtp_pass'); $smtp_host = Filter::input('smtp_host'); $smtp_port = Filter::input('smtp_port', 'post', 'int'); $smtp_hello = Filter::input('smtp_hello'); sqlConfigSet('smtp-user', $smtp_user); if ($smtp_pass != '**defined**') { sqlConfigSet('smtp-pass', $smtp_pass);
public function ShowAdminForm() { global $bd_names, $config; $info = $this->answer; $configUpd = false; if (isset($_POST['sp_group_edit'])) { $group = new Group(Filter::input('group', 'post', 'int')); $permissions = $group->GetAllPermissions(); foreach (self::$permissions as $key => $value) { if ($value == 'bool') { $permissions[$key] = Filter::input($key, 'post', 'int') ? 1 : 0; } elseif (isset($_POST[$key])) { $permissions[$key] = Filter::input($key, 'post', 'int'); } else { continue; } } $group->Edit($group->GetName(), $permissions); } elseif (isset($_POST['sp_config_set'])) { // @todo move rebuild action some where else $rebuild_items = Filter::input('rebuild_items', 'post', 'bool'); if ($rebuild_items) { $this->RebuildAll(); } $config['sp_online'] = !Filter::input('sp_offline', 'post', 'bool'); $config['sp_upload'] = Filter::input('sp_upload', 'post', 'bool'); $config['sp_download'] = Filter::input('sp_download', 'post', 'bool'); $config['sp_comments'] = Filter::input('sp_comments', 'post', 'bool'); $configUpd = true; } elseif (isset($_POST['sp_tables_set'])) { $bd_skins = Filter::input('bd_skins', 'post'); $bd_bad_skins = Filter::input('bd_bad_skins', 'post'); $bd_skins_ratio = Filter::input('bd_skins_ratio', 'post'); if ($bd_skins) { if (!getDB()->isColumnExist($bd_skins, 'fname')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins . ' ) <br />'; } else { $bd_names['sp_skins'] = $bd_skins; } } if ($bd_bad_skins) { if (!getDB()->isColumnExist($bd_bad_skins, 'hash')) { $this->answer .= 'Таблица не найдена ( ' . $bd_bad_skins . ' ) <br />'; } else { $bd_names['sp_bad_skins'] = $bd_bad_skins; } } if ($bd_skins_ratio) { if (!getDB()->isColumnExist($bd_skins_ratio, 'num')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins_ratio . ' ) <br />'; } else { $bd_names['sp_skins_ratio'] = $bd_skins_ratio; } } if ($bd_skins or $bd_bad_skins or $bd_skins_ratio) { $configUpd = true; } } elseif (isset($_POST['sp_upload_set'])) { $find_items = Filter::input('find_items', 'post', 'bool'); $tag = Filter::input('rebuild_type', 'post', 'int'); if ($find_items) { $this->FindNewSkins($tag); } } if ($configUpd) { loadTool('alist.class.php'); if (!MainConfig::SaveOptions()) { $this->answer .= 'Ошибка применения настроек <br />'; } else { $this->answer .= 'Настройки изменены <br />'; } } $info = $this->answer; $result = getDB()->ask("SELECT `id`, `name` FROM `{$bd_names['groups']}` ORDER BY `name` DESC LIMIT 0,90"); ob_start(); while ($line = $result->fetch()) { $group_i = new Group($line['id']); $group = $group_i->GetAllPermissions(); $group['name'] = $line['name']; $group['id'] = $line['id']; include $this->GetView('admin/group.html'); } $groups = ob_get_clean(); ob_start(); include $this->GetView('admin/constants.html'); return ob_get_clean(); }