1
|
1 |
<?php |
|
2 |
|
|
3 |
// +--------------------------------------------------------------------+ |
|
4 |
// | PowerAdmin | |
|
5 |
// +--------------------------------------------------------------------+ |
|
6 |
// | Copyright (c) 1997-2002 The PowerAdmin Team | |
|
7 |
// +--------------------------------------------------------------------+ |
|
8 |
// | This source file is subject to the license carried by the overal | |
|
9 |
// | program PowerAdmin as found on http://poweradmin.sf.net | |
|
10 |
// | The PowerAdmin program falls under the QPL License: | |
|
11 |
// | http://www.trolltech.com/developer/licensing/qpl.html | |
|
12 |
// +--------------------------------------------------------------------+ |
|
13 |
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl> | |
|
14 |
// | Sjeemz <sjeemz <AT> sjeemz <DOT> nl> | |
|
15 |
// +--------------------------------------------------------------------+ |
|
16 |
|
|
17 |
// |
|
18 |
// $Id: delete_user.php,v 1.9 2003/01/01 22:33:46 azurazu Exp $ |
|
19 |
// |
|
20 |
|
|
21 |
require_once("inc/toolkit.inc.php"); |
|
22 |
|
|
23 |
$id = ($_POST["id"]) ? $_POST["id"] : $_GET["id"]; |
|
24 |
|
|
25 |
if(isset($id)) |
|
26 |
{ |
|
27 |
if($_POST["confirm"] == '1') |
|
28 |
{ |
|
29 |
$domain = is_array($_POST["domain"]) ? $_POST["domain"] : $domain = array(); |
|
30 |
$delete = is_array($_POST["delete"]) ? $_POST["delete"] : $delete = array(); |
|
31 |
|
|
32 |
if(count($domain) > 0) |
|
33 |
{ |
|
34 |
foreach ($domain as $dom => $newowner) |
|
35 |
{ |
|
36 |
if (!in_array($dom, $delete)) |
|
37 |
{ |
|
38 |
add_owner($dom, $newowner); |
|
39 |
} |
|
40 |
} |
|
41 |
} |
|
42 |
if(count($delete) > 0) |
|
43 |
{ |
|
44 |
foreach ($delete as $del) |
|
45 |
{ |
|
46 |
delete_domain($del); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
delete_user($id); |
|
51 |
clean_page($BASE_URL . $BASE_PATH . "users.php"); |
|
52 |
} |
|
53 |
include_once("inc/header.inc.php"); |
2
|
54 |
?><H2><? echo _('Delete user'); ?> "<?= get_fullname_from_userid($id) ?>"</H2> |
1
|
55 |
<FORM METHOD="post"> |
|
56 |
<? |
|
57 |
$domains = get_domains_from_userid($id); |
|
58 |
if (count($domains) > 0) |
|
59 |
{ |
2
|
60 |
echo _('This user has access to the following domain(s)'); ?> :<BR><? |
1
|
61 |
$users = show_users($id); |
|
62 |
if(count($users) < 1) |
|
63 |
{ |
|
64 |
$add = " CHECKED DISABLED"; |
|
65 |
$no_users = 1; |
|
66 |
} |
|
67 |
?> |
|
68 |
<TABLE BORDER="0" CELLSPACING="4"> |
|
69 |
<TR STYLE="font-weight: Bold"><TD WIDTH="50" CLASS="tdbg">Delete</TD><TD CLASS="tdbg">Name</TD><? if (!$no_users) { ?><TD CLASS="tdbg">New owner</TD><? } ?></TR> |
|
70 |
<? |
|
71 |
foreach ($domains as $d) |
|
72 |
{ |
|
73 |
?><TR><TD CLASS="tdbg" ALIGN="center"><? |
|
74 |
if ($no_users) |
|
75 |
{ |
|
76 |
?><INPUT TYPE="hidden" NAME="delete[]" VALUE="<?= $d["id"] ?>"><? |
|
77 |
} |
|
78 |
?><INPUT TYPE="checkbox"<?= $add ?> NAME="delete[]" VALUE="<?= $d["id"] ?>"></TD><TD CLASS="tdbg"><?= $d["name"] ?></TD><TD CLASS="tdbg"><? |
|
79 |
if (!$no_users) |
|
80 |
{ |
|
81 |
?><SELECT NAME="domain[<?= $d["id"] ?>]"><? |
|
82 |
foreach($users as $u) |
|
83 |
{ |
|
84 |
?><OPTION VALUE="<?= $u["id"] ?>"><?= $u["fullname"] ?></OPTION><? |
|
85 |
} |
|
86 |
?></SELECT></TD><? |
|
87 |
} |
|
88 |
?></TR><? |
|
89 |
} |
|
90 |
?></TABLE><? |
|
91 |
} |
|
92 |
|
2
|
93 |
$message = _('You are going to delete this user, are you sure?'); |
1
|
94 |
if(($numrows = $db->getOne("select count(id) from zones where owner=$id")) != 0) |
|
95 |
{ |
2
|
96 |
$message .= " " . _('This user has access to $numrows domain(s), by deleting him you will also delete these domains'); |
1
|
97 |
} |
|
98 |
|
|
99 |
?> |
|
100 |
<BR><FONT CLASS="warning"><?= $message ?></FONT><BR><BR> |
|
101 |
<INPUT TYPE="hidden" NAME="id" VALUE="<?=$id ?>"> |
|
102 |
<INPUT TYPE="hidden" NAME="confirm" VALUE="1"> |
2
|
103 |
<INPUT TYPE="submit" CLASS="button" VALUE="<? echo _('Yes'); ?>"> <INPUT TYPE="button" CLASS="button" OnClick="location.href='users.php'" VALUE="<? echo _('No'); ?>"></FORM> |
1
|
104 |
<? |
|
105 |
include_once("inc/footer.inc.php"); |
|
106 |
} |
|
107 |
else |
|
108 |
{ |
|
109 |
message("Nothing to do!"); |
|
110 |
} |
|
111 |
|