File size: 3.36Kb
<?php
$list=null;
if($l=='/'){
$set['title'] = 'Файловый обменник';
}else{
$set['title']='Обменник - '.$dir_id['name'];
}
$_SESSION['page']=1;
include_once '../../sys/inc/thead.php';
title();
if(isset($user)){
include 'inc/upload_act.php';
include 'inc/admin_act.php';
}
err();
aut();
echo '<div class="menu">';
if($l!='/'){
echo '» <a href="index.php?id_comm='.$id_comm.'">Обменник</a><br/>';
}
echo '<table class="post">';
$q=mysql_query("SELECT * FROM `comm_obmen_dir` WHERE `dir_osn` = '/$l' OR `dir_osn` = '$l/' OR `dir_osn` = '$l' AND `id_comm` = '$id_comm' ORDER BY `name`,`num` ASC");
while($post = mysql_fetch_array($q)){
$list[]=array('dir'=>1,'post'=>$post);
}
$q=mysql_query("SELECT * FROM `comm_obmen_files` WHERE `id_dir` = '$id_dir' AND `id_comm` = '$id_comm' ORDER BY `time` DESC");
while($post = mysql_fetch_array($q)){
$list[]=array('dir'=>0,'post'=>$post);
}
$k_post=sizeof($list);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if($k_post==0){
echo '<tr><td class="p_t">Папка пуста</td></tr>';
}
for($i=$start;$i<$k_post && $i<$set['p_str']*$page;$i++){
if($list[$i]['dir']==1){
$post=$list[$i]['post'];
echo '<tr><td class="icon14"><img src="/style/themes/'.$set['set_them'].'/loads/dir.png" alt=""/></td>';
echo '<td class="p_t"><a href="index.php?d='.$post['dir'].'&id_comm='.$id_comm.'">'.esc(stripcslashes(htmlspecialchars($post['name']))).'</a> <b></b>';
$k_f=0;
$k_n=0;
$q3=mysql_query("SELECT * FROM `comm_obmen_dir` WHERE `dir_osn` like '$post[dir]%'");
while($post2 = mysql_fetch_array($q3)){
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_obmen_files` WHERE `id_dir` = '$post2[id]' AND `id_comm` = '$id_comm'"),0);
$k_n=$k_n+mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_obmen_files` WHERE `id_dir` = '$post2[id]' AND `time` > '".(time()-86400)."' AND `id_comm` = '$id_comm'"),0);
}
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_obmen_files` WHERE `id_dir` = '$post[id]' AND `id_comm` = '$id_comm'"),0);
$k_n=$k_n+mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_obmen_files` WHERE `id_dir` = '$post[id]' AND `time` > '".(time()-86400)."' AND `id_comm` = '$id_comm'"),0);
if($k_n==0){
$k_n=NULL;
}else{
$k_n='/+'.$k_n;
}
echo ' ('.$k_f.''.$k_n.')</td></tr>';
}else{
$post=$list[$i]['post'];
$ras=$post['ras'];
$file=H."sys/comm/obmen/files/$post[id].dat";
$name=$post['name'];
$size=$post['size'];
echo '<tr><td class="icon14">';
include 'inc/icon14.php';
echo '</td>';
echo '<td class="p_t">';
if($set['echo_rassh']==1){
$ras=".$post[ras]";
}else{
$ras=NULL;
}
echo '<a href="index.php?d='.$dir_id['dir'].'&f='.$post['name'].'.'.$post['ras'].'&id_comm='.$id_comm.'&showinfo">'.esc(stripcslashes(htmlspecialchars($post['name']))).''.$ras.'</a><br/></td></tr>';
echo '<tr><td class="p_m" colspan="2">';
include 'inc/opis.php';
echo '</td></tr>';
}
}
echo '</table>';
if($k_page>1){
str('index.php?id_comm='.$id_comm.'&d='.$dir_id['dir'].'&',$k_page,$page);
}
if(isset($user)){
include 'inc/upload_form.php';
include 'inc/admin_form.php';
}
echo '» <a href="'.H.'comm/comm.php?id='.$id_comm.'">В сообщество</a><br/>';
echo '</div>';
?>