Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/video/components/view.php
Строк: 83
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_Admin_video_view extends VModule_Admin_video
{
    protected 
$db;
    public function 
__construct()
    {
        
$this->db    = &VF::factory('database');
    }
    
    public function 
render()
    {
        
$video        = array();
        
$video_id     = (isset($_GET['id']) && is_numeric($_GET['id'])) ? (int) $_GET['id'] : 0;
        
        
$categories $this->get_video_categories();
        
$statuses    = array(
            
'0' => 'Suspended',
            
'1' => 'Published',
            
'2' => 'Waiting Approval',
            
'3' => 'Uploading',
            
'4' => 'Converting',
            
'5' => 'Grabbing',
            
'6' => 'Queued',
            
'7' => 'Error'
        
);
        
        
$errors        = array();
        
$messages    = array();
        
$warnings    = array();
        
        
$this->db->query("SELECT v.*, u.username, o.filename AS filename, o.ext AS oext,
                                 o.size AS osize, o.method, o.url as ourl, o.ip as oip, o.add_time AS oadd_time,
                                 GROUP_CONCAT(DISTINCT c.cat_id) AS cats,
                                 GROUP_CONCAT(DISTINCT c.name) AS name,
                                 GROUP_CONCAT(DISTINCT t.name) AS tags
                          FROM #__video AS v
                          LEFT JOIN #__video_category AS vc ON (vc.video_id = v.video_id)
                          LEFT JOIN #__video_categories AS c ON (vc.cat_id = c.cat_id)
                          LEFT JOIN #__video_tags AS t ON (t.video_id = v.video_id)
                          LEFT JOIN #__user AS u ON (u.user_id = v.user_id)
                          LEFT JOIN #__video_orig AS o ON (o.video_id = v.video_id)
                          WHERE v.video_id = "
.$video_id."
                          GROUP BY v.video_id
                          LIMIT 1"
);
        if (
$this->db->affected_rows()) {
            
$video $this->db->fetch_assoc();
            if (isset(
$_GET['a'])) {
                
$action trim($_GET['a']);
                switch (
$action) {
                    case 
'publish':
                        
$this->db->query("UPDATE #__video SET status = 1 WHERE video_id = ".$video_id." LIMIT 1");
                        
$video['status'] = 1;
                        
$messages[] = 'Video published!';
                        break;
                    case 
'suspend':
                        
$this->db->query("UPDATE #__video SET status = 0 WHERE video_id = ".$video_id." LIMIT 1");
                        
$video['status'] = 0;
                        
$messages[] = 'Video suspended!';
                        break;
                    case 
'delete':
                        
$this->delete_video($video_id);
                        
$video        = array();
                        
$messages[] = 'Video Deleted!';
                        break;
                    case 
'convert':
                        
$this->convert_video($video_id);
                        
$messages[] = 'Video Conversion running in background!';
                        break;
                    case 
'mobile':
                        
$this->convert_video_mobile($video_id);
                        
$messages[] = 'Video Mobile Conversion running in background!';
                        break;
                    case 
'regenerate':
                        
$this->regenerate_thumbs($video_id);
                        
$messages[] = 'Thumbs regenerated!';
                        break;
                    case 
'duration':
                        
$this->regenerate_duration($video_id);
                        
$messages[] = 'Duration updated!';
                        break;
                    default:
                        
$errors[] = 'Invalid action! What exactly did you click!?';
                }
            }
        }
    
        
$tpl    = &VF::factory('template');
        
$tpl->menu            'video';
        
$tpl->submenu        'video_view';
        
$tpl->meta_title    'Admin::Video::View';
        
$tpl->errors        $errors;
        
$tpl->messages        $messages;
        
$tpl->warnings        $warnings;
        
$tpl->statuses        $statuses;
        
$tpl->video            $video;
        
$tpl->video_id        $video_id;
        
$tpl->vcfg            VF::cfg('module.video');
        
$tpl->load(array('header''video_view''footer'));
        
$tpl->display();
    }
    
    private function 
get_video_categories()
    {
        return 
$this->db->get_rows("SELECT cat_id, name FROM #__video_categories ORDER BY name ASC");
    }
    
    private function 
regenerate_thumbs($video_id)
    {
        
VHelper::load('module.video.manage');
        
VHelper_video_manage::thumbs($video_id);
    }

    private function 
regenerate_duration($video_id)
    {
        
VHelper::load('module.video.manage');
        
VHelper_video_manage::duration($video_id);
    }
}
?>
Онлайн: 1
Реклама