Файл: soc-set/moduls/loads/view.php
Строк: 140
<?php
require_once('../../core/start.php');
require_once('func.php');
require_once('../../core/class/id.php');
check_auth();
$folder = DB::$dbs->queryFetch("SELECT * FROM ".LOADS." WHERE `id` = ? ", array(abs(num($_GET['folder']))));
if (empty($folder)) {
head('Каталог не найден');
echo DIV_TITLE . 'Каталог не найден' . CLOSE_DIV;
echo DIV_ERROR . 'Ошибка!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/loads/">Загрузки</a> / <b>Каталог не найден</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
$folderc = DB::$dbs->queryFetch("SELECT * FROM ".LOADS_CAT." WHERE `id` = ? ", array(abs(num($_GET['folderc']))));
if (empty($folderc)) {
head('Подкаталог не найден');
echo DIV_TITLE . 'Подкаталог не найден' . CLOSE_DIV;
echo DIV_ERROR . 'Ошибка!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/loads/">Загрузки</a> / <b>Подкаталог не найден</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
$file = DB::$dbs->queryFetch("SELECT * FROM ".LOADS_FILE." WHERE `id` = ? ", array(abs(num($_GET['file']))));
if (empty($file)) {
head('Файл не найден');
echo DIV_TITLE . 'Файл не найден' . CLOSE_DIV;
echo DIV_ERROR . 'Ошибка!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/loads/">Загрузки</a> / <b>Файл не найден</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
/* **** */
head('Файл: ' . $file['name']);
panel();
echo DIV_BLOCK . 'Файл: ' . $file['name'] . CLOSE_DIV;
echo DIV_BLOCK;
/* Музыка */
if ($folder['type'] == 3) {
echo '<b>' . $file['name'] . '</b> [' . get_size($file['size']) . ']<br /><br />';
?>
<object type="application/x-shockwave-flash" data="http://rugame.mobi/mp3/mp3_play2.swf" height="20" width="290">
<param name="movie" value="http://rugame.mobi/mp3/mp3_play2.swf">
<param name="FlashVars" value="soundFile=<?php echo HOME."/files/loads/files/".$file['url']; ?>&titles=">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<embed width="290" height="20" src="http://rugame.mobi/mp3/mp3_play2.swf" type="application/x-shockwave-flash" flashvars="soundFile=<?php echo HOME."/files/loads/files/".$file['url']; ?>;titles="></embed>
</object>
<?php
echo '<br /><br /><b>Исполнитель:</b> ' . $file['artist'] . '<br />';
echo '<b>Название:</b> ' . $file['track'] . '<br />';
echo (!empty($file['album']) ? '<b>Альбом:</b> ' . $file['album'] . '<br />' : NULL);
echo '<br />';
echo ' - Скачано: ' . $file['loads'] . ' раз(а)<br />';
echo ' - Добавлено: ' . vrem($file['time']) . '<br />';
echo ' - Загрузил(а): ' . user_choice($file['user_id'], 'link') . '<br /><br />';
echo ' - <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/download/">Скачать</a> ['.$file['type'].']<br />';
$id3 = &new MP3_Id();
$result = $id3->read("../../files/loads/files/".$file['url']);
// Ошибкаr "Tag not found" игнорируется
if (PEAR::isError($result) && $result->getCode() !== PEAR_MP3_ID_TNF) {
die($result->getMessage() . "n");
}
$result = $id3->study();
if (PEAR::isError($result)) {
die($result->getMessage() . "n");
}
echo '<br />';
// Читаем поля и выводим информацию
echo '<b>Информация о треке:</b><br />';
echo ' - Название: ' . $id3->getTag('name') . "<br />";
echo ' - Исполнитель: ' . $id3->getTag('artists') . "<br />";
echo ' - Альбом: ' . $id3->getTag('album') . "<br />";
echo ' - Год: ' . $id3->getTag('year') . "<br />";
echo ' - Комментарий: ' . $id3->getTag('comment') . "<br />";
echo ' - Жанр: ' . $id3->getTag('genre') . "<br />";
echo ' - Трэк: ' . $id3->getTag('track') . "<br /><br />";
echo ' - MPEG ' . $id3->getTag('mpeg_ver') . ' Layer ' . $id3->getTag('layer') . "n"; echo $id3->getTag('mode') . "<br />";
echo ' - Размер файла: ' . $id3->getTag('filesize') . " Bytes<br />";
echo ' - Bitrate: ' . $id3->getTag('bitrate') . "kB/s<br />";
echo ' - Длительность: ' . $id3->getTag('length') . " min<br />";
echo ' - Samplerate: ' . $id3->getTag('frequency') . "Hz<br />";
echo '<br />';
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_RATING." WHERE `file_id` = ? && `user_id` = ? ", array($file['id'], $user['user_id'])) == FALSE) {
echo '<b>Рейтинг файла:</b> <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/plus/">[+]</a> '.(empty($file['rating']) ? '0' : $file['rating']).' <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/minus/">[-]</a><br />';
} else {
echo '<b>Рейтинг файла:</b> '.(empty($file['rating']) ? '0' : $file['rating']).'<br />';
}
$comm = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_COMM." WHERE `file_id` = ?", array($file['id']));
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/comm/">Комментарии</a> ['.$comm.']<br />';
if (privilegy('zc')) {
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/delete/">Удалить файл</a><br />';
}
}
/* приложения */
if ($folder['type'] == 4 || $folder['type'] == 5 || $folder['type'] == 6 || $folder['type'] == 7 || $folder['type'] == 8 || $folder['type'] == 11) {
echo '<b>' . $file['name'] . '</b> [' . get_size($file['size']) . ']<br /><br />';
/* Скриншоты */
$screens = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_SCREEN." WHERE `file_id` = ? ", array($file['id']));
if (!empty($screens)) {
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_SCREEN." WHERE `file_id` = ? ", array($file['id']));
while($screen = $sql -> fetch()) {
echo '<a href="'.HOME.'/files/loads/screen/'.$screen['url'].'"><img src="'.HOME.'/files/loads/screen/'.$screen['url'].'" wight="80" height="80" /></a>';
}
}
echo '<br />';
echo (!empty($file['info']) ? '<b>Описание:</b> ' . text($file['info']) . ' <br />' : NULL);
echo (!empty($file['lang']) ? '<b>Язык:</b> ' . $file['lang'] . ' <br />' : NULL);
echo '<br />';
echo ' - Скачано: ' . $file['loads'] . ' раз(а)<br />';
echo ' - Добавлено: ' . vrem($file['time']) . '<br /><br />';
if ($file['type'] == '.jar') {
if (!file_get_contents('../../files/loads/files/' . $file['id'] . '.jad')) {
include_once '../../core/class/pclzip.lib.php';
$zip = new PclZip('../../files/loads/files/'.$file['url']);
$content = $zip->extract(PCLZIP_OPT_BY_NAME, "META-INF/MANIFEST.MF", PCLZIP_OPT_EXTRACT_AS_STRING);
$jad = eregi_replace("(MIDlet-Jar-URL:( )*[^(n|r)]*)", null, $content[0]['content']);
$jad = eregi_replace("(MIDlet-Jar-Size:( )*[^(n|r)]*)(n|r)", null, $jad);
$jad = trim($jad);
$jad .= "rnMIDlet-Jar-Size: " . filesize($file_info['s_name']) . "";
$jad .= "rnMIDlet-Jar-URL: $jar.jar";
file_put_contents('../../files/loads/files/'.$file['id'].'.jad', $jad);
header("Location: ".HOME."/loads/".$folder['id']."/".$folderc['id']."/".$file['id']."/");
}
$file2 = file('../../files/loads/files/'.$file['id'].'.jad');
$total = count($file2);
for ($p = 0; $p < $total; $p++) {
$dt = explode(":", $file2[$p]);
if ($dt[0] == "MIDlet-Vendor") {
$poz = $dt[0] . ':' . $dt[1] . '';
}
}
$poz = str_replace('MIDlet-Vendor:', '', $poz);
htmlspecialchars($poz);
$total = count($file2);
for ($p = 0; $p < $total; $p++) {
$dt = explode(":", $file2[$p]);
if ($dt[0] == "MIDlet-Version") {
$ver = $dt[0] . ':' . $dt[1] . '';
}
}
$ver = str_replace('MIDlet-Version:', '', $ver);
htmlspecialchars($ver);
echo '<b>Информация о приложении:</b><br />';
echo '<b>Разработчик:</b> ' . $poz . '<br />';
echo '<b>Версия:</b> ' . $ver . '<br />';
}
echo '<br />';
echo 'Скачать: <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/download/">'.$file['name'].'</a> ['.$file['type'].']<br />';
$files = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_FILE_DOP." WHERE `file_id` = ? ", array($file['id']));
if (!empty($files)) {
echo '<br /><b>Дополнительные версии:</b><br />';
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_FILE_DOP." WHERE `file_id` = ? ", array($file['id']));
while($dop = $sql -> fetch()) {
echo '<a href="'.HOME.'/files/loads/files/'.$dop['url'].'">'.$dop['name'].'</a> [Язык: '.$dop['lang'].' / Размер: '.get_size($dop['size']).' / '.$dop['type'].']<br />';
}
}
echo '<br />';
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_RATING." WHERE `file_id` = ? && `user_id` = ? ", array($file['id'], $user['user_id'])) == FALSE) {
echo '<b>Рейтинг файла:</b> <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/plus/">[+]</a> '.(empty($file['rating']) ? '0' : $file['rating']).' <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/minus/">[-]</a><br />';
} else {
echo '<b>Рейтинг файла:</b> '.(empty($file['rating']) ? '0' : $file['rating']).'<br />';
}
$comm = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_COMM." WHERE `file_id` = ?", array($file['id']));
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/comm/">Комментарии</a> ['.$comm.']<br />';
echo '<br />';
if (privilegy('zc')) {
echo '<a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/screen/">Управление скриншотами</a><br />';
echo '<a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/ver/">Управление версиями</a><br />';
echo '<a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/edit/">Редактирование файла</a><br />';
echo '<a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/delete/">Удалить файл</a><br />';
}
}
/* Темы, флеш, видео */
if ($folder['type'] == 2 || $folder['type'] == 9 || $folder['type'] == 10) {
echo '<b>' . $file['name'] . '</b> [' . get_size($file['size']) . ']<br /><br />';
/* Скриншоты */
$screens = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_SCREEN." WHERE `file_id` = ? ", array($file['id']));
if (!empty($screens)) {
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_SCREEN." WHERE `file_id` = ? ", array($file['id']));
while($screen = $sql -> fetch()) {
echo '<a href="'.HOME.'/files/loads/screen/'.$screen['url'].'"><img src="'.HOME.'/files/loads/screen/'.$screen['url'].'" wight="80" height="80" /></a>';
}
}
echo '<br />';
echo 'Скачано: ' . $file['loads'] . ' раз(а)<br />';
echo 'Добавлено: ' . vrem($file['time']) . '<br /><br />';
echo 'Скачать: <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/download/">'.$file['name'].'</a> ['.$file['type'].']<br />';
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_RATING." WHERE `file_id` = ? && `user_id` = ? ", array($file['id'], $user['user_id'])) == FALSE) {
echo '<b>Рейтинг файла:</b> <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/plus/">[+]</a> '.(empty($file['rating']) ? '0' : $file['rating']).' <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/minus/">[-]</a><br />';
} else {
echo '<b>Рейтинг файла:</b> '.(empty($file['rating']) ? '0' : $file['rating']).'<br />';
}
$comm = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_COMM." WHERE `file_id` = ?", array($file['id']));
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/comm/">Комментарии</a> ['.$comm.']<br />';
if (privilegy('zc')) {
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/screen/">Управление скриншотами</a><br />';
echo '<a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/delete/">Удалить файл</a><br />';
}
}
/* Картинки */
if ($folder['type'] == 1) {
echo '<b>' . $file['name'] . '</b> [' . get_size($file['size']) . ']<br /><br />';
echo '<img src="'.HOME.'/files/loads/files/mini_'.$file['url'].'" /><br />';
$img = getimagesize('../../files/loads/files/'. $file['url']);
echo 'Разрешение: ' . $img[0] . 'x' . $img[1] . '<br />';
echo 'Скачано: ' . $file['loads'] . ' раз(а)<br />';
echo 'Добавлено: ' . vrem($file['time']) . '<br /><br />';
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_RATING." WHERE `file_id` = ? && `user_id` = ? ", array($file['id'], $user['user_id'])) == FALSE) {
echo '<b>Рейтинг файла:</b> <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/plus/">[+]</a> '.(empty($file['rating']) ? '0' : $file['rating']).' <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/rating/minus/">[-]</a><br />';
} else {
echo '<b>Рейтинг файла:</b> '.(empty($file['rating']) ? '0' : $file['rating']).'<br />';
}
echo '<br /><b>Скачать картинку:</b><br />';
$img = getimagesize('../../files/loads/files/'. $file['url']);
echo ' - <a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/download/">' . $img[0] . 'x' . $img[1] . '</a> [Оригинал]<br />';
$arr = array('130x130','120x160','132x176','176x220','240x320');
foreach($arr as $v) {
list ($W,$H) = explode('x',$v);
echo ' - <a href="'.HOME.'/moduls/loads/im.php?id='.$file['id'].'&H='.$H.'&W='.$W.'">'.$v.'</a><br/ >';
}
$comm = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_COMM." WHERE `file_id` = ?", array($file['id']));
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/comm/">Комментарии</a> ['.$comm.']<br />';
if (privilegy('zc')) {
echo '<br /><a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/'.$file['id'].'/edit/delete/">Удалить файл</a><br />';
}
}
echo CLOSE_DIV;
echo DIV_LI . '<a href="'.HOME.'/loads/'.$folder['id'].'/'.$folderc['id'].'/">Вернуться назад</a>' . CLOSE_DIV;
$array = array('Загрузки');
nav($array);
require_once('../../core/stop.php');
?>