Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/template/components/config.php
Строк: 44
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_Admin_template_config
{
    private 
$db;
    public function 
__construct()
    {
        
$this->db VF::factory('database');
    }
    
    public function 
render()
    {
        
$errors        = array();
        
$messages    = array();
        
        
$tpl_id        = (isset($_GET['id'])) ? (int) trim($_GET['id']) : false;
        if (
$tpl_id) {
            
$this->db->query("
                SELECT name
                FROM #__template
                WHERE tpl_id = "
.$tpl_id."
                LIMIT 1
            "
);
            
            if (
$this->db->affected_rows()) {
                
$tpl        $this->db->fetch_assoc();
                
$template    $tpl['name'];
                
$file        VFile::safe(ADMIN_DIR.'/modules/template/config/'.$template.'.php');
                
$function    'template_config_'.$template;
                if (
file_exists($file) && is_file($file)) {
                    require 
$file;
                    
                    
$return    $function($tpl_id);
                    if (
is_array($return)) {
                        
$errors    array_merge($errors$return);
                    } else {
                        
$messages[]    = 'Config updated!';
                    }
                } else {
                    
$_SESSION['error'] = 'Invalid template config file!';
                    
VF::redirect(ADMIN_URL.'/index.php?q=template');                    
                }
            } else {
                
$_SESSION['error'] = 'Invalid template!';
                
VF::redirect(ADMIN_URL.'/index.php?q=template');
            }
        } else {
            
$_SESSION['error']    = 'Invalid template id!';
            
VF::redirect(ADMIN_URL.'/index.php?q=template');
        }
        
        
$this->db->query("
            SELECT config
            FROM #__template
            WHERE tpl_id = "
.$tpl_id."
            LIMIT 1
        "
);
        
        
$config    unserialize($this->db->fetch_field('config'));
        
        
$tpl VF::factory('template');
        
$tpl->menu            'home';
        
$tpl->submenu        'extend';
        
$tpl->meta_title    'Admin::Template::Config';
        
$tpl->errors        $errors;
        
$tpl->messages        $messages;
        
$tpl->tpl_id        $tpl_id;
        
$tpl->config        $config;
        
$tpl->template        $template;
        
$tpl->load(array('header''template_config''footer'));
        
$tpl->display();
    }    
}
Онлайн: 1
Реклама