source: temp/test-xoops.ec-cube.net/html/userinfo.php @ 405

Revision 405, 9.6 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: userinfo.php,v 1.3 2006/05/01 02:37:26 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28$xoopsOption['pagetype'] = 'user';
29include 'mainfile.php';
30include_once XOOPS_ROOT_PATH.'/class/module.textsanitizer.php';
31
32include_once XOOPS_ROOT_PATH . '/modules/system/constants.php';
33
34$uid = intval($_GET['uid']);
35if ($uid <= 0) {
36    redirect_header('index.php', 3, _US_SELECTNG);
37    exit();
38}
39
40$gperm_handler = & xoops_gethandler( 'groupperm' );
41$groups = ( $xoopsUser ) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS;
42
43$isAdmin = $gperm_handler->checkRight( 'system_admin', XOOPS_SYSTEM_USER, $groups);         // isadmin is true if user has 'edit users' admin rights
44
45if (is_object($xoopsUser)) {
46    if ($uid == $xoopsUser->getVar('uid')) {
47        $config_handler =& xoops_gethandler('config');
48        $xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);
49        $xoopsOption['template_main'] = 'system_userinfo.html';
50        include XOOPS_ROOT_PATH.'/header.php';
51        $xoopsTpl->assign('user_ownpage', true);
52        $xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);
53        $xoopsTpl->assign('lang_avatar', _US_AVATAR);
54        $xoopsTpl->assign('lang_inbox', _US_INBOX);
55        $xoopsTpl->assign('lang_logout', _US_LOGOUT);
56        if ($xoopsConfigUser['self_delete'] == 1) {
57            $xoopsTpl->assign('user_candelete', true);
58            $xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);
59        } else {
60            $xoopsTpl->assign('user_candelete', false);
61        }
62        $thisUser =& $xoopsUser;
63    } else {
64        $member_handler =& xoops_gethandler('member');
65        $thisUser =& $member_handler->getUser($uid);
66        if (!is_object($thisUser) || !$thisUser->isActive() ) {
67            redirect_header("index.php",3,_US_SELECTNG);
68            exit();
69        }
70        $xoopsOption['template_main'] = 'system_userinfo.html';
71        include XOOPS_ROOT_PATH.'/header.php';
72        $xoopsTpl->assign('user_ownpage', false);
73    }
74} else {
75    $member_handler =& xoops_gethandler('member');
76    $thisUser =& $member_handler->getUser($uid);
77    if (!is_object($thisUser) || !$thisUser->isActive()) {
78        redirect_header("index.php",3,_US_SELECTNG);
79        exit();
80    }
81    $xoopsOption['template_main'] = 'system_userinfo.html';
82    include(XOOPS_ROOT_PATH.'/header.php');
83    $xoopsTpl->assign('user_ownpage', false);
84}
85$myts =& MyTextSanitizer::getInstance();
86if ( is_object($xoopsUser) && $isAdmin ) {
87    $xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);
88    $xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);
89    $xoopsTpl->assign('user_uid', $thisUser->getVar('uid'));
90}
91$xoopsTpl->assign('lang_allaboutuser', sprintf(_US_ALLABOUT,$thisUser->getVar('uname')));
92$xoopsTpl->assign('lang_avatar', _US_AVATAR);
93$xoopsTpl->assign('user_avatarurl', 'uploads/'.$thisUser->getVar('user_avatar'));
94$xoopsTpl->assign('lang_realname', _US_REALNAME);
95$xoopsTpl->assign('user_realname', $thisUser->getVar('name'));
96$xoopsTpl->assign('lang_website', _US_WEBSITE);
97$xoopsTpl->assign('user_websiteurl', '<a href="'.$thisUser->getVar('url', 'E').'" target="_blank">'.$thisUser->getVar('url').'</a>');
98$xoopsTpl->assign('lang_email', _US_EMAIL);
99$xoopsTpl->assign('lang_privmsg', _US_PM);
100$xoopsTpl->assign('lang_icq', _US_ICQ);
101$xoopsTpl->assign('user_icq', $thisUser->getVar('user_icq'));
102$xoopsTpl->assign('lang_aim', _US_AIM);
103$xoopsTpl->assign('user_aim', $thisUser->getVar('user_aim'));
104$xoopsTpl->assign('lang_yim', _US_YIM);
105$xoopsTpl->assign('user_yim', $thisUser->getVar('user_yim'));
106$xoopsTpl->assign('lang_msnm', _US_MSNM);
107$xoopsTpl->assign('user_msnm', $thisUser->getVar('user_msnm'));
108$xoopsTpl->assign('lang_location', _US_LOCATION);
109$xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
110$xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
111$xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
112$xoopsTpl->assign('lang_interest', _US_INTEREST);
113$xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
114$xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
115$xoopsTpl->assign('user_extrainfo', $myts->makeTareaData4Show($thisUser->getVar('bio', 'N'),0,1,1));
116$xoopsTpl->assign('lang_statistics', _US_STATISTICS);
117$xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
118$xoopsTpl->assign('user_joindate', formatTimestamp($thisUser->getVar('user_regdate'),'s'));
119$xoopsTpl->assign('lang_rank', _US_RANK);
120$xoopsTpl->assign('lang_posts', _US_POSTS);
121$xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
122$xoopsTpl->assign('lang_more', _US_MOREABOUT);
123$xoopsTpl->assign('lang_myinfo', _US_MYINFO);
124$xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
125$xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
126$xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
127
128$xoopsTpl->assign('lang_signature', _US_SIGNATURE);
129$xoopsTpl->assign('user_signature', $myts->makeTareaData4Show($thisUser->getVar('user_sig', 'N'),0,1,1));
130
131if ($thisUser->getVar('user_viewemail') == 1) {
132    $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
133} else {
134    if (is_object($xoopsUser)) {
135        // All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)
136        if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
137            $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
138        } else {
139            $xoopsTpl->assign('user_email', '&nbsp;');
140        }
141    }
142}
143if (is_object($xoopsUser)) {
144    $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>");
145} else {
146    $xoopsTpl->assign('user_pmlink', '');
147}
148$userrank = $thisUser->rank();
149if ($userrank['image']) {
150    $xoopsTpl->assign('user_rankimage', '<img src="'.XOOPS_UPLOAD_URL.'/'.$userrank['image'].'" alt="" />');
151}
152$xoopsTpl->assign('user_ranktitle', $userrank['title']);
153$date = $thisUser->getVar("last_login");
154if (!empty($date)) {
155    $xoopsTpl->assign('user_lastlogin', formatTimestamp($date,"m"));
156}
157
158
159$module_handler =& xoops_gethandler('module');
160$criteria = new CriteriaCompo(new Criteria('hassearch', 1));
161$criteria->add(new Criteria('isactive', 1));
162$mids = array_keys($module_handler->getList($criteria));
163
164foreach ($mids as $mid) {
165    // Hack by marcan : only return results of modules for which user has access permission
166  if ( $gperm_handler->checkRight('module_read', $mid, $groups)) {
167    $module =& $module_handler->get($mid);
168    $results =& $module->search('', '', 5, 0, $thisUser->getVar('uid'));
169    $count = count($results);
170    if (is_array($results) && $count > 0) {
171        for ($i = 0; $i < $count; $i++) {
172            if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
173                $results[$i]['image'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['image'];
174            } else {
175                $results[$i]['image'] = 'images/icons/posticon2.gif';
176            }
177            $results[$i]['link'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['link'];
178            $results[$i]['title'] = $myts->makeTboxData4Show($results[$i]['title']);
179            $results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
180        }
181        if ($count == 5) {
182            $showall_link = '<a href="search.php?action=showallbyuser&amp;mid='.$mid.'&amp;uid='.$thisUser->getVar('uid').'">'._US_SHOWALL.'</a>';
183        } else {
184            $showall_link = '';
185        }
186        $xoopsTpl->append('modules', array('name' => $module->getVar('name'), 'results' => $results, 'showall_link' => $showall_link));
187    }
188    unset($module);
189  }
190}
191include XOOPS_ROOT_PATH.'/footer.php';
192?>
Note: See TracBrowser for help on using the repository browser.