if ($_REQUEST['do'] == 'post_thanks_add')
{
($hook = vBulletinHook::fetch_hook('post_thanks_main_add_thanks_start')) ? eval($hook) : false;
$postinfo = array_merge($postinfo, fetch_userinfo($postinfo['userid']));
if (post_thanks_off($forumid, $postinfo, $threadinfo['firstpostid']) || !can_thank_this_post($postinfo, $threadinfo['isdeleted']) || thanked_already($postinfo))
{
$using_ajax ? exit : print_no_permission();
}
add_thanks($postinfo);
($hook = vBulletinHook::fetch_hook('post_thanks_main_add_thanks_end')) ? eval($hook) : false;
if ($using_ajax)
{
$thanks = fetch_thanks($postid, '', true);
$postinfo['post_thanks_bit'] = fetch_thanks_bit($forumid, $thanks);
$postinfo['post_thanks_amount'] = $postinfo['post_thanks_amount'] + 1;
$postinfo['post_thanks_amount_formatted'] = vb_number_format($postinfo['post_thanks_amount']);
if ($vbulletin->options['post_thanks_delete_own'])
{
$postinfo['show_thanks_remove_option'] = true;
}
$echo = fetch_post_thanks_template($postinfo);
echo "$echo";
exit;
}
else
{
$vbulletin->url = "showthread.php?$session[sessionurl]p=$postid";
eval(print_standard_redirect('redirect_post_thanks'));
}
}