Аплоудишь файлы
mod_install/thx_light.xml
style_images\p_thanks.gif
в корень своего форума.
Заходишь в админ панель форума - Вкладка компоненты. (FSY22) Universal Mod Installer -> Manage Mod Installations page -> Ищите мод в списке. Нажимаете на серую кнопку Options рядом с ним и затем на Install
Открываешь фаил index.php
Ищешь.
КОД
"reg" => array( "register" , 'register' , array('profilefields') ),
Ниже добавляешь
КОД
"thanks" => array( "thanks" , 'thanks' , array() ),
---
Ищешь
КОД
//===========================================================================
// REQUIRE AND RUN
//===========================================================================
Ниже добавляешь
КОД
// Thanks Light - Adapted By ThiagoInfo - Start
if($ipsclass->input['act'] == "thanks")
{
$output = "";
$thpid = $ipsclass->input['pid'];
$divid = "thank_".$ipsclass->input['pid'];
$userpost = $ipsclass->input['usp'];
$userpostid = $ipsclass->input['tid'];
if (!$thpid || !$ipsclass->member['id'])
{
return;
}
$userid = $ipsclass->member['id'];
$username = $ipsclass->member['members_display_name'];
$ipsclass->DB->query("INSERT INTO ibf_post_thanks (userid, username, postid) VALUES('$userid', '$username', '$thpid')");
$query = $ipsclass->DB->query("SELECT thanks_point FROM ibf_members WHERE id = '$userpostid'");
$row = $ipsclass->DB->fetch_row($query);
$thanks_point = $row['thanks_point'];
++$thanks_point;
$ipsclass->DB->query("UPDATE ibf_members SET thanks_point ='$thanks_point' where id = '$userpostid'");
$query = $ipsclass->DB->query("SELECT * FROM ibf_post_thanks WHERE postid = '$thpid' ORDER BY username ASC");
$thank_tot = $ipsclass->DB->get_num_rows($query);
if ($thank_tot)
{
$thank_text1 = "<div class=\"row1\" colspan=\"2\" align=\"top\"><strong>The Following {$thank_tot} Users Say Thank You to {$userpost} For This Useful Post:</strong></div>";
while($row = $ipsclass->DB->fetch_row($query))
{
$thank_text .= "<a href=\"index.php?showuser=".$row['userid']."\">".$row['username']."</a>, ";
}
$thank_text = preg_replace( "/,\s+$/", "" , $thank_text);
$output = "{$thank_text1} {$thank_text}";
$output = str_replace("|", "", $output);
}
echo "$divid|$output";
exit;
}
// Thanks Light - Adapted By ThiagoInfo - End
Открываем фаил sources/action_public/topics.phpИщем
КОД
//-----------------------------------------
// Siggie stuff
//-----------------------------------------
Выше добавляем
КОД
// Thanks Ajax Adaptex By ThiagoInfo - Start
if ($this->ipsclass->vars['thanks_mod_enable'])
{
$thank_pid = $row['pid'];
if ($this->ipsclass->vars['thx_topics_replies'])
{
$row['thanks_button'] = "<a style=\"cursor:pointer;\" id=\"thank_".$thank_pid."b\" onclick=\"thanks_add('thanks', '{$thank_pid}', '{$row['author_name']}','{$row['author_id']}')\"><img src=\"style_images/<#IMG_DIR#>/p_thanks.gif\" alt=\"Thanks\" title=\"Thanks\" /></a>";
}
if ($row['pid'] == $this->topic['topic_firstpost'])
{
$row['thanks_button'] = "<a style=\"cursor:pointer;\" id=\"thank_".$thank_pid."b\" onclick=\"thanks_add('thanks', '{$thank_pid}', '{$row['author_name']}','{$row['author_id']}')\"><img src=\"style_images/<#IMG_DIR#>/p_thanks.gif\" alt=\"Thanks\" title=\"Thanks\" /></a>";
}
if ($this->ipsclass->member['id'] == $row['author_id'] || !$this->ipsclass->member['id'])
{
$row['thanks_button'] = "";
}
$thank_text = "";
$thank_text1 = "";
$tquery = $this->ipsclass->DB->query("SELECT * FROM ibf_post_thanks WHERE postid = '$thank_pid' ORDER BY username ASC");
$thank_tot = $this->ipsclass->DB->get_num_rows($tquery);
if ($thank_tot)
{
$thank_text1 = "<div class=\"row1\" colspan=\"2\" align=\"top\"><strong>{$this->ipsclass->lang['thx_thanks1']} {$thank_tot} {$this->ipsclass->lang['thx_thanks2']} {$row['author_name']} {$this->ipsclass->lang['thx_thanks3']}:</strong></div>";
while($th_row =$this->ipsclass->DB->fetch_row($tquery))
{
if ($this->ipsclass->member['id'] == $th_row['userid'])
{
$row['thanks_button'] = "";
}
$thank_text .= "<a href=\"index.php?showuser=".$th_row['userid']."\">".$th_row['username']."</a>, ";
}
$thank_text = preg_replace( "/,\s+$/", "" , $thank_text);
}
$row['who_thanks'] = "<tr><td class=\"row2\" colspan=\"2\" align=\"top\"><div id=\"";
$row['who_thanks'] .= "thank_".$thank_pid."\"> \n{$thank_text1} {$thank_text}</div></td></tr>\n";
if ($this->ipsclass->vars['thx_member_display'])
{
$thanksquery = $this->ipsclass->DB->query("SELECT thanks_point FROM ibf_members WHERE id = '{$poster['id']}'");
$thanks = $this->ipsclass->DB->fetch_row($thanksquery);
$poster['thanks_point'] = $this->ipsclass->compiled_templates['skin_topic']->member_thanks_point( $thanks['thanks_point'] );
}
}
//Thanks Ajax Adaptex By ThiagoInfo - End
Редактирование скинов (* ваш скин)
Внеший вид > * > Редактировать HTML шаблоны > Topic View > RenderRow:
Ищем
КОД
<!--Begin Msg Number {$post['pid']}-->
ниже добавляем
КОД
<script type="text/javascript">
<!--
function default_request() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var thanks_http = default_request();
var thanksn = new ajax_request();
function thanks_add(act, pid, usp, tid) {
thanksn.show_loading();
thanks_http.open('get', 'index.php?act='+act+'&pid='+pid+'&usp='+usp+'&tid='+tid);
thanks_http.onreadystatechange = thanks_handleResponse;
thanks_http.send(null);
}
function thanks_handleResponse() {
if(thanks_http.readyState == 4){
var response = thanks_http.responseText;
var update = new Array();
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById(update[0]).innerHTML = update[1];
var update2 = update[0] + 'b';
document.getElementById(update2).innerHTML = "";
thanksn.hide_loading();
}
}
}
//-->
</script>
Ищем
КОД
{$author['member_posts']}<br />
Ниже добавляем
КОД
{$author['thanks_point']}<br />
Ищем
КОД
<td class="catend" colspan="2">
перед <tr> добавляем
КОД
{$post['who_thanks']}
Ищем
КОД
{$post['delete_button']}
после добавляем
КОД
{$post['thanks_button']}
При необходимости можем подогнать мод под себя через настройки
Admin CP > TOOLS & SETTINGS > Thanks Mod Light - ajax
Языки правим в cache/lang_cache/*/lang_boards.php (Писал по памяти, не судите за ошибки)