function ShowComments() {
global $prefix, $db, $pagenum, $admin_file;
head();
NaviComments();
OpenTable();
if ($pagenum == "") $pagenum = 1;
$storynum = 50;
$offset = ($pagenum-1) * $storynum ;
$result = $db->sql_query("SELECT a.id, a.cid, a.modul, a.name, a.comment, b.user_name FROM ".$prefix."_comment AS a
LEFT JOIN ".$prefix."_users AS b ON (a.uid=b.user_id) ORDER BY date DESC LIMIT $offset, $storynum");
echo "<center><font class=\"option\"><b>"._COMMENTS."</b></font><br><br>"
."<script language=\"JavaScript\" type=\"text/javascript\" src=\"javascripts/SortTable.js\"></script>"
."<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" class=\"sort\" id=\"sort_id\"><tr>"
."<th>"._ID."</th><th>"._MODUL."</th><th>"._NICKNAME."</th><th
width=\"60%\">"._COMMENT."</th><th>"._FUNCTIONS."</th></tr>";
while (list($id, $cid, $com_modul, $com_name, $com_text, $user_name) = $db->sql_fetchrow($result)) {
$com_name = ($user_name) ? $user_name : $com_name;
if($com_modul=="News"){$link="index.php?name=$com_modul&op=article&sid=".$cid."#".$cid."";}
elseif($com_modul=="Files"){$link="index.php?name=$com_modul&op=view_file&lid=".$cid."#".$cid."";}
elseif($com_modul=="Voting"){$link="index.php?name=$com_modul&op=poll_result&poll_id=".$cid."#".$cid."";}
echo "<tr class=\"bgcolor1\">"
."<td align=\"center\">$id</td>"
."<td align=\"center\">$com_modul</td>"
."<td>$com_name</td>"
."<td>".bb_decode($com_text)."</td>";
echo "<td align=\"center\">
<a href=\"$link\" title=\"посмотреть\"><img src=\"images/show.gif\" border=\"0\" alt=\"посмотреть\"></a>
<a href=\"".$admin_file.".php?op=EditComments&id=$id\" title=\""._EDIT."\"><img src=\"images/edit.gif\" border=\"0\"
alt=\""._EDIT."\"></a> <a
href=\"".$admin_file.".php?op=DeleteComments&id=$id&cid=$cid&module_name=$com_modul&com_text=".htmlspecialchars($com_text)."\
" title=\""._DELETE."\"><img src=images/delete.gif border=\"0\" alt=\""._DELETE."\"></a></td>";
echo "</tr>";
}
echo "</table>";
CloseTable();
list($numstories) = $db->sql_fetchrow($db->sql_query("SELECT Count(id) FROM ".$prefix."_comment"));
$numpages = ceil($numstories / $storynum);
num_page("", $numstories, $numpages, $storynum, "op=ShowComments&");
foot();
}