Файл: adultscript-2.0.3-pro/files/modules/user/components/favorites.php
Строк: 33
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_user_favorites extends VModule_user
{
public function __construct()
{
parent::__construct();
}
public function render()
{
VAuth::check('Registered');
$user_id = (int) $_SESSION['user_id'];
$page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
$sql_count = "SELECT COUNT(*) AS total_videos
FROM #__video_favorites
WHERE user_id = ".$user_id;
$total_videos = $this->db->get_field($sql_count, 'total_videos');
$pagination = VPagination::get($page, $total_videos, 20);
$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
FROM #__video_favorites AS vf
LEFT JOIN #__video AS v ON (v.video_id = vf.video_id AND v.status = 1)
WHERE vf.user_id = ".$user_id."
LIMIT ".$pagination['limit'];
$videos = $this->db->get_rows($sql);
$this->tpl->menu = 'home';
$this->tpl->colmenu = 'manage';
$this->tpl->submenu = 'user-favorites';
$this->tpl->title = e(__('my-favorite-videos'));
$this->tpl->meta_title = __('my-favorite-videos');
$this->tpl->videos = $videos;
$this->tpl->pagination = $pagination;
$this->tpl->load(array('header', 'user_videos', 'footer'));
$this->tpl->display();
}
}