Вход Регистрация
Файл: adultscript-2.0.3-pro/files/modules/video/components/download.php
Строк: 27
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_video_download extends VModule_video
{
    private 
$video_id;
    public function 
__construct()
    {
        
parent::__construct();
        
$this->video_id VUri::request(1);
    }
    
    public function 
render()
    {
        if (
VCfg::get('video.download') != '1') {
            die(
'Download disabled!');
        }
        
        
$access    VCfg::get('video.view_access');
        if (
$access != 'all') {
            
VAuth::check($accessNULL__('download-access', array($access)));
        }
        
        
$this->db->query("SELECT url, server, ext, hd, mobile, allow_download, premium
                          FROM #__video
                          WHERE video_id = "
.$this->video_id."
                          AND allow_download = '1'
                          AND premium = '0'
                          AND status = 1
                          LIMIT 1"
);
        if (
$this->db->affected_rows()) {
              
$video $this->db->fetch_assoc();
        } else {
              
// how did the user get here?
              
throw new VException('Application Error! Aborting...');
        }
        
        
        
        
$this->db->query("UPDATE #__video
                          SET total_downloads = total_downloads+1
                          WHERE video_id = "
.$this->video_id."
                          LIMIT 1"
);
        
        if (
$video['url'] == '') {
            
VHelper::load('module.video.stream');

              
$type    VUri::request(2);
              if (
$type == 'flv' or $type == 'mp4') {
                  
$video_url  VHelper_video_stream::url(true$this->video_id$video['ext'], $video['server']);                  
                  
$video_self    BASE_URL.'/media/videos/'.$video['ext'].'/'.$this->video_id.'.'.$video['ext'];
              } elseif (
$type == 'hd') {
                  
$video_url  VHelper_video_stream::url(true$this->video_id$video['ext'], $video['server'], falsetrue);
                  
$video_self    BASE_URL.'/media/videos/mp4/'.$this->video_id.'_hd.mp4';
              } elseif (
$type == 'mobile') {
                  
$video_url  VHelper_video_stream::url_mobile(true$this->video_id$video['server']);                            
                  
$video_self    BASE_URL.'/media/videos/mobile/'.$this->video_id.'.mp4';
              } else {
                  
$video_url  VHelper_video_stream::url(true$this->video_id$video['ext'], $video['server']);
                  
$video_self    BASE_URL.'/media/videos/'.$video['ext'].'/'.$this->video_id.'.'.$video['ext'];
              }
              
              
$video_url    urldecode($video_url);
          } else {
              
$video_url    $video['url'];
          }
          
        if (
$video_url == $video_self) {
            if (!
VDownload::force(str_replace(BASE_URLBASE_DIR$video_self))) {
                
header('HTTP/1.0 404 Not Found');
            }
        } else {
            
VF::redirect($video_url);
        }
        
        exit();
    }
}
Онлайн: 1
Реклама