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 requests to edit zone records * * @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"); global $pdnssec_use; 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_content_edit = "all"; } elseif (verify_permission('zone_content_edit_own')) { $perm_content_edit = "own"; } else { $perm_content_edit = "none"; } if (verify_permission('zone_meta_edit_others')) { $perm_meta_edit = "all"; } elseif (verify_permission('zone_meta_edit_own')) { $perm_meta_edit = "own"; } else { $perm_meta_edit = "none"; } $zid = get_zone_id_from_record_id($_GET['id']); $user_is_zone_owner = verify_user_is_owner_zoneid($zid); $zone_type = get_domain_type($zid); $zone_name = get_zone_name_from_id($zid); if (isset($_POST["commit"])) { if ($zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0") { error(ERR_PERM_EDIT_RECORD); } else { $old_record_info = get_record_from_id($_POST["rid"]); $ret_val = edit_record($_POST); if ($ret_val == "1") { if ($_POST['type'] != "SOA") { update_soa_serial($zid); } success(SUC_RECORD_UPD); $new_record_info = get_record_from_id($_POST["rid"]); log_info(sprintf('client_ip:%s user:%s operation:edit_record' .' old_record_type:%s old_record:%s old_content:%s old_ttl:%s old_priority:%s' .' record_type:%s record:%s content:%s ttl:%s priority:%s', $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $old_record_info['type'], $old_record_info['name'], $old_record_info['content'], $old_record_info['ttl'], $old_record_info['prio'], $new_record_info['type'], $new_record_info['name'], $new_record_info['content'], $new_record_info['ttl'], $new_record_info['prio'])); if ($pdnssec_use) { if (dnssec_rectify_zone($zid)) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); } } } } } echo "

" . _('Edit record in zone') . " \"" . $zone_name . "\"

\n"; if ($perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0") { error(ERR_PERM_VIEW_RECORD); } else { $record = get_record_from_id($_GET["id"]); echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; /* Sanitize content due to SPF record quoting in PowerDNS */ if ($record['type'] == "SRV" || $record['type'] == "SPF" || $record['type'] == "TXT") { $clean_content = trim($record['content'], "\x22\x27"); } else { $clean_content = $record['content']; } if ($zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0") { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } else { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
" . _('Name') . " " . _('Type') . "" . _('Content') . "" . _('Priority') . "" . _('TTL') . "
" . $record["name"] . "IN" . htmlspecialchars($record["type"]) . "" . htmlspecialchars($clean_content) . "" . htmlspecialchars($record["prio"]) . "" . htmlspecialchars($record["ttl"]) . "
\n"; echo " \n"; echo " ." . $zone_name . "IN\n"; echo " \n"; echo "
\n"; echo "   \n"; echo "   \n"; echo "
\n"; } include_once("inc/footer.inc.php");