Файл: adultscript-2.0.3-pro/files/mobile/components/user_favorites.php
Строк: 38
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_mobile_user_favorites extends VComponent_mobile_user
{
public function __construct()
{
parent::__construct();
}
public function render()
{
VAuth::check('Registered', MOBILE_URL.'/user/login/');
$user_id = (int) $_SESSION['user_id'];
$page = (isset($_GET['page'])) ? (int) trim($_GET['page']) : 1;
$sql_count = "SELECT COUNT(f.video_id) AS total_videos
FROM #__video_favorites AS f
INNER JOIN #__video AS v ON (v.video_id = f.video_id AND v.mobile = '1')
WHERE f.user_id = ".$user_id;
$total_videos = $this->db->get_field($sql_count, 'total_videos');
$pagination = VPagination::get($page, $total_videos, $this->mcfg['videos_per_page']);
$sql = "SELECT v.video_id, v.title, v.slug, v.description, v.thumb, v.rating, v.rated_by, v.total_views, v.duration
FROM #__video_favorites AS f
INNER JOIN #__video AS v ON (v.video_id = f.video_id AND v.status = 1 AND v.mobile = '1')
WHERE f.user_id = ".$user_id."
ORDER BY v.add_time DESC
LIMIT ".$pagination['limit'];
$videos = $this->db->get_rows($sql);
$this->tpl->menu = 'community';
$this->tpl->submenu = 'favorites';
$this->tpl->title = __('favorites-title');
$this->tpl->canonical = BASE_URL.'/user/favorites/';
$this->tpl->videos = $videos;
$this->tpl->pagination = $pagination;
$this->tpl->load(array('header', 'user_favorites', 'footer'));
$this->tpl->display();
}
}