1
+ − 1
<?php
+ − 2
+ − 3
// +--------------------------------------------------------------------+
+ − 4
// | PowerAdmin |
+ − 5
// +--------------------------------------------------------------------+
+ − 6
// | Copyright (c) 1997-2002 The PowerAdmin Team |
+ − 7
// +--------------------------------------------------------------------+
+ − 8
// | This source file is subject to the license carried by the overal |
+ − 9
// | program PowerAdmin as found on http://poweradmin.sf.net |
+ − 10
// | The PowerAdmin program falls under the QPL License: |
+ − 11
// | http://www.trolltech.com/developer/licensing/qpl.html |
+ − 12
// +--------------------------------------------------------------------+
+ − 13
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl> |
+ − 14
// | Sjeemz <sjeemz <AT> sjeemz <DOT> nl> |
+ − 15
// +--------------------------------------------------------------------+
+ − 16
+ − 17
// Filename: search.php
+ − 18
// Startdate: 9-01-2003
+ − 19
// Searches the database for corresponding records or domains.
+ − 20
//
+ − 21
// The sourecode for this program was donated by DeViCeD, THANKS!
+ − 22
//
+ − 23
// $Id: search.php,v 1.1 2003/01/09 23:23:39 azurazu Exp $
+ − 24
//
+ − 25
+ − 26
require_once ( 'inc/toolkit.inc.php' );
+ − 27
+ − 28
if ( isset ( $_POST [ 's_submit' ]) || isset ( $_POST [ 'q' ]))
+ − 29
{
+ − 30
$submitted = true ;
+ − 31
$search_result = search_record ( $_POST [ 'q' ]);
+ − 32
}
+ − 33
+ − 34
+ − 35
// we will continue after the search form ...
+ − 36
include_once ( 'inc/header.inc.php' );
+ − 37
?>
2
+ − 38
<P><H2> <? echo _ ( 'Search zones or records' ); ?> </H2></P>
1
+ − 39
<P CLASS="nav">
2
+ − 40
<A HREF="index.php"> <? echo _ ( 'DNS Admin' ); ?> </A>
1
+ − 41
<?
+ − 42
if ( level ( 10 ))
+ − 43
{
3
+ − 44
?> <A HREF="users.php"> <? echo _ ( 'User admin' ); ?> </A> <A HREF="seq_update.php"> <? echo _ ( 'Synchronize database' ); ?> </A> <?
1
+ − 45
}
+ − 46
?>
+ − 47
</P><BR>
2
+ − 48
<? echo _ ( 'Type a hostname or a record in the box below and press search to see if the record exists in the system.' ); ?>
1
+ − 49
<table border = "0" cellspacing = "4">
+ − 50
<form method = "post" action=" <? = $_SERVER [ 'PHP_SELF' ] ?> ">
+ − 51
<tr>
2
+ − 52
<td class = "tdbg"><b> <? echo _ ( 'Enter a hostname or IP address' ); ?> </b></td>
1
+ − 53
<td width = "510" class = "tdbg"><input type = "text" class = "input" name = "q"></td>
+ − 54
</tr>
+ − 55
<tr>
+ − 56
<td class = "tdbg"> </td>
2
+ − 57
<td class = "tdbg"><input type = "submit" class = "button" name = "s_submit" value = " <? echo _ ( 'Search' ); ?> "></td>
1
+ − 58
</tr>
+ − 59
</form>
+ − 60
</table>
+ − 61
+ − 62
+ − 63
<?php
+ − 64
// results
+ − 65
if ( $submitted )
+ − 66
{
+ − 67
echo '<br><br>' ;
+ − 68
+ − 69
// let's check if we found any domains ...
+ − 70
if ( count ( $search_result ) == 2 && count ( $search_result [ 'domains' ]))
+ − 71
{
+ − 72
?>
2
+ − 73
<b> <? echo _ ( 'Domains found' ); ?> :</b>
1
+ − 74
<p>
+ − 75
<table border = "0" cellspacing = "4">
+ − 76
<tr style = "font-weight: Bold;">
+ − 77
<td class = "tdbg"> </td>
2
+ − 78
<td class = "tdbg"> <? echo _ ( 'Name' ); ?> </td>
+ − 79
<td class = "tdbg"> <? echo _ ( 'Records' ); ?> </td>
+ − 80
<td class = "tdbg"> <? echo _ ( 'Owner' ); ?> </td>
1
+ − 81
</tr>
+ − 82
<?php
+ − 83
foreach ( $search_result [ 'domains' ] as $d )
+ − 84
{
+ − 85
?>
+ − 86
<tr>
+ − 87
<td class = "tdbg">
+ − 88
<?php
+ − 89
if ( level ( 5 ))
+ − 90
{
3
+ − 91
echo '<a href = "delete_domain.php?id=' . $d [ 'id' ] . '"><img src = "images/delete.gif" alt = "[ ' . _ ( 'Delete zone' ) . ' ]" border = "0"></a>' ;
1
+ − 92
}
+ − 93
else
+ − 94
{
+ − 95
echo ' ' ;
+ − 96
}
+ − 97
?>
+ − 98
</td>
+ − 99
<td class = "tdbg"><a href = "edit.php?id= <? = $d [ 'id' ] ?> "> <? = $d [ 'name' ] ?> </a></td>
+ − 100
<td class = "tdbg"> <? = $d [ 'numrec' ] ?> </td>
+ − 101
<td class = "tdbg"> <? = get_owner_from_id ( $d [ 'owner' ]) ?> </td>
+ − 102
</tr>
+ − 103
<?php
+ − 104
} // end foreach ...
+ − 105
?>
+ − 106
</table>
+ − 107
<br><br>
+ − 108
<?php
+ − 109
} // end if
+ − 110
+ − 111
+ − 112
// any records ?!
+ − 113
if ( count ( $search_result [ 'records' ]))
+ − 114
{
+ − 115
?>
2
+ − 116
<b> <? echo _ ( 'Records found' ); ?> :</b>
1
+ − 117
<p>
+ − 118
<table border = "0" cellspacing = "4">
+ − 119
<tr style = "font-weight: Bold;">
+ − 120
<td class = "tdbg"> </td>
2
+ − 121
<td class = "tdbg"> <? echo _ ( 'Name' ); ?> </td>
+ − 122
<td class = "tdbg"> <? echo _ ( 'Type' ); ?> </td>
+ − 123
<td class = "tdbg"> <? echo _ ( 'Content' ); ?> </td>
+ − 124
<td class = "tdbg"> <? echo _ ( 'Priority' ); ?> </td>
+ − 125
<td class = "tdbg"> <? echo _ ( 'TTL' ); ?> </td>
1
+ − 126
</tr>
+ − 127
<?php
+ − 128
foreach ( $search_result [ 'records' ] as $r )
+ − 129
{
+ − 130
?>
+ − 131
<tr>
+ − 132
<td class = "tdbg">
+ − 133
<?php
+ − 134
if (( $r [ "type" ] != "SOA" && $r [ "type" ] != "NS" ) ||
+ − 135
( $GLOBALS [ "ALLOW_SOA_EDIT" ] && $r [ "type" ] == "SOA" ) ||
+ − 136
( $GLOBALS [ "ALLOW_NS_EDIT" ] && $r [ "type" ] == "NS" ) ||
+ − 137
( $r [ "type" ] == "NS" && get_name_from_record_id ( $r [ "id" ]) != get_domain_name_from_id ( recid_to_domid ( $r [ "id" ])) &&
+ − 138
$GLOBALS [ "ALLOW_NS_EDIT" ] != 1 ))
+ − 139
{
+ − 140
?>
3
+ − 141
<a href = "edit_record.php?id= <? = $r [ 'id' ] ?> &domain= <? = $r [ 'domain_id' ] ?> "><img src = "images/edit.gif" alt = "[ <? echo _ ( 'Edit record' ); ?> ]" border = "0"></a>
+ − 142
<a href = "delete_record.php?id= <? = $r [ 'id' ] ?> &domain= <? = $r [ 'domain_id' ] ?> "><img src = "images/delete.gif" alt = "[ <? echo _ ( 'Delete record' ); ?> ]" border = "0"></a>
1
+ − 143
<?php
+ − 144
} // big if ;-)
+ − 145
?>
+ − 146
</td>
+ − 147
<td style = "border: 1px solid #000000;"> <? = $r [ 'name' ] ?> </td>
+ − 148
<td style = "border: 1px solid #000000;"> <? = $r [ 'type' ] ?> </td>
+ − 149
<td style = "border: 1px solid #000000;"> <? = $r [ 'content' ] ?> </td>
+ − 150
<?php
+ − 151
if ( $r [ 'prio' ] != 0 )
+ − 152
{
+ − 153
?> <td style = "border: 1px solid #000000;"> <? = $r [ 'prio' ] ?> </td> <?php
+ − 154
}
+ − 155
else
+ − 156
{
+ − 157
?> <td class = "tdbg"></td> <?php
+ − 158
} // else
+ − 159
?> <td style = "border: 1px solid #000000;"> <? = $r [ 'ttl' ] ?> </td>
+ − 160
</tr>
+ − 161
<?php
+ − 162
} // foreach
+ − 163
?>
+ − 164
</table>
+ − 165
<?php
+ − 166
} // if
+ − 167
if ( count ( $search_result [ 'domains' ]) == 0 && count ( $search_result [ 'records' ]) == 0 )
+ − 168
{
+ − 169
?>
+ − 170
<table border = "0" cellspacing = "4">
+ − 171
<tr>
+ − 172
<td width = "510" class = "tdbg">
2
+ − 173
<? echo _ ( 'Nothing found for query' ); ?> " <? = $_POST [ 'q' ] ?> "
1
+ − 174
</td>
+ − 175
</tr>
+ − 176
</table>
+ − 177
<?
+ − 178
}
+ − 179
+ − 180
}
+ − 181
include_once ( 'inc/footer.inc.php' );
+ − 182
?>
+ − 183