Файл: adultscript-2.0.3-pro/files/mobile/components/photo_slideshow.php
Строк: 28
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_mobile_photo_slideshow extends VComponent_mobile_photo
{
public function __construct()
{
parent::__construct();
}
public function render()
{
$view_access = VF::cfg_item('module.photo.view_access');
if ($view_access != 'all') {
VAuth::check(ucfirst($view_access), null, __('album-access', array($view_access)), MOBILE_URL.'/user/login/');
}
$album_id = VUri::request(1);
$cache_id = 'album_mobile_'.$album_id;
if (!$album = $this->cache->get($cache_id, 7200)) {
$this->db->query("SELECT a.album_id, a.title, a.slug, a.total_photos, a.total_views, a.add_time,
GROUP_CONCAT(t.name) AS tags
FROM #__photo_albums AS a
LEFT JOIN #__photo_tags AS t ON (t.album_id = a.album_id)
WHERE a.album_id = ".$album_id."
AND a.mobile = '1'
AND a.status = '1'
LIMIT 1");
if (!$this->db->affected_rows()) {
$this->notfound('Invalid photo album!');
}
$album = $this->db->fetch_assoc();
$this->cache->store($cache_id, $album, 7200);
}
$url = 'photo/'.$album_id.'/'.$album['slug'].'/slideshow/';
if (!VUri::match($url)) {
$this->notfound();
}
$this->db->query("UPDATE #__photo_albums
SET total_views = total_views+1
WHERE album_id = ".$album_id."
LIMIT 1");
$sql = "SELECT photo_id, ext, caption
FROM #__photo
WHERE album_id = ".$album_id."
ORDER BY photo_id ASC";
if (!$photos = $this->cache->get($sql, 7200)) {
$this->db->query($sql);
if ($this->db->affected_rows()) {
$photos = $this->db->fetch_rows();
$this->cache->store($sql, $photos, 7200);
}
}
$this->tpl->menu = 'photo';
$this->tpl->title = $album['title'].' '.__('slideshow');
$this->tpl->meta_title = __('slideshow-meta-title', array($album['title'], $this->mcfg['site_name']));
$this->tpl->meta_keys = $album['tags'].', slideshow, '.$this->mcfg['meta_keys'];
$this->tpl->canonical = BASE_URL.'/photo/'.$album['album_id'].'/'.$album['slug'].'/';
$this->tpl->album = $album;
$this->tpl->photos = $photos;
$this->tpl->load(array('header', 'photo_slideshow', 'footer'));
$this->tpl->display();
}
}