<?php
function thx(&$post)
{
global $db, $mybb, $lang ,$session, $theme, $altbg, $templates, $thx_cache;
if(!$mybb->settings['thx_active'] || !empty($session->is_spider))
{
return false;
}
$lang->load("thx");
if($mybb->user['uid'] != 0 && $mybb->settings['thx_hidesystem_ignoregroups'] != 0)
{
$groups = explode(",", $mybb->settings['thx_hidesystem_ignoregroups']);
if($mybb->settings['thx_hidesystem_ignoregroups'] == 0 || in_array($mybb->user['usergroup'], $groups))
{
return false;
}
}
if($b = $post['pthx'])
{
$entries = build_thank($post['pid'], $b);
}
else
{
$entries = "";
}
if($mybb->user['uid'] != 0 && $mybb->user['uid'] != $post['uid'])
{
if(!$b)
{
$post['thanks'] = "<a id=\"a{$post['pid']}\" onclick=\"var uno = thx({$post['pid']});var dos = hideuntilthanks_reload(); return uno && dos;\" href=\"showthread.php?action=thank&tid={$post['tid']}&pid={$post['pid']}\"><img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_thx.gif\" border=\"0\" alt=\"$lang->thx_main\" title=\"$lang->thx_main\" id=\"i{$post['pid']}\" /></a>";
}
else if($mybb->settings['thx_del'] == "1")
{
$post['thanks'] = "<a id=\"a{$post['pid']}\" onclick=\"javascript:return rthx({$post['pid']});\" href=\"showthread.php?action=remove_thank&tid={$post['tid']}&pid={$post['pid']}\">
<img src=\"{$mybb->settings['bburl']}/{$theme['imgdir']}/postbit_rthx.gif\" border=\"0\" alt=\"$lang->thx_remove\" title=\"$lang->thx_remove\" id=\"i{$post['pid']}\" /></a>";
}
else
{
$post['thanks'] = "<!-- remove thanks disabled by administrator -->