Вход Регистрация
Файл: adultscript-2.0.3-pro/files/mobile/mobile.php
Строк: 90
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VMobile
{
    protected 
$db;
    protected 
$tpl;
    protected 
$mcfg;
    protected 
$cache;

    public function 
__construct()
    {
        
$this->db        VF::factory('database');
        
$this->mcfg        VF::cfg('module.mobile');
        
$this->cache    VF::factory('cache');
        
        
$template            'default';
        
$options            = array(
            
'template'        => $template,
            
'template_dir'    => BASE_DIR.'/mobile/templates/'.$template,
            
'template_url'    => MOBILE_URL.'/templates/'.$template,
            
'template_rel'    => MOBILE_REL.'/templates/'.$template
        
);
        
        if (
defined('CDN_URL')) {
            
$options['template_url'] = CDN_URL.'/mobile/templates/'.$template;
            
$options['template_rel'] = CDN_URL.'/mobile/templates/'.$template;
        }
                
        
$this->tpl                VF::factory('template'$options);
        
$this->tpl->language    VLanguage::get('language');
        
$this->tpl->languages   VLanguage::get('languages');
        
$this->tpl->flag        VLanguage::get_flag();
        
$this->tpl->mcfg        = array(
            
'site_name'        => $this->mcfg['site_name'],
            
'meta_desc'        => $this->mcfg['meta_desc'],
            
'meta_keys'        => $this->mcfg['meta_keys']
        );
    }
    
    public static function 
process()
    {
        
define('MOBILE_CUR'VUri::mobile());
        
define('MOBILE_REL''');
        
        
$segment          VUri::request(0);
        
$modules        = array(
              
'video'            => 1,
              
'user'            => 1,
              
'channels'      => 'channel',
              
'channel'        => 1,
              
'photo'            => 1,
              
'pornstar'        => 1,
              
'categories'    => 1,
              
'feedback'        => 1,
              
'community'        => 1,
              
'static'        => 1,
              
'users'            => 1,
              
'static'        => 1,
              
'search'        => 1,
              
'news'            => 1,
              
'kb'            => 1
        
);
        
        if (
VModule::enabled('premium')) {
              
$modules['premium']    = 1;
        }
        
        
$redirects        = array(
              
'photos'        => '/photo/recent/',
              
'pornstars'        => '/pornstar/',
              
'login'            => '/user/login/',
              
'register'        => '/user/signup/',
              
'dmca'            => '/static/dmca/',
              
'2257'            => '/static/2257/',
              
'help'            => '/static/help/',
              
'upgrade'        => '/user/upgrade/',
              
'album'            => str_replace('/album/''/photo/'MOBILE_CUR)
        );
        
        
$orders         = array('recent' => 1'watched' => 1'popular' => 1'discussed' => 1'rated' => 1'downloaded' => 1);

        if (
$segment == '') {
              
$segment 'recent';
        }
        
        if (isset(
$redirects[$segment])) {
              
VF::redirect(MOBILE_URL.$redirects[$segment], 301);
        }
        
        if (isset(
$modules[$segment])) {
              
// support for module slugs
              
$retval        $modules[$segment];
              
$component    = (is_int($retval)) ? $segment $retval;
        } else {
              
$component    'video';
        }
        
        
$component_class    'VComponent_mobile_'.$component;

        try {
            require 
BASE_DIR.'/mobile/components/'.$component.'.php';
            
            
VLanguage::load('frontend.global');
            
VLanguage::load('frontend.mobile');
            
            
$obj = new $component_class();
            
$obj->render();
        } catch (
Exception $e) {
            throw new 
VException($e);
        }
        
        
VF::close();
        exit;
    }
    
    protected function 
notfound($message false)
    {
        
VResponse::add_header('Status''404 Not Found');
        
$this->tpl->meta_title     __('not-found');
        
$this->tpl->title        __('not-found');
        
$this->tpl->error        = ($message) ? $message __('not-found-message');
        
$this->tpl->load(array('header''404''footer'));
        
$this->tpl->display();
        
        
VF::close();
        exit();
    }
}
Онлайн: 0
Реклама