[feladat @ 84]
Bugfix. The function zone_count() now also counts zones an owner has
only partial access to, not just those zones the owner has full access
to. This fixes just the count, the zones a user has partial access to
are not (yet!) shown in the "list zones" page.
Bugfix. In the zone listing the "edit" button is now show for users
with access level 1. Untill now they were presented an overview of the
zones they could change, but there was no link for them to actually
edit the zone.
Bugfix. Some of the buttons in the "edit zone" interface that are of
no use to a user with access level 1 have been hidden.
Bugfix. Make sure a user with access level 1 with only partial access
to a zone cannot add new records to that zone. Only the zone owner
should be able to add new record.
Bugfix. If a user with access level 1 edits a record in a zone he has
only partial access to, an error was shown because of call to a non-
existing function in the PEAR:MDB2. This bug was most likely
introduced while migrating from PEAR:DB to PEAR:MDB2.
Bugfix. A user with access level 1 was able to delete all records of a
zone he has only partial access to. Some additional checks have been
added.
Bugfix. If a user with accees level 1 has partial access to one or
more zones starting with a certain character, but did not own at least
one entire zone starting with the same character, the character wasn't
clickable in the "list zone" page.
Interface. If no record or zone id is given for delete_record.php or
delete_domain.php, don't just die but echo a nice message. The i18n
files have not yet been updated to reflect this change.
Interface. If no master IP is given in delete_supermaster.php, don't
just die but echo a nice message. The i18n files have not yet been
updated to reflect this change.
[All fixes by Peter Beernink.]
<?php
require_once("inc/i18n.inc.php");
require_once('inc/toolkit.inc.php');
if (isset($_POST['s_submit']) || isset($_POST['q']))
{
$submitted=true;
$search_result=search_record($_POST['q']);
}
// we will continue after the search form ...
include_once('inc/header.inc.php');
?>
<h2><? echo _('Search zones or records'); ?></h2>
<h3>Query</h3>
<table>
<form method="post" action="<? echo $_SERVER['PHP_SELF']?>">
<tr>
<td class="n"><? echo _('Enter a hostname or IP address'); ?></td>
<td class="n"><input type="text" class="input" name="q"></td>
</tr>
<tr>
<td class="n"> </td>
<td class="n"><input type="submit" class="button" name="s_submit" value="<? echo _('Search'); ?>"></td>
</tr>
</form>
</table>
<?php
// results
if ($submitted)
{
echo '<br><br>';
// let's check if we found any domains ...
if (count($search_result) == 2 && count($search_result['domains']))
{
?>
<h4><? echo _('Zones found'); ?>:</h4>
<table>
<tr>
<th> </th>
<th><? echo _('Name'); ?></th>
<th><? echo _('Records'); ?></th>
<th><? echo _('Owner'); ?></th>
</tr>
<?php
foreach($search_result['domains'] as $d)
{
?>
<tr>
<?
if (level(5))
{
?>
<td class="n">
<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>
<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>
</td>
<?
}
else
{
?>
<td class="n">
</td>
<?
}
?>
<td class="y"><? echo $d['name']?></td>
<td class="y"><? echo $d['numrec']?></td>
<td class="y"><? echo get_owner_from_id($d['owner'])?></td>
</tr>
<?php
} // end foreach ...
?>
</table>
<br><br>
<?php
} // end if
// any records ?!
if(count($search_result['records']))
{
?>
<b><? echo _('Records found'); ?>:</b>
<p>
<table>
<tr>
<td class="n"> </td>
<td class="n"><? echo _('Name'); ?></td>
<td class="n"><? echo _('Type'); ?></td>
<td class="n"><? echo _('Content'); ?></td>
<td class="n"><? echo _('Priority'); ?></td>
<td class="n"><? echo _('TTL'); ?></td>
</tr>
<?php
foreach($search_result['records'] as $r)
{
?>
<tr>
<td class="n">
<?php
if (($r["type"] != "SOA" && $r["type"] != "NS") ||
($GLOBALS["ALLOW_SOA_EDIT"] && $r["type"] == "SOA") ||
($GLOBALS["ALLOW_NS_EDIT"] && $r["type"] == "NS") ||
($r["type"] == "NS" && get_name_from_record_id($r["id"]) != get_domain_name_from_id(recid_to_domid($r["id"])) &&
$GLOBALS["ALLOW_NS_EDIT"] != 1))
{
?>
<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>
<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>
<?php
} // big if ;-)
?>
</td>
<td class="y"><? echo $r['name']?></td>
<td class="y"><? echo $r['type']?></td>
<td class="y"><? echo $r['content']?></td>
<?php
if ($r['prio'] != 0)
{
?><td class="y"><? echo $r['prio']?></td><?php
}
else
{
?><td class="n"></td><?php
} // else
?><td class="y"><? echo $r['ttl']?></td>
</tr>
<?php
} // foreach
?>
</table>
<?php
} // if
if(count($search_result['domains']) == 0 && count($search_result['records']) == 0)
{
?>
<table border="0" cellspacing="4">
<tr>
<td width="510" class="n">
<? echo _('Nothing found for query'); ?> "<? echo $_POST['q']?>"
</td>
</tr>
</table>
<?
}
}
include_once('inc/footer.inc.php');
?>