Файл: pages/app/view.php
Строк: 99
<?php
/*
** Автор кода: Евгений (rnddev)
** ICQ: 448235
** Email: rnddev@mail.ru
** Skype: rnddev
** Все права принадлежат автору.
** Модефикация и продажа запрещены.
*/
define('ACCESS', TRUE);
define('R', $_SERVER['DOCUMENT_ROOT']);
require_once R.'/system/bootstrap.php';
$id = abs(intval($_GET['id']));
$mov = $db->prepare("SELECT * FROM video WHERE id = :id LIMIT 1", array(':id' => $id));
$row = $mov->fetch();
$tpl->getHead(htmlspecialchars($row['name']));
############################################################ WAP ####################################
if($stylen == 'wap'){
if($row['id']) {
echo '<div class="content"><center>
<div class="player" id="videoplayer2836"></div>
<script type="text/javascript">this.player = new Uppod({m:"video",uid:"videoplayer2836",file:"'.HOST.'/download/mp4/'.$row['id'].'/",poster:"'.HOST.'/download/mp4/'.$row['id'].'/"});</script>
</center></div>';
echo '<div class="content">',
'Название: '.htmlspecialchars($row['name']).'<br/>',
'Длительность: '.Main::timeleft($row['timeleft']).'<br/>',
'Добавлен: '.Main::display_time($row['date_upload']).'<br/>';
if($row['view_count'] !== '0') echo 'Просмотров: '.$row['view_count'].'<br/>';
if($row['load_count'] !== '0') echo 'Скачиваний: '.$row['load_count'].'<br/>';
if($row['last_load'] !== '0') echo 'Последнее: '.Main::display_time($row['last_load']).'<br/>';
if($row['about'] !== '') echo 'Описание: '.htmlspecialchars($row['about']).'<br/>';
if( ! $_COOKIE['like_'.$row['id']]) echo '<a href="'.HOST.'/view/'.$row['id'].'/like/">Мне нравится <b>'.$row['like_count'].'</b></a>';
else echo 'Понравилось <b>'.$row['like_count'].'</b>';
echo '</div>';
$sql = $db->prepare("SELECT cat.name, cat.id
FROM category cat
INNER JOIN contact cont
ON (cat.id = cont.id_category)
WHERE cont.id_video = :id",
array(':id' => $row['id']));
if($sql->fetch() !== false) {
}
echo '<div class="content">Скачать видео: <br/><table>';
echo '<td><a class="button" href="'.HOST.'/download/mp4/'.$row['id'].'/">MP4 ('.Main::size($row['size_mp4']).')</a></td>';
echo '</table></div>';
if( ! $_COOKIE['view_'.$row['id']]) {
$db->prepare("UPDATE video SET view_count = view_count + 1 WHERE id = :id", array(':id' => $row['id']));
setcookie('view_'.$row['id'], $row['id'], time() + 3600 * 24 * 365, '/');
}
switch($_GET['act']):
case 'like':
if( ! $_COOKIE['like_'.$row['id']]) {
$db->prepare("UPDATE video SET like_count = like_count + 1 WHERE id = :id", array(':id' => $id));
setcookie('like_'.$row['id'], $row['id'], time() + 3600 * 24 * 365, '/');
header('Location: '.HOST.'/view/'.$row['id'].'/');
exit;
}
break;
endswitch;
} else {
echo '<div class="content">Файл не найден</div>';
}
}
########################################### WEB #######################################
if($stylen == 'web'){
if($row['id']) {
echo '<div class="content"><center>
<div class="player" id="videoplayer2836"></div>
<script type="text/javascript">this.player = new Uppod({m:"video",uid:"videoplayer2836",file:"'.HOST.'/download/mp4/'.$row['id'].'/",poster:"'.HOST.'/download/mp4/'.$row['id'].'/"});</script>
</center></div>';
echo '<div class="content2">',
'Название: '.htmlspecialchars($row['name']).'<br/>',
'Длительность: '.Main::timeleft($row['timeleft']).'<br/>',
'Добавлен: '.Main::display_time($row['date_upload']).'<br/>';
if($row['view_count'] !== '0') echo 'Проосмотров: '.$row['view_count'].'<br/>';
if($row['load_count'] !== '0') echo 'Скачиваний: '.$row['load_count'].'<br/>';
if($row['last_load'] !== '0') echo 'Последнее: '.Main::display_time($row['last_load']).'<br/>';
if($row['about'] !== '') echo 'Описание: '.htmlspecialchars($row['about']).'<br/>';
if( ! $_COOKIE['like_'.$row['id']]) echo '<a href="'.HOST.'/view/'.$row['id'].'/like/">Мне нравится <b>'.$row['like_count'].'</b></a>';
else echo 'Понравилось <b>'.$row['like_count'].'</b>';
echo '</div>';
$sql = $db->prepare("SELECT cat.name, cat.id
FROM category cat
INNER JOIN contact cont
ON (cat.id = cont.id_category)
WHERE cont.id_video = :id",
array(':id' => $row['id']));
if($sql->fetch() !== false) {
echo '</div>';
}
echo '<div class="content"><table><td><a class="button" href="'.HOST.'/download/mp4/'.$row['id'].'/">Скачать MP4 ('.Main::size($row['size_mp4']).')</a></td></table></div>';
if( ! $_COOKIE['view_'.$row['id']]) {
$db->prepare("UPDATE video SET view_count = view_count + 1 WHERE id = :id", array(':id' => $row['id']));
setcookie('view_'.$row['id'], $row['id'], time() + 3600 * 24 * 365, '/');
}
switch($_GET['act']):
case 'like':
if( ! $_COOKIE['like_'.$row['id']]) {
$db->prepare("UPDATE video SET like_count = like_count + 1 WHERE id = :id", array(':id' => $id));
setcookie('like_'.$row['id'], $row['id'], time() + 3600 * 24 * 365, '/');
header('Location: '.HOST.'/view/'.$row['id'].'/');
exit;
}
break;
endswitch;
} else {
echo '<div class="content">Файл не найден</div>';
}
}
if($stylen == 'web'){
echo '<td style="vertical-align: top; width: 300px;">';
echo '<div class="cat">Категории</div>';
$count_cat = $db->prepare("SELECT COUNT(*) as count FROM category")->fetch(PDO::FETCH_OBJ)->count;
if($count_cat !== '0') {
$cat = $db->prepare("SELECT * FROM category ORDER BY name");
while($row = $cat->fetch()) {
$schet = $db->prepare("SELECT COUNT(*) as count FROM contact WHERE id_category = '".$row['id']."' ")->fetch(PDO::FETCH_OBJ)->count;
$s = $schet-1;
echo '<a href="'.HOST.'/category/'.$row['id'].'/"><div class="menushka">'.$row['name'].' <div class="st">'.$s.'</div></div></a>';
}
} else { echo '<div class="content">Еще не создано ни одной ктегории</div>'; }
echo '</td>';
}
$tpl->getFoot();