Файл: down/top.php
Строк: 289
<?
//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';
###############Постраничная навигация###############
$max = 10;
$all=mysql_result(mysql_query("select COUNT(*) from `files` WHERE `size` > 0;"),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 `size` > 0 ORDER BY '.$MODE.' LIMIT 0, '.set('top_num'));
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>»<strong>ТОП '.set('top_num').' файлов</strong>'.$div9;
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_file($file_info['path'])){
if(is_integer($key / 2)) $divi = $div1; else $divi = $div2;
$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);
$backdir = @mysql_fetch_array(mysql_query("SELECT * FROM `files` WHERE `path` = '".clean($file_info['infolder'])."'"));
echo $divi.$ico.'<a href="'.H2.'down/'.$file_info[id].'"><strong>'.$file_info['name'].'</strong></a> [<a href="dir/'.$backdir['id'].'">В категорию</a>] '.$div9.$extension.$size2.'';
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_array(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 ''.$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/>';
}}
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');
?>