edit_record.php
changeset 79 0c0aa144356a
parent 71 e1b918eaf69a
child 80 48b5f7021aaa
equal deleted inserted replaced
78:effde559e0e9 79:0c0aa144356a
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20  */
    20  */
    21 
    21 
    22 require_once("inc/toolkit.inc.php");
    22 require_once("inc/toolkit.inc.php");
    23 
    23 
    24 if (isset($_GET["delid"])) {
    24 if (isset($_GET["delid"]) && isset($_GET['delid']) && isset($_GET['id'])) {
    25    delete_record_owner($_GET["domain"],$_GET["delid"],$_GET["id"]);
    25    delete_record_owner($_GET["domain"],$_GET["delid"],$_GET["id"]);
    26 }
    26 }
    27 
    27 
    28 $xsid = (isset($_GET['id'])) ? $_GET['id'] : $_POST['recordid'];
    28 $xsid = (isset($_GET['id'])) ? $_GET['id'] : $_POST['recordid'];
    29 
    29 
    30 if(!xs(recid_to_domid($xsid)))
    30 if(!xs(recid_to_domid($xsid)))
    31 {
    31 {
    32     error(ERR_RECORD_ACCESS_DENIED);
    32     error(ERR_RECORD_ACCESS_DENIED);
    33 }
    33 }
    34 
    34 
    35 if ($_POST["commit"])
    35 if (isset($_GET['domain'])) {
       
    36 	$domain_name = get_domain_name_from_id($_GET['domain']);
       
    37 }
       
    38 if (isset($_POST["commit"]) && isset($_POST['recordid']) && isset($_POST['domainid']) && isset($_POST['name']) && isset($_POST['type']) && isset($_POST['content']) && isset($_POST['ttl']) && isset($_POST['prio']))
    36 {
    39 {
    37         edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]);
    40         edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]);
    38         clean_page("edit.php?id=".$_POST["domainid"]);
    41         clean_page("edit.php?id=".$_POST["domainid"]);
    39 } elseif($_SESSION["partial_".get_domain_name_from_id($_GET["domain"])] == 1)
    42 } elseif(isset($_SESSION['partial_'.$domain_name]) && ($_SESSION["partial_".$domain_name] == 1))
    40 {
    43 {
    41 	$db->setLimit(1);
    44 	$db->setLimit(1);
    42     $checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id=".$db->quote($_GET["id"])." AND user_id=".$db->quote($_SESSION["userid"]));
    45     $checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id=".$db->quote($_GET["id"])." AND user_id=".$db->quote($_SESSION["userid"]));
    43     if (empty($checkPartial)) {
    46     if (empty($checkPartial)) {
    44         error(ERR_RECORD_ACCESS_DENIED);
    47         error(ERR_RECORD_ACCESS_DENIED);
    45     }
    48     }
    46 }
    49 }
    47 include_once("inc/header.inc.php");
    50 include_once("inc/header.inc.php");
    48 ?>
    51 ?>
    49     <h2><?php echo _('Edit record in zone'); ?> "<?php echo  get_domain_name_from_id($_GET["domain"]) ?>"</h2>
    52     <h2><?php echo _('Edit record in zone'); ?> "<?php echo  $domain_name ?>"</h2>
    50 <?php
    53 <?php
    51 
    54 
    52 $x_result = $db->query("SELECT r.id,u.fullname FROM record_owners as r, users as u WHERE r.record_id=".$db->quote($_GET['id'])." AND u.id=r.user_id");
    55 $x_result = $db->query("SELECT r.id,u.fullname FROM record_owners as r, users as u WHERE r.record_id=".$db->quote($_GET['id'])." AND u.id=r.user_id");
    53 if (level(10) && ($x_result->numRows() > 0)) 
    56 if (level(10) && ($x_result->numRows() > 0)) 
    54 {
    57 {
    96         <td>
    99         <td>
    97 <?php 
   100 <?php 
    98 if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  
   101 if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  
    99 {
   102 {
   100 ?>
   103 ?>
   101          <input type="hidden" name="name" value="<?php echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" class="input">
   104          <input type="hidden" name="name" value="<?php echo  trim(str_replace($domain_name, '', $rec["name"]), '.')?>" class="input">
   102 
   105 
   103 <?php echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>
   106 <?php echo  trim(str_replace($domain_name, '', $rec["name"]), '.') ?>
   104 <?php 
   107 <?php 
   105 } 
   108 } 
   106 else 
   109 else 
   107 { 
   110 { 
   108 ?>
   111 ?>
   109          <input type="text" name="name" value="<?php echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" class="input">
   112          <input type="text" name="name" value="<?php echo  trim(str_replace($domain_name, '', $rec["name"]), '.') ?>" class="input">
   110 <?php 
   113 <?php 
   111 } 
   114 } 
   112 ?>
   115 ?>
   113 .<?php echo  get_domain_name_from_id($_GET["domain"]) ?>
   116 .<?php echo  $domain_name ?>
   114         </td>
   117         </td>
   115 	<td class="n">IN</td>
   118 	<td class="n">IN</td>
   116 	<td>
   119 	<td>
   117 	 <select name="type">
   120 	 <select name="type">
   118 <?php
   121 <?php