82
|
1 |
<?php |
|
2 |
|
119
|
3 |
/* Poweradmin, a friendly web-based admin tool for PowerDNS. |
82
|
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 |
|
|
22 |
require_once("inc/toolkit.inc.php"); |
|
23 |
include_once("inc/header.inc.php"); |
|
24 |
|
|
25 |
$id = "-1"; |
|
26 |
if ((isset($_GET['id'])) || (v_num($_GET['id']))) { |
|
27 |
$id = $_GET['id'] ; |
|
28 |
} |
|
29 |
|
|
30 |
if ($id == "-1") { |
|
31 |
error(ERR_INV_INPUT); |
126
|
32 |
} elseif (!verify_permission('templ_perm_edit')) { |
82
|
33 |
error(ERR_PERM_EDIT_PERM_TEMPL); |
|
34 |
} else { |
|
35 |
$id = $_GET['id']; |
|
36 |
|
|
37 |
if (isset($_POST['commit'])) { |
|
38 |
update_perm_templ_details($_POST); |
|
39 |
} |
|
40 |
|
89
|
41 |
$templ = get_permission_template_details($id); |
82
|
42 |
$perms_templ = get_permissions_by_template_id($id); |
|
43 |
$perms_avail = get_permissions_by_template_id(); |
|
44 |
|
|
45 |
echo " <h2>" . _('Edit permission template') . "</h2>\n"; |
|
46 |
echo " <form method=\"post\">\n"; |
|
47 |
echo " <input type=\"hidden\" name=\"templ_id\" value=\"" . $id . "\">\n"; |
|
48 |
|
89
|
49 |
echo " <table>\n"; |
|
50 |
echo " <tr>\n"; |
|
51 |
echo " <th>" . _('Name') . "</th>\n"; |
|
52 |
echo " <td><input class=\"wide\" type=\"text\" name=\"templ_name\" value=\"" . $templ['name'] . "\"></td>\n"; |
|
53 |
echo " </tr>\n"; |
|
54 |
echo " <tr>\n"; |
|
55 |
echo " <th>" . _('Description') . "</th>\n"; |
|
56 |
echo " <td><input class=\"wide\" type=\"text\" name=\"templ_descr\" value=\"" . $templ['descr'] . "\"></td>\n"; |
|
57 |
echo " </tr>\n"; |
|
58 |
echo " </table>\n"; |
82
|
59 |
|
|
60 |
echo " <table>\n"; |
|
61 |
echo " <tr>\n"; |
|
62 |
echo " <th> </th>\n"; |
|
63 |
echo " <th>" . _('Name') . "</th>\n"; |
|
64 |
echo " <th>" . _('Description') . "</th>\n"; |
|
65 |
echo " </tr>\n"; |
|
66 |
|
|
67 |
foreach ($perms_avail as $perm_a) { |
|
68 |
|
|
69 |
echo " <tr>\n"; |
|
70 |
|
|
71 |
$has_perm = ""; |
|
72 |
foreach ($perms_templ as $perm_t) { |
|
73 |
if (in_array( $perm_a['id'], $perm_t )) { |
|
74 |
$has_perm = "checked"; |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
echo " <td><input type=\"checkbox\" name=\"perm_id[]\" value=\"" . $perm_a['id'] . "\" " . $has_perm . "></td>\n"; |
|
79 |
echo " <td>" . $perm_a['name'] . "</td>\n"; |
116
|
80 |
echo " <td>" . _($perm_a['descr']) . "</td>\n"; |
82
|
81 |
echo " </tr>\n"; |
|
82 |
} |
|
83 |
echo " </table>\n"; |
|
84 |
echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n"; |
|
85 |
echo " </form>\n"; |
|
86 |
} |
|
87 |
|
|
88 |
include_once("inc/footer.inc.php"); |
|
89 |
?> |