Для версии DLE 9.2 и форума DLE 2.6
1. В файле: engine/modules/show.full.php, найти строчку:
$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, 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->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, reg_date, signature, foto, fullname, land, icq, forum_reputation, 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'];
2. В файле: engine/modules/lastcomments.php, найти строчку:
$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, reg_date, signature, foto, fullname, land, icq, " . USERPREFIX . "_users.xfields as xprofile, " . PREFIX . "_post.title, " . PREFIX . "_post.date as newsdate, " . PREFIX . "_post.alt_name, " . PREFIX . "_post.category, " . PREFIX . "_post.flag 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->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, reg_date, signature, foto, fullname, land, icq, forum_reputation, " . USERPREFIX . "_users.xfields as xprofile, " . PREFIX . "_post.title, " . PREFIX . "_post.date as newsdate, " . PREFIX . "_post.alt_name, " . PREFIX . "_post.category, " . PREFIX . "_post.flag 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";
3. В файле engine/classes/comments.class.php
Найти строчку:
$tpl->set( '{comment}', "<div id='comm-id-" . $row['id'] . "'>" . stripslashes( $row['text'] ) . "</div>" );
Ниже добавить:
//reputation
require_once ENGINE_DIR . '/data/forum_config.php';
require_once ENGINE_DIR . '/forum/sources/modules/dle_func.php';
if ($forum_config['reputation']) {
$rep_m = "<a onclick=\"FRep('-', '$row[user_id]', '$row[id]', '0');\"><img src='{THEME}/forum/images/rep_m.gif' alt='-' border='0' /></a> ";
$rep_p = " <a onclick=\"FRep('+', '$row[user_id]', '$row[id]', '0');\"><img src='{THEME}/forum/images/rep_p.gif' alt='+' border='0' /></a>";
$reputation = $rep_m . link_rep($row['name'], $row['forum_reputation']) . $rep_p;
$tpl->set('{reputation}', "<span id='rep-".$row['id']."'>".$reputation.&quo
t;</span>");
}
else {
$tpl->set('{reputation}', "--");
}
unset ($reputation);
//
4. В файле engine/modules/profile.php
Ищем строчку:
$tpl->set( '{lastdate}', langdate( "j F Y H:i", $row['lastdate'] ) );
Ниже добавим:
//reputation
require_once ENGINE_DIR . '/data/forum_config.php';
require_once ENGINE_DIR . '/forum/sources/modules/dle_func.php';
if ($forum_config['reputation']) {
$rep_m = "<a onclick=\"FRep('-', '$row[user_id]', '$row[id]', '0');\"><img src='{THEME}/forum/images/rep_m.gif' alt='-' border='0' /></a> ";
$rep_p = " <a onclick=\"FRep('+', '$row[user_id]', '$row[id]', '0');\"><img src='{THEME}/forum/images/rep_p.gif' alt='+' border='0' /></a>";
$reputation = $rep_m . link_rep($row['name'], $row['forum_reputation']) . $rep_p;
$tpl->set('{reputation}', "<span id='rep-".$row['id']."'>".$reputation.&quo
t;</span>");
}
else {
$tpl->set('{reputation}', "--");
}
unset ($reputation);
//
5. В директории engine/forum/sources/modules/ создать файл dle_func.php, с кодом:
<?php
if(!defined('DATALIFEENGINE')) die("Hacking attempt!");
//reputation
if (!function_exists("link_rep")) {
function link_rep($user, $title = false) {
global $config;
if (!$title) $title = "0";
if ($config['allow_alt_url'] == "yes") {
$forum_url = $config['http_home_url']."forum";
return("<a href='{$forum_url}/reputation/".urlencode($user)."/'>{$ti
tle}</a>");
}
else {
$forum_url = $config['http_home_url']."index.php?do=forum&";
return("<a href='{$forum_url}act=reputation&user=".urlencode($user)."'&
gt;{$title}</a>");
}
}
}
?>
6.В файле main.tpl вашего шаблона, после строки:
{AJAX}
вставить код:
[aviable=showfull|lastcomments|userinfo]
<script language="javascript" type="text/javascript">
function FRep(action, user_id, post_id, forum_id)
{
var cause = prompt("Введите причину", "");
if (cause)
{
ShowLoading('');
$.post(dle_root + "engine/forum/ajax/reputation.php", { action: action, skin: dle_skin, forum_id: forum_id, post_id: post_id, cause: cause, user_id:user_id}, function(data){
HideLoading('');
$('#rep-' + post_id).html(data);
});
}
return false;
};
</script>
[/aviable]
7. Ну и на последок в файлах шаблона: comments.tpl и userinfo.tpl, вставляем
{reputation}
куда вам надо.