home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / userinfo.php < prev    next >
Encoding:
PHP Script  |  2008-01-12  |  9.9 KB  |  202 lines

  1. <?php
  2. // $Id: userinfo.php 1246 2008-01-12 10:56:48Z dugris $
  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';
  29. include 'mainfile.php';
  30. include_once XOOPS_ROOT_PATH.'/class/module.textsanitizer.php';
  31.  
  32. include_once XOOPS_ROOT_PATH . '/modules/system/constants.php';
  33.  
  34. $uid = intval($_GET['uid']);
  35. if ($uid <= 0) {
  36.     redirect_header('index.php', 3, _US_SELECTNG);
  37.     exit();
  38. }
  39.  
  40. $gperm_handler = & xoops_gethandler( 'groupperm' );
  41. $groups = is_object($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.  
  45. if (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();
  86. if ( 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. if ( $thisUser->getVar('url', 'E') == '') {
  98.     $xoopsTpl->assign('user_websiteurl', '');
  99. } else {
  100.     $xoopsTpl->assign('user_websiteurl', '<a href="'.$thisUser->getVar('url', 'E').'" target="_blank">'.$thisUser->getVar('url').'</a>');
  101. }
  102. $xoopsTpl->assign('lang_email', _US_EMAIL);
  103. $xoopsTpl->assign('lang_privmsg', _US_PM);
  104. $xoopsTpl->assign('lang_icq', _US_ICQ);
  105. $xoopsTpl->assign('user_icq', $thisUser->getVar('user_icq'));
  106. $xoopsTpl->assign('lang_aim', _US_AIM);
  107. $xoopsTpl->assign('user_aim', $thisUser->getVar('user_aim'));
  108. $xoopsTpl->assign('lang_yim', _US_YIM);
  109. $xoopsTpl->assign('user_yim', $thisUser->getVar('user_yim'));
  110. $xoopsTpl->assign('lang_msnm', _US_MSNM);
  111. $xoopsTpl->assign('user_msnm', $thisUser->getVar('user_msnm'));
  112. $xoopsTpl->assign('lang_location', _US_LOCATION);
  113. $xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
  114. $xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
  115. $xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
  116. $xoopsTpl->assign('lang_interest', _US_INTEREST);
  117. $xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
  118. $xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
  119. $var = $thisUser->getVar('bio', 'N');
  120. $xoopsTpl->assign('user_extrainfo', $myts->makeTareaData4Show( $var,0,1,1) );
  121. $xoopsTpl->assign('lang_statistics', _US_STATISTICS);
  122. $xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
  123. $var = $thisUser->getVar('user_regdate');
  124. $xoopsTpl->assign('user_joindate', formatTimestamp( $var, 's' ) );
  125. $xoopsTpl->assign('lang_rank', _US_RANK);
  126. $xoopsTpl->assign('lang_posts', _US_POSTS);
  127. $xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
  128. $xoopsTpl->assign('lang_more', _US_MOREABOUT);
  129. $xoopsTpl->assign('lang_myinfo', _US_MYINFO);
  130. $xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
  131. $xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
  132. $xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
  133.  
  134. $xoopsTpl->assign('lang_signature', _US_SIGNATURE);
  135. $var = $thisUser->getVar('user_sig', 'N');
  136. $xoopsTpl->assign('user_signature', $myts->makeTareaData4Show( $var, 0, 1, 1 ) );
  137.  
  138. if ($thisUser->getVar('user_viewemail') == 1) {
  139.     $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
  140. } else {
  141.     if (is_object($xoopsUser)) {
  142.         // All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)
  143.         if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
  144.             $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
  145.         } else {
  146.             $xoopsTpl->assign('user_email', ' ');
  147.         }
  148.     }
  149. }
  150. if (is_object($xoopsUser)) {
  151.     $xoopsTpl->assign('user_pmlink', "<a href=\"javascript:openWithSelfMain('".XOOPS_URL."/pmlite.php?send2=1&to_userid=".$thisUser->getVar('uid')."', 'pmlite', 450, 380);\"><img src=\"".XOOPS_URL."/images/icons/pm.gif\" alt=\"".sprintf(_SENDPMTO,$thisUser->getVar('uname'))."\" /></a>");
  152. } else {
  153.     $xoopsTpl->assign('user_pmlink', '');
  154. }
  155. $userrank =& $thisUser->rank();
  156. if ($userrank['image']) {
  157.     $xoopsTpl->assign('user_rankimage', '<img src="'.XOOPS_UPLOAD_URL.'/'.$userrank['image'].'" alt="" />');
  158. }
  159. $xoopsTpl->assign('user_ranktitle', $userrank['title']);
  160. $date = $thisUser->getVar("last_login");
  161. if (!empty($date)) {
  162.     $xoopsTpl->assign('user_lastlogin', formatTimestamp($date,"m"));
  163. }
  164.  
  165.  
  166. $module_handler =& xoops_gethandler('module');
  167. $criteria = new CriteriaCompo(new Criteria('hassearch', 1));
  168. $criteria->add(new Criteria('isactive', 1));
  169. $mids =& array_keys($module_handler->getList($criteria));
  170.  
  171. foreach ($mids as $mid) {
  172.   if ( $gperm_handler->checkRight('module_read', $mid, $groups)) {
  173.     $module =& $module_handler->get($mid);
  174.     $results =& $module->search('', '', 5, 0, $thisUser->getVar('uid'));
  175.     $count = count($results);
  176.     if (is_array($results) && $count > 0) {
  177.         for ($i = 0; $i < $count; $i++) {
  178.             if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
  179.                 $results[$i]['image'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['image'];
  180.             } else {
  181.                 $results[$i]['image'] = 'images/icons/posticon2.gif';
  182.             }
  183.  
  184.             if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
  185.                 $results[$i]['link'] = "modules/".$module->getVar('dirname')."/".$results[$i]['link'];
  186.             }
  187.  
  188.             $results[$i]['title'] = $myts->makeTboxData4Show($results[$i]['title']);
  189.             $results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
  190.         }
  191.         if ($count == 5) {
  192.             $showall_link = '<a href="search.php?action=showallbyuser&mid='.$mid.'&uid='.$thisUser->getVar('uid').'">'._US_SHOWALL.'</a>';
  193.         } else {
  194.             $showall_link = '';
  195.         }
  196.         $xoopsTpl->append('modules', array('name' => $module->getVar('name'), 'results' => $results, 'showall_link' => $showall_link));
  197.     }
  198.     unset($module);
  199.   }
  200. }
  201. include XOOPS_ROOT_PATH.'/footer.php';
  202. ?>