Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/mobile/components/config.php
Строк: 152
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_Admin_mobile_config
{
    public function 
__construct()
    {
    }
    
    public function 
render()
    {
        
$db            VF::factory('database');
        
$errors        = array();
        
$messages    = array();
        
$mcfg        VF::cfg('module.mobile');
        
$groups     $this->get_user_groups();
        
        if (isset(
$_POST['submit_config'])) {
            
$filter                        VF::factory('filter');
            
$site_name                    $filter->get('site_name');
            
$meta_desc                    $filter->get('meta_desc');
            
$meta_keys                    $filter->get('meta_keys');
            
$videos_per_page            = (int) trim($_POST['videos_per_page']);
            
$albums_per_page            = (int) trim($_POST['albums_per_page']);
            
$photos_per_page            = (int) trim($_POST['photos_per_page']);
            
$pornstars_per_page            = (int) trim($_POST['pornstars_per_page']);
            
$pornstars_videos            = (isset($_POST['pornstars_videos'])) ? (int) trim($_POST['pornstars_videos']) : 0;
            
$pornstars_videos_per_page    = (int) trim($_POST['pornstars_videos_per_page']);
            
$pornstars_photos            = (isset($_POST['pornstars_photos'])) ? (int) trim($_POST['pornstars_photos']) : 0;
            
$pornstars_photos_per_page    = (int) trim($_POST['pornstars_photos_per_page']);
            
$related_enabled            = (isset($_POST['related_enabled'])) ? (int) trim($_POST['related_enabled']) : 0;
            
$related_per_page            = (int) trim($_POST['related_per_page']);
            
$share_enabled                = (isset($_POST['share_enabled'])) ? (int) trim($_POST['share_enabled']) : 0;
            
$redirect                    = (int) trim($_POST['redirect']);
            
$premium                    = (isset($_POST['premium'])) ? (int) trim($_POST['premium']) : 0;

            
$view_access                $filter->get('view_access');
            
$view_desc                  = (int) trim($_POST['view_desc']);
            
$view_comments              = (int) trim($_POST['view_comments']);
            
$allow_comment              = (int) trim($_POST['allow_comment']);
            
$approve_comments           = (int) trim($_POST['approve_comments']);
            
$comments_per_page          = (int) trim($_POST['comments_per_page']);
            
$allow_rating               = (int) trim($_POST['allow_rating']);
            
$rating_count               = (int) trim($_POST['rating_count']);
            
$rating_type                $filter->get('rating_type');
            
$download                   = (int) trim($_POST['download']);
            
$download_perms             $filter->get('download_perms');

            
$interstitial                = (int) trim($_POST['interstitial']);
            
$inter_timeout                = (int) trim($_POST['inter_timeout']);
            
$inter_session                = (int) trim($_POST['inter_session']);
            
            
$player                        = (int) trim($_POST['player']);
            
            if (!
$errors) {
                
$config = array(
                    
'components'        => array(
                        
'browse'        => 1,
                        
'search'        => 1,
                        
'categories'    => 1,
                        
'category'        => 1,
                        
'feedback'        => 1,
                        
'download'        => 1,
                        
'view'            => 1,
                        
'photos'        => 1,
                        
'album'            => 1,
                        
'photo'            => 1,
                        
'static'        => 1,
                        
'share'            => 1
                    
),
                    
'redirect'                    => $redirect,
                    
'site_name'                    => $site_name,
                    
'meta_desc'                    => $meta_desc,
                    
'meta_keys'                    => $meta_keys,
            
                    
'videos_per_page'            => $videos_per_page,
                    
'related_enabled'            => $related_enabled,
                    
'related_per_page'            => $related_per_page,
                    
'share_enabled'                => $share_enabled,
                      
'view_access'                => $view_access,
                      
'view_desc'                  => $view_desc,
                      
'view_comments'              => $view_comments,
                      
'allow_comment'              => $allow_comment,
                      
'approve_comments'           => $approve_comments,
                      
'comments_per_page'          => $comments_per_page,
                      
'allow_rating'               => $allow_rating,
                      
'rating_count'               => $rating_count,
                      
'rating_type'                => $rating_type,
                      
'download'                   => $download,
                      
'download_perms'             => $download_perms,
                    
                    
'albums_per_page'            => $albums_per_page,
                    
'photos_per_page'            => $photos_per_page,

                    
'pornstars_per_page'        => $pornstars_per_page,
                    
'pornstars_videos'            => $pornstars_videos,
                    
'pornstars_videos_per_page'    => $pornstars_videos_per_page,
                    
'pornstars_photos'            => $pornstars_photos,
                    
'pornstars_photos_per_page'    => $pornstars_photos_per_page,

                    
'premium'                    => $premium,
                    
                      
'interstitial'                => $interstitial,
                      
'inter_timeout'                => $inter_timeout,
                      
'inter_session'                => $inter_session,
                      
                      
'player'                    => $player
                
);
                
                
$db->query("UPDATE #__module
                            SET config_cache = '"
.$db->escape(serialize($config))."',
                                config = '"
.$db->escape(serialize($config))."'
                            WHERE name = 'mobile'
                            LIMIT 1"
);
                                  
                
VF::cache_set('mobile'$config'module');
                
                
$messages[] = 'Mobile module configuration updated!';                                                                                                                                      
            }
        }
        
        
$mcfg    VF::cfg('module.mobile'TRUETRUE);
                
        
$tpl VF::factory('template');
        
$tpl->menu            'module';
        
$tpl->submenu        'module_manage';
        
$tpl->meta_title    'Admin::Mobile::Config';
        
$tpl->errors        $errors;
        
$tpl->messages        $messages;
        
$tpl->mcfg            $mcfg;
        
$tpl->groups        $groups;
        
$tpl->load(array('header''mobile_config''footer'));
        
$tpl->display();
    }
    
    private function 
get_user_groups()
    {
          
$db    VF::factory('database');
        
$db->query("SELECT group_id, name FROM #__user_groups ORDER BY group_id ASC");
        if (
$db->affected_rows()) {
            return 
$db->fetch_rows();
        }

        die(
'Failed to load the user groups table!');
    }    
}
Онлайн: 2
Реклама