Файл: adultscript-2.0.3-pro/files/modules/user/components/photos.php
Строк: 35
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_user_photos extends VModule_user
{
public function __construct()
{
parent::__construct();
}
public function render()
{
if (!VModule::enabled('photo')) {
VModule::load('404', TRUE);
}
VAuth::check('Registered');
$user_id = (int) $_SESSION['user_id'];
$page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
$sql_count = "SELECT COUNT(*) AS total_photos
FROM #__photo_favorites
WHERE user_id = ".$user_id;
$total_photos = $this->db->get_field($sql_count, 'total_photos');
$pagination = VPagination::get($page, $total_photos, 20);
$sql = "SELECT p.photo_id, p.caption, p.total_views, p.total_comments, p.likes, p.rating, p.rated_by
FROM #__photo_favorites AS pf
LEFT JOIN #__photo AS p ON (p.photo_id = pf.photo_id AND p.status = '1')
WHERE pf.user_id = ".$user_id."
LIMIT ".$pagination['limit'];
$photos = $this->db->get_rows($sql);
$this->tpl->menu = 'home';
$this->tpl->submenu = 'user-photos';
$this->tpl->colmenu = 'manage';
$this->tpl->css = array(TPL_REL.'/css/style_photo.css');
$this->tpl->title = __('my-favorite-photos');
$this->tpl->meta_title = __('my-favorite-photos');
$this->tpl->photos = $photos;
$this->tpl->pagination = $pagination;
$this->tpl->load(array('header', 'user_photos', 'footer'));
$this->tpl->display();
}
}