XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
userinfo.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
25 include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php';
27 $xoopsPreload->triggerEvent('core.userinfo.start');
28 
29 xoops_loadLanguage('user');
30 include_once $GLOBALS['xoops']->path('class/module.textsanitizer.php');
31 include_once $GLOBALS['xoops']->path('modules/system/constants.php');
32 
33 $uid = intval($_GET['uid']);
34 if ($uid <= 0) {
35  redirect_header('index.php', 3, _US_SELECTNG);
36  exit();
37 }
38 
40 $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
41 
42 $isAdmin = $gperm_handler->checkRight('system_admin', XOOPS_SYSTEM_USER, $groups);
43 if (is_object($xoopsUser)) {
44  if ($uid == $xoopsUser->getVar('uid')) {
45  $config_handler =& xoops_gethandler('config');
47  $xoopsOption['template_main'] = 'system_userinfo.html';
48  include $GLOBALS['xoops']->path('header.php');
49  $xoopsTpl->assign('user_ownpage', true);
50  $xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);
51  $xoopsTpl->assign('lang_avatar', _US_AVATAR);
52  $xoopsTpl->assign('lang_inbox', _US_INBOX);
53  $xoopsTpl->assign('lang_logout', _US_LOGOUT);
54  if ($xoopsConfigUser['self_delete'] == 1) {
55  $xoopsTpl->assign('user_candelete', true);
56  $xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);
57  } else {
58  $xoopsTpl->assign('user_candelete', false);
59  }
61  } else {
62  $member_handler =& xoops_gethandler('member');
63  $thisUser =& $member_handler->getUser($uid);
64  if (! is_object($thisUser) || ! $thisUser->isActive()) {
65  redirect_header("index.php", 3, _US_SELECTNG);
66  exit();
67  }
68  $xoopsOption['template_main'] = 'system_userinfo.html';
69  include $GLOBALS['xoops']->path('header.php');
70  $xoopsTpl->assign('user_ownpage', false);
71  }
72 } else {
73  $member_handler =& xoops_gethandler('member');
75  if (!is_object($thisUser) || !$thisUser->isActive()) {
76  redirect_header("index.php", 3, _US_SELECTNG);
77  exit();
78  }
79  $xoopsOption['template_main'] = 'system_userinfo.html';
80  include $GLOBALS['xoops']->path('header.php');
81  $xoopsTpl->assign('user_ownpage', false);
82 }
84 if (is_object($xoopsUser) && $isAdmin) {
85  $xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);
86  $xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);
87  $xoopsTpl->assign('user_uid', $thisUser->getVar('uid'));
88 }
89 $xoopsOption['xoops_pagetitle'] = sprintf(_US_ALLABOUT, $thisUser->getVar('uname'));
90 $xoopsTpl->assign('lang_allaboutuser', sprintf(_US_ALLABOUT, $thisUser->getVar('uname')));
91 $xoopsTpl->assign('lang_avatar', _US_AVATAR);
92 
93 $avatar = "";
94 if ($thisUser->getVar('user_avatar') && "blank.gif" != $thisUser->getVar('user_avatar')) {
95  $avatar = XOOPS_UPLOAD_URL . "/" . $thisUser->getVar('user_avatar');
96 }
97 $xoopsTpl->assign('user_avatarurl', $avatar);
98 $xoopsTpl->assign('lang_realname', _US_REALNAME);
99 $xoopsTpl->assign('user_realname', $thisUser->getVar('name'));
100 $xoopsTpl->assign('lang_website', _US_WEBSITE);
101 if ($thisUser->getVar('url', 'E') == '') {
102  $xoopsTpl->assign('user_websiteurl', '');
103 } else {
104  $xoopsTpl->assign('user_websiteurl', '<a href="' . $thisUser->getVar('url', 'E') . '" rel="external">' . $thisUser->getVar('url') . '</a>');
105 }
106 $xoopsTpl->assign('lang_email', _US_EMAIL);
107 $xoopsTpl->assign('lang_privmsg', _US_PM);
108 $xoopsTpl->assign('lang_icq', _US_ICQ);
109 $xoopsTpl->assign('user_icq', $thisUser->getVar('user_icq'));
110 $xoopsTpl->assign('lang_aim', _US_AIM);
111 $xoopsTpl->assign('user_aim', $thisUser->getVar('user_aim'));
112 $xoopsTpl->assign('lang_yim', _US_YIM);
113 $xoopsTpl->assign('user_yim', $thisUser->getVar('user_yim'));
114 $xoopsTpl->assign('lang_msnm', _US_MSNM);
115 $xoopsTpl->assign('user_msnm', $thisUser->getVar('user_msnm'));
116 $xoopsTpl->assign('lang_location', _US_LOCATION);
117 $xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
118 $xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
119 $xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
120 $xoopsTpl->assign('lang_interest', _US_INTEREST);
121 $xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
122 $xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
123 $var = $thisUser->getVar('bio', 'N');
124 $xoopsTpl->assign('user_extrainfo', $myts->displayTarea($var, 0, 1, 1));
125 $xoopsTpl->assign('lang_statistics', _US_STATISTICS);
126 $xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
127 $var = $thisUser->getVar('user_regdate');
128 $xoopsTpl->assign('user_joindate', formatTimestamp($var, 's'));
129 $xoopsTpl->assign('lang_rank', _US_RANK);
130 $xoopsTpl->assign('lang_posts', _US_POSTS);
131 $xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
132 $xoopsTpl->assign('lang_more', _US_MOREABOUT);
133 $xoopsTpl->assign('lang_myinfo', _US_MYINFO);
134 $xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
135 $xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
136 $xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
137 $xoopsTpl->assign('lang_signature', _US_SIGNATURE);
138 $var = $thisUser->getVar('user_sig', 'N');
139 $xoopsTpl->assign('user_signature', $myts->displayTarea($var, 0, 1, 1));
140 if ($thisUser->getVar('user_viewemail') == 1) {
141  $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
142 } else {
143  if (is_object($xoopsUser)) {
144  // All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)
145  if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
146  $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
147  } else {
148  $xoopsTpl->assign('user_email', '&nbsp;');
149  }
150  }
151 }
152 if (is_object($xoopsUser)) {
153  $xoopsTpl->assign('user_pmlink', "<a href=\"javascript:openWithSelfMain('" . XOOPS_URL . "/pmlite.php?send2=1&amp;to_userid=" . $thisUser->getVar('uid') . "', 'pmlite', 450, 380);\"><img src=\"" . XOOPS_URL . "/images/icons/pm.gif\" alt=\"" . sprintf(_SENDPMTO, $thisUser->getVar('uname')) . "\" /></a>");
154 } else {
155  $xoopsTpl->assign('user_pmlink', '');
156 }
157 $userrank = $thisUser->rank();
158 if (isset($userrank['image']) && $userrank['image']) {
159  $xoopsTpl->assign('user_rankimage', '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="" />');
160 }
161 $xoopsTpl->assign('user_ranktitle', $userrank['title']);
162 $date = $thisUser->getVar("last_login");
163 if (! empty($date)) {
164  $xoopsTpl->assign('user_lastlogin', formatTimestamp($date, "m"));
165 }
167 $criteria = new CriteriaCompo(new Criteria('hassearch', 1));
168 $criteria->add(new Criteria('isactive', 1));
169 $mids = array_keys($module_handler->getList($criteria));
170 foreach ($mids as $mid) {
171  if ($gperm_handler->checkRight('module_read', $mid, $groups)) {
172  $module = $module_handler->get($mid);
173  $results = $module->search('', '', 5, 0, $thisUser->getVar('uid'));
174  $count = count($results);
175  if (is_array($results) && $count > 0) {
176  for($i = 0; $i < $count; $i++) {
177  if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
178  $results[$i]['image'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['image'];
179  } else {
180  $results[$i]['image'] = 'images/icons/posticon2.gif';
181  }
182 
183  if (! preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
184  $results[$i]['link'] = "modules/" . $module->getVar('dirname') . "/" . $results[$i]['link'];
185  }
186 
187  $results[$i]['title'] = $myts->htmlspecialchars($results[$i]['title']);
188  $results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
189  }
190  if ($count == 5) {
191  $showall_link = '<a href="search.php?action=showallbyuser&amp;mid=' . $mid . '&amp;uid=' . $thisUser->getVar('uid') . '">' . _US_SHOWALL . '</a>';
192  } else {
193  $showall_link = '';
194  }
195  $xoopsTpl->append('modules', array(
196  'name' => $module->getVar('name') ,
197  'results' => $results ,
198  'showall_link' => $showall_link));
199  }
200  unset($module);
201  }
202 }
203 include $GLOBALS['xoops']->path('footer.php');
204 
205 ?>