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'); |
|
23 |
|
|
24 |
if (isset($_POST['s_submit']) || isset($_POST['q'])) |
|
25 |
{ |
13
|
26 |
$submitted=true; |
|
27 |
$search_result=search_record($_POST['q']); |
79
|
28 |
} else { |
|
29 |
$submitted = false; |
1
|
30 |
} |
|
31 |
|
|
32 |
// we will continue after the search form ... |
|
33 |
include_once('inc/header.inc.php'); |
|
34 |
?> |
|
35 |
|
71
|
36 |
<h2><?php echo _('Search zones or records'); ?></h2> |
13
|
37 |
<h3>Query</h3> |
|
38 |
<table> |
71
|
39 |
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>"> |
13
|
40 |
<tr> |
71
|
41 |
<td class="n"><?php echo _('Enter a hostname or IP address'); ?></td> |
13
|
42 |
<td class="n"><input type="text" class="input" name="q"></td> |
|
43 |
</tr> |
|
44 |
<tr> |
|
45 |
<td class="n"> </td> |
71
|
46 |
<td class="n"><input type="submit" class="button" name="s_submit" value="<?php echo _('Search'); ?>"></td> |
13
|
47 |
</tr> |
|
48 |
</form> |
|
49 |
</table> |
|
50 |
|
1
|
51 |
<?php |
|
52 |
// results |
79
|
53 |
|
1
|
54 |
if ($submitted) |
|
55 |
{ |
|
56 |
echo '<br><br>'; |
|
57 |
|
|
58 |
// let's check if we found any domains ... |
|
59 |
if (count($search_result) == 2 && count($search_result['domains'])) |
|
60 |
{ |
|
61 |
?> |
71
|
62 |
<h4><?php echo _('Zones found'); ?>:</h4> |
13
|
63 |
<table> |
|
64 |
<tr> |
|
65 |
<th> </th> |
71
|
66 |
<th><?php echo _('Name'); ?></th> |
|
67 |
<th><?php echo _('Records'); ?></th> |
|
68 |
<th><?php echo _('Owner'); ?></th> |
13
|
69 |
</tr> |
|
70 |
<?php |
|
71 |
foreach($search_result['domains'] as $d) |
|
72 |
{ |
|
73 |
?> |
|
74 |
<tr> |
71
|
75 |
<?php |
13
|
76 |
if (level(5)) |
|
77 |
{ |
|
78 |
?> |
|
79 |
<td class="n"> |
71
|
80 |
<a href="edit.php?id=<?php echo $d["id"] ?>"><img src="images/edit.gif" title="<?php echo _('Edit zone') . " " . $d['name']; ?>" alt="[ <?php echo _('Edit zone') . " " . $d['name']; ?> ]"></a> |
|
81 |
<a href="delete_domain.php?id=<?php echo $d["id"] ?>"><img src="images/delete.gif" title="<?php print _('Delete zone') . " " . $d['name']; ?>" alt="[<?php echo _('Delete zone') . " " . $d['name']; ?>]"></a> |
13
|
82 |
</td> |
71
|
83 |
<?php |
13
|
84 |
} |
|
85 |
else |
|
86 |
{ |
|
87 |
?> |
|
88 |
<td class="n"> |
|
89 |
|
|
90 |
</td> |
71
|
91 |
<?php |
13
|
92 |
} |
|
93 |
?> |
71
|
94 |
<td class="y"><?php echo $d['name']?></td> |
|
95 |
<td class="y"><?php echo $d['numrec']?></td> |
|
96 |
<td class="y"><?php echo get_owner_from_id($d['owner'])?></td> |
13
|
97 |
</tr> |
1
|
98 |
<?php |
|
99 |
} // end foreach ... |
|
100 |
?> |
|
101 |
</table> |
|
102 |
<br><br> |
|
103 |
<?php |
|
104 |
} // end if |
|
105 |
|
|
106 |
// any records ?! |
|
107 |
if(count($search_result['records'])) |
|
108 |
{ |
|
109 |
?> |
71
|
110 |
<b><?php echo _('Records found'); ?>:</b> |
1
|
111 |
<p> |
13
|
112 |
<table> |
|
113 |
<tr> |
|
114 |
<td class="n"> </td> |
71
|
115 |
<td class="n"><?php echo _('Name'); ?></td> |
|
116 |
<td class="n"><?php echo _('Type'); ?></td> |
|
117 |
<td class="n"><?php echo _('Content'); ?></td> |
|
118 |
<td class="n"><?php echo _('Priority'); ?></td> |
|
119 |
<td class="n"><?php echo _('TTL'); ?></td> |
1
|
120 |
</tr> |
|
121 |
<?php |
|
122 |
foreach($search_result['records'] as $r) |
|
123 |
{ |
|
124 |
?> |
|
125 |
<tr> |
13
|
126 |
<td class="n"> |
1
|
127 |
<?php |
|
128 |
if (($r["type"] != "SOA" && $r["type"] != "NS") || |
|
129 |
($GLOBALS["ALLOW_SOA_EDIT"] && $r["type"] == "SOA") || |
|
130 |
($GLOBALS["ALLOW_NS_EDIT"] && $r["type"] == "NS") || |
|
131 |
($r["type"] == "NS" && get_name_from_record_id($r["id"]) != get_domain_name_from_id(recid_to_domid($r["id"])) && |
|
132 |
$GLOBALS["ALLOW_NS_EDIT"] != 1)) |
|
133 |
{ |
|
134 |
?> |
71
|
135 |
<a href="edit_record.php?id=<?php echo $r['id']?>&domain=<?php echo $r['domain_id']?>"><img src="images/edit.gif" alt="[ <?php echo _('Edit record'); ?> ]" border="0"></a> |
|
136 |
<a href="delete_record.php?id=<?php echo $r['id']?>&domain=<?php echo $r['domain_id']?>"><img src="images/delete.gif" alt="[ <?php echo _('Delete record'); ?> ]" border="0"></a> |
1
|
137 |
<?php |
|
138 |
} // big if ;-) |
|
139 |
?> |
|
140 |
</td> |
71
|
141 |
<td class="y"><?php echo $r['name']?></td> |
|
142 |
<td class="y"><?php echo $r['type']?></td> |
|
143 |
<td class="y"><?php echo $r['content']?></td> |
1
|
144 |
<?php |
|
145 |
if ($r['prio'] != 0) |
|
146 |
{ |
71
|
147 |
?><td class="y"><?php echo $r['prio']?></td><?php |
1
|
148 |
} |
|
149 |
else |
|
150 |
{ |
13
|
151 |
?><td class="n"></td><?php |
1
|
152 |
} // else |
71
|
153 |
?><td class="y"><?php echo $r['ttl']?></td> |
1
|
154 |
</tr> |
|
155 |
<?php |
|
156 |
} // foreach |
|
157 |
?> |
|
158 |
</table> |
|
159 |
<?php |
|
160 |
} // if |
|
161 |
if(count($search_result['domains']) == 0 && count($search_result['records']) == 0) |
|
162 |
{ |
|
163 |
?> |
13
|
164 |
<table border="0" cellspacing="4"> |
1
|
165 |
<tr> |
13
|
166 |
<td width="510" class="n"> |
71
|
167 |
<?php echo _('Nothing found for query'); ?> "<?php echo $_POST['q']?>". |
1
|
168 |
</td> |
|
169 |
</tr> |
|
170 |
</table> |
71
|
171 |
<?php |
1
|
172 |
} |
|
173 |
|
|
174 |
} |
|
175 |
include_once('inc/footer.inc.php'); |
|
176 |
?> |
|
177 |
|