Thread: Show Thread Enhancements - [AJAX] Post Thank You Hack
View Single Post
  #1031  
Old 05-16-2007, 07:13 PM
mamashid mamashid is offline
 
Join Date: Jan 2007
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont think....nothing has changed just upgraded!

I am slight new to all the updates etc....what is line 110???
here is the php

Quote:
<?php
/*=====================================*\
|| ################################### ||
|| # Post Thank You Hack version 6.1 # ||
|| ################################### ||
\*=====================================*/

function post_thanks_off($forumid = 0, $postinfo = array(), $threadfirstpostid = 0, $this_script = '')
{
global $vbulletin;

($hook = vBulletinHook::fetch_hook('post_thanks_function_po st_thanks_off_start')) ? eval($hook) : false;

if (!($vbulletin->options['post_thanks_on_off']) || $forumid == 0 || post_thanks_in_array($forumid, $vbulletin->options['post_thanks_forum_off']))
{
return true;
}

if (($vbulletin->options['post_thanks_forum_first_all'] && !($postinfo['postid'] == $threadfirstpostid)) || (post_thanks_in_array($forumid, $vbulletin->options['post_thanks_forum_first']) && !($postinfo['postid'] == $threadfirstpostid)))
{
return true;
}

if (!($this_script == 'showthread' || $this_script == 'showpost' || $this_script == ''))
{
return true;
}

if ($vbulletin->options['post_thanks_usergroup_getting'])
{
if (is_member_of($postinfo, explode("|", $vbulletin->options['post_thanks_usergroup_getting'])))
{
return true;
}
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_po st_thanks_off_end')) ? eval($hook) : false;

return false;
}

function can_thank_this_post($postinfo = array(), $threadisdeleted = 0)
{
global $vbulletin;

($hook = vBulletinHook::fetch_hook('post_thanks_function_ca n_thank_this_post_start')) ? eval($hook) : false;

if ($postinfo['postid'] == 0 || $vbulletin->userinfo['userid'] == 0 || $postinfo['isdeleted'] || $threadisdeleted || (!($vbulletin->options['post_thanks_poster_button']) && $postinfo['userid'] == $vbulletin->userinfo['userid']))
{
return false;
}

if (post_thanks_in_array($vbulletin->userinfo['usergroupid'], $vbulletin->options['post_thanks_usergroup_using']) || post_thanks_in_array($vbulletin->userinfo['userid'], $vbulletin->options['post_thanks_user_useing']))
{
return false;
}

if ($vbulletin->userinfo['posts'] < $vbulletin->options['post_thanks_post_count_needed'])
{
return false;
}

if ($vbulletin->options['post_thanks_days_old'])
{
if (TIMENOW > (($vbulletin->options['post_thanks_days_old'] * 60 * 60 * 24) + $postinfo['dateline']))
{
return false;
}
}

if ($vbulletin->options['post_groan_integrate'])
{
require_once(DIR . '/includes/functions_post_groan.php');
if (groaned_already($postinfo))
{
return false;
}
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_ca n_thank_this_post_end')) ? eval($hook) : false;

return true;
}

function can_delete_all_thanks()
{
global $vbulletin;

($hook = vBulletinHook::fetch_hook('post_thanks_function_ca n_delete_all_thanks_start')) ? eval($hook) : false;

if ($vbulletin->userinfo['usergroupid'] == '6')
{
return true;
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_ca n_delete_all_thanks_end')) ? eval($hook) : false;

return false;
}

function thanked_already($postinfo, $userid = 0)
{
global $vbulletin;
$thanks = fetch_thanks($postinfo['postid']);

($hook = vBulletinHook::fetch_hook('post_thanks_function_th anked_already_start')) ? eval($hook) : false;

$userid != 0 ? $userid = $userid : $userid = $vbulletin->userinfo['userid'];

if ($postinfo['post_thanks_amount'] && $thanks[$userid])
{
return true;
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_th anked_already_end')) ? eval($hook) : false;

return false;
}

function show_thanks_date($forumid = 0)
{
global $vbulletin;

($hook = vBulletinHook::fetch_hook('post_thanks_function_sh ow_thanks_date_start')) ? eval($hook) : false;

if ($vbulletin->options['post_thanks_date_all'] && !post_thanks_in_array($forumid, $vbulletin->options['post_thanks_date_forum']))
{
return true;
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_sh ow_thanks_date_end')) ? eval($hook) : false;

return false;
}

function fetch_thanks($postid = 0, $postids = '', $fetch_again = false)
{
global $vbulletin;
static $cache, $act;

($hook = vBulletinHook::fetch_hook('post_thanks_function_fe tch_thanks_start')) ? eval($hook) : false;

if ((!($cache) && !($act)) || ($fetch_again))
{
$cache = array();

if ($postids)
{
$post_ids = "0$postids";
}
else
{
$post_ids = $postid;
}

$thanks = $vbulletin->db->query_read("SELECT * FROM " .TABLE_PREFIX. "post_thanks WHERE postid IN (" . $post_ids . ") ORDER BY username ASC");

while ($thank = $vbulletin->db->fetch_array($thanks))
{
$cache[$thank['postid']][$thank['userid']]['userid'] = $thank['userid'];
$cache[$thank['postid']][$thank['userid']]['username'] = $thank['username'];
$cache[$thank['postid']][$thank['userid']]['date'] = $thank['date'];
$cache[$thank['postid']][$thank['userid']]['postid'] = $thank['postid'];
}
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_fe tch_thanks_end')) ? eval($hook) : false;

$act = true;
return $cache[$postid];
}

function fetch_thanks_bit($forumid = 0, $thanks)
{
global $vbulletin;

($hook = vBulletinHook::fetch_hook('post_thanks_function_fe tch_thanks_bit_start')) ? eval($hook) : false;

$number_rows = count($thanks);

$cmpt=1;

foreach ($thanks AS $thank)
{
if ($cmpt<$number_rows)
{
$virg=",";
}
else
{
$virg="";
}

if (show_thanks_date($forumid))
{
$date_thank = vbdate($vbulletin->options['dateformat'], $thank['date'], true);
}

eval('$liste_user .= " ' . fetch_template('post_thanks_box_bit') . '";');
$cmpt++;
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_fe tch_thanks_bit_end')) ? eval($hook) : false;

return $liste_user;
}

function fetch_post_thanks_template($post)
{
global $vbulletin, $vbphrase, $stylevar;

($hook = vBulletinHook::fetch_hook('post_thanks_function_fe tch_post_thanks_template_start')) ? eval($hook) : false;

if ($vbulletin->options['legacypostbit'])
{
eval('$template = "' . fetch_template('post_thanks_postbit_legacy') . '";');
}
else
{
eval('$template = "' . fetch_template('post_thanks_postbit') . '";');
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_fe tch_post_thanks_template_end')) ? eval($hook) : false;

return $template;
}

function add_thanks($postinfo)
{
global $vbulletin, $vbphrase;

($hook = vBulletinHook::fetch_hook('post_thanks_function_ad d_thanks_start')) ? eval($hook) : false;

$vbulletin->db->query_write("
INSERT INTO ". TABLE_PREFIX ."post_thanks
(userid, username, date, postid)
VALUES
('" . $vbulletin->userinfo['userid'] . "', '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "', " . TIMENOW . ", " . $postinfo['postid'] .")
");

$set_user_gave = 'post_thanks_user_amount = 1 + post_thanks_user_amount';
$set_user_got = 'post_thanks_thanked_times = 1 + post_thanks_thanked_times';
$set_post = 'post_thanks_amount = 1 + post_thanks_amount';

if ($postinfo['post_thanks_amount'] == 0)
{
$set_user_got .= ', post_thanks_thanked_posts = 1 + post_thanks_thanked_posts';
}

if ($vbulletin->options['post_thanks_reputation'])
{
$vbulletin->db->query_write("
INSERT IGNORE INTO ". TABLE_PREFIX ."reputation
(postid, userid, reputation, whoadded, reason, dateline)
VALUES
('".$postinfo['postid']."', '".$postinfo['userid']."', '" . $vbulletin->options['post_thanks_reputation'] . "', '" . $vbulletin->userinfo['userid'] . "', '$vbphrase[post_thanks_thanked_post]', " . TIMENOW . ")
");

if ($vbulletin->db->affected_rows() != 0)
{
$set_user_got .= ", reputation = " . $vbulletin->options['post_thanks_reputation'] . " + reputation";
}
}

if ($vbulletin->options['post_thanks_post_count'])
{
$set_user_gave .= ', posts = 1 + posts';
}

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET $set_user_gave
WHERE userid = '" . $vbulletin->userinfo['userid'] . "'
");

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET $set_user_got
WHERE userid = '$postinfo[userid]'
");

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "post
SET $set_post
WHERE postid = '$postinfo[postid]'
");

($hook = vBulletinHook::fetch_hook('post_thanks_function_ad d_thanks_end')) ? eval($hook) : false;
}

function delete_all_thanks($postinfo)
{
global $vbulletin, $vbphrase;

($hook = vBulletinHook::fetch_hook('post_thanks_function_de lete_all_thanks_start')) ? eval($hook) : false;

$thanks=$vbulletin->db->query_read("SELECT * FROM ". TABLE_PREFIX ."post_thanks WHERE postid='$postinfo[postid]' ORDER BY username");
$nb=$vbulletin->db->num_rows($thanks);

if ($nb != 0)
{
while ($thank = $vbulletin->db->fetch_array($thanks))
{
$thank_userids[] = $thank['userid'];
}

$vbulletin->db->query_write("DELETE FROM ". TABLE_PREFIX ."post_thanks WHERE postid='$postinfo[postid]'");

$set_user_gave = 'post_thanks_user_amount = post_thanks_user_amount - 1';
$set_user_got = "post_thanks_thanked_times = post_thanks_thanked_times - $nb, post_thanks_thanked_posts = post_thanks_thanked_posts - 1";
$set_post = 'post_thanks_amount = 0';
$postinfo['post_thanks_amount'] = 0;

if ($vbulletin->options['post_thanks_reputation'])
{
$vbulletin->db->query_write("DELETE FROM ". TABLE_PREFIX ."reputation WHERE postid = '$postinfo[postid]' AND reason = '$vbphrase[post_thanks_thanked_post]'");

if ($vbulletin->db->affected_rows() != 0)
{
$total_rep_got = $vbulletin->options['post_thanks_reputation'] * $nb;
$set_user_got .= ", reputation = reputation - $total_rep_got";
}
}

if ($vbulletin->options['post_thanks_post_count'])
{
$set_user_gave .= ', posts = posts - 1';
}

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET $set_user_gave
WHERE userid IN (".implode(",",$thank_userids).")
");

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET $set_user_got
WHERE userid = '$postinfo[userid]'
");

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "post
SET $set_post
WHERE postid = '$postinfo[postid]'
");
}

($hook = vBulletinHook::fetch_hook('post_thanks_function_de lete_all_thanks_end')) ? eval($hook) : false;
}

function delete_thanks($postinfo, $userid)
{
global $vbulletin, $vbphrase;

($hook = vBulletinHook::fetch_hook('post_thanks_function_de lete_thanks_start')) ? eval($hook) : false;

if (!(thanked_already($postinfo, $userid)))
{
return false;
}

$vbulletin->db->query_write("DELETE FROM ". TABLE_PREFIX ."post_thanks WHERE postid = '$postinfo[postid]' AND userid = '$userid'");

$set_user_gave = 'post_thanks_user_amount = post_thanks_user_amount - 1';
$set_user_got = "post_thanks_thanked_times = post_thanks_thanked_times - 1";
$set_post = 'post_thanks_amount = post_thanks_amount - 1';

if ($postinfo[post_thanks_amount] == 1)
{
$set_user_got .= ', post_thanks_thanked_posts = post_thanks_thanked_posts - 1';
}

if ($vbulletin->options['post_thanks_reputation'])
{
$vbulletin->db->query_write("DELETE FROM ". TABLE_PREFIX ."reputation WHERE postid = '$postinfo[postid]' AND whoadded = '$userid' AND reason = '$vbphrase[post_thanks_thanked_post]'");

if ($vbulletin->db->affected_rows() != 0)
{
$set_user_got .= ", reputation = reputation - ". $vbulletin->options[post_thanks_reputation] ."";
}
}

if ($vbulletin->options['post_thanks_post_count'])
{
$set_user_gave .= ', posts = posts - 1';
}

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET $set_user_gave
WHERE userid = '$userid'
");

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET $set_user_got
WHERE userid = '$postinfo[userid]'
");

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "post
SET $set_post
WHERE postid = '$postinfo[postid]'
");

($hook = vBulletinHook::fetch_hook('post_thanks_function_de lete_thanks_end')) ? eval($hook) : false;

return true;
}

function post_thanks_in_array($number = 0, $array = 0)
{
$array_split = explode("|", $array);

foreach ($array_split AS $array_number)
{
if ($number == $array_number)
{
return true;
}
}
return false;
}
?>


Quote:
Originally Posted by Abe1 View Post
No clue. Never saw such an error before. Do you have any other hacks that could be affecting this one?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02278 seconds
  • Memory Usage 1,840KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete