Вход Регистрация
Файл: adultscript-2.0.3-pro/files/modules/profile/components/profile.php
Строк: 102
<?php
class VComponent_profile_profile extends VModule_profile
{
    public function 
__construct()
    {
        
parent::__construct();
    }
    
    public function 
render()
    {
        if (!
VUri::match('users/'.$this->username.'/')) {
            
VModule::load('404'true);
        }
        
        if (!
$this->profile($this->username)) {
            return 
false;
        }
        
        
VLanguage::load('frontend.global');
        
VLanguage::load('frontend.profile');
        
        
$user_id    $this->user['user_id'];
        
        
$this->db->query("
            UPDATE #__user_activity
            SET total_profile_views = total_profile_views+1
            WHERE user_id = "
.$user_id."
            LIMIT 1
        "
);
        
        if (
$this->show($this->user['show_videos'])) {
            if (
$this->tpl->total_public_videos $this->get_videos_count($user_id'public')) {
                
$this->tpl->public_videos     $this->get_videos($user_id'public'8);
            }

            if (
$this->tpl->total_private_videos $this->get_videos_count($user_id'private')) {
                
$this->tpl->private_videos    $this->get_videos($user_id'private'8);
            }
        }

        if (
$this->show($this->user['show_video_favorites'])) {
            if (
$this->tpl->total_favorite_videos $this->get_favorites_count($user_id)) {
                
$this->tpl->favorite_videos $this->get_video_favorites($user_id);
            }
        }
        
        if (
$this->show($this->user['show_video_ratings'])) {
            
$this->tpl->rated_vides $this->get_video_ratings($user_id);
        }
        
        if (
$this->show($this->user['show_video_history'])) {
            if (
$this->tpl->total_watched_videos $this->get_history_count($user_id)) {
                
$this->tpl->watched_videos $this->get_video_history($user_id);
            }
        }

        if (
VModule::enabled('photo')) {
            
$this->tpl->css = array(TPL_REL.'/css/style_photo.css');
            if (
$this->show($this->user['show_albums'])) {
                if (
$this->tpl->total_public_albums $this->get_albums_count($user_id'public')) {
                    
$this->tpl->public_albums     $this->get_albums($user_id'public'8);
                }
                
                if (
$this->tpl->total_private_albums $this->get_albums_count($user_id'private')) {
                    
$this->tpl->private_albums    $this->get_albums($user_id'private'8);
                }
            }
            
            if (
$this->show($this->user['show_photo_favorites'])) {
                if (
$this->tpl->total_photos $this->get_photo_favorites_count($user_id)) {
                    
$this->tpl->photos $this->get_photo_favorites($user_id8);
                }
            }
        }
        
        if (
$this->show($this->user['show_friends'])) {
            if (
$this->tpl->total_friends $this->get_friends_count($user_id)) {
                
$this->tpl->friends $this->get_friends($user_id8);
            }
        }
        
        if (
$this->show($this->user['show_subscribers'])) {
            if (
$this->tpl->total_subscribers $this->get_subscribers_count($user_id)) {
                
$this->tpl->subscribers $this->get_subscribers($user_id8);
            }
        }
        
        if (
$this->show($this->user['show_subscriptions'])) {
            if (
$this->tpl->total_subscriptions $this->get_subscriptions_count($user_id)) {
                
$this->tpl->subscriptions $this->get_subscriptions($user_id8);
            }            
        }
        
        if (
$this->show($this->user['profile_comments'])) {
            if (
$comments $this->get_comments($user_id)) {
                
$this->tpl->comments      $comments['comments'];
                
$this->tpl->pagination    $comments['pagination'];
            }
        }

        
$this->tpl->menu          'community';
        
$this->tpl->submenu       'profile';
        
$this->tpl->meta_title    __('profile-meta-title', array($this->usernameVF::cfg_item('site_name')));
        
$this->tpl->meta_desc     $this->username.' - '.$this->tpl->cfg['meta_desc'];
        
$this->tpl->meta_keys     $this->username.', '.$this->tpl->cfg['meta_keys'];
        
$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->load(array('header''profile''footer'));
        
$this->tpl->display();
    }
    
    private function 
get_video_playlists($user_id$limit=4)
    {
        return 
NULL;
    }

    private function 
get_comments($user_id$limit=5)
    {
        
$total_comments $this->db->get_field("SELECT COUNT(*) AS total_comments
                                                FROM #__user_comments
                                                WHERE user_id = "
.$user_id."
                                                AND status = '1'"
'total_comments');
        
$pagination     VPagination::get(1$total_comments$limit);

        
$cache_id 'user_comments_'.$user_id;
        if (!
$comments $this->cache->get($cache_id3600)) {
            
$this->db->query("SELECT uc.comment_id, uc.parent_id, uc.user_id, uc.poster_id, uc.comment,
                                     uc.likes, uc.rated_by, uc.add_time,
                                     u.username, u.gender, u.avatar
                              FROM #__user_comments AS uc
                              LEFT JOIN #__user AS u ON (u.user_id = uc.poster_id)
                              WHERE uc.user_id = "
.$user_id."
                              AND uc.status = '1'
                              ORDER BY uc.comment_id DESC
                              LIMIT "
.$limit);
            if (
$this->db->affected_rows()) {
                
$comments $this->db->fetch_rows();
                
$this->cache->store($cache_id$comments3600);
            } else {
                
$comments = array();
            }
        }

        return array(
            
'comments'      => $comments,
            
'pagination'    => $pagination
        
);
    }    
}
Онлайн: 1
Реклама