Вход Регистрация
Файл: adultscript-2.0.3-pro/files/modules/profile/components/videos_history.php
Строк: 52
<?php
class VComponent_profile_videos_history extends VModule_profile
{
    public function 
__construct()
    {
        
parent::__construct();
    }
    
    public function 
render()
    {
        
$page    = VUri::request(4); $page = ($page) ? (int) $page : 1;
        
$url    = 'users/'.$this->username.'/videos/history/';
        if (
$page > 1) {
            
$url    .= $page.'/';
        }
        
        if (!
VUri::match($url)) {
            
VModule::load('404', true);
        }
        
        if (!
$this->profile($this->username)) {
            return 
false;
        }
        
        
VLanguage::load('frontend.global');
        
VLanguage::load('frontend.profile');

        
$user_id        = (int) $this->user['user_id'];
        
$sql_count      = "SELECT COUNT(*) AS total_videos
                           FROM #__video_history AS vh
                           WHERE vh.user_id = "
.$user_id;
        
$total_videos   = $this->db->get_field($sql_count, 'total_videos');
        
$pagination     = VPagination::get($page, $total_videos, 16);
        
$sql            = "SELECT v.video_id, v.title, v.slug, v.likes, v.rating, v.rated_by, v.hd,
                                  v.thumb, v.thumbs, v.duration, v.total_views, v.add_time, v.ext, u.username
                           FROM #__video_history AS vh
                           LEFT JOIN #__video AS v ON (v.video_id = vh.video_id AND v.status = 1)
                           LEFT JOIN #__user AS u ON (u.user_id = v.user_id)
                           WHERE vh.user_id = "
.$user_id."
                           ORDER BY vh.view_time DESC
                           LIMIT "
.$pagination['limit'];
        if (!
$videos = $this->cache->get($sql, 3600)) {
            
$this->db->query($sql);
            if (
$this->db->affected_rows()) {
                
$videos = $this->db->fetch_rows();
                
$this->cache->store($sql, $videos, 3600);
            } else {
                
$videos = array();
            }
        }
        
        
$add    = ($page > 1) ? ' - '.__('page').' '.$page : '';

        
$this->tpl->menu          = 'community';
        
$this->tpl->submenu       = 'profile';
        
$this->tpl->extra         = 'video';
                
        
$this->tpl->title          = __('watched-title');
        
        
$this->tpl->meta_title    = __('watched-meta-title', array($this->username, $add, VF::cfg_item('site_name')));
        
$this->tpl->meta_desc     = __('watched-meta-desc', array($this->username, $add, VF::cfg_item('site_name')));
        
        
$this->tpl->user          = $this->user;
        
$this->tpl->username      = e($this->username);
        
$this->tpl->is_subscribed = $this->is_subscribed;
        
$this->tpl->is_friend     = $this->is_friend;
        
$this->tpl->is_self       = $this->is_self;
        
$this->tpl->is_moderator  = $this->is_moderator;
        
$this->tpl->is_loggedin   = $this->is_loggedin;
        
$this->tpl->is_blocked    = $this->is_blocked;
        
        
$this->tpl->videos            = $videos;
        
$this->tpl->pagination        = $pagination;
        
$this->tpl->url                = REL_URL.'/users/'.$this->username.'/videos/history/#PAGE#/';
        
        
$this->tpl->load(array('header', 'profile_items', 'footer'));
        
$this->tpl->display();
    }
}
Онлайн: 2
Реклама