Файл: apanel_view.php
Строк: 609
<?php
// mod Gemorroj
require 'moduls/config.php';
require 'moduls/header.php';
$HeadTime = microtime(true);
//=================================================================================================================
if ($_SESSION['autorise'] != $setup['password'] || $_SESSION['ipu'] != $_SERVER['REMOTE_ADDR']) {
error($setup['hackmess']);
}
//=================================================================================================================
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$onpage = get2ses('onpage');
$prew = get2ses('prew');
$sort = get2ses('sort');
if ($onpage < 3) {
$onpage = 3;
}
if ($prew != 0 && $prew != 1) {
$prew = $setup['preview'];
}
if($_POST['god']){
mysql_query("UPDATE `files` SET `bt` = '" . mysql_real_escape_string($_POST['bt'], $mysql) . "', `3d` = '" . mysql_real_escape_string($_POST['3d'], $mysql) . "', `god` = '" . mysql_real_escape_string($_POST['god'], $mysql) . "', `lang` = '" . mysql_real_escape_string($_POST['lang'], $mysql) . "', `country` = '" . mysql_real_escape_string($_POST['country'], $mysql) . "', `vendor` = '" . mysql_real_escape_string($_POST['vendor'], $mysql) . "', `prim` = '" . mysql_real_escape_string($_POST['prim'], $mysql) . "', `rejj` = '" . mysql_real_escape_string($_POST['rejj'], $mysql) . "', `akt` = '" . mysql_real_escape_string($_POST['akt'], $mysql) . "', `babki` = '" . mysql_real_escape_string($_POST['babki'], $mysql) . "', `sbory` = '" . mysql_real_escape_string($_POST['sbory'], $mysql) . "', `kachestvo` = '" . mysql_real_escape_string($_POST['kachestvo'], $mysql) . "', `trans` = '" . mysql_real_escape_string($_POST['trans'], $mysql) . "' WHERE `id`='$id' LIMIT 1", $mysql);
}
//------------------------------------------------------------------------------------------
$file_info = mysql_fetch_assoc(mysql_query('SELECT * FROM `files` WHERE `id` = ' . $id, $mysql));
if (!is_file($file_info['path'])) {
error('File not found!');
}
//------------------------------------------------------------------------------------------
$filename = pathinfo($file_info['path']);
$ext = strtolower($filename['extension']);
$dir = $filename['dirname'];
$filename = $filename['basename'];
$back = mysql_fetch_array(mysql_query("SELECT `id` FROM `files` WHERE `path` = '" . mysql_real_escape_string($dir, $mysql) . "'", $mysql));
//------------------------------------------------------------------------------------------
if (isset($_GET['hidden'])) {
if ($_GET['hidden'] == 1 && $file_info['hidden'] == 0) {
if (mysql_query('UPDATE `files` SET `hidden` = "1" WHERE `id` = ' . $id)) {
$file_info['hidden'] = 1;
dir_count($file_info['infolder'], false);
}
} else if ($_GET['hidden'] == 0 && $file_info['hidden'] == 1) {
if (mysql_query('UPDATE `files` SET `hidden` = "0" WHERE `id` = ' . $id)) {
$file_info['hidden'] = 0;
dir_count($file_info['infolder'], true);
}
}
} else if (isset($_GET['del'])) {
$filek = mysql_query('SELECT `path` FROM `files` WHERE `fileid` = ' . intval($_GET['del']) . ' LIMIT 1', $mysql);
if(mysql_num_rows($filek) == 1){
$fl=mysql_result($filek,0);
unlink($fl);
mysql_query("DELETE FROM `files` WHERE `fileid` = '" . intval($_GET['del']) . "' LIMIT 1",$mysql);
echo'Файл успешно удален';
}else{
error('Ошибка удаления файла');
}
} else if (isset($_POST['folder'])) {
$folder = mysql_fetch_assoc(mysql_query('SELECT `path` FROM `files` WHERE `fileid`="0" AND `id` = ' . intval($_POST['folder']), $mysql));
if (!$folder) {
echo '<div class="red">Указанной директории не существует. Файл не перемещен<br/></div>';
} else if (file_exists($folder['path'] . $filename)) {
echo '<div class="red">Файл с таким именем в указанной директории уже есть. Файл не перемещен<br/></div>';
} else {
if (rename($file_info['path'], $folder['path'] . $filename)) {
$err='';
$sql_at = mysql_query("SELECT * FROM `files` WHERE `fileid` = '$id' AND `hidden`='0' AND `dir`='0' ORDER BY `id`", $mysql);
if(mysql_num_rows($sql_at) > 0){
while($at=mysql_fetch_assoc($sql_at)){
$fnam=pathinfo($at['path'],PATHINFO_BASENAME);
if(!rename($at['path'], $folder['path'] . $fnam) && !mysql_query('UPDATE `files` SET `path` = "' . mysql_real_escape_string($folder['path'] . $fnam, $mysql) . '", `infolder` = "' . mysql_real_escape_string($folder['path'], $mysql) . '" WHERE `id` = ' . $at['id'], $mysql)) $err.=1;
}
}
if (mysql_query('UPDATE `files` SET `path` = "' . mysql_real_escape_string($folder['path'] . $filename, $mysql) . '", `infolder` = "' . mysql_real_escape_string($folder['path'], $mysql) . '" WHERE `id` = ' . $id, $mysql) && $err == '') {
if (!$file_info['hidden']) {
dir_count($dir, false);
dir_count($folder['path'], true);
}
$path1 = strstr($file_info['path'], '/'); // убираем папку с загрузками
$path2 = strstr($folder['path'], '/'); // убираем папку с загрузками
// перемещаем скриншоты и описания
if (is_file($setup['spath'] . $path1 . '.gif')) {
rename($setup['spath'] . $path1 . '.gif', $setup['spath'] . $path2 . $filename . '.gif');
}
if (is_file($setup['spath'] . $path1 . '.jpg')) {
rename($setup['spath'] . $path1 . '.jpg', $setup['spath'] . $path2 . $filename . '.jpg');
}
if (is_file($setup['opath'] . $path1 . '.txt')) {
rename($setup['opath'] . $path1 . '.txt', $setup['opath'] . $path2 . $filename . '.txt');
}
echo '<div class="green">Файл перемещен<br/></div>';
} else {
rename($folder['path'] . $filename, $file_info['path']);
echo '<div class="red">Ошибка записи в БД<br/>' . mysql_error($mysql) . 'или не могут быть перемещены доп. файлы</div>';
}
} else {
echo '<div class="red">Ошибка переименования файла<br/></div>';
}
}
require 'moduls/foot.php';
exit;
}
$all_komments = mysql_result(mysql_query('SELECT COUNT(1) FROM `komments` WHERE file_id = ' . $id, $mysql), 0);
$file_info['size'] = size($file_info['size']) ;
###############Особый размер для картинок############
$prev_pic = str_replace('/', '--', iconv_substr(strstr($file_info['path'], '/'), 1));
###############Вывод###################
echo '<div class="mainzag">' . htmlspecialchars($filename, ENT_NOQUOTES) . '</div>';
if ($ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'jpe' || $ext == 'png') {
$out= '';
if (file_exists($setup['picpath'] . '/' . $prev_pic . '.gif')) {
$out.= '<div class="row"><img src="' . DIRECTORY . $setup['picpath'] . '/' . htmlspecialchars($prev_pic) . '.gif" alt=""/></div>';
} else {
$out.= '<div class="row"><img src="' . DIRECTORY . 'im/' . $id . '" alt=""/></div>';
}
$size = getimagesize($file_info['path']);
$out .= '<div class="row"><strong>' . $_SESSION['language']['custom size'] . ':</strong> '.$size[0] . 'x' . $size[1].'</div>';
$out .= '<div class="row2"><form action="' . DIRECTORY . 'im.php?" method="post">
<input type="hidden" name="id" value="' . $id . '"/><select name="size">';
foreach (explode(',', $setup['view_size']) as $val) {
$wh = explode('*', $val);
$out .= '<option value="'.$wh[0].'x'.$wh[1].'">'.$wh[0].'x'.$wh[1].'</option>';
}
$out.='</select> <input type="submit" value="' . $_SESSION['language']['download'] . '"/></form></div>';
echo $out;
echo'<div class="row">';
}
###############Инфа о mp3###########################
else if ($ext == 'mp3' || $ext == 'wav' || $ext == 'ogg') {
if ($ext == 'mp3' || $ext == 'wav') {
if (file_exists('moduls/cache/' . $id . '.dat')) {
$tmpa = unserialize(file_get_contents('moduls/cache/' . $id . '.dat'));
} else {
include 'moduls/class/classAudioFile.php';
$audio = new AudioFile;
$audio->loadFile($file_info['path']);
if($audio->wave_length){
$length = $audio->wave_length;
} else {
include 'moduls/class/mp3.class.php';
$mp3 = new mp3($file_info['path']);
$mp3->setFileInfoExact();
$length = $mp3->time;
}
$comments = array();
if (isset($audio->id3_title)) {
if ($audio->id3_title != iconv('UTF-8', 'UTF-8', $audio->id3_title)) {
$comments['TITLE'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $audio->id3_title);
} else {
$comments['TITLE'] = $audio->id3_title;
}
} else {
$comments['TITLE'] = '';
}
if (isset($audio->id3_artist)) {
if ($audio->id3_artist != iconv('UTF-8', 'UTF-8', $audio->id3_artist)) {
$comments['ARTIST'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $audio->id3_artist);
} else {
$comments['ARTIST'] = $audio->id3_artist;
}
} else {
$comments['ARTIST'] = '';
}
if (isset($audio->id3_album)) {
if ($audio->id3_album != iconv('UTF-8', 'UTF-8', $audio->id3_album)) {
$comments['ALBUM'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $audio->id3_album);
} else {
$comments['ALBUM'] = $audio->id3_album;
}
} else {
$comments['ALBUM'] = '';
}
if (isset($audio->id3_year)) {
if ($audio->id3_year != iconv('UTF-8', 'UTF-8', $audio->id3_year)) {
$comments['DATE'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $audio->id3_year);
} else {
$comments['DATE'] = $audio->id3_year;
}
} else {
$comments['DATE'] = '';
}
if (isset($audio->id3_genre)) {
if ($audio->id3_genre != iconv('UTF-8', 'UTF-8', $audio->id3_genre)) {
$comments['GENRE'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $audio->id3_genre);
} else {
$comments['GENRE'] = $audio->id3_genre;
}
} else {
$comments['GENRE'] = '';
}
if (isset($audio->id3_comment)) {
if ($audio->id3_comment != iconv('UTF-8', 'UTF-8', $audio->id3_comment)) {
$comments['COMMENT'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $audio->id3_comment);
} else {
$comments['COMMENT'] = $audio->id3_comment;
}
} else {
$comments['COMMENT'] = '';
}
$tmpa = array(
'channels' => $audio->wave_channels,
'sampleRate' => $audio->wave_framerate,
'avgBitrate' => str_replace(' Kbps', '', $audio->wave_byterate) * 1024,
'streamLength' => $length,
'comments' => array(
'TITLE' => trim(str_replace(array(chr(0), chr(1)), '', $comments['TITLE'])),
'ARTIST' => trim(str_replace(array(chr(0), chr(1)), '', $comments['ARTIST'])),
'ALBUM' => trim(str_replace(array(chr(0), chr(1)), '', $comments['ALBUM'])),
'DATE' => $comments['DATE'],
'GENRE' => $comments['GENRE'],
'COMMENT' => trim(str_replace(array(chr(0), chr(1)), '', $comments['COMMENT']))
)
);
}
} else if ($ext == 'ogg') {
if (file_exists('moduls/cache/' . $id . '.dat')) {
$tmpa = unserialize(file_get_contents('moduls/cache/' . $id . '.dat'));
} else {
include 'moduls/PEAR/Ogg.php';
try{
$ogg = new File_Ogg($file_info['path']);
$obj = & current($ogg->_streams);
$comments = array();
if (isset($obj->_comments['TITLE'])) {
if ($obj->_comments['TITLE'] != iconv('UTF-8', 'UTF-8', $obj->_comments['TITLE'])) {
$comments['TITLE'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $obj->_comments['TITLE']);
} else {
$comments['TITLE'] = $obj->_comments['TITLE'];
}
} else {
$comments['TITLE'] = '';
}
if (isset($obj->_comments['ARTIST'])) {
if ($obj->_comments['ARTIST'] != iconv('UTF-8', 'UTF-8', $obj->_comments['ARTIST'])) {
$comments['ARTIST'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $obj->_comments['ARTIST']);
} else {
$comments['ARTIST'] = $obj->_comments['ARTIST'];
}
} else {
$comments['ARTIST'] = '';
}
if (isset($obj->_comments['ALBUM'])) {
if ($obj->_comments['ALBUM'] != iconv('UTF-8', 'UTF-8', $obj->_comments['ALBUM'])) {
$comments['ALBUM'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $obj->_comments['ALBUM']);
} else {
$comments['ALBUM'] = $obj->_comments['ALBUM'];
}
} else {
$comments['ALBUM'] = '';
}
if (isset($obj->_comments['DATE'])) {
if ($obj->_comments['DATE'] != iconv('UTF-8', 'UTF-8', $obj->_comments['DATE'])) {
$comments['DATE'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $obj->_comments['DATE']);
} else {
$comments['DATE'] = $obj->_comments['DATE'];
}
} else {
$comments['DATE'] = '';
}
if (isset($obj->_comments['GENRE'])) {
if ($obj->_comments['GENRE'] != iconv('UTF-8', 'UTF-8', $obj->_comments['GENRE'])) {
$comments['GENRE'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $obj->_comments['GENRE']);
} else {
$comments['GENRE'] = $obj->_comments['GENRE'];
}
} else {
$comments['GENRE'] = '';
}
if (isset($obj->_comments['COMMENT'])) {
if ($obj->_comments['COMMENT'] != iconv('UTF-8', 'UTF-8', $obj->_comments['COMMENT'])) {
$comments['COMMENT'] = iconv('Windows-1251', 'UTF-8//TRANSLIT', $obj->_comments['COMMENT']);
} else {
$comments['COMMENT'] = $obj->_comments['COMMENT'];
}
} else {
$comments['COMMENT'] = '';
}
$tmpa = array(
'channels' => $obj->_channels,
'sampleRate' => $obj->_sampleRate,
'avgBitrate' => $obj->_avgBitrate,
'streamLength' => $obj->_streamLength,
'comments' => array(
'TITLE' => trim(str_replace(array(chr(0), chr(1)), '', $comments['TITLE'])),
'ARTIST' => trim(str_replace(array(chr(0), chr(1)), '', $comments['ARTIST'])),
'ALBUM' => trim(str_replace(array(chr(0), chr(1)), '', $comments['ALBUM'])),
'DATE' => $comments['DATE'],
'GENRE' => $comments['GENRE'],
'COMMENT' => trim(str_replace(array(chr(0), chr(1)), '', $comments['COMMENT']))
)
);
}
catch(Exception $e){}
}
}
file_put_contents('moduls/cache/' . $id . '.dat', serialize($tmpa));
$out = '<br/><strong>Информация:</strong><br/>Каналов: ' . $tmpa['channels'] . '<br/>Частота: ' . $tmpa['sampleRate'] . ' Hz<br/>Битрейт: ' . round($tmpa['avgBitrate'] / 1024) . ' Kbps<br/>Длина: ' . date('H:i:s', mktime(0, 0, $tmpa['streamLength'])) . '<br/>';
if ($tmpa['comments']['TITLE']) {
echo 'Название: ' . htmlspecialchars($tmpa['comments']['TITLE'], ENT_NOQUOTES) . '<br/>';
}
if ($tmpa['comments']['ARTIST']) {
echo 'Исполнитель: ' . htmlspecialchars($tmpa['comments']['ARTIST'], ENT_NOQUOTES) . '<br/>';
}
if ($tmpa['comments']['ALBUM']) {
echo 'Альбом: ' . htmlspecialchars($tmpa['comments']['ALBUM'], ENT_NOQUOTES) . '<br/>';
}
if ($tmpa['comments']['DATE']) {
echo 'Год: ' . htmlspecialchars($tmpa['comments']['DATE'], ENT_NOQUOTES) . '<br/>';
}
if ($tmpa['comments']['GENRE']) {
echo 'Жанр: ' . htmlspecialchars($tmpa['comments']['GENRE'], ENT_NOQUOTES) . '<br/>';
}
if ($tmpa['comments']['COMMENT']) {
echo 'Комментарии: ' . htmlspecialchars($tmpa['comments']['COMMENT'], ENT_NOQUOTES) . '<br/>';
}
echo $out;
}
// Видео (ffmpeg)
else if (($ext == '3gp' || $ext == 'avi' || $ext == 'mp4' || $ext == 'flv') && extension_loaded('ffmpeg')) {
if (@$_GET['frame'] < 1) {
$frame = 5;
} else {
$frame = $_GET['frame'];
}
// 80x80
if (is_file($setup['ffmpegpath'] . '/' . $prev_pic . '_frame_' . $frame . '.gif')) {
$out = '<br/><img src="' . DIRECTORY . $setup['ffmpegpath'] . '/' . htmlspecialchars($prev_pic) . '_frame_' . $frame . '.gif" alt=""/><br/>';
} else {
$out = '<br/><img src="' . DIRECTORY . 'ffmpeg/' . $id . '/' . $frame . '" alt=""/><br/>';
}
foreach (explode(',', $setup['ffmpeg_frames']) as $fr) {
$out.= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '&frame=' . $fr . '">' . (@++$i) . '</a>, ';
}
if (file_exists('moduls/cache/' . $id . '.dat')) {
$tmpa = unserialize(file_get_contents('moduls/cache/' . $id . '.dat'));
} else {
$mov = new ffmpeg_movie($file_info['path']);
$tmpa = array(
'getVideoCodec' => $mov->getVideoCodec(),
'GetFrameWidth' => $mov->GetFrameWidth(),
'GetFrameHeight' => $mov->GetFrameHeight(),
'getDuration' => $mov->getDuration(),
'getBitRate' => $mov->getBitRate()
);
file_put_contents('moduls/cache/' . $id . '.dat', serialize($tmpa));
}
$out = rtrim($out, ', ') . '<br/>Кодек: ' . htmlspecialchars($tmpa['getVideoCodec'], ENT_NOQUOTES) . '<br/>Разрешение: ' . intval($tmpa['GetFrameWidth']) . ' x ' . intval($tmpa['GetFrameHeight']) . '<br/>Длина: ' . date('H:i:s', mktime(0, 0, round($tmpa['getDuration']))) . '<br/>';
echo $out;
if ($tmpa['getBitRate']) {
echo 'Битрейт: ' . ceil($tmpa['getBitRate'] / 1024) . ' Kbps<br/>';
}
} else if ($ext == 'swf') {
echo '<br/><object width="128" height="128"><param name="movie" value="' . DIRECTORY . htmlspecialchars($file_info['path']) . '"><embed src="' . DIRECTORY . htmlspecialchars($file_info['path']) . '" width="128" height="128"></embed></param></object>';
} else if ($ext == 'jar') {
if (file_exists($setup['ipath'] . '/' . $prev_pic . '.png')) {
echo '<br/><img style="margin: 1px;" src="' . DIRECTORY . $setup['ipath'] . '/' . htmlspecialchars($prev_pic) . '.png" alt=""/>';
} else if (jar_ico($file_info['path'], $setup['ipath'] . '/' . $prev_pic . '.png')) {
echo '<br/><img style="margin: 1px;" src="' . DIRECTORY . $setup['ipath'] . '/' . htmlspecialchars($prev_pic) . '.png" alt=""/>';
}
}
$imgg='<img src="dis/i.png" class="ico" alt=">"/> ';
$screen = strstr($file_info['path'], '/'); // убираем папку с загрузками
//Скиншот
if (is_file($setup['spath'] . $screen . '.gif')) {
echo '<hr/><strong>Скриншот:</strong><br/><img src="' . $setup['spath'] . htmlspecialchars($screen) . '.gif" alt="screen"/><br/><strong><a href="apanel.php?action=del_screen&id=' . $id . '">Удалить скриншот</a></strong>';
} else if (is_file($setup['spath'] . $screen . '.jpg')) {
echo '<hr/><strong>Скриншот:</strong><br/><img src="' . $setup['spath'] . htmlspecialchars($screen) . '.jpg" alt="screen"/><br/><strong><a href="apanel.php?action=del_screen&id=' . $id . '">Удалить скриншот</a></strong>';
} else {
echo $imgg.'<strong><a href="apanel.php?action=screen&id=' . $id . '">Добавить скриншот</a></strong>';
}
echo'</div><div class="row"><strong>Размер:</strong> ' . $file_info['size'] . '<br/>
<strong>Скачано:</strong> ' . $file_info['loads'] . ' раз(а)<br/>';
###############Недавнее скачивание###################
if ($file_info['timeload']) {
$file_info['timeload'] = tm($file_info['timeload']);
echo '<strong>Последнее:</strong> ' . $file_info['timeload'] . '<br/>';
}
$file_info['timeupload'] = tm($file_info['timeupload']);
###############Время добавления######################
echo '<strong>Добавлено:</strong> ' . $file_info['timeupload'].'<br/>';
echo'<form action="apanel_view.php?id=' .$id. '" method="post">
<table cellpadding="1">';
echo'<tr><td>Год:</td><td><input name="god" value="' .$file_info['god']. '" type="text"/></td></tr>';
echo'<tr><td>Язык:</td><td><input name="lang" value="' .$file_info['lang']. '" type="text"/></td></tr>';
echo'<tr><td>Страна:</td><td><input name="country" value="' .$file_info['country']. '" type="text"/></td></tr>';
echo'<tr><td>Разработчик:</td><td><input name="vendor" value="' .$file_info['vendor']. '" type="text"/></td></tr>';
echo'<tr><td>Премьера:</td><td><input name="prim" value="' .$file_info['prim']. '" type="text"/></td></tr>';
echo'<tr><td>Режиссер:</td><td><input name="rejj" value="' .$file_info['rejj']. '" type="text"/></td></tr>';
echo'<tr><td>Актеры:</td><td><input name="akt" value="' .$file_info['akt']. '" type="text"/></td></tr>';
echo'<tr><td>Бюджет:</td><td><input name="babki" value="' .$file_info['babki']. '" type="text"/></td></tr>';
echo'<tr><td>Кассовые сборы:</td><td><input name="sbory" value="' .$file_info['sbory']. '" type="text"/></td></tr>';
echo'<tr><td>Качество:</td><td><input name="kachestvo" value="' .$file_info['kachestvo']. '" type="text"/></td></tr>';
echo'<tr><td>Перевод:</td><td><input name="trans" value="' .$file_info['trans']. '" type="text"/></td></tr>';
echo'<tr><td>Поддержка bluetooth:</td><td><select name="bt">';
echo $file_info['bt'] == 0 ? '<option value="0" selected>пусто</option>' : '<option value="0">пусто</option>';
echo $file_info['bt'] == 1 ? '<option value="1" selected>нет</option>' : '<option value="1">нет</option>';
echo $file_info['bt'] == 2 ? '<option value="2" selected>есть</option>' : '<option value="2">есть</option>';
echo'</select></td></tr>';
echo'<tr><td>Поддержка 3D:</td><td><select name="3d">';
echo $file_info['3d'] == 0 ? '<option value="0" selected>пусто</option>' : '<option value="0">пусто</option>';
echo $file_info['3d'] == 1 ? '<option value="1" selected>нет</option>' : '<option value="1">нет</option>';
echo $file_info['3d'] == 2 ? '<option value="2" selected>есть</option>' : '<option value="2">есть</option>';
echo'</select></td></tr>';
echo '<tr><td><input type="submit" value="Сохранить"></td></tr></table></form></div>';
//Описание
if (is_file($setup['opath'] . $screen . '.txt')) {
echo '<div class="row"><strong>Описание:</strong><br/>' . trim(file_get_contents($setup['opath'] . '/' . $screen . '.txt')).'</div>';
} else if ($ext == 'txt' && $setup['lib_desc']) {
$fp = fopen($file_info['path'], 'r');
echo '<div class="row"><strong>Описание:</strong><br/>' . trim(fgets($fp, 1024)).'</div>';
fclose($fp);
}
if ($file_info['hidden']) {
$tmp = '<a href="apanel_view.php?id=' . $id . '&hidden=0"><button>Видимый</button></a> <strong>Не видимый</strong>';
} else {
$tmp = '<strong>Видимый</strong> <a href="apanel_view.php?id=' . $id . '&hidden=1"><button>Не видимый</button></a>';
}
echo '<div class="row">
<strong>'.$imgg.'<a href="apanel.php?action=upload_dop&id=' . $id . '">Добавить доп. файлы upload</a></strong><br/>
<strong>'.$imgg.'<a href="apanel.php?action=import_dop&id=' . $id . '">Добавить доп. файлы import</a></strong><br/>
<strong>'.$imgg.'<a href="apanel.php?action=about&id=' . $id . '">Добавить/изменить описание</a></strong></div>
<div class="row">' . $tmp . '
<form action="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '" method="post">
<select name="folder" class="buttom">
<option value="' . $setup['path'] . '/">/</option>';
$dirs = mysql_query('SELECT `id`, `path` FROM `files` WHERE `dir` = "1"', $mysql);
while ($item = mysql_fetch_assoc($dirs)) {
echo '<option ' . ($item['path'] == $file_info['infolder'] ? 'selected="selected" ' : '') . ' value="' . $item['id'] . '">' . htmlspecialchars(substr(strstr($item['path'], '/'), 1), ENT_NOQUOTES) . '</option>';
}
echo '</select> <input type="submit" value="Перенести" class="buttom"/>
</div>
</form>';
// Голосование
if ($setup['eval_change']) {
$i = $file_info['yes'] + $file_info['no'];
if ($i) {
$i = round($file_info['yes'] / $i *100, 0);
}
echo '<div class="row">
<strong>Рейтинг файла</strong>: <img src="dis/yes.png" alt="yes"/> <span class="yes">' . $file_info['yes'] . '</span> <img src="dis/no.png" alt="no"/> <span class="no">' . $file_info['no'] . '</span> <a href="apanel.php?id=' . $file_info['id'] . '&action=cleareval"><button>Сбросить</button></a><br/>
Понравился файл?: <span class="yes"><a href="view.php?id=' . $id . '&eval=1">Да</a></span>/<span class="no"><a href="view.php?id=' . $id . '&eval=0">Нет</a></span></div>';
}
###############Нарезка###########################
echo '</div><div class="row2">';
if ($setup['cut_change'] && ($ext == 'mp3' || $ext == 'wav')) {
echo '<div class="row2">'.$imgg.'<strong><a href="cut.php?id=' . $id . '">Нарезка</a></strong></div>';
}
###############Просмотр архива####################
if ($setup['zip_change'] && $ext == 'zip') {
echo '<div class="row2">'.$imgg.'<strong><a href="zip.php?id=' . $id . '">Просмотр архива</a></strong></div>';
}
###############Комментарии#######################
if ($setup['komments_change']) {
echo '<img src="'.DIRECTORY.'dis/comment.png" alt="comment" title="comment"> <a href="komm.php?id=' . $id . '"><strong>Обсудить </strong></a> [' . $all_komments . '] <a href="apanel.php?id=' . $file_info['id'] . '&action=clearkomm"><button>Очистить</button></a><br/>';
}
// txt файлы
if ($ext == 'txt') {
if ($setup['lib_change']) {
$str = '<div class="row2">'.$imgg.'<strong><a href="read.php?id=' . $id . '">Читать</a></strong></div>';
}
echo $str . '<div class="row2">'.$imgg.'<a href="txt_zip.php?id=' . $id . '">Скачать [zip]</a> <a href="txt_jar.php?id=' . $id . '">[jar]</a></div>';
}
$sql_att = mysql_query("SELECT * FROM `files` WHERE `fileid` = '$id' AND `hidden`='0' AND `dir`='0' ORDER BY `id`", $mysql);
if(mysql_num_rows($sql_att) > 0){
// Меню закачек
echo '</div><div class="row"><img src="'.DIRECTORY.'dis/download.png" alt="load"/> ' . $_SESSION['language']['download'] . ':</div>';
echo'<div class="row2"><img src="' . DIRECTORY . 'ext/dir.png" alt=""/> ' . htmlspecialchars($filename, ENT_NOQUOTES) . '<br/><a class="link" href="' . DIRECTORY . 'load/' . $id . '">' . strtoupper($ext) . '</a>';
if ($setup['jad_change'] && $ext == 'jar') {
echo' | <a class="link" href="' . DIRECTORY . 'jad/' . $id . '">JAD</a>';
}
}else{
// Меню закачек
echo '</div><div class="row2"><img src="'.DIRECTORY.'dis/download.png" alt="load"/> <strong><a href="' . DIRECTORY . 'load/' . $id . '">' . $_SESSION['language']['download'] . '_' . htmlspecialchars($filename, ENT_NOQUOTES) . '.' . $ext . '</a></strong>';
if ($setup['jad_change'] && $ext == 'jar') {
echo ' <strong><a href="' . DIRECTORY . 'jad/' . $id . '">[jad]</a></strong>';
}
}
echo'</div>';
//Вложения файлов
if(mysql_num_rows($sql_att) > 0){
$dn = 86400 * $setup['day_new'];
while($att=mysql_fetch_array($sql_att)){
//Новизна файла
if (($att['timeupload'] + $dn) >= $_SERVER['REQUEST_TIME'] && $setup['day_new']) {
$new_info = ' <span class="yes">' . $_SESSION['language']['new'] . '</span>';
} else {
$new_info = '';
}
$fname = pathinfo($att['path']);
$exat = strtolower($fname['extension']);
echo '<div class="row2"><img src="' . DIRECTORY . 'ext/dir.png" alt=""/> ' .($_SESSION['langpack'] == 'russian' ? htmlspecialchars($att['rus_name'], ENT_NOQUOTES) : htmlspecialchars($att['name'], ENT_NOQUOTES)) . '<br/><a class="link" href="' . DIRECTORY . 'load/' . $att['id'] . '">' . strtoupper($exat) . '</a>';
if ($setup['jad_change'] && $exat == 'jar') {
echo ' | <a class="link" href="' . DIRECTORY . 'jad/' . $att['id'] . '">JAD</a>';
}
echo' [' . $att['loads'] . '] ' . $new_info . ' <a href="apanel_view.php?del='.$att['id'].'"><button>удалить</button></a></div>';
}
}
echo '</div>
<div class="foot">
<a href="apanel_index.php?id=' . $back['id'] . '">Назад</a> |
<a href="apanel.php">Админка</a> |
</div>';
require 'moduls/foot.php';
?>