[ Index ]
 

Code source de XOOPS 2.0.17.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/htdocs/ -> userinfo.php (source)

   1  <?php
   2  // $Id: userinfo.php 772 2006-10-17 01:41:32Z skalpa $

   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  $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  $var = $thisUser->getVar('bio', 'N');
 116  $xoopsTpl->assign('user_extrainfo', $myts->makeTareaData4Show( $var,0,1,1) );
 117  $xoopsTpl->assign('lang_statistics', _US_STATISTICS);
 118  $xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
 119  $var = $thisUser->getVar('user_regdate');
 120  $xoopsTpl->assign('user_joindate', formatTimestamp( $var, 's' ) );
 121  $xoopsTpl->assign('lang_rank', _US_RANK);
 122  $xoopsTpl->assign('lang_posts', _US_POSTS);
 123  $xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
 124  $xoopsTpl->assign('lang_more', _US_MOREABOUT);
 125  $xoopsTpl->assign('lang_myinfo', _US_MYINFO);
 126  $xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
 127  $xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
 128  $xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
 129  
 130  $xoopsTpl->assign('lang_signature', _US_SIGNATURE);
 131  $var = $thisUser->getVar('user_sig', 'N');
 132  $xoopsTpl->assign('user_signature', $myts->makeTareaData4Show( $var, 0, 1, 1 ) );
 133  
 134  if ($thisUser->getVar('user_viewemail') == 1) {
 135      $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
 136  } else {
 137      if (is_object($xoopsUser)) {
 138          // All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)

 139          if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
 140              $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
 141          } else {
 142              $xoopsTpl->assign('user_email', '&nbsp;');
 143          }
 144      }
 145  }
 146  if (is_object($xoopsUser)) {
 147      $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>");
 148  } else {
 149      $xoopsTpl->assign('user_pmlink', '');
 150  }
 151  $userrank =& $thisUser->rank();
 152  if ($userrank['image']) {
 153      $xoopsTpl->assign('user_rankimage', '<img src="'.XOOPS_UPLOAD_URL.'/'.$userrank['image'].'" alt="" />');
 154  }
 155  $xoopsTpl->assign('user_ranktitle', $userrank['title']);
 156  $date = $thisUser->getVar("last_login");
 157  if (!empty($date)) {
 158      $xoopsTpl->assign('user_lastlogin', formatTimestamp($date,"m"));
 159  }
 160  
 161  
 162  $module_handler =& xoops_gethandler('module');
 163  $criteria = new CriteriaCompo(new Criteria('hassearch', 1));
 164  $criteria->add(new Criteria('isactive', 1));
 165  $mids =& array_keys($module_handler->getList($criteria));
 166  
 167  foreach ($mids as $mid) {
 168    if ( $gperm_handler->checkRight('module_read', $mid, $groups)) {
 169      $module =& $module_handler->get($mid);
 170      $results =& $module->search('', '', 5, 0, $thisUser->getVar('uid'));
 171      $count = count($results);
 172      if (is_array($results) && $count > 0) {
 173          for ($i = 0; $i < $count; $i++) {
 174              if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
 175                  $results[$i]['image'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['image'];
 176              } else {
 177                  $results[$i]['image'] = 'images/icons/posticon2.gif';
 178              }
 179              
 180              if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
 181                  $results[$i]['link'] = "modules/".$module->getVar('dirname')."/".$results[$i]['link'];
 182              }
 183  
 184              $results[$i]['title'] = $myts->makeTboxData4Show($results[$i]['title']);
 185              $results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
 186          }
 187          if ($count == 5) {
 188              $showall_link = '<a href="search.php?action=showallbyuser&amp;mid='.$mid.'&amp;uid='.$thisUser->getVar('uid').'">'._US_SHOWALL.'</a>';
 189          } else {
 190              $showall_link = '';
 191          }
 192          $xoopsTpl->append('modules', array('name' => $module->getVar('name'), 'results' => $results, 'showall_link' => $showall_link));
 193      }
 194      unset($module);
 195    }
 196  }
 197  include  XOOPS_ROOT_PATH.'/footer.php';
 198  ?>


Généré le : Sun Nov 25 11:44:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics