Размер файла: 2.18Kb
<?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></div><div class="list">';
$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)) {
if (!isset($num) ) $num = 1;
$num++;
$row_class = (!($num % 2)) ? 'row1' : 'row2';
echo '<div class="'.$row_class.'">';
echo '<a href="profile.php?id='.$comm['id_user'].'">'.login($comm['id_user']).'</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&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'].': '.justusername($comm['edit_by']).' ('.date('d.m.y, H:i', $comm['edit_time']).' )</span>';
echo '</div>';
}
navig($page, '?act=comm&id='.$id.'&', $pages);
} else {
echo $lang['no_comments_yet'];
}
echo '</div>';
if ($u['id']) {
echo '<div class="main">
<form action="?act=comm_add&id='.$id.'" method="post">
<textarea name="text" cols="" rows="3"></textarea>
<input name="" type="submit" value="Ok">
</form>
</div>';
}
} else {
redirect('?');
}
nav('?act=view&id='.$id);
?>