forked from BitweaverCMS/users
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lookup_user_inc.php
52 lines (48 loc) · 2.05 KB
/
lookup_user_inc.php
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
<?php
/**
* $Header$
*
* @package users
* @subpackage functions
*/
global $gQueryUser;
/**
* This is a centralized include file to setup $gQueryUser var if you need to display detailed information about an arbitrary user.
*/
// fHomepage stuff is for backwards comability
if( isset( $_REQUEST['fHomepage'] )) {
$_REQUEST['home'] = $_REQUEST['fHomepage'];
} elseif( isset( $_REQUEST['home'] )) {
$_REQUEST['fHomepage'] = $_REQUEST['home'];
} elseif( @BitBase::verifyId( $_REQUEST['content_id'] )) {
$userInfo = $gBitUser->getUserInfo( array( 'content_id' => $_REQUEST['content_id'] ));
$_REQUEST['home'] = !empty( $userInfo['login'] ) ? $userInfo['login'] : NULL;
} elseif( @BitBase::verifyId( $_REQUEST['user_id'] )) {
$userInfo = $gBitUser->getUserInfo( array( 'user_id' => $_REQUEST['user_id'] ));
$_REQUEST['home'] = !empty( $userInfo['login'] ) ? $userInfo['login'] : NULL;
}
if( isset( $_REQUEST['home'] )) {
// this allows for a numeric user_id or alpha_numeric user_id
$queryUserId = $gBitUser->lookupHomepage( $_REQUEST['home'], $gBitSystem->getConfig( 'users_case_sensitive_login', 'y' ) == 'y' );
$userClass = $gBitSystem->getConfig( 'user_class', 'BitPermUser' );
require_once( USERS_PKG_PATH . $userClass .'.php' );
$gQueryUser = new $userClass( $queryUserId );
$gQueryUser->load( TRUE );
} elseif( $gBitUser->isValid() ) {
// We are looking at ourself, use our existing BitUser
global $gBitUser;
$gQueryUser = &$gBitUser;
}
if( !$gBitUser->hasPermission( 'p_users_admin' ) ) {
if( $gQueryUser->mUserId != $gBitUser->mUserId && $gQueryUser->getPreference( 'users_information' ) == 'private' ) {
$gBitSystem->fatalError( tra( "This information is private" ), NULL, NULL, HttpStatusCodes::HTTP_FORBIDDEN );
}
}
if( $gQueryUser->isValid() ) {
$gQueryUser->sanitizeUserInfo();
$gBitSmarty->assign_by_ref( 'gQueryUser', $gQueryUser );
$gBitSmarty->assign_by_ref( 'userInfo', $gQueryUser->mInfo );
$gBitSmarty->assign_by_ref( 'userPrefs', $gQueryUser->mPrefs );
$gBitSmarty->assign( 'homepage_header', $gQueryUser->getPreference( 'homepage_header' ) );
}
?>