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