Файл: forum/inc/file.php
Строк: 31
<?php
$q_f = mysql_query("SELECT * FROM `forum_files` WHERE `id_post` = '$post[id]'");
while ($file = mysql_fetch_assoc($q_f)) {
if (preg_match('#jpg|jpeg|gif|png#i', $file['ras'])) {
echo "<img src = '/forum/files/$file[id]/$file[name].$file[ras]' width = '100' height = '100' alt = 'pic' /><br />";
}
echo "<img src = '/style/icons/files/$file[ras].png'/>n";
$ras = ".$file[ras]";
echo "<a href = '/forum/files/$file[id]/$file[name].$file[ras]'>$file[name]$ras</a> (" . size_file($file['size']) . ") n";
$k_vote = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files_rating` WHERE `id_file` = '$file[id]'"), 0);
$sum_vote = mysql_result(mysql_query("SELECT SUM(`rating`) FROM `forum_files_rating` WHERE `id_file` = '$file[id]'"), 0);
if ($sum_vote == null) {
$sum_vote = 0;
}
if (isset($user) && $user['level'] > 1) {
echo "<a href = '/forum/delete/$file[id]/' title = 'Удалить из списка'><img src = '/style/icons/cross.png' /></a>";
}
echo "<br />Рейтинг: ";
if (isset($user) && $user['money'] >= 0 && $user['rating'] >= 0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files_rating` WHERE `id_user` = '$user[id]' AND `id_file` = '$file[id]'"), 0) == 0) {
echo "<a href = '/forum/$forum[id]/$razdel[id]/$them[id]/?page=$page&id_file=$file[id]&rating=down' title = 'Не нравится'><img src = '/style/icons/thumb_down.png' /></a>";
}
echo " $sum_vote | прогол. $k_vote чел";
if (isset($user) && $user['money'] >= 0 && $user['rating'] >= 0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files_rating` WHERE `id_user` = '$user[id]' AND `id_file` = '$file[id]'"), 0) == 0) {
echo "<a href = '/forum/$forum[id]/$razdel[id]/$them[id]/?page=$page&id_file=$file[id]&rating=up' title = 'Мне нравится'><img src = '/style/icons/thumb_up.png' /></a>";
}
echo " | ";
echo "Скачано: $file[count] раз(а) <br />";
}