<?php
define('ROOT','../');
define('SYS','../../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if($aut==false)header('location: '.SYS.'../aut.php');
$diz -> head('Инфо о файле');
$row = $db -> query("SELECT * FROM `obmen_files` WHERE `id`='".$id."'") -> fetch_assoc();
$diz -> title('<b>'.$row['name'].'</b>');
if (!is_file($row['infolder'])) {
	$msg .='<div class="fon">Файл не найден!</div>';
}else{
$ext = strtolower(pathinfo($row['infolder'], PATHINFO_EXTENSION));
$dir = pathinfo($row['infolder'], PATHINFO_DIRNAME);
$filename = pathinfo($row['infolder'], PATHINFO_BASENAME);
$arr = $db -> query("SELECT `login` FROM `users` WHERE `id` = '".$row['user']."' LIMIT 1");
if ($arr -> num_rows > 0) {
$array = $arr -> fetch_assoc();
$user ='<a href="/my/id'.$row['user'].'">'.$array['login'].'</a>';
}else{$user.='[Удалён]';}
if($ya['level']>4){$msg .='<div class="spisok"><a href="'.SYS.'func.php?mode=del&amp;id='.$row['id'].'">Удалить файл</a> | <a href="'.SYS.'func.php?mode=redf&amp;id='.$row['id'].'">Изменить файл</a></br>';}
$msg .= '<b>Скачан:</b> '.$func ->GetName($row['load'], 'раз', 'раза', 'раз').'<br/>
<b>Загрузил:</b> '.$user.'<br/>
<b>Формат:</b> '.$ext.'<br/>';
$msg .='<b>Просмотров:</b> '.$row['rate'].'<br/>';
$msg .='<b>Добавлен:</b> '.$func ->vremja($row['dateupload']).'</br>';
if (!empty($row['info'])) $msg .='<b>Описание:</b> '.$row['info'].'';
$msg .='</div>';
if($ya['id']!=$row['user'])$db -> multi_query("UPDATE `load_files` SET `rate`=rate+1 WHERE `id`='".$row['id']."'");
$plus = $db -> dbcount('COUNT(`id`)','reit',"`komy` = '".$row['id']."' and `where`='obmen'  and `rei`='1'");
$minus = $db -> dbcount('COUNT(`id`)','reit',"`komy` = '".$row['id']."' and `where`='obmen'   and `rei`='0'");
$msg .= '<div class="spisok">»<a href="'.SYS.'reit'.$id.'">Рейтинг </a>: (<b><span style="color:green">'.$plus.'</span>/<span style="color:red">'.$minus.'</span></b>)</div>';
$size=filesize($row['infolder']);
if ($ext == 'gif' || $ext == 'jpeg' || $ext == 'jpg' || $ext == 'png') {
$foto = '../obmen/'.$row['infolder'];
$msg .= '<img src="../../../system/resize.php?img='.$foto.'&width=110&height=110&i=0" alt="*"/></br>';
$msg .= '<div class="spisok">'.$diz -> img('load/load.gif').' <a href="'.SYS.''.$GLOBALS['id'].'.load">Скачать</a> ['.$func ->size($size).']</div>';}
else if ($ext == 'mp3' || $ext == 'wav' || $ext == 'wma') {
require_once('power/classAudioFile.php');
$ua = str_replace('windows ce', '', strtolower($_SERVER['HTTP_USER_AGENT']));

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) {
	$msg.= '<div class="spisok">
<b>Онлайн прослушка:</b><br/>
<object type="application/x-shockwave-flash" data="'.SYS.'player.swf" width="200"height="20">
<param name="movie" value="player.swf" />
<param name="FlashVars" value="mp3='.SYS.''.$row['infolder'].'&amp;showvolume=1" />
</object></div>';
}

$file = new AudioFile;
$file->loadFile($row['infolder']);
$file->printSampleInfo(); 
$msg .= ''.$diz -> img('obmen/load.gif').' <a href="'.SYS.''.$id.'.load">Скачать</a> ['.$func ->size($size).']<br/>';}

else if ($ext == 'jar') {
$msg.= '<div class="menu">
'.$diz -> img('obmen/load.gif').' Скачать <a href="'.SYS.''.$GLOBALS['id'].'.load">JAR</a>/<a href="'.SYS.''.$GLOBALS['id'].'.jad">JAD</a> ['.$func ->size($size).']<br/>
</div>';}
else if ($ext == 'txt') {
$file = file_get_contents($GLOBALS['row']['path']);
$msg .= '<a href="'.SYS.''.$GLOBALS['id'].'.article">Читать онлайн</a>
</br>'.$diz -> img('obmen/load.gif').' Cкачать <a href="'.SYS.''.$GLOBALS['id'].'.load">TXT</a>
 ['.$func->size($GLOBALS['row']['size']).']
</div>';	
}
else if ($ext == '3gp' || $ext == 'avi' || $ext == 'mp4' || $ext == 'flv' || $ext == 'flv') {
	
if (extension_loaded('ffmpeg')) {
	$movie = new ffmpeg_movie($row['infolder']);
	$msg .= '<div class="spisok">
	Кодек: '.$movie->getVideoCodec().'<br/>
	Разрешение: '.$movie->GetFrameWidth().'x'.$movie->GetFrameHeight().'
	</div>';}
 $ua = str_replace('windows ce', '', strtolower($_SERVER['HTTP_USER_AGENT']));
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) {

}
$msg .= '<div class="spisok">'.$diz -> img('obmen/load.gif').' <a href="'.SYS.''.$GLOBALS['id'].'.load">Скачать</a> ['.$func ->size($size).']</div>';

	
}
else if ($ext == 'thm' || $ext == 'nth') {
$msg .= '<div class="spisok">'.$diz -> img('obmen/load.gif').' <a href="'.SYS.''.$GLOBALS['id'].'.load">Скачать</a> ['.$func ->size($size).']</div>';	
}
else if ($ext == 'zip' || $ext == 'rar') {	
$msg .= '<div class="spisok">'.$diz -> img('obmen/load.gif').' <a href="'.SYS.''.$GLOBALS['id'].'.load">Скачать</a> ('.$func ->size($size).')</a><br/>
<small>»<a href="'.SYS.''.$GLOBALS['id'].'.archive">Просмотр архива</a></small></div>';	
}
else {
$msg .= '<div class="spisok">'.$diz -> img('obmen/load.gif').' <a href="'.SYS.'/'.$id.'.load">Скачать</a> ('.$func ->size($size).')</a></div>';
}
$cou = $db -> dbcount('COUNT(`id`)','comes',"`idwh` = '".(int)$id."' and `where`='obmen'");
$msg .= '<div class="spisok">'.$diz -> img('obmen/comment.gif').' <a href="'.SYS.'com'.$id.'">Комментарии</a> ('.$cou.')</div>';
$msg.='</div>';}
$msg .= '<div class="levo">'.$diz -> img('back.png').'<a href="/obmen/index.php?id='.$row['cat'].'">Назад</a>';
$msg .= '</br>'.$diz -> img('home.png').'<a href="/index.php">На главную</a></div>';
#####Копирайт#######
require_once (ROOT.'system/kopy.php');
$diz -> out($msg);
?>