Файл: adultscript-2.0.3-pro/files/admin/modules/frontpage/components/config.php
Строк: 39
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_frontpage_config
{
    public function __construct()
    {
    }
    
    public function render()
    {
        $db            = VF::factory('database');
        $errors        = array();
        $messages    = array();
        $fcfg        = VF::cfg('module.frontpage');
        
        if (isset($_POST['submit-config'])) {
            $filter                = VF::factory('filter');
            $watched            = (int) trim($_POST['watched']);
            $watched_per_page    = (int) trim($_POST['watched_per_page']);
            $videos                = $filter->get('videos');
            $videos_per_page    = (int) trim($_POST['videos_per_page']);
            
            if (!$errors) {
                $config = array(
                    'watched'            => $watched,
                    'watched_per_page'    => $watched_per_page,
                    'videos'            => $videos,
                    'videos_per_page'    => $videos_per_page
                );
                
                $db->query("UPDATE #__module
                            SET config_cache = '".$db->escape(serialize($config))."',
                                config = '".$db->escape(serialize($config))."'
                            WHERE name = 'frontpage'
                            LIMIT 1");
                                  
                VF::cache_set('frontpage', $config, 'module');
                
                $messages[] = 'Frontpage module configuration updated!';                                                                                                                                      
            }
        }
        
        $fcfg    = VF::cfg('module.frontpage', TRUE, TRUE);
                
        $tpl = VF::factory('template');
        $tpl->menu            = 'module';
        $tpl->submenu        = 'module_manage';
        $tpl->meta_title    = 'Admin::Frontpage::Config';
        $tpl->errors        = $errors;
        $tpl->messages        = $messages;
        $tpl->fcfg            = $fcfg;
        $tpl->load(array('header', 'frontpage_config', 'footer'));
        $tpl->display();
    }
}