<?php
$q_f=mysql_query("SELECT * FROM `comm_forum_files` WHERE `id_post` = '$post[id]' AND `id_comm` = '$id_comm'");
while($file = mysql_fetch_array($q_f)){
	if(is_file(H.'style/themes/'.$set['set_them'].'/loads/'.$file['ras'].'.png')){
		echo '<img src="/style/themes/'.$set['set_them'].'/loads/'.$file['ras'].'.png" alt="'.$file['ras'].'"/>';

if($set['echo_rassh_forum']==1){
	$ras=".$file[ras]";
	}else{
		$ras=NULL;
		}
		}else{
			echo '<img src="/style/themes/'.$set['set_them'].'/forum/file.png" alt=""/>';
			$ras=$file['ras'];
			}

echo '<a href="files.php?id='.$file['id'].'&amp;id_comm='.$id_comm.'">'.$file['name'].''.$ras.'</a> ('.size_file($file['size']).') ';

$k_vote=mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_files_rating` WHERE `id_file` = '$file[id]' AND `id_comm` = '$id_comm'"), 0);
$sum_vote=mysql_result(mysql_query("SELECT SUM(`rating`) FROM `comm_forum_files_rating` WHERE `id_file` = '$file[id]' AND `id_comm` = '$id_comm'"), 0);

if($sum_vote==null){
	$sum_vote=0;
	}

if(isset($user) && $admin['uid']==$user['id'] && $admin['priv']>0){
	echo '<a href="files.php?id='.$file['id'].'&amp;id_comm='.$id_comm.'&amp;del"><img src="/style/themes/'.$set['set_them'].'/forum/del_file.png" alt=""/></a>';
	}

echo '<br/>Рейтинг: ';

if(isset($user) && $admin['uid']==$user['id'] && $user['balls']>=50 && mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_files_rating` WHERE `id_user` = '$user[id]' AND `id_file` = '$file[id]' AND `id_comm` = '$id_comm'"), 0)==0){
	echo '<a href="index.php?id_forum='.$forum['id'].'&amp;id_razdel='.$razdel['id'].'&amp;id_them='.$them['id'].'&amp;page='.$page.'&amp;id_file='.$file['id'].'&amp;id_comm='.$id_comm.'&amp;rating=down">[-]</a>';
	}

echo '&nbsp;'.$sum_vote.'/'.$k_vote.'&nbsp;';

if(isset($user) && $admin['uid']==$user['id'] && $user['balls']>=50 && mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_files_rating` WHERE `id_user` = '$user[id]' AND `id_file` = '$file[id]' AND `id_comm` = '$id_comm'"), 0)==0){
	echo '<a href="index.php?id_forum='.$forum['id'].'&amp;id_razdel='.$razdel['id'].'&amp;id_them='.$them['id'].'&amp;page='.$page.'&amp;id_file='.$file['id'].'&amp;id_comm='.$id_comm.'&amp;rating=up">[+]</a>';
	}

echo ' | Скачано: '.$file['count'].' раз(а) <br/>';
}
?>