1
|
1 |
<?php |
47
|
2 |
|
|
3 |
/* PowerAdmin, a friendly web-based admin tool for PowerDNS. |
|
4 |
* See <https://rejo.zenger.nl/poweradmin> for more details. |
|
5 |
* |
|
6 |
* Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl> |
|
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 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21 |
|
1
|
22 |
require_once("inc/toolkit.inc.php"); |
|
23 |
|
|
24 |
$id = ($_POST["id"]) ? $_POST["id"] : $_GET["id"]; |
|
25 |
|
|
26 |
if(isset($id)) |
|
27 |
{ |
|
28 |
if($_POST["confirm"] == '1') |
|
29 |
{ |
|
30 |
$domain = is_array($_POST["domain"]) ? $_POST["domain"] : $domain = array(); |
|
31 |
$delete = is_array($_POST["delete"]) ? $_POST["delete"] : $delete = array(); |
|
32 |
|
|
33 |
if(count($domain) > 0) |
|
34 |
{ |
|
35 |
foreach ($domain as $dom => $newowner) |
|
36 |
{ |
|
37 |
if (!in_array($dom, $delete)) |
|
38 |
{ |
|
39 |
add_owner($dom, $newowner); |
|
40 |
} |
|
41 |
} |
|
42 |
} |
|
43 |
if(count($delete) > 0) |
|
44 |
{ |
|
45 |
foreach ($delete as $del) |
|
46 |
{ |
|
47 |
delete_domain($del); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
delete_user($id); |
73
|
52 |
clean_page("users.php"); |
1
|
53 |
} |
|
54 |
include_once("inc/header.inc.php"); |
13
|
55 |
?> |
|
56 |
|
71
|
57 |
<h3><?php echo _('Delete user'); ?> "<?php echo get_fullname_from_userid($id) ?>"</h3> |
13
|
58 |
<form method="post"> |
71
|
59 |
<?php |
1
|
60 |
$domains = get_domains_from_userid($id); |
|
61 |
if (count($domains) > 0) |
|
62 |
{ |
71
|
63 |
echo _('This user has access to the following zone(s)'); ?> :<BR><?php |
1
|
64 |
$users = show_users($id); |
|
65 |
if(count($users) < 1) |
|
66 |
{ |
|
67 |
$add = " CHECKED DISABLED"; |
|
68 |
$no_users = 1; |
|
69 |
} |
|
70 |
?> |
13
|
71 |
<table> |
|
72 |
<tr> |
|
73 |
<td class="n">Delete</td> |
|
74 |
<td class="n">Name</td> |
71
|
75 |
<?php if (!$no_users) { ?> |
13
|
76 |
<td class="n">New owner</td> |
71
|
77 |
<?php } ?> |
13
|
78 |
</tr> |
71
|
79 |
<?php |
1
|
80 |
foreach ($domains as $d) |
|
81 |
{ |
13
|
82 |
?> |
|
83 |
<tr> |
71
|
84 |
<td class="n" align="center"><?php |
1
|
85 |
if ($no_users) |
|
86 |
{ |
71
|
87 |
?><input type="hidden" name="delete[]" value="<?php echo $d["id"] ?>"><?php |
1
|
88 |
} |
71
|
89 |
?><input type="checkbox"<?php echo $add ?> name="delete[]" value="<?php echo $d["id"] ?>"></td><td class="n"><?php echo $d["name"] ?></td><td class="n"><?php |
1
|
90 |
if (!$no_users) |
|
91 |
{ |
71
|
92 |
?><select name="domain[<?php echo $d["id"] ?>]"><?php |
1
|
93 |
foreach($users as $u) |
|
94 |
{ |
71
|
95 |
?><option value="<?php echo $u["id"] ?>"><?php echo $u["fullname"] ?></option><?php |
1
|
96 |
} |
71
|
97 |
?></select></td><?php |
1
|
98 |
} |
71
|
99 |
?></tr><?php |
1
|
100 |
} |
71
|
101 |
?></table><?php |
1
|
102 |
} |
|
103 |
|
2
|
104 |
$message = _('You are going to delete this user, are you sure?'); |
65
|
105 |
if(($numrows = $db->queryOne("SELECT count(id) FROM zones WHERE owner=".$db->quote($id))) != 0) |
1
|
106 |
{ |
13
|
107 |
$message .= " " . _('This user has access to ') . $numrows . _(' zones, by deleting him you will also delete these zones.'); |
1
|
108 |
} |
|
109 |
|
|
110 |
?> |
71
|
111 |
<font class="warning"><?php echo $message ?></font><br> |
|
112 |
<input type="hidden" name="id" value="<?php echo $id ?>"> |
13
|
113 |
<input type="hidden" name="confirm" value="1"> |
71
|
114 |
<input type="submit" class="button" value="<?php echo _('Yes'); ?>"> <input type="button" class="button" OnClick="location.href='users.php'" value="<?php echo _('No'); ?>"></FORM> |
|
115 |
<?php |
1
|
116 |
include_once("inc/footer.inc.php"); |
|
117 |
} |
|
118 |
else |
|
119 |
{ |
|
120 |
message("Nothing to do!"); |
|
121 |
} |
|
122 |
|