-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuserinfo.php
112 lines (98 loc) · 5.26 KB
/
userinfo.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
<?php
/**
* Extended User Profile
*
* @copyright The ImpressCMS Project http://www.impresscms.org/
* @license LICENSE.txt
* @license GNU General Public License (GPL) http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @package modules
* @since 1.2
* @author Jan Pedersen
* @author The SmartFactory <www.smartfactory.ca>
* @author Sina Asghari (aka stranger) <[email protected]>
* @version $Id$
*/
include '../../mainfile.php';
$uid = isset($_GET['uid']) ? (int)$_GET['uid'] : '';
if ($uid <= 0) {
if (is_object(icms::$user)) {
$uid = icms::$user->getVar('uid');
} else {
header('location: '.ICMS_URL);
exit();
}
}
if (icms::$module->config['profile_social'] == 1) {
header('location: '.ICMS_URL.'/modules/'.basename(dirname(__FILE__)).'/index.php?uid='.$uid);
exit();
}
$groups = is_object(icms::$user) ? icms::$user->getGroups() : array(ICMS_GROUP_ANONYMOUS);
if (!$icmsConfigUser['allow_annon_view_prof'] && !is_object(icms::$user)) redirect_header(ICMS_URL.'/user.php', 3, _NOPERM);
if (is_object(icms::$user) && $uid == icms::$user->getVar('uid')) {
//disable cache
$icmsConfig['module_cache'][icms::$module->getVar('mid')] = 0;
$xoopsOption['template_main'] = 'profile_userinfo.html';
include ICMS_ROOT_PATH.'/header.php';
$thisUser = icms::$user;
} else {
$thisUser = icms::handler('icms_member')->getUser($uid);
if (!is_object($thisUser) || (!$thisUser->isActive() && (!icms::$user || !icms::$user->isAdmin()))) redirect_header(ICMS_URL."/modules/".basename(dirname(__FILE__)), 3, _MD_PROFILE_SELECTNG);
//disable cache
if (is_object(icms::$user) && icms::$user->isAdmin(icms::$module->getVar('mid'))) $icmsConfig['module_cache'][icms::$module->getVar('mid')] = 0;
$xoopsOption['template_main'] = 'profile_userinfo.html';
include ICMS_ROOT_PATH.'/header.php';
if (!$thisUser->isActive() && icms::$user && icms::$user->isAdmin()) $icmsTpl->assign('deleted', _MD_PROFILE_DELETED);
}
// adding profile stylesheet
$xoTheme->addStylesheet(ICMS_URL.'/modules/'.basename(dirname(__FILE__)).'/assets/css/profile'.(@_ADM_USE_RTL == 1 ? '_rtl':'').'.css');
// Dynamic User Profiles
$field_handler = icms_getModuleHandler('field', basename(dirname(__FILE__)), 'profile');
$categories = $field_handler->getProfileFields($thisUser);
$icmsTpl->assign('categories', $categories);
$icmsTpl->assign('break', count($categories) / 2 + 1);
unset($categories, $field_handler);
if (icms::$module->config['profile_search']) {
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('hassearch', 1));
$criteria->add(new icms_db_criteria_Item('isactive', 1));
$modules = icms::handler('icms_module')->getObjects($criteria, true);
$mids = array_keys($modules);
$allowed_mids = icms::handler('icms_member_groupperm')->getItemIds('module_read', $groups);
if (count($mids) > 0 && count($allowed_mids) > 0) {
foreach ($mids as $mid) {
if ( in_array($mid, $allowed_mids)) {
$results = $modules[$mid]->search('', '', 5, 0, $thisUser->getVar('uid'));
$count = count($results);
if (is_array($results) && $count > 0) {
for ($i = 0; $i < $count; $i++) {
if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
$results[$i]['image'] = ICMS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$results[$i]['image'];
} else {
$results[$i]['image'] = ICMS_URL.'/images/icons/posticon2.gif';
}
if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
$results[$i]['link'] = ICMS_URL."/modules/".$modules[$mid]->getVar('dirname')."/".$results[$i]['link'];
}
$results[$i]['title'] = icms_core_DataFilter::htmlSpecialChars($results[$i]['title']);
$results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
}
if ($count == 5) {
$showall_link = '<a href="'.ICMS_URL.'/search.php?action=showallbyuser&mid='.$mid.'&uid='.$thisUser->getVar('uid').'">'._MD_PROFILE_SHOWALL.'</a>';
} else {
$showall_link = '';
}
$icmsTpl->append('modules', array('name' => $modules[$mid]->getVar('name'), 'results' => $results, 'showall_link' => $showall_link));
}
unset($modules[$mid]);
}
}
}
}
if (icms::$module->config['index_real_name'] == 'real' && trim($thisUser->getVar('name'))) {
$owner_name = is_object($thisUser) ? trim($thisUser->getVar('name')) : _GUESTS;
} elseif (icms::$module->config['index_real_name'] == 'both' && trim($thisUser->getVar('name'))) {
$owner_name = is_object($thisUser) ? trim($thisUser->getVar('name')).' ('.trim($thisUser->getVar('uname')).')' : _GUESTS;
} else {
$owner_name = is_object($thisUser) ? trim($thisUser->getVar('uname')) : _GUESTS;
}
$icmsTpl->assign('profile_module_home', sprintf(_MD_PROFILE_PAGETITLE, $owner_name));
include 'footer.php';