1
|
1 |
<?php |
|
2 |
require_once("inc/toolkit.inc.php"); |
|
3 |
|
|
4 |
$id = ($_POST["id"]) ? $_POST["id"] : $_GET["id"]; |
|
5 |
|
|
6 |
if(isset($id)) |
|
7 |
{ |
|
8 |
if($_POST["confirm"] == '1') |
|
9 |
{ |
|
10 |
$domain = is_array($_POST["domain"]) ? $_POST["domain"] : $domain = array(); |
|
11 |
$delete = is_array($_POST["delete"]) ? $_POST["delete"] : $delete = array(); |
|
12 |
|
|
13 |
if(count($domain) > 0) |
|
14 |
{ |
|
15 |
foreach ($domain as $dom => $newowner) |
|
16 |
{ |
|
17 |
if (!in_array($dom, $delete)) |
|
18 |
{ |
|
19 |
add_owner($dom, $newowner); |
|
20 |
} |
|
21 |
} |
|
22 |
} |
|
23 |
if(count($delete) > 0) |
|
24 |
{ |
|
25 |
foreach ($delete as $del) |
|
26 |
{ |
|
27 |
delete_domain($del); |
|
28 |
} |
|
29 |
} |
|
30 |
|
|
31 |
delete_user($id); |
|
32 |
clean_page($BASE_URL . $BASE_PATH . "users.php"); |
|
33 |
} |
|
34 |
include_once("inc/header.inc.php"); |
13
|
35 |
?> |
|
36 |
|
|
37 |
<h3><? echo _('Delete user'); ?> "<? echo get_fullname_from_userid($id) ?>"</h3> |
|
38 |
<form method="post"> |
1
|
39 |
<? |
|
40 |
$domains = get_domains_from_userid($id); |
|
41 |
if (count($domains) > 0) |
|
42 |
{ |
13
|
43 |
echo _('This user has access to the following zone(s)'); ?> :<BR><? |
1
|
44 |
$users = show_users($id); |
|
45 |
if(count($users) < 1) |
|
46 |
{ |
|
47 |
$add = " CHECKED DISABLED"; |
|
48 |
$no_users = 1; |
|
49 |
} |
|
50 |
?> |
13
|
51 |
<table> |
|
52 |
<tr> |
|
53 |
<td class="n">Delete</td> |
|
54 |
<td class="n">Name</td> |
|
55 |
<? if (!$no_users) { ?> |
|
56 |
<td class="n">New owner</td> |
|
57 |
<? } ?> |
|
58 |
</tr> |
1
|
59 |
<? |
|
60 |
foreach ($domains as $d) |
|
61 |
{ |
13
|
62 |
?> |
|
63 |
<tr> |
|
64 |
<td class="n" align="center"><? |
1
|
65 |
if ($no_users) |
|
66 |
{ |
13
|
67 |
?><input type="hidden" name="delete[]" value="<? echo $d["id"] ?>"><? |
1
|
68 |
} |
13
|
69 |
?><input type="checkbox"<? echo $add ?> name="delete[]" value="<? echo $d["id"] ?>"></td><td class="n"><? echo $d["name"] ?></td><td class="n"><? |
1
|
70 |
if (!$no_users) |
|
71 |
{ |
13
|
72 |
?><select name="domain[<? echo $d["id"] ?>]"><? |
1
|
73 |
foreach($users as $u) |
|
74 |
{ |
13
|
75 |
?><option value="<? echo $u["id"] ?>"><? echo $u["fullname"] ?></option><? |
1
|
76 |
} |
13
|
77 |
?></select></td><? |
1
|
78 |
} |
13
|
79 |
?></tr><? |
1
|
80 |
} |
13
|
81 |
?></table><? |
1
|
82 |
} |
|
83 |
|
2
|
84 |
$message = _('You are going to delete this user, are you sure?'); |
8
|
85 |
if(($numrows = $db->queryOne("select count(id) from zones where owner=$id")) != 0) |
1
|
86 |
{ |
13
|
87 |
$message .= " " . _('This user has access to ') . $numrows . _(' zones, by deleting him you will also delete these zones.'); |
1
|
88 |
} |
|
89 |
|
|
90 |
?> |
13
|
91 |
<font class="warning"><? echo $message ?></font><br> |
|
92 |
<input type="hidden" name="id" value="<? echo $id ?>"> |
|
93 |
<input type="hidden" name="confirm" value="1"> |
|
94 |
<input type="submit" class="button" value="<? echo _('Yes'); ?>"> <input type="button" class="button" OnClick="location.href='users.php'" value="<? echo _('No'); ?>"></FORM> |
1
|
95 |
<? |
|
96 |
include_once("inc/footer.inc.php"); |
|
97 |
} |
|
98 |
else |
|
99 |
{ |
|
100 |
message("Nothing to do!"); |
|
101 |
} |
|
102 |
|