Файл: down/index.php
Строк: 350
<?
require'../shaxty.php'; // waphp.ru - закрытый клуб вап мастеров!
require_once'fun.php';
$align='left';
$title='Архив файлов!';
$head='Архив файлов! Тут найдется все )';
include_once (H.'shaxty/head.php');
check_login();
###############Проверка переменных###############
$onpage = check(get2ses('onpage'));
$prew = check(get2ses('prew'));
$sort = check(get2ses('sort'));
if(!empty($_SESSION["onpage"]) AND !empty($_GET['onpage'])){
$_SESSION["onpage"]=$_GET['onpage'];
}elseif(empty($_SESSION["onpage"]) AND !empty($_GET['onpage'])){
$onpage=$_GET['onpaget'];
session_register ("onpage") ;}
if(!empty($_SESSION["prew"]) AND !empty($_GET['prew']))
$_SESSION["prew"]=$_GET['prew'];
elseif(empty($_SESSION["prew"]) AND !empty($_GET['prew'])){
$prew=$_GET['prew'];
session_register ("prew") ;}
if(!empty($_SESSION["sort"]) AND !empty($_GET['sort']))
$_SESSION["sort"]=$_GET['sort'];
elseif(empty($_SESSION["sort"]) AND !empty($_GET['sort'])){
$sort=$_GET['sort'];
session_register ("sort") ;}
$prew = check(intval($_SESSION["prew"]));
$sort = get2ses('sort');
if($prew != 0 and $prew != 1)$prew = set('preview');
$MODE = '`priority` DESC,`timeupload` DESC';
if($sort == 'data') $MODE = '`priority` DESC,`timeupload` DESC';
elseif($sort == 'size') $MODE = '`priority` DESC,`size` ASC';
elseif($sort == 'load') $MODE = '`priority` DESC,`loads` DESC';
elseif($sort == 'eval' && $setup['eval_change']) $MODE = '`priority` DESC,`yes` DESC ,`no` ASC';
###############Получаем текущий каталог#############
if(!$id){$d['path'] = set('path').'/';
}else{
$d = mysql_fetch_assoc(mysql_query('SELECT `path` FROM `files` WHERE `id` = '.$id.' LIMIT 1'));}
if(!is_dir($d['path'])) die('Такой папки не существует!');
###############Постраничная навигация###############
$alldir=mysql_result(mysql_query("select COUNT(*) from `files` WHERE `infolder` = '".$d['path']."' and `size` = '0';"),0);
if ($alldir>10)$max = 20;
else $max = 17;
$all=mysql_result(mysql_query("select COUNT(*) from `files` WHERE `infolder` = '".$d['path']."';"),0);
$k_page=k_page($all,$max);
$page=page($k_page);
$start=$max*$page-$max;
###############Получаем список файлов###############
$array_id = array();
$query = mysql_query('SELECT `id` FROM `files` WHERE `infolder` = "'.$d['path'].'" ORDER BY '.$MODE.' LIMIT '.$start.', '.$max);
while($list_sw = mysql_fetch_row($query)){
$array_id[] = $list_sw[0];
}
###############Готовим заголовок###################
$ex = explode('/',$d['path']);
foreach($ex as $k=>$v)
{
if($v!='' and $v!='.' and $v!='..' and $v!=set('path'))
{
$s = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `files` WHERE `path` LIKE '%".clean($v)."/' AND `size` = '0'"));
$s['name'] = str_replace('*','',$s['name']);
if($k >= sizeof($ex)-2) $put .= $s['name'];
else $put .= '<a href="'.H2.'down/dir/'.$s['id'].'">'.$s['name'].'</a>»';
}
}$dirnamegg=$s['name'];
##############Заголовок##########################
echo $div1.'<a href="/"><b> '.$_SERVER['HTTP_HOST'].'</b></a>»<a href="'.H2.'down/">Загрузки</a>»'.$put.$div9;
//echo '<img src="/down/ext/search.png" alt="*"/> <a href="'.H2.'down/search.php">Поиск файлов</a><br />';
//echo '<img src="/down/ext/top.gif" alt="*"/> <a href="'.H2.'down/top.php">ТОП '.set('top_num').' файлов</a><br /><dt></dt>';
if($sort == 'name') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=size">размер</a>|<a href="?sort=load">популярность</a>|<a href="?sort=eval">рейтинг</a>';
elseif($sort == 'size') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=name">имя|<a href="?sort=load">популярность</a></a>|<a href="?sort=eval">рейтинг</a>';
elseif($sort == 'load') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=name">имя|<a href="?sort=size">размер</a>|<a href="?sort=eval">рейтинг</a>';
elseif($sort == 'eval') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=name">имя|<a href="?sort=size">размер</a>|<a href="?sort=load">популярность</a>';
else $sortlink = '<a href="?sort=name">имя</a>|<a href="?sort=size">размер</a>|<a href="?sort=load">популярность</a>|<a href="?sort=eval">рейтинг</a>';
echo ' Cортировать по: '.$sortlink.'<br /><dt></dt>';
////////////////////////////////
###############Список фалов и папок###############
if ($all == 0) echo '<b>Раздел пока пуст</b><br />';
foreach($array_id as $key => $value)
{
$file_info = mysql_fetch_array(mysql_query('SELECT * FROM `files` WHERE `id` = "'.$value.'";'));
if(is_dir($file_info['path']))
{
if(is_integer($key / 2)) $divi = $div1; else $divi = $div2;
//Кол-во новых файлов в папке
$new_all="";
$stime=$time-(3600*24*set('day_new'));
$new_all = mysql_fetch_array(mysql_query('SELECT count(*) FROM `files` WHERE `timeupload` > "'.$stime.'" AND `infolder` LIKE "'.$file_info['path'].'%" AND `size` > "0";'));
if($new_all[0] and set('day_new')!=0) $new_all = '<font color="red">+'.$new_all[0].'</font>'; else $new_all="";
$allinfolder = mysql_fetch_array(mysql_query('SELECT count(*) FROM `files` WHERE `infolder` LIKE "'.$file_info['path'].'%" AND `size` > "0";'));
$name = str_replace('*','',$file_info['name']);
if(!file_exists($file_info['path'].'folder.png')) $ico = '<img src="'.H2.'down/ext/dir.png" alt="">'; else $ico = '<img src="'.$file_info['path'].'folder.png" alt="">';
//Собсвенно вывод
//echo $divi.$ico.'<a href="'.H2.'down/dir/'.$file_info[id].'">'.$name.'</a>('.$allinfolder[0].')'.$new_all;
echo '<div class="menu_j"> <a href="'.H2.'down/dir/'.$file_info[id].'" class="top_menu_j"><img src="/down/ext/dir.png" alt="*"/>'.$name.'('.$allinfolder[0].')'.$new_all.'</div></a>';
if(!empty($file_info['fastabout'])) echo '<br>'.str_replace("", '<br>',$file_info['fastabout']);
echo $div9;
}elseif(is_file($file_info['path'])){
$close_info = mysql_fetch_array(mysql_query("SELECT close FROM `files` WHERE `id` = '$s[id]'"));
if ($close_info[0] > $user['level'])
{
echo '<b span style="color: #FF0000;">Данный раздел доступен с уровня ' . level($close_info['close']) . '</b><br/>';
include_once '../shaxty/foot.php';
exit();
}
if(is_integer($key / 2)) $divi = $div1; else $divi = $div2;
if (!empty($file_info['fastabout'])) $file_info['about'] = str_replace("", '<br>',$file_info['about']);
$ex = pathinfo($file_info['path']);
$ext = strtolower($ex['extension']);
//Предосмотр
$pre = '';
if ($prew==1)
{
if ($ext == 'bmp') $pre = 'Предосмотр невозможен <br>';
if ($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpg' or $ext == 'png' or $ext == 'JPG' or $ext == 'GIF' or $ext == 'PNG'or $ext == 'JPEG') $pre = '<img style="margin: 1px;" src="'.H2.'down/im.php?id='.$file_info['id'].'" alt=""/><br />';
}
$all_loads = $file_info['loads'];
$file_time = date('d.m.y', $file_info['timeupload']);
if ($sort=='name'or $sort=='size') $info = '';
if($sort=='load') $info = '(<font color="#FFFF00">'.$all_loads.'</font>)';
if ($sort=='data') $info = "($file_time)";
if ($sort=='eval' and $setup['eval_change']==1) $info = '(<font color="#800000">'.$file_info['yes'].'</font>/<font color="#004080">'.$file_info[no].'</font>)';
//Новизна файла
$new_info='';
$filtime2 = $file_info['timeupload']+(3600*24*$setup['day_new']);
if($filtime2>=$time and $setup['day_new']!=0) $new_info = '<font color="red">NEW!</font>';
//Красивый размер
if($file_info['size'] < 1024) $file_info['size'] = '('.$file_info['size'].' б)';
if($file_info['size'] < 1048576 and $file_info['size'] >= 1024) $file_info['size'] = '('.round($file_info['size']/1024, 2).' Кб)';
if($file_info['size'] > 1048576) $file_info['size'] = '('.round($file_info['size']/1024/1024, 2).' Мб)';
//Иконка к файлу
if(!file_exists('ext/'.$ext.'.png') ) $ico = '<img src="'.H2.'down/ext/stand.png" alt="">';
elseif ($ext =='jar') $ico = ' <img src="'.H2.'down/ic.php?lf='.$file_info['path'].'&id='.$file_info[id].'" alt="" width="16" height="16"/>';
else $ico = '<img src="'.H2.'down/ext/'.$ext.'.png" alt="">';
//Показ расиширения
$extension = "$ext";
//Собственно вывод
if(is_integer($key / 2)) $divi = $div1; else $divi = $div2;
$size1=str_replace(')','|',$file_info['size']);
$size2=str_replace('(','|',$size1);
$info=str_replace('(','|',$info);
$info=str_replace(')','|',$info);
echo $divi.$ico.'<a href="'.H2.'down/'.$file_info[id].'"><strong>'.$file_info['name'].'</strong></a>'.$div9.$extension.$size2.'';
if ($user['level']==9){echo'<a href="'.H2.'down/apanel.php/id='.$file_info[id].'?action=fast">правка описания:'; }
echo '<a href="'.H2.'down/load.php?id='.$file_info[id].'"><font color="red">Скачать</font></a>|';
/*if($ext =='txt') { echo '<a href="'.H2.'down/read.php?id='.$file_info['id'].'&id2='.$id.'"><font color="red">Читать</font></a>';}*/
echo $new_info.'<br />';
$finfo=substr($file_info['fastabout'],0,50);
if(!empty($f_info)) $f_info = "".$finfo."...";
if(!empty($f_info)) echo str_replace("", '<br>',$f_info);
######################################################
###############Получаем инфу о файле###########
$id2=$file_info[id];
$file_info2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `files` WHERE `id` = '$id2'"));
if (!is_file ($file_info2['path'])) die('Файл не существует');
###############Скиншот GIF #############################
#######Получаем имя файла и обратный каталог#####
$filename = pathinfo($file_info2['path']);
$ext = $filename['extension'];
$dir = $filename['dirname'].'/';
$filename = $filename['basename'];
$back = mysql_fetch_array(mysql_query("SELECT * FROM `files` WHERE `path` = '".check(clean($dir))."'"));
#
##################
$bolt=0;
if(($ext == 'avi' || $ext == '3gp' || $ext == 'mp4') && extension_loaded('ffmpeg')){
$pre = '<img style="margin: 1px;" src="'.H2.'down/ffmpeg.php?id='.$file_info['id'].'" alt=""/><br>';
$bolt=1;
}
################# Скиншот GIF #############################
echo $pre;
if(is_file(H2.'down/'.set('spath').'/'.$filename.'.gif') or is_file(H2.'down/'.set('spath').'/'.$filename.'.GIF')) echo '<tr><td><img style="margin: 1px;" src="im2.php?pic='.H2.'down/'.set('spath').'/'.$filename.'.gif&W=40&H=47" alt="screen"></td><td>';
###############Скиншот JPG #############################
if(is_file(set('spath').'/'.$filename.'.jpg') or is_file(set('spath').'/'.$filename.'.JPG')) echo '<tr><td><img style="margin: 1px;" src="im2.php?pic='.H2.'down/'.set('spath').'/'.$filename.'.jpg&W=40&H=47" alt="screen"></td><td> ';
###############Скиншот PNG #############################
if(is_file(set('spath').'/'.$filename.'.png') or is_file(H2.'down/'.set('spath').'/'.$filename.'.PNG')) echo '<tr><td><img style="margin: 1px;" src="im2.php?pic='.H2.'down/'.set('spath').'/'.$filename.'.png&W=40&H=47" alt="screen"></td><td>';
###############Скиншот JPEG #############################
if(is_file(set('spath').'/'.$filename.'.jpeg') or is_file(H2.'down/'.set('spath').'/'.$filename.'.JPEG')) echo '<tr><td><img style="margin: 1px;" src="im2.php?pic='.H2.'down/'.set('spath').'/'.$filename.'.jpeg&W=40&H=47" alt="screen"></td><td> ';
##############Спецзаказ для рифмы) Описание
$filenamen=$filename;
$filenamen=str_replace('.sis','',$filenamen);
$filenamen=str_replace('.zip','',$filenamen);
$filenamen=str_replace('.sisx','',$filenamen);
$filenamen=str_replace('.nth','',$filenamen);
$filenamen=str_replace('.thm','',$filenamen);
$filenamen=str_replace('.3gp','',$filenamen);
$filenamen=str_replace('.avi','',$filenamen);
$filenamen=str_replace('.mp4','',$filenamen);
$filenamen=str_replace('.jar','',$filenamen);
$filenamen=str_replace('.mp3','',$filenamen);
$filenamen=str_replace('.jpg','',$filenamen);
$filenamen=str_replace('.jpeg','',$filenamen);
$filenamen=str_replace('.gif','',$filenamen);
$filenamen=str_replace('.txt','',$filenamen);
$filenamen=str_replace('.rar','',$filenamen);
if ($ext == 'txt') {$popis=file_get_contents($file_info2['path']);
$popis=substr($popis,0,100);
$popis = htmlentities($popis, ENT_QUOTES, 'UTF-8');
echo ''.text($popis).'...<br />';
$outp=1;
}else{
$popis=substr($file_info2['about'],0,100);
$popis = htmlentities($popis, ENT_QUOTES, 'UTF-8');
if($file_info2['about'])echo ''.text($popis).'...<br />';
}
echo'<a href="'.H2.'down/'.$id2.'?komm">Ком.: ('.mysql_result(mysql_query('SELECT count(`id`) FROM `komments` WHERE `file` = '.$id2),0).')</a>|Рейтинг:<font color="black">'.$file_info['yes'].'</font>/<font color="red">'.$file_info['no'].'</font><font color="blue">|Скач.:</font>['.$file_info['loads'].']<br/>';
}
}
if ($k_page>1){
echo '<br/><dl><dt></dt></dl>';
str("?id=".$id."&",$k_page,$page); // Вывод страниц
echo '<br/><dl><dt></dt></dl>';
}
echo "<br/>";
if($level>=$set['zc_levadm'])echo $div1.'<a href="'.H2.'down/apanel.php"><b>Управление</b></a>'.$div9;
//echo $div1.'<a href="'.H2.'down/stat.php?">Статистика</a>'.$div9;
include_once (H.'shaxty/foot.php');
?>