} if ($allow_list[0] != "all") { $join = "LEFT JOIN " . PREFIX . "_post ON " . PREFIX . "_comments.post_id=" . PREFIX . "_post.id "; if ($config['allow_multi_category']) { $where[] = PREFIX . "_post.category regexp '[[:<:]](" . implode('|', $allow_list) . ")[[:>:]]'"; } else { $where[] = PREFIX . "_post.category IN ('" . implode("','", $allow_list) . "')"; } } else { $join = ""; } if ($config['allow_cmod']) { $where[] = PREFIX . "_comments.approve=1"; } if (count($where)) { $where = implode(" AND ", $where); $where = "WHERE " . $where; } else { $where = ""; } $sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_comments " . $join . $where; $row_count = $db->super_query($sql_count); if ($row_count['count']) { include_once ENGINE_DIR . '/classes/comments.class.php'; $comments = new DLE_Comments($db, $row_count['count'], intval($config['comm_nummers'])); $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, " . PREFIX . "_comments.date, " . PREFIX . "_comments.autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, name, " . USERPREFIX . "_users.email, news_num, " . USERPREFIX . "_users.comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, icq, " . USERPREFIX . "_users.xfields, " . PREFIX . "_post.title, " . PREFIX . "_post.date as newsdate, " . PREFIX . "_post.alt_name, " . PREFIX . "_post.category FROM " . PREFIX . "_comments LEFT JOIN " . PREFIX . "_post ON " . PREFIX . "_comments.post_id=" . PREFIX . "_post.id LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id " . $where . " ORDER BY id desc"; $comments->build_comments('comments.tpl', 'lastcomments'); $comments->build_navigation('navigation.tpl', false, $user_query); } else { msgbox($lang['all_info'], $lang['err_last']); }
} if (check_ip($banned_info['ip'])) { die("error"); } $tpl = new dle_template(); $tpl->dir = ROOT_DIR . '/templates/' . $_REQUEST['skin']; define('TEMPLATE_DIR', $tpl->dir); $ajax_adds = true; $_POST['name'] = convert_unicode($_POST['name'], $config['charset']); $_POST['mail'] = convert_unicode($_POST['mail'], $config['charset']); $_POST['comments'] = convert_unicode($_POST['comments'], $config['charset']); $_POST['question_answer'] = convert_unicode($_POST['question_answer'], $config['charset']); require_once ENGINE_DIR . '/modules/addcomments.php'; if ($CN_HALT != TRUE) { include_once ENGINE_DIR . '/classes/comments.class.php'; $comments = new DLE_Comments($db, 1, 1); $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, icq, xfields FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '{$post_id}' order by id DESC"; $comments->build_comments('comments.tpl', 'ajax'); } if ($_POST['editor_mode'] == "wysiwyg") { $clear_value = "oUtil.obj.focus();oUtil.obj.loadHTML('');"; } else { $clear_value = "form.comments.value = '';"; } if ($user_group[$member_id['user_group']]['comments_question']) { $qs = $db->super_query("SELECT id, question FROM " . PREFIX . "_question ORDER BY RAND() LIMIT 1"); $qs['question'] = htmlspecialchars(stripslashes($qs['question']), ENT_QUOTES); $_SESSION['question'] = $qs['id']; } if ($CN_HALT) { $stop = implode('<br /><br />', $stop);
$tpl->result['content'] = show_attach($tpl->result['content'], $news_id); } } if (!$news_found and !$perm) { msgbox($lang['all_err_1'], "<b>{$user_group[$member_id['user_group']]['group_name']}</b> " . $lang['news_err_28']); } elseif (!$news_found) { @header("HTTP/1.0 404 Not Found"); msgbox($lang['all_err_1'], $lang['news_err_12']); } //#################################################################################################################### // Просмотр комментариев //#################################################################################################################### if ($allow_comments and $news_found) { if ($comments_num > 0) { include_once ENGINE_DIR . '/classes/comments.class.php'; $comments = new DLE_Comments($db, $comments_num, intval($config['comm_nummers'])); if ($config['comm_msort'] == "" or $config['comm_msort'] == "ASC") { $comm_msort = "ASC"; } else { $comm_msort = "DESC"; } if ($config['tree_comments']) { $comm_msort = "ASC"; } if ($config['allow_cmod']) { $where_approve = " AND " . PREFIX . "_comments.approve=1"; } else { $where_approve = ""; } $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, " . PREFIX . "_comments.rating, " . PREFIX . "_comments.vote_num, " . PREFIX . "_comments.parent, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, xfields FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '{$news_id}'" . $where_approve . " ORDER BY " . PREFIX . "_comments.id " . $comm_msort; if ($allow_full_cache and $config['allow_comments_cache']) {
$link_page = $config['http_home_url'] . get_url($category_id) . "/" . 'page,1,'; $news_name = $row['alt_name']; } else { $row['alt_name'] = $row['id'] . "-" . $row['alt_name']; $link_page = $config['http_home_url'] . 'page,1,'; $news_name = $row['alt_name']; } } else { $link_page = $config['http_home_url'] . date('Y/m/d/', $row['date']) . 'page,1,'; $news_name = $row['alt_name']; } } else { $link_page = ""; $news_name = ""; } $comments = new DLE_Comments($db, $row['comm_num'], intval($config['comm_nummers'])); if ($config['comm_msort'] == "") { $config['comm_msort'] = "ASC"; } if ($config['allow_cmod']) { $where_approve = " AND " . PREFIX . "_comments.approve='1'"; } else { $where_approve = ""; } $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, icq, xfields FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '{$news_id}'" . $where_approve . " ORDER BY date " . $config['comm_msort']; $comments->build_comments('comments.tpl', 'ajax', $allow_full_cache); $comments->build_navigation('navigation.tpl', $link_page . "{page}," . $news_name . ".html#comment", $user_query); if ($config['comm_msort'] == "DESC") { $tpl->result['comments'] = "<div id=\"dle-ajax-comments\"></div>" . $tpl->result['comments']; } else { $tpl->result['comments'] = $tpl->result['comments'] . "<div id=\"dle-ajax-comments\"></div>";
$tpl->result['content'] = str_ireplace('[shortresult]', '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[/shortresult]', '', $tpl->result['content']); } if ($config['files_allow'] == "yes") { if (strpos($tpl->result['content'], "[attachment=") !== false) { $tpl->result['content'] = show_attach($tpl->result['content'], $attachments); } } } // Вывод результатов поиска в комментариях if ($titleonly == 1) { include_once ENGINE_DIR . '/classes/comments.class.php'; if ($search_start) { $_GET['cstart'] = $search_start / $config['search_number'] + 1; } $comments = new DLE_Comments($db, $count_result, intval($config['search_number'])); $comments->query = $sql_find . " ORDER BY id desc"; $comments->build_comments('searchresult.tpl', 'lastcomments'); $found_result = $comments->intern_count; $to_num = $search_start + $found_result; $tpl->result['content'] = preg_replace("'\\[searchposts\\].*?\\[/searchposts\\]'si", '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[searchcomments]', '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[/searchcomments]', '', $tpl->result['content']); if ($showposts == 0) { $tpl->result['content'] = preg_replace("'\\[shortresult\\].*?\\[/shortresult\\]'si", '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[fullresult]', '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[/fullresult]', '', $tpl->result['content']); } else { $tpl->result['content'] = preg_replace("'\\[fullresult\\].*?\\[/fullresult\\]'si", '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[shortresult]', '', $tpl->result['content']); $tpl->result['content'] = str_ireplace('[/shortresult]', '', $tpl->result['content']);