PHP Code:
if ($_REQUEST['do'] == 'findthanks')
{
$bbuserinfo = $vbulletin->userinfo;
$vboptions = $vbulletin->options;
$vbulletin->input->clean_array_gpc('r', array(
'userid' => TYPE_UINT,
));
// valid user id?
if (!$vbulletin->GPC['userid'])
{
eval(standard_error(fetch_error('invalidid', $vbphrase['user'], $vbulletin->options['contactuslink'])));
}
// get user info
if ($user = $db->query_first("SELECT userid, username, posts FROM " . TABLE_PREFIX . "user WHERE userid = " . $vbulletin->GPC['userid']))
{
$searchuser =& $user['username'];
}
// could not find specified user
else
{
eval(standard_error(fetch_error('invalidid', $vbphrase['user'], $vbulletin->options['contactuslink'])));
}
// #############################################################################
// build search hash
$query = '';
$searchuser = $user['username'];
$exactname = 1;
$starteronly = 0;
$forumchoice = $foruminfo['forumid'];
$childforums = 1;
$titleonly = 0;
$showposts = 1;
$searchdate = 0;
$beforeafter = 'after';
$replyless = 0;
$replylimit = 0;
$searchthreadid = 0;
($hook = vBulletinHook::fetch_hook('search_finduser_start')) ? eval($hook) : false;
$searchhash = md5(TIMENOW . "||" . $vbulletin->userinfo['userid'] . "||" . strtolower($searchuser) . "||$exactname||$starteronly||$forumchoice||$childforums||$titleonly||$showposts||$searchdate||$beforeafter||$replyless||$replylimit||$searchthreadid");
// check if search already done
//if ($search = $db->query_first("SELECT searchid FROM " . TABLE_PREFIX . "search AS search WHERE searchhash = '" . $db->escape_string($searchhash) . "'"))
//{
// $vbulletin->url = "search.php?" . $vbulletin->session->vars['sessionurl'] . "searchid=$search[searchid]";
// eval(print_standard_redirect('search'));
//}
// start search timer
$searchtime = microtime();
// #############################################################################
// check to see if we should be searching in a particular forum or forums
if ($forumids = fetch_search_forumids($forumchoice, $childforums))
{
$forumids = 'thread.forumid IN(' . implode(',', $forumids) . ')';
$showforums = true;
}
else
{
$forumids = '0';
foreach ($vbulletin->forumcache AS $forumid => $forum)
{
$fperms =& $vbulletin->userinfo['forumpermissions']["$forumid"];
if (($fperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($fperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']))
{
$forumids .= ",$forumid";
}
}
$forumids = "thread.forumid IN($forumids)";
$showforums = false;
}
// query post ids in dateline DESC order...
$orderedids = array();
$posts = $db->query_read("
SELECT postid
FROM " . TABLE_PREFIX . "post AS post " . iif($forumids, "
INNER JOIN " . TABLE_PREFIX . "thread AS thread ON(thread.threadid = post.threadid)
WHERE post.userid = $user[userid]
AND post.post_thanks_amount != 0
AND $forumids") . "
ORDER BY post.dateline DESC
LIMIT " . ($vbulletin->options['maxresults'] * 2) . "
");
while ($post = $db->fetch_array($posts))
{
$orderedids[] = $post['postid'];
}
unset($post);
$db->free_result($posts);
// did we get some results?
if (empty($orderedids))
{
eval(standard_error(fetch_error('searchnoresults', $displayCommon), '', false));
}
// set display terms
$display = array(
'words' => array(),
'highlight' => array(),
'common' => array(),
'users' => array($user['userid'] => $user['username']),
'forums' => iif($showforums, $display['forums'], 0),
'options' => array(
'starteronly' => 0,
'childforums' => 1,
'action' => 'process'
)
);
// end search timer
$searchtime = fetch_microtime_difference($searchtime);
($hook = vBulletinHook::fetch_hook('search_finduser_complete')) ? eval($hook) : false;
/*insert query*/
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "search (userid, ipaddress, personal, searchuser, forumchoice, sortby, sortorder, searchtime, showposts, orderedids, dateline, displayterms, searchhash)
VALUES (" . $vbulletin->userinfo['userid'] . ", '" . $db->escape_string(IPADDRESS) . "', 1, '" . $db->escape_string($user['username']) . "', '" . $db->escape_string($forumchoice) . "', 'post.dateline', 'DESC', $searchtime, 1, '" . $db->escape_string(implode(',', $orderedids)) . "', " . TIMENOW . ", '" . $db->escape_string(serialize($display)) . "', '" . $db->escape_string($searchhash) . "')
");
$searchid = $db->insert_id();
$vbulletin->url = "search.php?" . $vbulletin->session->vars['sessionurl'] . "searchid=$searchid";
eval(print_standard_redirect('search'));
}
// #############################################################################
if ($_REQUEST['do'] == 'findallthanks')
{
$bbuserinfo = $vbulletin->userinfo;
$vboptions = $vbulletin->options;
// #############################################################################
// build search hash
$query = '';
$searchuser = $user['username'];
$exactname = 1;
$starteronly = 0;
$forumchoice = $foruminfo['forumid'];
$childforums = 1;
$titleonly = 0;
$showposts = 1;
$searchdate = 0;
$beforeafter = 'after';
$replyless = 0;
$replylimit = 0;
$searchthreadid = 0;
($hook = vBulletinHook::fetch_hook('search_finduser_start')) ? eval($hook) : false;
$searchhash = md5(TIMENOW . "||" . $vbulletin->userinfo['userid'] . "||" . strtolower($searchuser) . "||$exactname||$starteronly||$forumchoice||$childforums||$titleonly||$showposts||$searchdate||$beforeafter||$replyless||$replylimit||$searchthreadid");
// check if search already done
//if ($search = $db->query_first("SELECT searchid FROM " . TABLE_PREFIX . "search AS search WHERE searchhash = '" . $db->escape_string($searchhash) . "'"))
//{
// $vbulletin->url = "search.php?" . $vbulletin->session->vars['sessionurl'] . "searchid=$search[searchid]";
// eval(print_standard_redirect('search'));
//}
// start search timer
$searchtime = microtime();
// #############################################################################
// check to see if we should be searching in a particular forum or forums
if ($forumids = fetch_search_forumids($forumchoice, $childforums))
{
$forumids = 'thread.forumid IN(' . implode(',', $forumids) . ')';
$showforums = true;
}
else
{
$forumids = '0';
foreach ($vbulletin->forumcache AS $forumid => $forum)
{
$fperms =& $vbulletin->userinfo['forumpermissions']["$forumid"];
if (($fperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($fperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']))
{
$forumids .= ",$forumid";
}
}
$forumids = "thread.forumid IN($forumids)";
$showforums = false;
}
// query post ids in dateline DESC order...
$orderedids = array();
$posts = $db->query_read("
SELECT postid
FROM " . TABLE_PREFIX . "post AS post " . iif($forumids, "
INNER JOIN " . TABLE_PREFIX . "thread AS thread ON(thread.threadid = post.threadid)
WHERE post.post_thanks_amount != 0
AND $forumids") . "
ORDER BY post.dateline DESC
LIMIT " . ($vbulletin->options['maxresults'] * 2) . "
");
while ($post = $db->fetch_array($posts))
{
$orderedids[] = $post['postid'];
}
unset($post);
$db->free_result($posts);
// did we get some results?
if (empty($orderedids))
{
eval(standard_error(fetch_error('searchnoresults', $displayCommon), '', false));
}
// set display terms
$display = array(
'words' => array(),
'highlight' => array(),
'common' => array(),
'forums' => iif($showforums, $display['forums'], 0),
'options' => array(
'starteronly' => 0,
'childforums' => 1,
'action' => 'process'
)
);
// end search timer
$searchtime = fetch_microtime_difference($searchtime);
($hook = vBulletinHook::fetch_hook('search_finduser_complete')) ? eval($hook) : false;
/*insert query*/
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "search (userid, ipaddress, personal, searchuser, forumchoice, sortby, sortorder, searchtime, showposts, orderedids, dateline, displayterms, searchhash)
VALUES (" . $vbulletin->userinfo['userid'] . ", '" . $db->escape_string(IPADDRESS) . "', 1, '" . $db->escape_string($user['username']) . "', '" . $db->escape_string($forumchoice) . "', 'post.dateline', 'DESC', $searchtime, 1, '" . $db->escape_string(implode(',', $orderedids)) . "', " . TIMENOW . ", '" . $db->escape_string(serialize($display)) . "', '" . $db->escape_string($searchhash) . "')
");
$searchid = $db->insert_id();
$vbulletin->url = "search.php?" . $vbulletin->session->vars['sessionurl'] . "searchid=$searchid";
eval(print_standard_redirect('search'));
}
Does anythink ring a bell? I have no clue....