[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/ -> deleteuser.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://cmsmadesimple.sf.net
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  #
  19  #$Id: deleteuser.php 3345 2006-08-21 12:42:08Z wishy $
  20  
  21  $CMS_ADMIN_PAGE=1;
  22  
  23  require_once ("../include.php");
  24  
  25  check_login();
  26  
  27  $dodelete = true;
  28  
  29  $user_id = -1;
  30  if (isset($_GET["user_id"]))
  31  {
  32      $user_id = $_GET["user_id"];
  33      $user_name = "";
  34      $userid = get_userid();
  35      $access = check_permission($userid, 'Remove Users');
  36  
  37      if ($access)
  38      {
  39          global $gCms;
  40          $userops =& $gCms->GetUserOperations();
  41          $oneuser = $userops->LoadUserByID($user_id);
  42          $user_name = $oneuser->username;
  43          $ownercount = $userops->CountPageOwnershipByID($user_id);
  44  
  45          if ($ownercount > 0)
  46          {
  47              $dodelete = false;
  48          }
  49  
  50          if ($dodelete)
  51          {
  52              #Perform the deleteuser_pre callback
  53              foreach($gCms->modules as $key=>$value)
  54              {
  55                  if ($gCms->modules[$key]['installed'] == true &&
  56                      $gCms->modules[$key]['active'] == true)
  57                  {
  58                      $gCms->modules[$key]['object']->DeleteUserPre($oneuser);
  59                  }
  60              }
  61              
  62              Events::SendEvent('Core', 'DeleteUserPre', array('user' => &$oneuser));
  63  
  64              $oneuser->Delete();
  65  
  66              #Perform the deleteuser_post callback
  67              foreach($gCms->modules as $key=>$value)
  68              {
  69                  if ($gCms->modules[$key]['installed'] == true &&
  70                      $gCms->modules[$key]['active'] == true)
  71                  {
  72                      $gCms->modules[$key]['object']->DeleteUserPost($oneuser);
  73                  }
  74              }
  75              
  76              Events::SendEvent('Core', 'DeleteUserPost', array('user' => &$oneuser));
  77  
  78              audit($user_id, $user_name, 'Deleted User');
  79          }
  80      }
  81  }
  82  
  83  if ($dodelete == true)
  84  {
  85      redirect("listusers.php");
  86  }
  87  else
  88  {
  89      redirect("listusers.php?message=".lang('erroruserinuse'));
  90  }
  91  
  92  # vim:ts=4 sw=4 noet
  93  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7