Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
user_del.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Action to delete a user account
9  *
10  * The action also delete mail account of the user
11  * @author Anakeen 2000
12  * @version $Id: user_del.php,v 1.7 2007/02/21 11:08:02 eric Exp $
13  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
14  * @package FDL
15  * @subpackage USERS
16  */
17 /**
18  */
19 
20 include_once ("Class.SubForm.php");
21 include_once ("Class.MailAccount.php");
22 include_once ("Class.User.php");
23 /**
24  * Action to delete a user account
25  *
26  * The action also delete mail account of the user
27  * @param Action current action
28  */
29 function user_del(&$action)
30 {
31  // -----------------------------------
32  // Get all the params
33  $id = GetHttpVars("id");
34 
35  if ($id !== "" && $id != 1) {
36  $user = new User($action->GetParam("CORE_DB") , $id);
37  if ((isset($action->user)) && ($action->HasPermission("ADMIN") || (($action->HasPermission("DOMAIN_MASTER")) && ($action->user->iddomain == $user->iddomain) && ($action->user->id != $user->id)))) {
38  $fid = $user->fid;
39  $err = $user->Delete();
40 
41  if (($err == "") && ($fid > 0) && usefreedomuser()) {
42  $du = new_Doc($action->getParam("FREEDOM_DB") , $fid);
43  $du->Delete();
44  }
45 
46  $mailapp = new Application();
47  if (($action->user->isgroup != "Y") && $mailapp->Exists("MAILADMIN")) {
48  $mailapp->Set("MAILADMIN", $action->parent);
49  $acc = new MailAccount($mailapp->Getparam("MAILDB") , $id);
50  $acc->Remove();
51  }
52  } else {
53  $action->info("Access Not Allowed");
54  Redirect($action, "CORE", "");
55  }
56  }
57 
58  if (isset($user) && ($user->isgroup == "Y")) {
59  redirect($action, "USERS", "GROUP_TABLE");
60  } else {
61  redirect($action, "USERS", "USER_TABLE");
62  }
63 }
64 ?>
← centre documentaire © anakeen - published under CC License - Dynacase