Файл: CMS/core/modules/comments.inc.php
Строк: 68
<?php
if (!defined('CMS')) { die('Access Denied!'); }
if (!$id || !$comm_type || !$comm_url) die('Error!');
$onpage = !empty($config['comm_num']) ? num($config['comm_num']) : 10;
if ($page > 1) $from = ($page - 1) * $onpage; else $from = 0;
$_SESSION[SP]['comm'] = !empty($_SESSION[SP]['comm']) ? num($_SESSION[SP]['comm']) : 1;
$_SESSION[SP]['comm'] = (!empty($_GET['sort']) && in_array($_GET['sort'],array(1,2))) ? num($_GET['sort']) : num($_SESSION[SP]['comm']);
$order = ($_SESSION[SP]['comm'] == 1) ? 'DESC' : 'ASC';
$coms = $db->selectPage( $total, "SELECT `c`.*, `v`.`visit_nowtime`, `u`.`users_gender`
FROM ?_comments `c`
LEFT JOIN ?_users_visit `v`
ON `c`.`comm_author` = `v`.`visit_user`
LEFT JOIN ?_users `u`
ON `c`.`comm_author` = `u`.`users_login`
WHERE `c`.`comm_type` = ? AND `c`.`comm_post` = ?
ORDER BY `c`.`comm_date` " . $order . "
LIMIT ?d, ?d", $comm_type, $id, $from, $onpage );
echo '<div class="b">' . icon('comment.png', 'icons');
echo '<span id="comm"><b>Комментарии</b> (' . num($total) . ')</span><br />';
echo 'Показывать новые: ';
if ($_SESSION[SP]['comm'] == 1) echo '<a href="' . gen_uri($comm_url, $id, 'sort=2&' . RND) . '">вверху</a> | <b>внизу</b></div>';
else echo '<b>вверху</b> | <a href="' . gen_uri($comm_url, $id, 'sort=1&' . RND) . '">внизу</a></div>';
if (!empty($coms) && $total > 0) {
if (is_admin()) {
echo '<form action="' . gen_uri($comm_url, $id, 'rnd=' . $_SESSION['token'] . '&' . RND) . '" method="post" name="comm">';
}
$i = $from + 1;
foreach($coms as $com) {
$cid = num($com['comm_id']);
echo '<div class="b">';
echo '<div class="img">' . $i++ . '. ' . user_visit_icon($com['comm_author'], $com['users_gender'], $com['visit_nowtime']) . '</div>';
echo '<b>' . users_anketa($com['comm_author']) . '</b>';
echo '<div class="right"> (' . get_date(strtotime($com['comm_date'])) . ')</div><br />';
echo nl2br(bb_code($com['comm_text'])) . '<br />';
if (is_admin()) {
echo '<input type="checkbox" name="del[]" value="' . $cid . '" />';
}
if (!empty($config['anonymity'])) {
echo '<span class="data">(' . $com['comm_ua'] . ', ' . $com['comm_ip'] . ')</span>';
}
echo '</div>';
}
echo show_pages(gen_uri($comm_url, $id, RND));
if (is_admin()) {
echo '<div class="b">';
echo '<input type="checkbox" name="master_box" title="Отметить всё" onclick="javascript:ckeck_uncheck_all()">';
echo '<input type="submit" class="btns" value="Удалить выбранное" /></form><br /></div>';
echo <<<JSCRIPT
<script language='JavaScript' type="text/javascript">
<!--
function ckeck_uncheck_all() {
var frm = document.comm;
if(frm.master_box.checked == true){ frm.master_box.checked = false; }
else{ frm.master_box.checked = true; }
for (var i=0;i<frm.elements.length;i++) {
var elmnt = frm.elements[i];
if (elmnt.type=='checkbox') {
if(frm.master_box.checked == true){ elmnt.checked=false; }
else{ elmnt.checked=true; }
}
}
}
-->
</script>
JSCRIPT;
}
}
?>