} 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']); }
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'] = "<script language=\"JavaScript\" type=\"text/javascript\">\nvar form = document.getElementById('dle-comments-form');\n"; if (!$where_approve) {
} 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']) { $allow_full_cache = $news_id; } else { $allow_full_cache = false; } $comments->build_comments('comments.tpl', 'news', $allow_full_cache, $full_link); unset($tpl->result['comments']); if (isset($_GET['news_page']) and $_GET['news_page']) { $user_query = "newsid=" . $newsid . "&news_page=" . intval($_GET['news_page']); } else { $user_query = "newsid=" . $newsid; } $comments->build_navigation('navigation.tpl', $link_page . "{page}," . $news_name . ".html#comment", $user_query, $full_link); unset($comments); unset($tpl->result['commentsnavigation']); } if ($is_logged and $config['comments_restricted'] and $_TIME - $member_id['reg_date'] < $config['comments_restricted'] * 86400) { $lang['news_info_6'] = str_replace('{days}', intval($config['comments_restricted']), $lang['news_info_8']); $allow_add = false; } if (!isset($member_id['restricted'])) {
$comments = new DLE_Comments($db, $row['comm_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; $comments->build_comments('comments.tpl', 'ajax', $allow_full_cache); $comments->build_navigation('navigation.tpl', $link_page . "{page}," . $news_name . ".html#comment", $user_query, $full_link); if ($_GET['massact'] != "disable") { 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>"; } if ($user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) { $tpl->result['comments'] .= "\n<div class=\"mass_comments_action\">{$lang['mass_comments']} <select name=\"mass_action\"><option value=\"\">{$lang['edit_selact']}</option><option value=\"mass_combine\">{$lang['edit_selcomb']}</option><option value=\"mass_delete\">{$lang['edit_seldel']}</option></select> <input type=\"submit\" class=\"bbcodes\" value=\"{$lang['b_start']}\" /></div>\n<input type=\"hidden\" name=\"do\" value=\"comments\" /><input type=\"hidden\" name=\"dle_allow_hash\" value=\"{$dle_login_hash}\" /><input type=\"hidden\" name=\"area\" value=\"news\" />"; } } $tpl->result['comments'] = str_replace('{THEME}', $config['http_home_url'] . 'templates/' . $_REQUEST['skin'], $tpl->result['comments']); $tpl->result['commentsnavigation'] = str_replace('{THEME}', $config['http_home_url'] . 'templates/' . $_REQUEST['skin'], $tpl->result['commentsnavigation']); $tpl->result['comments'] = addcslashes($tpl->result['comments'], "\v\t\n\r\f\"\\/"); $tpl->result['comments'] = str_replace("{", '', $tpl->result['comments']);
} 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']); } }