summaryrefslogtreecommitdiff
path: root/lookup_user_inc.php
blob: 112d9f0c92fd9beebbc5b5b5c75d60f8020cdf2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
 * $Header: /cvsroot/bitweaver/_bit_users/lookup_user_inc.php,v 1.4 2005/08/01 18:42:02 squareing Exp $
 *
 * Copyright (c) 2004 bitweaver.org
 * Copyright (c) 2003 tikwiki.org
 * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See copyright.txt for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
 *
 * $Id: lookup_user_inc.php,v 1.4 2005/08/01 18:42:02 squareing Exp $
 * @package users
 * @subpackage functions
 */
global $gQueryUser;

/**
 * This is a centralized include file to setup $gQueryUser var if you need to display detailed information about any arbitrary user.
 */
// Keep backward compatability
if (isset($_REQUEST['fHomepage'])) {
	$_REQUEST['home'] = $_REQUEST['fHomepage'];
}
if (isset($_REQUEST['home'])) {
	$_REQUEST['fHomepage'] = $_REQUEST['home'];
}

if (isset($_REQUEST['content_id'])) {
	// This identifies the user_id associated with the contact_id of a record
	// Used to allow access to user records via the generic index.php?content_id=x
	$_REQUEST['home'] = $gBitUser->getUserFromContentId($_REQUEST['content_id']);
}

if (isset($_REQUEST['home'])) {
	// this allows for a numeric user_id or alpha_numeric user_id
	$queryUserId = $gBitUser->lookupHomepage($_REQUEST['home'], $gBitSystem->getPreference('case_sensitive_login', 'y') == 'y');
	$_REQUEST['home'] = $queryUserId;
	$gQueryUser = new BitPermUser( $queryUserId );
	$gQueryUser->load( TRUE );
} elseif( $gBitUser->isValid() ) {
	// We are looking at ourself, use our existing BitUser
	global $gBitUser;
	$gQueryUser = &$gBitUser;
}

if (!$gBitUser->isAdmin()) {
	if( $gQueryUser->mUserPrefs['user_information'] == 'private') {
		$gBitSystem->fatalError( tra("The user has choosen to make his information private") );
		die;
	}
}

$gQueryUser->sanitizeUserInfo();
$gBitSmarty->assign_by_ref('gQueryUser', $gQueryUser);

if( $gQueryUser->isValid() ) {
	$gBitSmarty->assign_by_ref( 'userInfo', $gQueryUser->mInfo );
	$gBitSmarty->assign_by_ref( 'userPrefs', $gQueryUser->mUserPrefs );
	$gBitSmarty->assign( 'homepage_header', $gQueryUser->getPreference( 'homepage_header' ) );
}
?>