/** * Helper function, used for pretty print. * @param type $info */ function print_info($info, $suffix = '', $htmlspecialchars = true) { if (isset($info) && !empty($info)) { echo replace_links(($htmlspecialchars ? htmlspecialchars($info) : $info) . $suffix); } else { echo '®Not_available®'; } }
} else { $onload_scripts = ""; } $ajax .= <<<HTML //--> </script> HTML; if (stripos($tpl->copy_template, "{jsfiles}") !== false) { $tpl->set('{headers}', $metatags); $tpl->set('{jsfiles}', $js_array); } else { $tpl->set('{headers}', $metatags . "\n" . $js_array); } $tpl->set('{AJAX}', $ajax); $tpl->set('{info}', $tpl->result['info']); $tpl->set('{content}', "<div id='dle-content'>" . $tpl->result['content'] . "</div>"); $tpl->compile('main'); if ($config['allow_links']) { $tpl->result['main'] = replace_links($tpl->result['main'], $replace_links['all']); } $tpl->result['main'] = str_ireplace('{THEME}', $config['http_home_url'] . 'templates/' . $config['skin'], $tpl->result['main']); if ($replace_url) { $tpl->result['main'] = str_replace($replace_url[0] . "/", $replace_url[1] . "/", $tpl->result['main']); } $tpl->result['main'] = str_replace('src="http://' . $_SERVER['HTTP_HOST'] . '/', 'src="/', $tpl->result['main']); echo $tpl->result['main']; $tpl->global_clear(); $db->close(); echo "\n<!-- DataLife Engine Copyright SoftNews Media Group (http://dle-news.ru) -->\r\n"; GzipOut();
unset($temp_array); unset($value2); unset($value3); } if (empty($xfieldsdata[$value[0]])) { $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template); } else { $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template); } $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]); if ($config['allow_links'] and $value[3] == "textarea" and function_exists('replace_links')) { $xfieldsdata[$value[0]] = replace_links($xfieldsdata[$value[0]], $replace_links['news']); } $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template); if (preg_match("#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches)) { $count = intval($matches[1]); $xfieldsdata[$value[0]] = str_replace("</p><p>", " ", $xfieldsdata[$value[0]]); $xfieldsdata[$value[0]] = strip_tags($xfieldsdata[$value[0]], "<br>"); $xfieldsdata[$value[0]] = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $xfieldsdata[$value[0]]))))); if ($count and dle_strlen($xfieldsdata[$value[0]], $config['charset']) > $count) { $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $count, $config['charset']); if ($temp_dmax = dle_strrpos($xfieldsdata[$value[0]], ' ', $config['charset'])) { $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset']); } } $tpl->set($matches[0], $xfieldsdata[$value[0]]); }
$tpl->set('{images}', ''); } $row['full_story'] = preg_replace("#<!--TBegin(.+?)<!--TEnd-->#is", "", $row['full_story']); $row['full_story'] = preg_replace("#<!--MBegin(.+?)<!--MEnd-->#is", "", $row['full_story']); $row['full_story'] = preg_replace("'\\[attachment=(.*?)\\]'si", "", $row['full_story']); $row['full_story'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#ims", "", $row['full_story']); $row['full_story'] = trim(htmlspecialchars(strip_tags(stripslashes(str_replace("<br />", " ", $row['full_story']))), ENT_QUOTES, $config['charset'])); if ($row['full_story'] == "") { $row['full_story'] = $row['short_story']; } $tpl->set('{full-story}', $row['full_story']); } } else { $row['short_story'] = stripslashes($row['short_story']); if ($config['allow_links'] and function_exists('replace_links') and isset($replace_links['news'])) { $row['short_story'] = replace_links($row['short_story'], $replace_links['news']); } if (stripos($tpl->copy_template, "{image-") !== false) { $images = array(); preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['short_story'], $media); $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "\$3", $media[0]); foreach ($data as $url) { $info = pathinfo($url); if (isset($info['extension'])) { if ($info['filename'] == "spoiler-plus" or $info['filename'] == "spoiler-minus") { continue; } $info['extension'] = strtolower($info['extension']); if ($info['extension'] == 'jpg' || $info['extension'] == 'jpeg' || $info['extension'] == 'gif' || $info['extension'] == 'png') { array_push($images, $url); }
function compile_comment($row, $area, $indent) { global $config, $tpl, $is_logged, $member_id, $user_group, $lang, $dle_login_hash, $_TIME, $allow_comments_ajax, $ajax_adds, $news_date, $news_author, $replace_links; $PHP_SELF = $config['http_home_url'] . "index.php"; $this->intern_count++; $tpl->result['comments'] = ""; $row['date'] = strtotime($row['date']); $row['gast_name'] = stripslashes($row['gast_name']); $row['gast_email'] = stripslashes($row['gast_email']); $row['name'] = stripslashes($row['name']); if (!$row['is_register'] or $row['name'] == '') { if ($row['gast_email'] != "") { $tpl->set('{author}', "<a href=\"mailto:" . htmlspecialchars($row['gast_email'], ENT_QUOTES, $config['charset']) . "\">" . $row['gast_name'] . "</a>"); } else { $tpl->set('{author}', $row['gast_name']); } $tpl->set('{login}', $row['gast_name']); $tpl->set('[profile]', ""); $tpl->set('[/profile]', ""); } else { if ($config['allow_alt_url']) { $go_page = $config['http_home_url'] . "user/" . urlencode($row['name']) . "/"; $tpl->set('[profile]', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">"); } else { $go_page = "{$PHP_SELF}?subaction=userinfo&user="******"<a href=\"{$PHP_SELF}?subaction=userinfo&user="******"\">"); } $go_page = "onclick=\"ShowProfile('" . urlencode($row['name']) . "', '" . htmlspecialchars($go_page, ENT_QUOTES, $config['charset']) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\""; if ($config['allow_alt_url']) { $tpl->set('{author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">" . $row['name'] . "</a>"); } else { $tpl->set('{author}', "<a {$go_page} href=\"{$PHP_SELF}?subaction=userinfo&user="******"\">" . $row['name'] . "</a>"); } $tpl->set('{login}', $row['name']); $tpl->set('[/profile]', "</a>"); } if ($is_logged and $member_id['user_group'] == '1') { $tpl->set('{ip}', "IP: <a onclick=\"return dropdownmenu(this, event, IPMenu('" . $row['ip'] . "', '" . $lang['ip_info'] . "', '" . $lang['ip_tools'] . "', '" . $lang['ip_ban'] . "'), '190px')\" href=\"https://www.nic.ru/whois/?ip={$row['ip']}\" target=\"_blank\">{$row['ip']}</a>"); } else { $tpl->set('{ip}', ''); } $edit_limit = false; if (!$user_group[$member_id['user_group']]['edit_limit']) { $edit_limit = true; } elseif ($row['date'] + $user_group[$member_id['user_group']]['edit_limit'] * 60 > $_TIME) { $edit_limit = true; } if ($is_logged and $edit_limit and ($member_id['name'] == $row['name'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_editc'] or $user_group[$member_id['user_group']]['edit_allc'])) { $tpl->set('[com-edit]', "<a onclick=\"ajax_comm_edit('" . $row['id'] . "', '" . $area . "'); return false;\" href=\"" . $config['http_home_url'] . "index.php?do=comments&action=comm_edit&id=" . $row['id'] . "&area=" . $area . "\">"); $tpl->set('[/com-edit]', "</a>"); $allow_comments_ajax = true; } else { $tpl->set_block("'\\[com-edit\\](.*?)\\[/com-edit\\]'si", ""); } if ($is_logged and $edit_limit and ($member_id['name'] == $row['name'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_delc'] or $member_id['user_group'] == '1' or $user_group[$member_id['user_group']]['del_allc'])) { $tpl->set('[com-del]', "<a href=\"javascript:DeleteComments('{$row['id']}', '{$dle_login_hash}')\">"); $tpl->set('[/com-del]', "</a>"); } else { $tpl->set_block("'\\[com-del\\](.*?)\\[/com-del\\]'si", ""); } if ($is_logged and $user_group[$member_id['user_group']]['allow_admin'] and $user_group[$member_id['user_group']]['del_allc']) { $tpl->set('[spam]', "<a href=\"javascript:MarkSpam('{$row['id']}', '{$dle_login_hash}');\">"); $tpl->set('[/spam]', "</a>"); } else { $tpl->set_block("'\\[spam\\](.*?)\\[/spam\\]'si", ""); } if ($user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) { $tpl->set('{mass-action}', "<input name=\"selected_comments[]\" value=\"{$row['id']}\" type=\"checkbox\" />"); } else { $tpl->set('{mass-action}', ""); } if ($area == 'lastcomments') { $tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si", ""); $tpl->set_block("'\\[reply\\](.*?)\\[/reply\\]'si", ""); } else { if ($user_group[$member_id['user_group']]['allow_addc'] and $config['allow_comments']) { if (!$row['is_register'] or $row['name'] == '') { $row['name'] = $row['gast_name']; } else { $row['name'] = $row['name']; } $tpl->set('[fast]', "<a onmouseover=\"dle_copy_quote('" . str_replace(array(" ", "'"), array(" ", "&#039;"), $row['name']) . "');\" href=\"#\" onclick=\"dle_ins('{$row['id']}'); return false;\">"); $tpl->set('[/fast]', "</a>"); $tpl->set('[/reply]', "</a>"); if ($config['tree_comments']) { if ($config['tree_comments_level'] and ($indent >= $config['tree_comments_level'] or $this->indent >= $config['tree_comments_level'])) { $tpl->set('[reply]', "<a onclick=\"dle_fastreply('" . str_replace(array(" ", "'"), array(" ", "&#039;"), $row['name']) . "'); return false;\" href=\"#\">"); } else { if ($this->indent) { $indent = $this->indent; } $tpl->set('[reply]', "<a onclick=\"dle_reply('{$row['id']}', '{$indent}', '{$config['simple_reply']}'); return false;\" href=\"#\">"); } } else { $tpl->set('[reply]', "<a onclick=\"dle_fastreply('" . str_replace(array(" ", "'"), array(" ", "&#039;"), $row['name']) . "'); return false;\" href=\"#\">"); } } else { $tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si", ""); $tpl->set_block("'\\[reply\\](.*?)\\[/reply\\]'si", ""); } } $tpl->set('{mail}', $row['gast_email']); $tpl->set('{id}', $row['id']); if (date('Ymd', $row['date']) == date('Ymd', $_TIME)) { $tpl->set('{date}', $lang['time_heute'] . langdate(", H:i", $row['date'])); } elseif (date('Ymd', $row['date']) == date('Ymd', $_TIME - 86400)) { $tpl->set('{date}', $lang['time_gestern'] . langdate(", H:i", $row['date'])); } else { $tpl->set('{date}', langdate($config['timestamp_comment'], $row['date'])); } $news_date = $row['date']; $tpl->copy_template = preg_replace_callback("#\\{date=(.+?)\\}#i", "formdate", $tpl->copy_template); if ($area == 'lastcomments') { $row['category'] = intval($row['category']); if ($config['allow_alt_url']) { if ($config['seo_type'] == 1 or $config['seo_type'] == 2) { if ($row['category'] and $config['seo_type'] == 2) { $full_link = $config['http_home_url'] . get_url($row['category']) . "/" . $row['post_id'] . "-" . $row['alt_name'] . ".html"; } else { $full_link = $config['http_home_url'] . $row['post_id'] . "-" . $row['alt_name'] . ".html"; } } else { $full_link = $config['http_home_url'] . date('Y/m/d/', strtotime($row['newsdate'])) . $row['alt_name'] . ".html"; } } else { $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['post_id']; } $tpl->set('{news_title}', "<a href=\"" . $full_link . "\">" . stripslashes($row['title']) . "</a>"); } else { $tpl->set('{news_title}', ""); } if ($this->xfound) { $xfieldsdata = xfieldsdataload($row['xfields']); foreach ($this->xfields as $value) { $preg_safe_name = preg_quote($value[0], "'"); if ($value[5] != 1 or $member_id['user_group'] == 1 or $is_logged and $row['is_register'] and $member_id['name'] == $row['name']) { if (empty($xfieldsdata[$value[0]])) { $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template); } else { $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template); } $tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", stripslashes($xfieldsdata[$value[0]]), $tpl->copy_template); } else { $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", "", $tpl->copy_template); $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); } } } if ($area == 'ajax' and isset($ajax_adds)) { $tpl->set('{comment-id}', "--"); } elseif ($area == 'lastcomments') { $tpl->set('{comment-id}', $this->total_comments - $this->cstart - $this->intern_count + 1); } else { if ($config['comm_msort'] == "ASC") { $tpl->set('{comment-id}', $this->cstart + $this->intern_count); } else { $tpl->set('{comment-id}', $this->total_comments - $this->cstart - $this->intern_count + 1); } } if (count(explode("@", $row['foto'])) == 2) { $tpl->set('{foto}', '//www.gravatar.com/avatar/' . md5(trim($row['foto'])) . '?s=' . intval($user_group[$row['user_group']]['max_foto'])); } else { if ($row['foto']) { if (strpos($row['foto'], "//") === 0) { $avatar = "http:" . $row['foto']; } else { $avatar = $row['foto']; } $avatar = @parse_url($avatar); if ($avatar['host']) { $tpl->set('{foto}', $row['foto']); } else { $tpl->set('{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto']); } } else { $tpl->set('{foto}', "{THEME}/dleimages/noavatar.png"); } } if ($row['is_register'] and $row['fullname']) { $tpl->set('[fullname]', ""); $tpl->set('[/fullname]', ""); $tpl->set('{fullname}', stripslashes($row['fullname'])); $tpl->set_block("'\\[not-fullname\\](.*?)\\[/not-fullname\\]'si", ""); } else { $tpl->set_block("'\\[fullname\\](.*?)\\[/fullname\\]'si", ""); $tpl->set('{fullname}', ""); $tpl->set('[not-fullname]', ""); $tpl->set('[/not-fullname]', ""); } if ($config['tree_comments']) { $tpl->set('[treecomments]', ""); $tpl->set('[/treecomments]', ""); $tpl->set_block("'\\[not-treecomments\\](.*?)\\[/not-treecomments\\]'si", ""); } else { $tpl->set('[not-treecomments]', ""); $tpl->set('[/not-treecomments]', ""); $tpl->set_block("'\\[treecomments\\](.*?)\\[/treecomments\\]'si", ""); } if ($indent or $this->indent) { $tpl->set_block("'\\[rootcomments\\](.*?)\\[/rootcomments\\]'si", ""); $tpl->set('[childrencomments]', ""); $tpl->set('[/childrencomments]', ""); } else { $tpl->set('[rootcomments]', ""); $tpl->set('[/rootcomments]', ""); $tpl->set_block("'\\[childrencomments\\](.*?)\\[/childrencomments\\]'si", ""); } if (isset($row['children'])) { $tpl->set('{replycount}', count($row['children'])); } else { $tpl->set('{replycount}', 0); } if ($row['user_id'] and $row['user_id'] == $member_id['user_id']) { $tpl->set('[comments-author]', ""); $tpl->set('[/comments-author]', ""); $tpl->set_block("'\\[not-comments-author\\](.*?)\\[/not-comments-author\\]'si", ""); } else { $tpl->set_block("'\\[comments-author\\](.*?)\\[/comments-author\\]'si", ""); $tpl->set('[not-comments-author]', ""); $tpl->set('[/not-comments-author]', ""); } if ($news_author and $row['user_id'] and $row['user_id'] == $news_author) { $tpl->set('[news-author]', ""); $tpl->set('[/news-author]', ""); $tpl->set_block("'\\[not-news-author\\](.*?)\\[/not-news-author\\]'si", ""); } else { $tpl->set_block("'\\[news-author\\](.*?)\\[/news-author\\]'si", ""); $tpl->set('[not-news-author]', ""); $tpl->set('[/not-news-author]', ""); } if ($row['is_register'] and $row['land']) { $tpl->set('[land]', ""); $tpl->set('[/land]', ""); $tpl->set('{land}', stripslashes($row['land'])); $tpl->set_block("'\\[not-land\\](.*?)\\[/not-land\\]'si", ""); } else { $tpl->set_block("'\\[land\\](.*?)\\[/land\\]'si", ""); $tpl->set('{land}', ""); $tpl->set('[not-land]', ""); $tpl->set('[/not-land]', ""); } if ($row['comm_num']) { $tpl->set('[comm-num]', ""); $tpl->set('[/comm-num]', ""); $tpl->set('{comm-num}', $row['comm_num']); $tpl->set_block("'\\[not-comm-num\\](.*?)\\[/not-comm-num\\]'si", ""); } else { $tpl->set('{comm-num}', 0); $tpl->set('[not-comm-num]', ""); $tpl->set('[/not-comm-num]', ""); $tpl->set_block("'\\[comm-num\\](.*?)\\[/comm-num\\]'si", ""); } if ($row['news_num']) { $tpl->set('[news-num]', ""); $tpl->set('[/news-num]', ""); $tpl->set('{news-num}', $row['news_num']); $tpl->set_block("'\\[not-news-num\\](.*?)\\[/not-news-num\\]'si", ""); } else { $tpl->set('{news-num}', 0); $tpl->set('[not-news-num]', ""); $tpl->set('[/not-news-num]', ""); $tpl->set_block("'\\[news-num\\](.*?)\\[/news-num\\]'si", ""); } if ($row['is_register'] and $row['reg_date']) { $tpl->set('{registration}', langdate("j.m.Y", $row['reg_date'])); } else { $tpl->set('{registration}', '--'); } if ($row['is_register'] and $row['lastdate']) { $tpl->set('{lastdate}', langdate("j.m.Y", $row['lastdate'])); if ($row['lastdate'] + 1200 > $_TIME or $row['user_id'] and $row['user_id'] == $member_id['user_id']) { $tpl->set('[online]', ""); $tpl->set('[/online]', ""); $tpl->set_block("'\\[offline\\](.*?)\\[/offline\\]'si", ""); } else { $tpl->set('[offline]', ""); $tpl->set('[/offline]', ""); $tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si", ""); } } else { $tpl->set('{lastdate}', '--'); $tpl->set_block("'\\[offline\\](.*?)\\[/offline\\]'si", ""); $tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si", ""); } if ($row['is_register'] and $row['signature'] and $user_group[$row['user_group']]['allow_signature']) { $tpl->set_block("'\\[signature\\](.*?)\\[/signature\\]'si", "\\1"); $tpl->set('{signature}', stripslashes($row['signature'])); } else { $tpl->set_block("'\\[signature\\](.*?)\\[/signature\\]'si", ""); } if ($is_logged) { $tpl->set('[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'comments')\">"); $tpl->set('[/complaint]', "</a>"); } else { $tpl->set_block("'\\[complaint\\](.*?)\\[/complaint\\]'si", ""); } if ($config['comments_rating_type'] == "1") { $tpl->set('[rating-type-2]', ""); $tpl->set('[/rating-type-2]', ""); $tpl->set_block("'\\[rating-type-1\\](.*?)\\[/rating-type-1\\]'si", ""); $tpl->set_block("'\\[rating-type-3\\](.*?)\\[/rating-type-3\\]'si", ""); } elseif ($config['comments_rating_type'] == "2") { $tpl->set('[rating-type-3]', ""); $tpl->set('[/rating-type-3]', ""); $tpl->set_block("'\\[rating-type-1\\](.*?)\\[/rating-type-1\\]'si", ""); $tpl->set_block("'\\[rating-type-2\\](.*?)\\[/rating-type-2\\]'si", ""); } else { $tpl->set('[rating-type-1]', ""); $tpl->set('[/rating-type-1]', ""); $tpl->set_block("'\\[rating-type-3\\](.*?)\\[/rating-type-3\\]'si", ""); $tpl->set_block("'\\[rating-type-2\\](.*?)\\[/rating-type-2\\]'si", ""); } if ($config['allow_comments_rating']) { $tpl->set('{rating}', ShowCommentsRating($row['id'], $row['rating'], $row['vote_num'], $user_group[$member_id['user_group']]['allow_comments_rating'])); $tpl->set('{vote-num}', "<span id=\"comments-vote-num-id-" . $row['id'] . "\">" . $row['vote_num'] . "</span>"); $tpl->set('[rating]', ""); $tpl->set('[/rating]', ""); if ($row['rating'] > 0) { $tpl->set('[positive-comment]', ""); $tpl->set('[/positive-comment]', ""); $tpl->set_block("'\\[negative-comment\\](.*?)\\[/negative-comment\\]'si", ""); $tpl->set_block("'\\[neutral-comment\\](.*?)\\[/neutral-comment\\]'si", ""); } elseif ($row['rating'] < 0) { $tpl->set('[negative-comment]', ""); $tpl->set('[/negative-comment]', ""); $tpl->set_block("'\\[positive-comment\\](.*?)\\[/positive-comment\\]'si", ""); $tpl->set_block("'\\[neutral-comment\\](.*?)\\[/neutral-comment\\]'si", ""); } else { $tpl->set('[neutral-comment]', ""); $tpl->set('[/neutral-comment]', ""); $tpl->set_block("'\\[positive-comment\\](.*?)\\[/positive-comment\\]'si", ""); $tpl->set_block("'\\[negative-comment\\](.*?)\\[/negative-comment\\]'si", ""); } if ($user_group[$member_id['user_group']]['allow_comments_rating']) { if ($config['comments_rating_type']) { $tpl->set('[rating-plus]', "<a href=\"#\" onclick=\"doCommentsRate('plus', '{$row['id']}'); return false;\" >"); $tpl->set('[/rating-plus]', '</a>'); if ($config['comments_rating_type'] == "2") { $tpl->set('[rating-minus]', "<a href=\"#\" onclick=\"doCommentsRate('minus', '{$row['id']}'); return false;\" >"); $tpl->set('[/rating-minus]', '</a>'); } else { $tpl->set_block("'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", ""); } } else { $tpl->set_block("'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", ""); $tpl->set_block("'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", ""); } } else { $tpl->set_block("'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", ""); $tpl->set_block("'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", ""); } } else { $tpl->set('{rating}', ""); $tpl->set('{vote-num}', ""); $tpl->set_block("'\\[rating\\](.*?)\\[/rating\\]'si", ""); $tpl->set_block("'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", ""); $tpl->set_block("'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", ""); } if (!$row['user_group']) { $row['user_group'] = 5; } $this->comments_group = $row['user_group']; if (strpos($tpl->copy_template, "[commentsgroup=") !== false) { $tpl->copy_template = preg_replace_callback("#\\[(commentsgroup)=(.+?)\\](.*?)\\[/commentsgroup\\]#is", array(&$this, 'check_group'), $tpl->copy_template); } if (strpos($tpl->copy_template, "[not-commentsgroup=") !== false) { $tpl->copy_template = preg_replace_callback("#\\[(not-commentsgroup)=(.+?)\\](.*?)\\[/not-commentsgroup\\]#is", array(&$this, 'check_group'), $tpl->copy_template); } if (strpos($tpl->copy_template, "[commentscount=") !== false) { $tpl->copy_template = preg_replace_callback("#\\[(commentscount)=(.+?)\\](.*?)\\[/commentscount\\]#is", array(&$this, 'check_commentscount'), $tpl->copy_template); } if (strpos($tpl->copy_template, "[not-commentscount=") !== false) { $tpl->copy_template = preg_replace_callback("#\\[(not-commentscount)=(.+?)\\](.*?)\\[/not-commentscount\\]#is", array(&$this, 'check_commentscount'), $tpl->copy_template); } if ($user_group[$row['user_group']]['icon']) { $tpl->set('{group-icon}', "<img src=\"" . $user_group[$row['user_group']]['icon'] . "\" alt=\"\" />"); } else { $tpl->set('{group-icon}', ""); } $tpl->set('{group-name}', $user_group[$row['user_group']]['group_prefix'] . $user_group[$row['user_group']]['group_name'] . $user_group[$row['user_group']]['group_suffix']); if (count($this->extras_rules)) { foreach ($this->extras_rules as $rules) { if ($rules[0] == 'set') { $tpl->set($rules[1], $rules[2]); } else { $tpl->set_block($rules[1], $rules[2]); } } } if ($config['allow_links'] and function_exists('replace_links') and isset($replace_links['comments'])) { $row['text'] = replace_links($row['text'], $replace_links['comments']); } if ($user_group[$member_id['user_group']]['allow_hide']) { $row['text'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['text'])); } else { $row['text'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $row['text']); } $tpl->set('{comment}', "<div id='comm-id-" . $row['id'] . "'>" . stripslashes($row['text']) . "</div>"); $tpl->compile('comments'); return $tpl->result['comments']; }
function custom_link($matches) { return replace_links($matches, 'custom'); }