[ Index ]

PHP Cross Reference of Xoops v2.3.1

[Global whois Lookup]    [Ranchi, Jharkhand, India website]     [Hindi Magazine]     [Desi Community website in tristate area]    [B 4 Bollywood]    [Internet nation of India]

title

Body

[close]

/ -> userinfo.php (source)

   1  <?php
   2  // $Id: userinfo.php 2131 2008-09-21 06:48:46Z phppp $

   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  
  29  
  30  //$xoopsOption['pagetype'] = 'user';

  31  include  'mainfile.php';
  32  $module_handler = xoops_gethandler('module');
  33  $profile_module = $module_handler->getByDirname('profile');
  34  if ($profile_module && $profile_module->getVar('isactive')) {
  35      header("location: ./modules/profile/userinfo.php" . (empty($_SERVER['QUERY_STRING']) ? "" : "?" . $_SERVER['QUERY_STRING']) );
  36      exit();
  37  }
  38  
  39  xoops_loadLanguage('user');
  40  include_once  XOOPS_ROOT_PATH.'/class/module.textsanitizer.php';
  41  include_once  XOOPS_ROOT_PATH . '/modules/system/constants.php';
  42  
  43  $uid = intval($_GET['uid']);
  44  if ($uid <= 0) {
  45      redirect_header('index.php', 3, _US_SELECTNG);
  46      exit();
  47  }
  48  
  49  $gperm_handler = & xoops_gethandler( 'groupperm' );
  50  $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
  51  
  52  $isAdmin = $gperm_handler->checkRight( 'system_admin', XOOPS_SYSTEM_USER, $groups);
  53  /*

  54  // Check access permission

  55  if ( $isAdmin || ( is_object($xoopsUser) && $uid == $xoopsUser->getVar('uid') ) ) {

  56  } else {

  57      $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);

  58      if (!array_intersect($groups, $xoopsConfigUser["allowed_groups"])) {

  59          redirect_header('index.php', 3, _NOPERM);

  60          exit();

  61      }

  62  }

  63  */
  64  
  65  if (is_object($xoopsUser)) {
  66      if ($uid == $xoopsUser->getVar('uid')) {
  67          $config_handler =& xoops_gethandler('config');
  68          $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
  69          $xoopsOption['template_main'] = 'system_userinfo.html';
  70          include  XOOPS_ROOT_PATH.'/header.php';
  71          $xoopsTpl->assign('user_ownpage', true);
  72          $xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);
  73          $xoopsTpl->assign('lang_avatar', _US_AVATAR);
  74          $xoopsTpl->assign('lang_inbox', _US_INBOX);
  75          $xoopsTpl->assign('lang_logout', _US_LOGOUT);
  76          if ($xoopsConfigUser['self_delete'] == 1) {
  77              $xoopsTpl->assign('user_candelete', true);
  78              $xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);
  79          } else {
  80              $xoopsTpl->assign('user_candelete', false);
  81          }
  82          $thisUser =& $xoopsUser;
  83      } else {
  84          $member_handler =& xoops_gethandler('member');
  85          $thisUser =& $member_handler->getUser($uid);
  86          if (!is_object($thisUser) || !$thisUser->isActive() ) {
  87              redirect_header("index.php",3,_US_SELECTNG);
  88              exit();
  89          }
  90          $xoopsOption['template_main'] = 'system_userinfo.html';
  91          include  XOOPS_ROOT_PATH.'/header.php';
  92          $xoopsTpl->assign('user_ownpage', false);
  93      }
  94  } else {
  95      $member_handler =& xoops_gethandler('member');
  96      $thisUser =& $member_handler->getUser($uid);
  97      if (!is_object($thisUser) || !$thisUser->isActive()) {
  98          redirect_header("index.php",3,_US_SELECTNG);
  99          exit();
 100      }
 101      $xoopsOption['template_main'] = 'system_userinfo.html';
 102      include (XOOPS_ROOT_PATH.'/header.php');
 103      $xoopsTpl->assign('user_ownpage', false);
 104  }
 105  $myts =& MyTextSanitizer::getInstance();
 106  if ( is_object($xoopsUser) && $isAdmin ) {
 107      $xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);
 108      $xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);
 109      $xoopsTpl->assign('user_uid', $thisUser->getVar('uid'));
 110  }
 111  $xoopsTpl->assign('lang_allaboutuser', sprintf(_US_ALLABOUT,$thisUser->getVar('uname')));
 112  $xoopsTpl->assign('lang_avatar', _US_AVATAR);
 113  $xoopsTpl->assign('user_avatarurl', 'uploads/'.$thisUser->getVar('user_avatar'));
 114  $xoopsTpl->assign('lang_realname', _US_REALNAME);
 115  $xoopsTpl->assign('user_realname', $thisUser->getVar('name'));
 116  $xoopsTpl->assign('lang_website', _US_WEBSITE);
 117  if ( $thisUser->getVar('url', 'E') == '') {
 118      $xoopsTpl->assign('user_websiteurl', '');
 119  } else {
 120      $xoopsTpl->assign('user_websiteurl', '<a href="'.$thisUser->getVar('url', 'E').'" rel="external">'.$thisUser->getVar('url').'</a>');
 121  }
 122  $xoopsTpl->assign('lang_email', _US_EMAIL);
 123  $xoopsTpl->assign('lang_privmsg', _US_PM);
 124  $xoopsTpl->assign('lang_icq', _US_ICQ);
 125  $xoopsTpl->assign('user_icq', $thisUser->getVar('user_icq'));
 126  $xoopsTpl->assign('lang_aim', _US_AIM);
 127  $xoopsTpl->assign('user_aim', $thisUser->getVar('user_aim'));
 128  $xoopsTpl->assign('lang_yim', _US_YIM);
 129  $xoopsTpl->assign('user_yim', $thisUser->getVar('user_yim'));
 130  $xoopsTpl->assign('lang_msnm', _US_MSNM);
 131  $xoopsTpl->assign('user_msnm', $thisUser->getVar('user_msnm'));
 132  $xoopsTpl->assign('lang_location', _US_LOCATION);
 133  $xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
 134  $xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
 135  $xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
 136  $xoopsTpl->assign('lang_interest', _US_INTEREST);
 137  $xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
 138  $xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
 139  $var = $thisUser->getVar('bio', 'N');
 140  $xoopsTpl->assign('user_extrainfo', $myts->displayTarea( $var,0,1,1) );
 141  $xoopsTpl->assign('lang_statistics', _US_STATISTICS);
 142  $xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
 143  $var = $thisUser->getVar('user_regdate');
 144  $xoopsTpl->assign('user_joindate', formatTimestamp( $var, 's' ) );
 145  $xoopsTpl->assign('lang_rank', _US_RANK);
 146  $xoopsTpl->assign('lang_posts', _US_POSTS);
 147  $xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
 148  $xoopsTpl->assign('lang_more', _US_MOREABOUT);
 149  $xoopsTpl->assign('lang_myinfo', _US_MYINFO);
 150  $xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
 151  $xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
 152  $xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
 153  
 154  $xoopsTpl->assign('lang_signature', _US_SIGNATURE);
 155  $var = $thisUser->getVar('user_sig', 'N');
 156  $xoopsTpl->assign('user_signature', $myts->displayTarea( $var, 0, 1, 1 ) );
 157  
 158  if ($thisUser->getVar('user_viewemail') == 1) {
 159      $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
 160  } else {
 161      if (is_object($xoopsUser)) {
 162          // All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)

 163          if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
 164              $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
 165          } else {
 166              $xoopsTpl->assign('user_email', '&nbsp;');
 167          }
 168      }
 169  }
 170  if (is_object($xoopsUser)) {
 171      $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>");
 172  } else {
 173      $xoopsTpl->assign('user_pmlink', '');
 174  }
 175  $userrank = $thisUser->rank();
 176  if ($userrank['image']) {
 177      $xoopsTpl->assign('user_rankimage', '<img src="'.XOOPS_UPLOAD_URL.'/'.$userrank['image'].'" alt="" />');
 178  }
 179  $xoopsTpl->assign('user_ranktitle', $userrank['title']);
 180  $date = $thisUser->getVar("last_login");
 181  if (!empty($date)) {
 182      $xoopsTpl->assign('user_lastlogin', formatTimestamp($date,"m"));
 183  }
 184  
 185  
 186  $module_handler =& xoops_gethandler('module');
 187  $criteria = new CriteriaCompo(new Criteria('hassearch', 1));
 188  $criteria->add(new Criteria('isactive', 1));
 189  $mids = array_keys($module_handler->getList($criteria));
 190  
 191  foreach ($mids as $mid) {
 192      if ( $gperm_handler->checkRight('module_read', $mid, $groups)) {
 193          $module = $module_handler->get($mid);
 194          $results = $module->search('', '', 5, 0, $thisUser->getVar('uid'));
 195          $count = count($results);
 196          if (is_array($results) && $count > 0) {
 197              for ($i = 0; $i < $count; $i++) {
 198                  if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
 199                      $results[$i]['image'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['image'];
 200                  } else {
 201                      $results[$i]['image'] = 'images/icons/posticon2.gif';
 202                  }
 203      
 204                  if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
 205                      $results[$i]['link'] = "modules/".$module->getVar('dirname')."/".$results[$i]['link'];
 206                  }
 207      
 208                  $results[$i]['title'] = $myts->htmlspecialchars($results[$i]['title']);
 209                  $results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
 210              }
 211              if ($count == 5) {
 212                  $showall_link = '<a href="search.php?action=showallbyuser&amp;mid='.$mid.'&amp;uid='.$thisUser->getVar('uid').'">'._US_SHOWALL.'</a>';
 213              } else {
 214                  $showall_link = '';
 215              }
 216              $xoopsTpl->append('modules', array('name' => $module->getVar('name'), 'results' => $results, 'showall_link' => $showall_link));
 217          }
 218          unset($module);
 219      }
 220  }
 221  include  XOOPS_ROOT_PATH.'/footer.php';
 222  ?>


[ Xoops]     [PhpNuke]     [PostNuke]     [Joomla]    [Drupal]    [E107]    [NucleusCms]
[Php-Fusion]     [PhpBB]     [WordPress]     [Typo3]
Generated: Mon Oct 27 11:51:45 2008
Open Source related documentation for developers.