1
|
1 |
<?php |
|
2 |
|
47
|
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"); |
82
|
23 |
include_once("inc/header.inc.php"); |
|
24 |
verify_permission(user_view_others) ? $perm_view_others = "1" : $perm_view_others = "0" ; |
|
25 |
verify_permission(user_edit_own) ? $perm_edit_own = "1" : $perm_edit_own = "0" ; |
|
26 |
verify_permission(user_edit_others) ? $perm_edit_others = "1" : $perm_edit_others = "0" ; |
|
27 |
verify_permission(templ_perm_edit) ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ; |
|
28 |
verify_permission(is_ueberuser) ? $perm_is_godlike = "1" : $perm_is_godlike = "0" ; |
1
|
29 |
|
105
|
30 |
unset($commit_button); |
|
31 |
|
82
|
32 |
if (isset($_POST['commit'])) { |
|
33 |
foreach ($_POST['user'] as $user) { |
|
34 |
update_user_details($user); |
13
|
35 |
} |
1
|
36 |
} |
|
37 |
|
82
|
38 |
$users = get_user_detail_list(""); |
110
|
39 |
echo " <h2>" . _('User administration') . "</h2>\n"; |
82
|
40 |
echo " <form method=\"post\">\n"; |
|
41 |
echo " <table>\n"; |
|
42 |
echo " <tr>\n"; |
|
43 |
echo " <th> </th>\n"; |
|
44 |
echo " <th>" . _('Username') . "</th>\n"; |
|
45 |
echo " <th>" . _('Fullname') . "</th>\n"; |
|
46 |
echo " <th>" . _('Description') . "</th>\n"; |
|
47 |
echo " <th>" . _('Emailaddress') . "</th>\n"; |
|
48 |
echo " <th>" . _('Template') . "</th>\n"; |
|
49 |
echo " <th>" . _('Enabled') . "</th>\n"; |
|
50 |
echo " </tr>\n"; |
1
|
51 |
|
82
|
52 |
foreach ($users as $user) { |
|
53 |
if ($user['active'] == "1" ) { |
|
54 |
$active = " checked"; |
|
55 |
} else { |
|
56 |
$active = ""; |
|
57 |
} |
|
58 |
if (($user['uid'] == $_SESSION["userid"] && $perm_edit_own == "1") || ($user['uid'] != $_SESSION["userid"] && $perm_edit_others == "1" )) { |
105
|
59 |
$commit_button = "1"; |
|
60 |
|
|
61 |
echo " <input type=\"hidden\" name=\"user[" . $user['uid'] . "][uid]\" value=\"" . $user['uid'] . "\">\n"; |
|
62 |
echo " <tr>\n"; |
|
63 |
echo " <td>\n"; |
82
|
64 |
echo " <a href=\"edit_user.php?id=" . $user['uid'] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit user') . "\" ]></a>\n"; |
|
65 |
echo " <a href=\"delete_user.php?id=" . $user['uid'] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete user') . "\" ]></a>\n"; |
105
|
66 |
echo " </td>\n"; |
|
67 |
echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][username]\" value=\"" . $user['username'] . "\"></td>\n"; |
|
68 |
echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][fullname]\" value=\"" . $user['fullname'] . "\"></td>\n"; |
|
69 |
echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][descr]\" value=\"" . $user['descr'] . "\"></td>\n"; |
|
70 |
echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][email]\" value=\"" . $user['email'] . "\"></td>\n"; |
|
71 |
echo " <td>\n"; |
|
72 |
if ($perm_templ_perm_edit == "1") { |
|
73 |
echo " <select name=\"user[" . $user['uid'] . "][templ_id]\">\n"; |
|
74 |
foreach (list_permission_templates() as $template) { |
|
75 |
($template['id'] == $user['tpl_id']) ? $select = " SELECTED" : $select = "" ; |
|
76 |
echo " <option value=\"" . $template['id'] . "\"" . $select . ">" . $template['name'] . "</option>\n"; |
|
77 |
} |
|
78 |
echo " </select>\n"; |
|
79 |
} else { |
|
80 |
echo $user['tpl_name']; |
|
81 |
} |
|
82 |
echo " </td>\n"; |
|
83 |
echo " <td><input type=\"checkbox\" name=\"user[" . $user['uid'] . "][active]\"" . $active . "></td>\n"; |
|
84 |
echo " </tr>\n"; |
82
|
85 |
} else { |
105
|
86 |
echo " <tr>\n"; |
|
87 |
echo " <td> </td>\n"; |
|
88 |
echo " <td>" . $user['username'] . "</td>\n"; |
|
89 |
echo " <td>" . $user['fullname'] . "</td>\n"; |
|
90 |
echo " <td>" . $user['descr'] . "</td>\n"; |
|
91 |
echo " <td>" . $user['email'] . "</td>\n"; |
|
92 |
echo " <td>" . $user['tpl_name'] . "</td>\n"; |
|
93 |
if ($active == " checked") { |
|
94 |
echo " <td>Yes</td>\n"; |
|
95 |
} else { |
|
96 |
echo " <td>No</td>\n"; |
|
97 |
} |
|
98 |
echo " </tr>\n"; |
82
|
99 |
} |
1
|
100 |
} |
82
|
101 |
|
|
102 |
echo " </table>\n"; |
105
|
103 |
if ($commit_button) { |
|
104 |
echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n"; |
|
105 |
} |
82
|
106 |
echo " </form>\n"; |
1
|
107 |
|
99
|
108 |
echo " <ul>\n"; |
82
|
109 |
if ($perm_templ_perm_edit == "1") { |
110
|
110 |
echo "<li><a href=\"list_perm_templ.php\">" . _('Edit permission template') . "</a>.</li>\n"; |
82
|
111 |
} |
|
112 |
|
|
113 |
if (verify_permission(user_add_new)) { |
99
|
114 |
echo "<li><a href=\"add_user.php\">" . _('Add user') . "</a>.</li>\n"; |
82
|
115 |
} |
99
|
116 |
echo " </ul>\n"; |
82
|
117 |
|
|
118 |
|
1
|
119 |
include_once("inc/footer.inc.php"); |
|
120 |
?> |