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'); |
1
|
24 |
|
82
|
25 |
if (!(verify_permission(search))) { |
|
26 |
error(ERR_PERM_SEARCH); |
|
27 |
include_once('inc/footer.inc.php'); |
|
28 |
exit; |
|
29 |
|
79
|
30 |
} else { |
82
|
31 |
echo " <h2>" . _('Search zones and records') . "</h2>\n"; |
|
32 |
|
|
33 |
if ($_POST['submit']) { |
1
|
34 |
|
82
|
35 |
if (verify_permission(zone_content_view_others)) { $perm_view = "all" ; } |
|
36 |
elseif (verify_permission(zone_content_view_own)) { $perm_view = "own" ; } |
|
37 |
else { $perm_view = "none" ; } |
1
|
38 |
|
82
|
39 |
if (verify_permission(zone_content_edit_others)) { $perm_edit = "all" ; } |
|
40 |
elseif (verify_permission(zone_content_edit_own)) { $perm_edit = "own" ; } |
|
41 |
else { $perm_edit = "none" ; } |
|
42 |
|
|
43 |
$holy_grail = $_POST['query']; |
|
44 |
|
|
45 |
$result = search_zone_and_record($holy_grail,$perm_view); |
79
|
46 |
|
82
|
47 |
if (is_array($result['zones'])) { |
|
48 |
echo " <h3>" . _('Zones found') . ":</h3>\n"; |
|
49 |
echo " <table>\n"; |
|
50 |
echo " <tr>\n"; |
|
51 |
echo " <th> </th>\n"; |
|
52 |
echo " <th>" . _('Name') . "</th>\n"; |
|
53 |
echo " <th>" . _('Type') . "</th>\n"; |
|
54 |
echo " <th>" . _('Master') . "</th>\n"; |
|
55 |
echo " </tr>\n"; |
1
|
56 |
|
82
|
57 |
foreach ($result['zones'] as $zone) { |
|
58 |
echo " <tr>\n"; |
|
59 |
echo " <td>\n"; |
|
60 |
echo " <a href=\"edit.php?id=" . $zone['zid'] . "\"><img src=\"images/edit.gif\" title=\"" . _('Edit zone') . " " . $zone['name'] . "\" alt=\"[ " . _('Edit zone') . " " . $zone['name'] . " ]\"></a>\n"; |
|
61 |
if ( $perm_edit != "all" || $perm_edit != "none") { |
|
62 |
$user_is_zone_owner = verify_user_is_owner_zoneid($zone['zid']); |
|
63 |
} |
|
64 |
if ( $perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1") ) { |
|
65 |
echo " <a href=\"delete_domain.php?id=" . $zone['zid'] . "\"><img src=\"images/delete.gif\" title=\"" . _('Delete zone') . " " . $zone['name'] . "\" alt=\"[ ". _('Delete zone') . " " . $zone['name'] . " ]\"></a>\n"; |
|
66 |
} |
|
67 |
echo " </td>\n"; |
|
68 |
echo " <td>" . $zone['name'] . "</td>\n"; |
|
69 |
echo " <td>" . $zone['type'] . "</td>\n"; |
|
70 |
if ($zone['type'] == "SLAVE") { |
|
71 |
echo " <td>" . $zone['master'] . "</td>\n"; |
|
72 |
} else { |
|
73 |
echo " <td> </td>\n"; |
|
74 |
} |
|
75 |
echo " </tr>\n"; |
1
|
76 |
} |
82
|
77 |
echo " </table>\n"; |
|
78 |
} |
|
79 |
|
|
80 |
if (is_array($result['records'])) { |
|
81 |
echo " <h3>" . _('Records found') . ":</h3>\n"; |
|
82 |
echo " <table>\n"; |
|
83 |
echo " <tr>\n"; |
|
84 |
echo " <th> </th>\n"; |
|
85 |
echo " <th>" . _('Name') . "</th>\n"; |
|
86 |
echo " <th>" . _('Type') . "</th>\n"; |
110
|
87 |
echo " <th>" . _('Priority') . "</th>\n"; |
82
|
88 |
echo " <th>" . _('Content') . "</th>\n"; |
|
89 |
echo " <th>" . _('TTL') . "</th>\n"; |
|
90 |
echo " </tr>\n"; |
|
91 |
|
|
92 |
foreach ($result['records'] as $record) { |
|
93 |
|
|
94 |
echo " <tr>\n"; |
|
95 |
echo " <td>\n"; |
|
96 |
echo " <a href=\"edit_record.php?id=" . $record['rid'] . "\"><img src=\"images/edit.gif\" title=\"" . _('Edit record') . " " . $record['name'] . "\" alt=\"[ " . _('Edit record') . " " . $record['name'] . " ]\"></a>\n"; |
|
97 |
if ( $perm_edit != "all" || $perm_edit != "none") { |
|
98 |
$user_is_zone_owner = verify_user_is_owner_zoneid($record['zid']); |
|
99 |
} |
|
100 |
if ( $perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1") ) { |
|
101 |
echo " <a href=\"delete_record.php?id=" . $record['rid'] . "\"><img src=\"images/delete.gif\" title=\"" . _('Delete record') . " " . $record['name'] . "\" alt=\"[ ". _('Delete record') . " " . $record['name'] . " ]\"></a>\n"; |
|
102 |
} |
|
103 |
echo " </td>\n"; |
|
104 |
echo " <td>" . $record['name'] . "</td>\n"; |
|
105 |
echo " <td>" . $record['type'] . "</td>\n"; |
|
106 |
if ($record['type'] == "MX") { |
|
107 |
echo " <td>" . $record['prio'] . "</td>\n"; |
|
108 |
} else { |
|
109 |
echo " <td> </td>\n"; |
|
110 |
} |
|
111 |
echo " <td>" . $record['content'] . "</td>\n"; |
|
112 |
echo " <td>" . $record['ttl'] . "</td>\n"; |
|
113 |
echo " </tr>\n"; |
|
114 |
} |
|
115 |
echo " </table>\n"; |
|
116 |
} |
|
117 |
|
1
|
118 |
} |
82
|
119 |
|
|
120 |
echo " <h3>" . _('Query') . ":</h3>\n"; |
|
121 |
echo " <table>\n"; |
|
122 |
echo " <form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n"; |
|
123 |
echo " <tr>\n"; |
|
124 |
echo " <td class=\"n\">" . _('Enter a hostname or IP address') . "</td>\n"; |
|
125 |
echo " <td class=\"n\"><input type=\"text\" class=\"input\" name=\"query\" value=\"" . $holy_grail . "\"></td>\n"; |
|
126 |
echo " </tr>\n"; |
|
127 |
echo " <tr>\n"; |
|
128 |
echo " <td class=\"n\"> </td>\n"; |
|
129 |
echo " <td class=\"n\"><input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Search') . "\"></td>\n"; |
|
130 |
echo " </tr>\n"; |
|
131 |
echo " </form>\n"; |
|
132 |
echo " </table>\n"; |
|
133 |
|
1
|
134 |
} |
|
135 |
include_once('inc/footer.inc.php'); |
|
136 |
?> |
|
137 |
|