[ 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]

/ -> user.php (source)

   1  <?php
   2  // $Id: user.php 1969 2008-08-24 02:13:23Z 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  $xoopsOption['pagetype'] = 'user';
  29  include  'mainfile.php';
  30  
  31  $op = 'main';
  32  
  33  if ( isset($_POST['op']) ) {
  34      $op = trim($_POST['op']);
  35  } elseif ( isset($_GET['op']) ) {
  36      $op = trim($_GET['op']);
  37  }
  38  
  39  if ($op == 'login') {
  40      include_once  XOOPS_ROOT_PATH . '/include/checklogin.php';
  41      exit();
  42  }
  43  
  44  $module_handler = xoops_gethandler('module');
  45  $profile_module = $module_handler->getByDirname('profile');
  46  if ($profile_module && $profile_module->getVar('isactive')) {
  47      header("location: ./modules/profile/user.php" . (empty($_SERVER['QUERY_STRING']) ? "" : "?" . $_SERVER['QUERY_STRING']) );
  48      exit();
  49  }
  50  
  51  if ($op == 'main') {
  52      if ( !$xoopsUser ) {
  53          $xoopsOption['template_main'] = 'system_userform.html';
  54          include  'header.php';
  55          $xoopsTpl->assign('lang_login', _LOGIN);
  56          $xoopsTpl->assign('lang_username', _USERNAME);
  57          if (isset($_GET['xoops_redirect'])) {
  58              $xoopsTpl->assign('redirect_page', htmlspecialchars(trim($_GET['xoops_redirect']), ENT_QUOTES));
  59          }
  60          if ($xoopsConfig['usercookie']) {
  61              $xoopsTpl->assign('lang_rememberme', _US_REMEMBERME);
  62          }
  63          $xoopsTpl->assign('lang_password', _PASSWORD);
  64          $xoopsTpl->assign('lang_notregister', _US_NOTREGISTERED);
  65          $xoopsTpl->assign('lang_lostpassword', _US_LOSTPASSWORD);
  66          $xoopsTpl->assign('lang_noproblem', _US_NOPROBLEM);
  67          $xoopsTpl->assign('lang_youremail', _US_YOUREMAIL);
  68          $xoopsTpl->assign('lang_sendpassword', _US_SENDPASSWORD);
  69          $xoopsTpl->assign('mailpasswd_token', $GLOBALS['xoopsSecurity']->createToken());
  70          include  'footer.php';
  71          exit();
  72      }
  73      if ( !empty($_GET['xoops_redirect']) ) {
  74          $redirect = trim($_GET['xoops_redirect']);
  75          $isExternal = false;
  76          if ($pos = strpos( $redirect, '://' )) {
  77              $xoopsLocation = substr( XOOPS_URL, strpos( XOOPS_URL, '://' ) + 3 );
  78              if ( strcasecmp(substr($redirect, $pos + 3, strlen($xoopsLocation)), $xoopsLocation) ) {
  79                  $isExternal = true;
  80              }
  81          }
  82          if (!$isExternal) {
  83              header('Location: ' . $redirect);
  84              exit();
  85          }
  86      }
  87      header('Location: '.XOOPS_URL.'/userinfo.php?uid='.$xoopsUser->getVar('uid'));
  88      exit();
  89  }
  90  
  91  if ($op == 'logout') {
  92      $message = '';
  93      $_SESSION = array();
  94      session_destroy();
  95      setcookie($xoopsConfig['usercookie'], 0, -1, '/',  '', 0);
  96      // clear entry from online users table

  97      if (is_object($xoopsUser)) {
  98          $online_handler =& xoops_gethandler('online');
  99          $online_handler->destroy($xoopsUser->getVar('uid'));
 100      }
 101      $message = _US_LOGGEDOUT.'<br />'._US_THANKYOUFORVISIT;
 102      redirect_header('index.php', 1, $message);
 103      exit();
 104  }
 105  
 106  if ($op == 'actv') {
 107      trigger_error("Deprecated code. The activation is now handled by register.php", E_USER_WARNING);
 108      $id = intval($_GET['id']);
 109      $actkey = trim($_GET['actkey']);
 110      redirect_header("register.php?id={$id}&amp;actkey={$actkey}", 1, '');
 111      exit();
 112   
 113      if (empty($id)) {
 114          redirect_header('index.php',1,'');
 115          exit();
 116      }
 117      $member_handler =& xoops_gethandler('member');
 118      $thisuser =& $member_handler->getUser($id);
 119      if (!is_object($thisuser)) {
 120          exit();
 121      }
 122      if ($thisuser->getVar('actkey') != $actkey) {
 123          redirect_header('index.php',5,_US_ACTKEYNOT);
 124      } else {
 125          if ($thisuser->getVar('level') > 0 ) {
 126              redirect_header( 'user.php', 5, _US_ACONTACT, false );
 127          } else {
 128              if (false != $member_handler->activateUser($thisuser)) {
 129                  $config_handler =& xoops_gethandler('config');
 130                  $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
 131                  if ($xoopsConfigUser['activation_type'] == 2) {
 132                      $myts =& MyTextSanitizer::getInstance();
 133                      $xoopsMailer =& xoops_getMailer();
 134                      $xoopsMailer->useMail();
 135                      $xoopsMailer->setTemplate('activated.tpl');
 136                      $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
 137                      $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
 138                      $xoopsMailer->assign('SITEURL', XOOPS_URL."/");
 139                      $xoopsMailer->setToUsers($thisuser);
 140                      $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
 141                      $xoopsMailer->setFromName($xoopsConfig['sitename']);
 142                      $xoopsMailer->setSubject(sprintf(_US_YOURACCOUNT,$xoopsConfig['sitename']));
 143                      include  'header.php';
 144                      if ( !$xoopsMailer->send() ) {
 145                          printf(_US_ACTVMAILNG, $thisuser->getVar('uname'));
 146                      } else {
 147                          printf(_US_ACTVMAILOK, $thisuser->getVar('uname'));
 148                      }
 149                      include  'footer.php';
 150                  } else {
 151                      redirect_header( 'user.php', 5, _US_ACTLOGIN, false );
 152                  }
 153              } else {
 154                  redirect_header('index.php',5,'Activation failed!');
 155              }
 156          }
 157      }
 158      exit();
 159  }
 160  
 161  if ($op == 'delete') {
 162      $config_handler =& xoops_gethandler('config');
 163      $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
 164      if (!$xoopsUser || $xoopsConfigUser['self_delete'] != 1) {
 165          redirect_header('index.php',5,_US_NOPERMISS);
 166          exit();
 167      } else {
 168          $groups = $xoopsUser->getGroups();
 169          if (in_array(XOOPS_GROUP_ADMIN, $groups)){
 170              // users in the webmasters group may not be deleted

 171              redirect_header('user.php', 5, _US_ADMINNO);
 172              exit();
 173          }
 174          $ok = !isset($_POST['ok']) ? 0 : intval($_POST['ok']);
 175          if ($ok != 1) {
 176              include  'header.php';
 177              xoops_confirm(array('op' => 'delete', 'ok' => 1), 'user.php', _US_SURETODEL.'<br/>'._US_REMOVEINFO);
 178              include  'footer.php';
 179          } else {
 180              $del_uid = $xoopsUser->getVar("uid");
 181              $member_handler =& xoops_gethandler('member');
 182              if (false != $member_handler->deleteUser($xoopsUser)) {
 183                  $online_handler =& xoops_gethandler('online');
 184                  $online_handler->destroy($del_uid);
 185                  xoops_notification_deletebyuser($del_uid);
 186                  redirect_header('index.php', 5, _US_BEENDELED);
 187              }
 188              redirect_header('index.php',5,_US_NOPERMISS);
 189          }
 190          exit();
 191      }
 192  }
 193  ?>


[ 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.