Размер файла: 2.27Kb
<?php
$ctype = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `$type` WHERE `id` = '$id'"));
if ($ctype['name']) {
echo '<div class="title"><a href="?act=view&id='.$id.'">'.$ctype['name'].'</a>» kомментарии</div>';
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `id_".$type."` = '$id'"), 0);
if ($total > 0) {
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$comm_r = mysql_query("SELECT * FROM `".$type."_comm` WHERE `id_$type` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($comm = mysql_fetch_assoc($comm_r)) {
echo '<div class="post" id="'.$comm['id'].'"><div class="img">'.avatar($comm['id_user']).'</div> ';
echo '<a href="../other/profile.php?id='.$comm['id_user'].'">'.username($comm['id_user'], 2).'</a> '.ccdate($comm['time'], $comm['id_user']).' <a href="?act=comm_reply&id='.$comm['id'].'">'.$lang['re'].'</a>';
if ($u['access'] > 0 or $u['id'] and $u['id'] == $comm['id_user'] and TIME - $comm['time'] < $config['edit_time']) echo '|<a href="?act=comm_edit&p='.$page.'&id='.$comm['id'].'">'.$lang['edit'].'</a>';
if ($u['access'] > 0) echo '|<a href="?act=comm_del&id='.$comm['id'].'">DEL</a>';
echo '<br />'.bb($comm['text']);
if ($comm['edit_by']) echo '<br />_______<br /><span style="font-size: 10px;">'.$lang['edited_by'].': '.username($comm['edit_by'], 0).' ('.date('d.m.y, H:i', $comm['edit_time']).' )</span>';
echo '</div>';
}
echo '<div class="body">';
navig($page, '?act=comm&id='.$id.'&', $pages);
} else {
echo '<div class="body">Нет комментариев пока</div>';
}
if ($u['id']) {
echo bbpanel('form', 'text').'
<form name="form" action="?act=comm_add&id='.$id.'" method="post">
<textarea name="text" cols="" rows="3"></textarea>
<input name="" type="submit" value="Ok">
</form>';
}
echo '<a href="?act=view&id='.$id.'">'.$ctype['name'].'</a>» kомментарии</div>';
} else {
redirect('?');
}
?>