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