Файл: adultscript-2.0.3-pro/files/mobile/components/user_comments.php
Строк: 54
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_mobile_user_comments extends VComponent_mobile_user
{
public function __construct()
{
parent::__construct();
}
public function render()
{
VAuth::check('Registered', MOBILE_URL.'/user/login/');
$page = (isset($_GET['page'])) ? (int) trim($_GET['page']) : 1;
$user_id = (int) $_SESSION['user_id'];
$sql_count = "SELECT COUNT(*) AS total_comments
FROM #__video_comments
WHERE video_id IN (SELECT video_id FROM #__video WHERE user_id = ".$user_id.")";
$total_comments = $this->db->get_field($sql_count, 'total_comments');
$pagination = VPagination::get($page, $total_comments, 10);
$sql = "SELECT c.comment_id, c.parent_id, c.user_id,
c.comment, c.add_time, c.nickname,
u.username, u.gender, u.avatar, c.status
FROM #__video_comments AS c
LEFT JOIN #__user AS u ON (u.user_id = c.user_id)
WHERE c.video_id IN (SELECT video_id FROM #__video WHERE user_id = ".$user_id.")
ORDER BY c.comment_id DESC
LIMIT ".$pagination['limit'];
$comments = $this->db->get_rows($sql);
$this->tpl->menu = 'community';
$this->tpl->submenu = 'comments';
$this->tpl->meta_title = __('comments');
$this->tpl->comments = $comments;
$this->tpl->pagination = $pagination;
$this->tpl->load(array('header', 'user_comments', 'footer'));
$this->tpl->display();
}
}