Файл: adultscript-2.0.3-pro/files/mobile/components/video_inter.php
Строк: 36
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_mobile_video_inter extends VComponent_mobile_video
{
public function __construct()
{
parent::__construct();
}
public function render()
{
$video_id = (int) VUri::request(1);
$this->db->query("SELECT v.video_id, v.title, v.slug, v.server, v.embed_code,
v.premium, v.mobile_url, v.thumb, v.thumbs,
m.meta_title, m.meta_desc, m.meta_keys,
GROUP_CONCAT(DISTINCT t.name) AS tags
FROM #__video AS v
LEFT JOIN #__video_meta AS m ON (m.video_id = v.video_id)
LEFT JOIN #__video_tags AS t ON (t.video_id = v.video_id)
WHERE v.video_id = ".$video_id."
AND v.mobile = '1'
AND v.status = 1
LIMIT 1");
if (!$this->db->affected_rows()) {
$this->notfound('Invalid video!');
}
$video = $this->db->fetch_assoc();
$access = true;
$user_id = (VAuth::loggedin()) ? (int) $_SESSION['user_id'] : 0;
if ($video['premium'] == '1' && VModule::enabled('premium')) {
$access = false;
}
if ($access === FALSE) {
if (!empty($user_id)) {
if (VAuth::group('Moderator')) {
$access = TRUE;
} elseif (VAuth::group('Premium')) {
// lets add +1 day to this
$end_time = strtotime($_SESSION['end_date']);
if ($end_time > strtotime('-1 day')) {
$access = TRUE;
}
}
}
}
// guest limit
if (!$user_id) {
if (VF::cfg_item('module.user.guest_limit') && !VBrowser::get('is_robot')) {
VHelper::load('module.user.guest');
VHelper_user_guest::update(VServer::ip(TRUE), $video['size'], $video['duration'], true);
}
}
if ($video['mobile_url'] == '') {
VHelper::load('module.video.stream');
$video['mobile_url'] = VHelper_video_stream::url_mobile(TRUE, $video_id, $video['server']);
}
if ($this->mcfg['inter_session']) {
$_SESSION['inter'] = 1;
}
$this->tpl->menu = 'video';
$this->tpl->title = $video['title'];
$this->tpl->meta_title = ($video['meta_title'] != '') ? $video['meta_title'] : $video['title'].' - '.$this->mcfg['site_name'];
$this->tpl->meta_desc = ($video['meta_desc'] != '') ? $video['meta_desc'] : __('watch').' '.$video['title'].'. '.$this->mcfg['meta_desc'];
$this->tpl->meta_keys = ($video['meta_keys'] != '') ? $video['meta_keys'] : $video['tags'];
$this->tpl->metas = array(
'og:title' => $video['title'],
'og:type' => 'movie',
'og:url' => MOBILE_CUR,
'og:image' => THUMB_URL.'/'.path($video['video_id']).'/'.$video['thumb'].'.jpg'
);
$this->tpl->canonical = BASE_URL.'/'.$video['video_id'].'/'.$video['slug'].'/';
$this->tpl->user_id = $user_id;
$this->tpl->access = $access;
$this->tpl->video = $video;
$this->tpl->load(array('header', 'video_inter', 'footer'));
$this->tpl->display();
}
}