Размер файла: 1.93Kb
<?php
/**
* Ant0ha's project
*
* @package
* @author Anton Pisarenko <[email protected]>
* @copyright Copyright (c) 2006 - 2010, Anton Pisarenko
* @license http://ant0ha.ru/license.txt
* @link http://ant0ha.ru
*/
//---------------------------------------------
/**
* Основные функции админ панели
*/
class Main_Admin_Controller extends Controller {
/**
* Уровень пользовательского доступа
*/
protected $access_level = 10;
/**
* Тема
*/
protected $template_theme = 'admin';
/**
* Метод по умолчанию
*/
public function action_index() {
$this->action_config();
}
/**
* Конфигурация системы
*/
public function action_config() {
$_config = $this->config['system'];
if(isset($_POST['submit'])) {
main::is_demo();
$_config = $_POST;
foreach($_config as $key => $value) {
if($key == 'submit') continue;
$sql = "UPDATE #__config SET \n";
$sql .= "`value` = '". mysql_real_escape_string(stripslashes($value)) ."'\n";
$sql .= "WHERE `key` = '". $key ."'";
$this->db->query($sql);
}
a_notice('Данные успешно изменены!', a_url('main/admin/config'));
}
if(!isset($_POST['submit']) || $error) {
# Получаем темы
$default_themes = array();
$admin_themes = array();
$dir = opendir(ROOT .'views');
while($theme = readdir($dir)) {
if($theme == '.' || $theme == '..') continue;
if(file_exists(ROOT .'views/'. $theme .'/theme.ini')) {
$theme_info = parse_ini_file(ROOT .'views/'. $theme .'/theme.ini');
if(!empty($theme_info['title'])) {
if(strpos($theme, 'admin') === 0) $admin_themes[] = $theme_info;
else $default_themes[] = $theme_info;
}
}
}
$this->tpl->assign(array(
'_config' => $_config,
'admin_themes' => $admin_themes,
'default_themes' => $default_themes
));
$this->tpl->display('config');
}
}
}
?>