Invalid ID |
08-02-2007 03:43 PM |
Thanks for your reply... I am posting my member.php in three parts, as it's too big to appear in one post:
First Part of member.php
Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.6.5 - Licence Number
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000-2007 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'member');
define('BYPASS_STYLE_OVERRIDE', 1);
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
'wol',
'user',
'messaging',
'cprofilefield',
'reputationlevel',
'infractionlevel',
);
// get special data templates from the datastore
$specialtemplates = array(
'smiliecache',
'bbcodecache'
);
// pre-cache templates used by all actions
$globaltemplates = array(
'MEMBERINFO',
'memberinfo_customfields',
'memberinfo_membergroupbit',
'im_aim',
'im_icq',
'im_msn',
'im_yahoo',
'im_skype',
'bbcode_code',
'bbcode_html',
'bbcode_php',
'bbcode_quote',
'postbit_reputation',
'postbit_onlinestatus',
'userfield_checkbox_option',
'userfield_select_option',
'userinfraction_infobit'
);
// pre-cache templates used by specific actions
$actiontemplates = array();
if ($_REQUEST['do'] == 'vcard') // don't alter this $_REQUEST
{
define('NOHEADER', 1);
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/class_postbit.php');
require_once(DIR . '/includes/functions_user.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if (!($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']))
{
print_no_permission();
}
$vbulletin->input->clean_array_gpc('r', array(
'find' => TYPE_STR,
'moderatorid' => TYPE_UINT,
'userid' => TYPE_UINT,
'username' => TYPE_NOHTML
));
($hook = vBulletinHook::fetch_hook('member_start')) ? eval($hook) : false;
if ($vbulletin->GPC['find'] == 'firstposter' AND $threadinfo['threadid'])
{
if ((!$threadinfo['visible'] AND !can_moderate($threadinfo['forumid'], 'canmoderateposts')) OR ($threadinfo['isdeleted'] AND !can_moderate($threadinfo['forumid'])))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
if (in_coventry($threadinfo['postuserid']) AND !can_moderate($threadinfo['forumid']))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission();
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))
{
print_no_permission();
}
$vbulletin->GPC['userid'] = $threadinfo['postuserid'];
}
else if ($vbulletin->GPC['find'] == 'lastposter' AND $threadinfo['threadid'])
{
if ((!$threadinfo['visible'] AND !can_moderate($threadinfo['forumid'], 'canmoderateposts')) OR ($threadinfo['isdeleted'] AND !can_moderate($threadinfo['forumid'])))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
if (in_coventry($threadinfo['postuserid']) AND !can_moderate($threadinfo['forumid']))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission();
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))
{
print_no_permission();
}
require_once(DIR . '/includes/functions_bigthree.php');
$coventry = fetch_coventry('string');
$getuserid = $db->query_first_slave("
SELECT post.userid
FROM " . TABLE_PREFIX . "post AS post
WHERE post.threadid = $threadinfo[threadid]
AND post.visible = 1
". ($coventry ? "AND post.userid NOT IN ($coventry)" : '') . "
ORDER BY dateline DESC
LIMIT 1
");
$vbulletin->GPC['userid'] = $getuserid['userid'];
}
else if ($vbulletin->GPC['find'] == 'lastposter' AND $foruminfo['forumid'])
{
$_permsgetter_ = 'lastposter fperms';
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission();
}
if ($vbulletin->userinfo['userid'] AND in_coventry($vbulletin->userinfo['userid'], true))
{
$tachyjoin = "LEFT JOIN " . TABLE_PREFIX . "tachythreadpost AS tachythreadpost ON " .
"(tachythreadpost.threadid = thread.threadid AND tachythreadpost.userid = " . $vbulletin->userinfo['userid'] . ')';
}
else
{
$tachyjoin = '';
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
require_once(DIR . '/includes/functions_misc.php');
$forumslist = $forumid . ',' . fetch_child_forums($foruminfo['forumid']);
require_once(DIR . '/includes/functions_bigthree.php');
// this isn't including moderator checks, because the last post checks don't either
if ($coventry = fetch_coventry('string')) // takes self into account
{
$globalignore_post = "AND post.userid NOT IN ($coventry)";
$globalignore_thread = "AND thread.postuserid NOT IN ($coventry)";
}
else
{
$globalignore_post = '';
$globalignore_thread = '';
}
cache_ordered_forums(1);
$datecutoff = $vbulletin->forumcache["$foruminfo[forumid]"]['lastpost'] - 30;
$thread = $db->query_first_slave("
SELECT thread.threadid
" . ($tachyjoin ? ', IF(tachythreadpost.lastpost > thread.lastpost, tachythreadpost.lastpost, thread.lastpost) AS lastpost' : '') . "
FROM " . TABLE_PREFIX . "thread AS thread
$tachyjoin
WHERE thread.forumid IN ($forumslist)
AND thread.visible = 1
AND thread.sticky IN (0,1)
AND thread.open <> 10
" . (!$tachyjoin ? "AND lastpost > $datecutoff" : '') . "
$globalignore_thread
ORDER BY lastpost DESC
LIMIT 1
");
if (!$thread)
{
eval(standard_error(fetch_error('invalidid', $vbphrase['user'], $vbulletin->options['contactuslink'])));
}
$getuserid = $db->query_first_slave("
SELECT post.userid
FROM " . TABLE_PREFIX . "post AS post
WHERE threadid = $thread[threadid]
AND visible = 1
$globalignore_post
ORDER BY dateline DESC
LIMIT 1
");
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($getuserid['userid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))
{
print_no_permission();
}
$vbulletin->GPC['userid'] = $getuserid['userid'];
}
else if ($vbulletin->GPC['find'] == 'moderator' AND $vbulletin->GPC['moderatorid'])
{
$moderatorinfo = verify_id('moderator', $vbulletin->GPC['moderatorid'], 1, 1);
$vbulletin->GPC['userid'] = $moderatorinfo['userid'];
}
else if ($vbulletin->GPC['username'] != '' AND !$vbulletin->GPC['userid'])
{
$user = $db->query_first_slave("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . $db->escape_string($vbulletin->GPC['username']) . "'");
$vbulletin->GPC['userid'] = $user['userid'];
}
if (!$vbulletin->GPC['userid'])
{
eval(standard_error(fetch_error('unregistereduser')));
}
$userinfo = verify_id('user', $vbulletin->GPC['userid'], 1, 1, 47);
if ($userinfo['usergroupid'] == 4 AND !($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
{
print_no_permission();
}
if ($_REQUEST['do'] == 'vcard' AND $vbulletin->userinfo['userid'] AND $userinfo['showvcard'])
{
// source: http://www.ietf.org/rfc/rfc2426.txt
$text = "BEGIN:VCARD\r\n";
$text .= "VERSION:2.1\r\n";
$text .= "N:;$userinfo[username]\r\n";
$text .= "FN:$userinfo[username]\r\n";
$text .= "EMAIL;PREF;INTERNET:$userinfo[email]\r\n";
if (!empty($userinfo['birthday'][7]) AND $userinfo['showbirthday'] == 2)
{
$birthday = explode('-', $userinfo['birthday']);
$text .= "BDAY:$birthday[2]-$birthday[0]-$birthday[1]\r\n";
}
if (!empty($userinfo['homepage']))
{
$text .= "URL:$userinfo[homepage]\r\n";
}
$text .= 'REV:' . date('Y-m-d') . 'T' . date('H:i:s') . "Z\r\n";
$text .= "END:VCARD\r\n";
$filename = $userinfo['userid'] . '.vcf';
header("Content-Disposition: attachment; filename=$filename");
header('Content-Length: ' . strlen($text));
header('Connection: close');
header("Content-Type: text/x-vCard; name=$filename");
echo $text;
exit;
}
// display user info
$userperms = cache_permissions($userinfo, false);
if ($userperms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canbeusernoted'])
{
# User has permission to view self or others
if
(
($userinfo['userid'] == $vbulletin->userinfo['userid'] AND $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewownusernotes'])
OR ($userinfo['userid'] != $vbulletin->userinfo['userid'] AND $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewothersusernotes'])
)
{
$show['usernotes'] = true;
$usernote = $db->query_first_slave("
SELECT MAX(dateline) AS lastpost, COUNT(*) AS total
FROM " . TABLE_PREFIX . "usernote AS usernote
WHERE userid = $userinfo[userid]
");
$show['usernoteview'] = intval($usernote['total']) ? true : false;
$usernote['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $usernote['lastpost'], true);
$usernote['lastposttime'] = vbdate($vbulletin->options['timeformat'], $usernote['lastpost'], true);
}
# User has permission to post about self or others
if
(
($userinfo['userid'] == $vbulletin->userinfo['userid'] AND $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canpostownusernotes'])
OR ($userinfo['userid'] != $vbulletin->userinfo['userid'] AND $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canpostothersusernotes'])
)
{
$show['usernotes'] = true;
$show['usernotepost'] = true;
}
}
|