Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 144 lines (126 sloc) 6.083 kb
05ca180 Rejo Zenger Initial import
rejozenger authored
1 <?php
2
887f8bd Rejo Zenger Changed case of Poweradmin's name (a is now lowercase).
rejozenger authored
3 /* Poweradmin, a friendly web-based admin tool for PowerDNS.
86ae2a8 Edmondas updated project url in copyright text
eg authored
4 * See <https://www.poweradmin.org> for more details.
8eba64f Rejo Zenger Second half of previous commit. :)
rejozenger authored
5 *
5113199 mgob Update copyright dates
mgob authored
6 * Copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
7bba914 Edmondas updated copyright date
eg authored
7 * Copyright 2010-2011 Poweradmin Development Team <http://www.poweradmin.org/credits>
8eba64f Rejo Zenger Second half of previous commit. :)
rejozenger authored
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
05ca180 Rejo Zenger Initial import
rejozenger authored
23 require_once("inc/toolkit.inc.php");
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
24 include_once("inc/header.inc.php");
9fc30d8 Edmondas show begining and end of HTML list only when user has required permissio...
eg authored
25
3298506 pbeernink Fixed a lot of notices which where shown when php was running in E_ALL i...
pbeernink authored
26 verify_permission('user_view_others') ? $perm_view_others = "1" : $perm_view_others = "0" ;
27 verify_permission('user_edit_own') ? $perm_edit_own = "1" : $perm_edit_own = "0" ;
28 verify_permission('user_edit_others') ? $perm_edit_others = "1" : $perm_edit_others = "0" ;
29 verify_permission('templ_perm_edit') ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ;
9fc30d8 Edmondas show begining and end of HTML list only when user has required permissio...
eg authored
30 verify_permission('is_ueberuser') ? $perm_is_godlike = "1" : $perm_is_godlike = "0" ;
31 verify_permission('user_add_new') ? $perm_add_new = "1" : $perm_add_new = "0" ;
05ca180 Rejo Zenger Initial import
rejozenger authored
32
833b666 Edmondas disable swotching to other user feature, because
eg authored
33 #if (isset($_GET['action']) && $_GET['action'] === "switchuser" && $perm_is_godlike === "1"){
34 # $_SESSION["userlogin"] = $_GET['username'];
35 # echo '<meta http-equiv="refresh" content="1"/>';
36 #}
03c4344 mgob FEATURE #396 - Allow god users to switch to other users.
mgob authored
37
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
38 unset($commit_button);
39
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
40 if (isset($_POST['commit'])) {
41 foreach ($_POST['user'] as $user) {
42 update_user_details($user);
9f26afe Rejo Zenger Merged 1.4.0 changes r23:59 into trunk.
rejozenger authored
43 }
05ca180 Rejo Zenger Initial import
rejozenger authored
44 }
45
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
46 $users = get_user_detail_list("");
7e4bc3a Rejo Zenger Lots of minor updates to user interface text.
rejozenger authored
47 echo " <h2>" . _('User administration') . "</h2>\n";
791cfc1 mgob FIXED #340 - Fix invalid css and HTML
mgob authored
48 echo " <form method=\"post\" action=\"\">\n";
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
49 echo " <table>\n";
50 echo " <tr>\n";
51 echo " <th>&nbsp;</th>\n";
52 echo " <th>" . _('Username') . "</th>\n";
53 echo " <th>" . _('Fullname') . "</th>\n";
54 echo " <th>" . _('Description') . "</th>\n";
4c0aca6 Edmondas "Emailaddress" replaced to "Email address"
eg authored
55 echo " <th>" . _('Email address') . "</th>\n";
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
56 echo " <th>" . _('Template') . "</th>\n";
57 echo " <th>" . _('Enabled') . "</th>\n";
58 echo " </tr>\n";
59
60 foreach ($users as $user) {
61 if ($user['active'] == "1" ) {
62 $active = " checked";
63 } else {
64 $active = "";
65 }
66 if (($user['uid'] == $_SESSION["userid"] && $perm_edit_own == "1") || ($user['uid'] != $_SESSION["userid"] && $perm_edit_others == "1" )) {
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
67 $commit_button = "1";
68 echo " <tr>\n";
69 echo " <td>\n";
791cfc1 mgob FIXED #340 - Fix invalid css and HTML
mgob authored
70 echo " <input type=\"hidden\" name=\"user[" . $user['uid'] . "][uid]\" value=\"" . $user['uid'] . "\">\n";
71 echo " <a href=\"edit_user.php?id=" . $user['uid'] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit user') . " ]\"></a>\n";
18c65d1 Edmondas TTN #70 - disallow users to delete themselves
eg authored
72
73 // do not allow to delete him- or herself, available to superusers only
74 if($user['uid'] != $_SESSION["userid"] || $perm_is_godlike == "1"){
03c4344 mgob FEATURE #396 - Allow god users to switch to other users.
mgob authored
75 echo " <a href=\"delete_user.php?id=" . $user['uid'] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete user') . " ]\"></a>";
18c65d1 Edmondas TTN #70 - disallow users to delete themselves
eg authored
76 }
833b666 Edmondas disable swotching to other user feature, because
eg authored
77
78 # if ($user['uid'] != $_SESSION["userid"] && $perm_is_godlike == "1") {
79 # echo " <a href=\"users.php?action=switchuser&username=" . $user['username'] . "\"><img src=\"images/switch_user.png\" alt=\"[ " . _('Switch user') . " ]\"></a>\n";
80 # }
4fe213e Edmondas TTN #396: disallow "switch to user" function for the same account
eg authored
81
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
82 echo " </td>\n";
83 echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][username]\" value=\"" . $user['username'] . "\"></td>\n";
84 echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][fullname]\" value=\"" . $user['fullname'] . "\"></td>\n";
85 echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][descr]\" value=\"" . $user['descr'] . "\"></td>\n";
86 echo " <td><input type=\"text\" name=\"user[" . $user['uid'] . "][email]\" value=\"" . $user['email'] . "\"></td>\n";
87 echo " <td>\n";
88 if ($perm_templ_perm_edit == "1") {
89 echo " <select name=\"user[" . $user['uid'] . "][templ_id]\">\n";
90 foreach (list_permission_templates() as $template) {
91 ($template['id'] == $user['tpl_id']) ? $select = " SELECTED" : $select = "" ;
92 echo " <option value=\"" . $template['id'] . "\"" . $select . ">" . $template['name'] . "</option>\n";
93 }
94 echo " </select>\n";
95 } else {
0620953 Rejo Zenger Bugfix. A user without the privilige to change the permission templates ...
rejozenger authored
96 echo " <input type=\"hidden\" name=\"user[" . $user['uid'] . "][templ_id]\" value=\"" . $user['tpl_id'] . "\">\n";
97 echo " " . $user['tpl_name'] . "\n";
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
98 }
99 echo " </td>\n";
100 echo " <td><input type=\"checkbox\" name=\"user[" . $user['uid'] . "][active]\"" . $active . "></td>\n";
101 echo " </tr>\n";
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
102 } else {
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
103 echo " <tr>\n";
104 echo " <td>&nbsp;</td>\n";
105 echo " <td>" . $user['username'] . "</td>\n";
106 echo " <td>" . $user['fullname'] . "</td>\n";
107 echo " <td>" . $user['descr'] . "</td>\n";
108 echo " <td>" . $user['email'] . "</td>\n";
109 echo " <td>" . $user['tpl_name'] . "</td>\n";
110 if ($active == " checked") {
111 echo " <td>Yes</td>\n";
112 } else {
113 echo " <td>No</td>\n";
114 }
115 echo " </tr>\n";
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
116 }
9f26afe Rejo Zenger Merged 1.4.0 changes r23:59 into trunk.
rejozenger authored
117 }
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
118
119 echo " </table>\n";
2c9f392 Edmondas add additional checking of variable before showing buttons
eg authored
120 if (isset($commit_button) && $commit_button) {
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
121 echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
9dd1333 mgob FEAT TTN#300 - Added reset button to form edits - THANKS pcairney
mgob authored
122 echo " <input type=\"reset\" class=\"button\" name=\"reset\" value=\"" . _('Reset changes') . "\">\n";
aec3f7e Rejo Zenger Bugfix. A user with with at least view access could change user details,...
rejozenger authored
123 }
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
124 echo " </form>\n";
125
9fc30d8 Edmondas show begining and end of HTML list only when user has required permissio...
eg authored
126 if ($perm_templ_perm_edit == "1" || $perm_add_new == "1") {
127 echo " <ul>\n";
128 }
129
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
130 if ($perm_templ_perm_edit == "1") {
7e4bc3a Rejo Zenger Lots of minor updates to user interface text.
rejozenger authored
131 echo "<li><a href=\"list_perm_templ.php\">" . _('Edit permission template') . "</a>.</li>\n";
05ca180 Rejo Zenger Initial import
rejozenger authored
132 }
133
9fc30d8 Edmondas show begining and end of HTML list only when user has required permissio...
eg authored
134 if ($perm_add_new == "1") {
aa3e95b Rejo Zenger Changed layout of links to additional menu options in user management wi...
rejozenger authored
135 echo "<li><a href=\"add_user.php\">" . _('Add user') . "</a>.</li>\n";
05ca180 Rejo Zenger Initial import
rejozenger authored
136 }
70e6cf3 Rejo Zenger Merged r125:181 of branches/rewrite-user-management into trunk. This inc...
rejozenger authored
137
9fc30d8 Edmondas show begining and end of HTML list only when user has required permissio...
eg authored
138 if ($perm_templ_perm_edit == "1" || $perm_add_new == "1") {
139 echo " </ul>\n";
140 }
05ca180 Rejo Zenger Initial import
rejozenger authored
141
142 include_once("inc/footer.inc.php");
143 ?>
Something went wrong with that request. Please try again.