Файл: modules/video/view.php
Строк: 219
<?php
require_once '../../incfiles/core.php';
require_once '../../incfiles/func.php';
require_once '../../incfiles/auth.php';
require_once '../../incfiles/user.php';
require_once 'handler/del_video.php';
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `video` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true)
{
$arr_video = mysql_fetch_array(mysql_query("SELECT * FROM `video` WHERE `id` = '".$id."' LIMIT 1"));
$arr_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$arr_video['user_id']."' LIMIT 1"));
$count_view = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `video_view` WHERE `v_id` = '".$id."'"),0);
// Антифлуд
$i=30;
$fl =(time()-$i);
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `video_view` WHERE `v_id` = '".$id."' AND `time` > '".$fl."'"),0) == true) $flood = true;
if($flood == false)mysql_query("INSERT INTO `video_view` SET `v_id` = '".$id."', `user_id` = '".$user_id."', `time` = '".time()."'");
}
else
{
go(URL.'/');
}
}
else
{
go(URL.'/');
}
$title = $arr_video['name'];
require_once '../../incfiles/head.php';
echo user_access_page($arr_user);
echo '<div class="title">'.lang('Просмотр видео','Перегляд відео').' '.$arr_video['name'].'</div>';
echo '<div class="block">';
$query = mysql_query("SELECT * FROM `video` WHERE `id` = '".$id."' ORDER by `time` DESC LIMIT 1");
while ($arr_video = mysql_fetch_array($query))
{
if($arr_video['type']==0){
if (!file_exists(HOME .'/files/video/'. $arr_video['dir'].'/'.$arr_video['file']))
{
echo '<div class="title">'.lang('Автор удалил видео с публичного доступа','Автор видалив відео із публічного доступу').' '.$arr_video['name'].'</div>';
require_once '../../incfiles/foot.php';
}
echo ' <link href="'.URL.'/jscript/video/video-js.css" rel="stylesheet" type="text/css" />
<script src="'.URL.'/jscript/video/video.js"></script>
<script>videojs.options.flash.swf = "'.URL.'/jscript/video/video-js.swf";</script>';
echo '<video class="video-js vjs-default-skin" controls preload="auto" width="99%" height="350"
poster="'.URL.''.$arr_video['img'].'"data-setup="{}">
<source src="'.URL.'/files/video/'.$arr_video['dir'].'/'.$arr_video['file'].'" type="video/mp4" />
<track kind="captions" src="'.URL.'/jscript/video/demo.captions.vtt" srclang="en" label="English"></track>
<track kind="subtitles" src="'.URL.'/jscript/video/demo.captions.vtt" srclang="en" label="English"></track>
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video>';
}
elseif($arr_video['type']==1)
{
echo BBCode::parse('[youtube]'.$arr_video['file'].'[/youtube]');
}elseif($arr_video['type']==2){
/*if (!@fopen($arr_video['file'], "r")) {
echo '<div class="title">'.lang('Автор удалил видео с публичного доступа','Автор видалив відео із публічного доступу').' '.$arr_video['name'].'</div>';
require_once '../../incfiles/foot.php';
}*/
echo ' <link href="'.URL.'/jscript/video/video-js.css" rel="stylesheet" type="text/css" />
<script src="'.URL.'/jscript/video/video.js"></script>
<script>videojs.options.flash.swf = "'.URL.'/jscript/video/video-js.swf";</script>';
echo '<video class="video-js vjs-default-skin" controls preload="none" width="99%" height="350"
poster="'.URL.''.$arr_video['img'].'"data-setup="{}">
<source src="'.$arr_video['file'].'" type="video/mp4" />
<track kind="captions" src="'.URL.'/jscript/video/demo.captions.vtt" srclang="en" label="English"></track>
<track kind="subtitles" src="'.URL.'/jscript/video/demo.captions.vtt" srclang="en" label="English"></track>
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video>';
}
echo '</div>';
?>
<style type="text/css">
.box .action a {
display: none;
}
.txt {
overflow: hidden;
}
.close .txt {
height: 50px;
}
.open .txt {
height: auto;
}
.close .action .open,
.open .action .close {
display: inline;
}
</style>
<script type="text/javascript">
$(document).ready(function (){
$('.action .open').click(function (){
$(this).parents('.box').removeClass('close').addClass('open');
});
$('.action .close').click(function (){
$(this).parents('.box').removeClass('open').addClass('close');
});
});
</script>
<?
if($arr_video['about'] != '')echo "<div class='title'>
<div class='box close'>
<div class='txt'>
".$arr_video['about']."
</div>
<div class='action'><br />
<a href='#' class='close'>".lang('Скрыть','Приховати')."</a>
<a href='#' class='open'>".lang('Показать все','Показати більше')."</a>
</div>
</div></div>";
// echo ''.$arr_video['about'].'</div>';
echo '<div class="title">';
if (!empty($user_id) && $user_id != $arr_user['id'])
{
if (!in_array($user_id, explode("||", substr($arr_video['ulike'], 1, -1)))) echo '<div id="like_'.$arr_video['id'].'"><a href="'.URL.'/modules/video/like.php?id='.$arr_video['id'].'" onclick="Like.Go(this.href,'.$arr_video['id'].'); return false"><img class="ico" src="'.URL.'/design/img/like.png"/>'.lang('Мне нравиться','Мені подобається').' <b>'.$arr_video['clike'].'</b></a></div>'; else echo '<div id="like_'.$arr_video['id'].'"><a href="'.URL.'/modules/video/like.php?id='.$arr_video['id'].'" onclick="Like.Go(this.href,'.$arr_video['id'].'); return false"><img class="ico" src="'.URL.'/design/img/like_ok.png"/>'.lang('Мне нравиться','Мені подобається').' <b>'.$arr_video['clike'].'</b></a></div>';
}
else echo '<a href="'.URL.'/modules/video/show_like.php?id='.$arr_video['id'].'" onclick="Page.Go(this.href); return false"><img class="ico" src="'.URL.'/design/img/like.png"/>'.lang('Мне нравиться','Мені подобається').' <b>'.$arr_video['clike'].'</b></a>';
echo '</div>';
echo '<div class="block">'.lang('Добавлено','Додана').': '.vtime($arr_video['time']).'
<div class="right">'.$count_view.' '.lang('просмотров','переглядів').'</div></div>';
echo '<p>'.user_name($arr_video['dir'],1,2).'</p>';
if (!empty($user_id) && $user_id == $arr_user['id'])
{
echo '<div class="title">';
echo '<a href="'.URL.'/video/'.$id.'?del_video='.$arr_video['id'].'" onclick="Page.Go(this.href); return false">'.lang('Удалить','Видалити').'</a>';
echo '<a href="'.URL.'/modules/video/edit.php?id='.$arr_video['id'].'" onclick="Page.Go(this.href); return false">'.lang('Изменить','Редагувати').'</a>';
echo'</div>';
}
if (!empty($user_id) && $user_id != $arr_user['id'])
{
echo '<div class="block"><div class="title">';
echo '<a href="'.URL.'/modules/video/add_video.php?id='.$arr_video['id'].'" onclick="Window.Open(this.href); return false"><i class="fa fa-plus"> '.lang('Добавить в свои видеозаписи','Додати у свої відеозаписи').'</i></a>';
echo'</div></div>';
}
if (!empty($user_id))
{
if ($site_version == 'default')
{
?>
<script type="text/javascript">
$(function () {
$('#form').on('submit', function (e) {
e.preventDefault();
var $that = $(this)
, formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action')
, type: $that.attr('method')
, contentType: false
, processData: false
, data: formData
, success: function (response) {
if (response) {
$('#content_comm').load($that.attr('action') + '#content_comm .comm');
$('#textarea').val('');
}
}
});
});
});
$(function () {
$('#form_re_comm').on('submit', function (e) {
e.preventDefault();
var $that = $(this)
, formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action')
, type: $that.attr('method')
, contentType: false
, processData: false
, data: formData
, success: function (response) {
if (response) {
Page.Go($that.attr('action'));
}
}
});
});
});
</script>
<?
}
require_once 'handler/del_comm.php';
require_once 'handler/comm.php';
echo '<div class="block2">
<form id="form" method="post" action="'.URL.'/video/'.$id.'">
<textarea id="textarea" class="input" name="comm" rows="4"></textarea>
<input class="button2" type="submit" value="'.lang('Написать','Написати').'"/>
<a class="button3" href="'.URL.'/ajax/smiles.php" onclick="FormContent.Smiles(this.href); return false"><img src="'.URL.'/design/img/smile.png"/></a>
</form>
</div>
<div id="form_content"></div>';
}
echo '<div id="content_comm"><div class="comm">
<div class="title">'.lang('Комментарии','Коментарі').' <div class="right">'.$arr_video['comm'].'</div></div>';
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `video_comm` WHERE `fid` = '".$arr_video['id']."' LIMIT 1"),0);
if ($all == true)
{
$cp = ceil($all/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$arr_comm = mysql_query("SELECT * FROM `video_comm` WHERE `fid` = '".$arr_video['id']."' ORDER by `time` DESC LIMIT $start,10");
while ($arr = mysql_fetch_array($arr_comm))
{
echo '<div class="block">';
if (!empty($user_id) && $user_id == $arr_user['id'] or !empty($user_id) && $user_id == $arr['user_id']) echo '<div class="right"><a href="'.URL.'/video/'.$id.'?p='.$p.'&del_comm='.$arr['id'].'" onclick="Form.delPost(this.href); return false"><img src="'.URL.'/design/img/closed.png"/></a></div>';
echo user_name($arr['user_id']).'<br/>'.vtime($arr['time']).'<ul>';
if (!empty($arr['quote_id'])) echo '<div class="quote">'.user_name($arr['quote_id']).' '.lang('пишет','пише').':<ul>'.smiles(text($arr['quote'])).'</ul></div>';
echo smiles(text($arr['text'])).'</ul>';
if (!empty($user_id) && $user_id != $arr['user_id'])
{
echo '<ul><a class="link_re_comm" id="link_re_comm_'.$arr['id'].'" href="" onclick="Form.reComm('.$arr['id'].'); return false">'.lang('Ответить','Відповісти').'</a></ul>
<div class="re_comm" id="re_comm_'.$arr['id'].'">
<form id="form_re_comm" method="post" action="'.URL.'/video/'.$id.'">
<textarea class="input" name="re_comm" rows="4"></textarea>
<input type="hidden" name="re_id" value="'.$arr['id'].'"/>
<input class="button2" type="submit" value="'.lang('Написать','Написати').'"/>
</form>
</div>';
}
echo '</div>';
}
navi($p,$cp,''.URL.'/video/'.$id.'?');
}
echo '</div></div>';
}
require_once '../../incfiles/foot.php';
?>