/
index.php
121 lines (101 loc) · 4.71 KB
/
index.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/**
* $Header$
*
* $Id$
* @package users
* @subpackage functions
*/
global $gQueryUserId, $gBitSystem;
/**
* required setup
*/
require_once( '../kernel/includes/setup_inc.php' );
$gBitSystem->setActivePackage( 'users' );
// custom userfields
if( $gBitSystem->getConfig( 'custom_user_fields' )) {
$customFields= explode( ',', $gBitSystem->getConfig( 'custom_user_fields' ));
$gBitSmarty->assign( 'customFields', $customFields );
}
// lookup may be via content_id which will then return user_id for search request
require_once( USERS_PKG_INCLUDE_PATH.'lookup_user_inc.php' );
// i think we should always allow looking at yourself - regardless of permissions
if( !empty( $_REQUEST['home'] ) ) {
if( $gQueryUser->isValid() && (( $gBitUser->hasPermission( 'p_users_view_user_homepage' ) || $gBitUser->hasPermission( 'p_users_admin' )) || $gQueryUser->mUserId == $gBitUser->mUserId )) {
$gQueryUserId = $gQueryUser->mUserId;
if( !$gBitUser->hasPermission('p_user_admin') && $gQueryUser->isValid() ) {
$gBitSmarty->assign( 'gQueryUserId', $gQueryUserId );
$gQueryUser->verifyPermission( 'p_users_edit_user_homepage' );
}
if( $gBitSystem->isPackageActive('stars') && $gBitSystem->isFeatureActive('stars_user_ratings')) {
require( STARS_PKG_PATH."templates/user_ratings.php" );
}
$gBitSystem->setCanonicalLink( $gQueryUser->getDisplayUrl() );
if( $gQueryUser->canCustomizeTheme() ) {
$userHomeStyle = $gQueryUser->getPreference( 'theme' );
if( !empty( $userHomeStyle )) {
$gBitThemes->setStyle( $userHomeStyle );
$gBitThemes->mStyles['styleSheet'] = $gBitThemes->getStyleCssFile( $userHomeStyle, $gQueryUser->mUserId );
$gBitSmarty->assign( 'userStyle', $userHomeStyle );
}
}
$userHomeTitle = $gQueryUser->getPreference( 'homepage_title' );
if( empty( $userHomeTitle )) {
$userHomeTitle = $gQueryUser->getDisplayName()."'s Homepage";
}
$browserTitle = $userHomeTitle;
if( $gBitSystem->isFeatureActive( 'display_users_content_list' ) && $gBitUser->hasPermission( 'p_liberty_list_content' ) ) {
// some content specific offsets and pagination settings
if( !empty( $_REQUEST['sort_mode'] ) ) {
$content_sort_mode = $_REQUEST['sort_mode'];
}
$max_content = $gBitSystem->getConfig( 'max_records' );
// set the user_id to only display content viewing user
$_REQUEST['user_id'] = $gQueryUserId;
$gBitSmarty->assign( 'user_id', $gQueryUserId);
// now that we have all the offsets, we can get the content list
include_once( LIBERTY_PKG_INCLUDE_PATH.'get_content_list_inc.php' );
//$gBitSmarty->assignByRef('offset', $offset);
$gBitSmarty->assign( 'contentSelect', $contentSelect );
$gBitSmarty->assign( 'contentTypes', $contentTypes );
$gBitSmarty->assign( 'contentList', $contentList );
// needed by pagination
$contentListHash['listInfo']['ihash']['content_type_guid'] = $contentSelect[0];
$contentListHash['listInfo']['ihash']['user_id'] = $gQueryUserId;
$contentListHash['listInfo']['ihash']['find'] = $contentListHash['find'];
$gBitSmarty->assign( 'listInfo', $contentListHash['listInfo'] );
$gBitSmarty->assign( 'display_content_list', 1 );
// end of content listing
}
$gQueryUser->invokeServices( 'content_display_function' );
// need to load layout now that we can check for center pieces
$layoutHash['layout'] = $gQueryUser->getField( 'login' );
$layoutHash['fallback'] = TRUE;
$layoutHash['fallback_layout'] = 'home';
$gBitThemes->loadLayout( $layoutHash );
$gBitSmarty->assign( 'pageCssId', 'userhomepage' );
$centerDisplay = ( count( $gCenterPieces ) ? 'bitpackage:kernel/dynamic.tpl' : 'bitpackage:users/center_user_wiki_page.tpl' );
} else {
$gBitSmarty->assign( 'metaNoIndex', TRUE );
$gBitSystem->fatalError( tra( "Page not found." ), NULL, NULL, HttpStatusCodes::HTTP_NOT_FOUND );
}
} else {
$gBitSystem->verifyPermission( 'p_users_view_user_list' );
$users = $gQueryUser->getList( $_REQUEST );
$gBitSmarty->assignByRef( 'users', $users );
$gBitSmarty->assignByRef( 'usercount', $_REQUEST["cant"] );
// display an error message
if( !empty( $_REQUEST['home'] )) {
$gBitSystem->setHttpStatus( HttpStatusCodes::HTTP_GONE );
$feedback['error'] = tra( 'The following user could not be found' ).': '.$_REQUEST['home'];
$gBitSmarty->assign( 'feedback', $feedback );
}
$_REQUEST['listInfo']["URL"] = USERS_PKG_URL."index.php";
$gBitSmarty->assignByRef( 'control', $_REQUEST['listInfo'] );
$gBitSmarty->assignByRef( 'listInfo', $_REQUEST['listInfo'] );
$browserTitle = $gBitSystem->getConfig( 'site_title' ).' '.tra( 'Members' );
$centerDisplay = 'bitpackage:users/index_list.tpl';
}
$gBitSmarty->assign( 'gBitLanguage', $gBitLanguage );
$gBitSystem->display( $centerDisplay, $browserTitle , array( 'display_mode' => 'display' ));
?>