for more details. * * Copyright 2007-2010 Rejo Zenger * Copyright 2010-2014 Poweradmin Development Team * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * Script that handles search requests * * @package Poweradmin * @copyright 2007-2010 Rejo Zenger * @copyright 2010-2014 Poweradmin Development Team * @license http://opensource.org/licenses/GPL-3.0 GPL */ require_once('inc/toolkit.inc.php'); include_once('inc/header.inc.php'); if (!(verify_permission('search'))) { error(ERR_PERM_SEARCH); include_once('inc/footer.inc.php'); exit; } else { echo "

" . _('Search zones and records') . "

\n"; $holy_grail = ''; if (isset($_POST['query'])) { if (verify_permission('zone_content_view_others')) { $perm_view = "all"; } elseif (verify_permission('zone_content_view_own')) { $perm_view = "own"; } else { $perm_view = "none"; } if (verify_permission('zone_content_edit_others')) { $perm_edit = "all"; } elseif (verify_permission('zone_content_edit_own')) { $perm_edit = "own"; } else { $perm_edit = "none"; } $holy_grail = $_POST['query']; $wildcards = ($_POST['wildcards'] == "true" ? true : false); $arpa = ($_POST['arpa'] == "true" ? true : false); $result = search_zone_and_record($holy_grail, $perm_view, ZONE_SORT_BY, RECORD_SORT_BY, $wildcards, $arpa); if (is_array($result['zones'])) { echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo "

" . _('Zones found') . ":

\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; /* If user has all edit permissions show zone owners */ if ($perm_edit == "all") { echo " \n"; } echo " \n"; echo " \n"; foreach ($result['zones'] as $zone) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($zone['type'] == "SLAVE") { echo " \n"; } else { echo " \n"; } if ($perm_edit == "all") { echo " "; } echo " \n"; } echo "
 " . _('Name') . "" . _('Type') . "" . _('Master') . "" . _('Owner') . "
\n"; echo " \"[\n"; if ($perm_edit != "all" || $perm_edit != "none") { $user_is_zone_owner = verify_user_is_owner_zoneid($zone['zid']); } if ($perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1")) { echo " \"[\n"; } echo " " . $zone['name'] . "" . $zone['type'] . "" . $zone['master'] . " " . $zone['owner'] . "
\n"; } if (is_array($result['records'])) { echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo "

" . _('Records found') . ":

\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; foreach ($result['records'] as $record) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($record['type'] == "MX" || $record['type'] == "SRV") { echo " \n"; } else { echo " \n"; } echo " \n"; echo " \n"; } echo "
 " . _('Name') . "" . _('Type') . "" . _('Content') . "Priority" . _('TTL') . "
\n"; echo " \"[\n"; if ($perm_edit != "all" || $perm_edit != "none") { $user_is_zone_owner = verify_user_is_owner_zoneid($record['zid']); } if ($perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1")) { echo " \"[\n"; } echo " " . $record['name'] . "" . $record['type'] . "" . $record['content'] . "" . $record['prio'] . " " . $record['ttl'] . "
\n"; } } else { // !isset($_POST['query']) $wildcards = true; $arpa = true; } echo "

" . _('Query') . ":

\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "  \n"; echo " \n"; echo " " . _('Wildcard') . "\n"; echo " " . _('Reverse') . "\n"; echo "
\n"; echo " " . _('Enter a hostname or IP address. SQL LIKE syntax supported: an underscore (_) in pattern matches any single character, a percent sign (%) matches any string of zero or more characters.') . "\n"; echo "
\n"; echo "
\n"; } include_once('inc/footer.inc.php');