<?php
/*
*
* @author (Макс) Freedom <by_freedom@bk.ru>
* ICQ 286-0-666
*
*/
$id = isset($_GET['id']) ? abs((int)$_GET['id']) : false;
if (empty($id)) {
header ('location: /');
exit;
}
$query = DB::$dbs->query("SELECT * FROM `files` WHERE `id`= ? LIMIT 1", array($id));
if ($query -> rowCount () == 0) {
header ('location: /');
die();
}
$a = $query->fetch();
func::head($lang['file'].' '.$a['name']);
if (isset($_GET['down'])) {
if (empty($a['pass'])) {
DB::$dbs->query("UPDATE `files` SET `down` = `down` + ? WHERE `id` = ?", array(1,$id));
header('location: /'.$a['url']);
die();
} elseif ($_COOKIE['pass'] == null && !empty($a['pass']) && !empty($_SESSION["password$id"])) {
DB::$dbs->query("UPDATE `files` SET `down` = `down` + ? WHERE `id` = ?", array(1,$id));
header('location: /'.$a['url']);
die();
}
}
if ($_COOKIE['pass'] != sha1($pass)) {
if (!empty($a['pass']) && empty($_SESSION["password$id"])) {
$_SESSION['password'] = '';
if (isset($_POST['ok'])) {
$password = func::check($_POST['pass']);
if (empty($password) OR $a['pass'] != sha1($password.'freed')) {
func::err($lang['pass_enter'].'!');
} else {
$_SESSION["password$id"] = sha1($password.'freed');
header('location: /'.$id);
die();
}
}
echo '<div class="list-group-item"><form action="/'.$id.'" method="POST"><label class="control-label">'.$lang['pass'].':</label"><input type="text" name="pass" class="form-control"/><br/><button type="submit" class="btn btn-default" name="ok">'.$lang['go'].'</button></form></div>';
func::foot();
die();
}
}
$ext = strtolower(strrchr($a['url'], '.'));
$format = array('.png', '.jpg', '.jpeg', '.gif', '.bmp');
echo '<ul class="list-group">';
if (in_array($ext, $format)) {
echo '<center><a href="'.$a['url'].'"><img src="'.$a['url'].'" class="img-responsive" alt="not image" style="border-radius: 5px;"/></a></center>';
}
$ua = str_replace('windows ce', '', strtolower($_SERVER['HTTP_USER_AGENT']));
if (in_array($ext, array('.mp3'))) {
echo '<li class="list-group-item">
Прослушка:<br/>';
if (stripos($ua, 'windows') !== false || stripos($ua, 'linux') !== false || stripos($ua, 'bsd') !== false || stripos($ua, 'x11') !== false || stripos($ua, 'unix')
 !== false || stripos($ua, 'macos') !== false || stripos($ua, 'macintosh') !== false){
echo '<object type="application/x-shockwave-flash" data="/media/mp3.swf" width="200" height="20"><param name="wmode" value="transparent" /><param name="movie" value="/media/mp3.swf" />
<param name="FlashVars" value="mp3=/'.$a['url'].'&amp;bgcolor1=ffffff&amp;bgcolor2=cccccc&amp;buttoncolor=999999&amp;buttonovercolor=0&amp;slidercolor1=cccccc&amp;slidercolor2=999999&amp;sliderovercolor=666666&amp;textcolor=0&amp;showvolume=1&amp;showstop=1" /></object>';
} else {
echo 'Ваш браузер не поддерживает Online-прослушку! Установите Flash Player.';
}
echo '</li>';
}

if ($ext == '.avi' || $ext == '.flv' || $ext =='.swf' || $ext =='.mp4') {
echo '<li class="form-group-item"><center><object type="application/x-shockwave-flash" data="/media/uflvplayer_500x375.swf" height="200" width="250">
<param name="bgcolor" value="#DFE6EF" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="/media/uflvplayer_500x375.swf" />
<param name="FlashVars" value="way=/'.$a['url'].'&amp;swf=/media/uflvplayer_500x375.swf&amp;w=400&amp;h=300&amp;autoplay=0&amp;tools=1&amp;skin=white&amp;volume=70&amp;q=&amp;comment="/></object></center></li>';
}
echo '<li class="list-group-item">'.$a['name'].'</li>';
echo '<li class="list-group-item">'.$lang['weight'].': '.func::size($a['size']).'</li>';
echo '<li class="list-group-item">'.$lang['format_file'].': '.$ext . '</li>';
echo '<li class="list-group-item">'.$lang['added'].': '.date('d.m.y / H:i', $a['time']) . '</li>';
echo '<a href="/'.$id.'?down" class="list-group-item">'.$lang['down'].' <span class="badge">'.$a['down'].'</span></a>';
echo '</ul>';

echo '<ul class="list-group">';
echo '<li class="list-group-item">' .$lang['share'].'
<script type="text/javascript" src="//yastatic.net/share/share.js" charset="utf-8"></script><div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="none" data-yashareQuickServices="vkontakte,facebook,twitter,odnoklassniki,moimir"></div></li>';
echo '<label class="control-label">'.$lang['link_to_file'].':</label><input type="text" value="http://'.homeurl.'/'.$id.'" class="form-control"><label class="control-label">'.$lang['link_to_import'].':</label><input type="text" value="http://'.homeurl.'/'.$a['url'].'" class="form-control">';
echo '</ul>';
if ($aut == true) {
echo '<ul class="list-group"><li class="list-group-item">Admin-Функции</li>';
echo '<li class="list-group-item">Данные, с каких был загружен файл:<br/><b>IP:</b> '.$a['ip'].'<br/><b>Soft:</b> '.$a['soft'].'</li>';
echo '<a href="/cpanel/?do=delfile&id='.$id.'" class="list-group-item">Удалить файл</a></ul>';
}
echo '<ul class="list-group"><a href="/plugin/complate.php?id='.$id.'" class="list-group-item">Жалоба</a></div>';
func::foot();
?>