Вход Регистрация
Файл: adultscript-2.0.3-pro/files/modules/user/components/comments.php
Строк: 82
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_user_comments extends VModule_user
{
    public function 
__construct()
    {
        
parent::__construct();
    }
    
    public function 
render()
    {
        
VAuth::check('Registered');
    
        
// for the future, right now only profile comments are supported
        
$errors        = array();
        
$messages    = array();
        
$request    VUri::request(2);
        
$types         = array('video''photo''profile');
        
$type        = (!empty($request) && in_array($types[$type])) ? $request 'profile';
        
        
        
$user_id        = (int) $_SESSION['user_id'];
        
$page           = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
        
$function        'get_'.$type.'_comments';
        
$query            $this->$function($user_id$page);
        
$comments        $query['comments']; 
        
$pagination        $query['pagination'];
        
        
$this->tpl->menu              'home';
        
$this->tpl->colmenu            'manage';
        
$this->tpl->submenu            'user-comments';
        
        
$this->tpl->title            __('my-comments');
        
$this->tpl->meta_title        __('my-comments');
        
        
$this->tpl->errors        $errors;
        
$this->tpl->messages      $messages;
        
$this->tpl->comments        $comments;
        
$this->tpl->pagination    $pagination;
        
        
$this->tpl->load(array('header''user_comments''footer'));
        
$this->tpl->display();    
    }
    
    private function 
get_profile_comments($user_id$page)
    {
        
$sql_count      "SELECT COUNT(*) AS total_comments
                           FROM #__user_comments
                           WHERE user_id= "
.$user_id;
        
$total_comments $this->db->get_field($sql_count'total_comments');
        
$pagination     VPagination::get($page$total_comments20);
        
$sql            "SELECT uc.comment_id, uc.parent_id, uc.user_id, uc.poster_id, uc.comment, uc.likes,
                                  uc.rated_by, uc.add_time, uc.status, uc.spam, 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."
                           ORDER BY uc.comment_id DESC
                           LIMIT "
.$pagination['limit'];
        
$comments        $this->db->get_rows($sql);
        
        return array(
              
'comments'         => $comments,
              
'pagination'    => $pagination
        
);
    }
    
    private function 
get_video_comments($user_id$page)
    {
    }
    
    private function 
get_photo_comments($user_id$page)
    {
    }
}
Онлайн: 1
Реклама