edit_record.php
changeset 71 e1b918eaf69a
parent 65 ce1c4d5e1576
child 79 0c0aa144356a
equal deleted inserted replaced
70:47248e2af079 71:e1b918eaf69a
     1 <?
     1 <?php
     2 
     2 
     3 /*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
     3 /*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
     4  *  See <https://rejo.zenger.nl/poweradmin> for more details.
     4  *  See <https://rejo.zenger.nl/poweradmin> for more details.
     5  *
     5  *
     6  *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
     6  *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
    44         error(ERR_RECORD_ACCESS_DENIED);
    44         error(ERR_RECORD_ACCESS_DENIED);
    45     }
    45     }
    46 }
    46 }
    47 include_once("inc/header.inc.php");
    47 include_once("inc/header.inc.php");
    48 ?>
    48 ?>
    49     <h2><? echo _('Edit record in zone'); ?> "<? echo  get_domain_name_from_id($_GET["domain"]) ?>"</h2>
    49     <h2><?php echo _('Edit record in zone'); ?> "<?php echo  get_domain_name_from_id($_GET["domain"]) ?>"</h2>
    50 <?
    50 <?php
    51 
    51 
    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");
    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");
    53 if (level(10) && ($x_result->numRows() > 0)) 
    53 if (level(10) && ($x_result->numRows() > 0)) 
    54 {
    54 {
    55 ?>
    55 ?>
    56     <div id="meta">
    56     <div id="meta">
    57      <div id="meta-left">
    57      <div id="meta-left">
    58       <table>
    58       <table>
    59        <tr>
    59        <tr>
    60         <th><? echo _('Sub-owners'); ?></td>
    60         <th><?php echo _('Sub-owners'); ?></td>
    61         <th>&nbsp;</td>
    61         <th>&nbsp;</td>
    62        </tr>
    62        </tr>
    63 <?
    63 <?php
    64 	while ($x_r = $x_result->fetchRow()) 
    64 	while ($x_r = $x_result->fetchRow()) 
    65 	{
    65 	{
    66 ?>
    66 ?>
    67         <tr>
    67         <tr>
    68 	 <td class="tdbg"><? echo $x_r["fullname"]; ?></td>
    68 	 <td class="tdbg"><?php echo $x_r["fullname"]; ?></td>
    69 	 <td class="tdbg"><a href="<? echo $_SERVER["PHP_SELF"]; ?>?id=<? echo $_GET["id"]; ?>&amp;domain=<? echo $_GET["domain"]; ?>&amp;delid=<? echo $x_r["id"]; ?>"><img src="images/delete.gif" alt="trash"></a></td>
    69 	 <td class="tdbg"><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?id=<?php echo $_GET["id"]; ?>&amp;domain=<?php echo $_GET["domain"]; ?>&amp;delid=<?php echo $x_r["id"]; ?>"><img src="images/delete.gif" alt="trash"></a></td>
    70 	</tr>
    70 	</tr>
    71 <?
    71 <?php
    72 	}
    72 	}
    73 ?>
    73 ?>
    74        </table>
    74        </table>
    75       </div>
    75       </div>
    76      </div>
    76      </div>
    77 <? 
    77 <?php 
    78 }
    78 }
    79 ?>
    79 ?>
    80     <form method="post" action="edit_record.php">
    80     <form method="post" action="edit_record.php">
    81      <input type="hidden" name="recordid" value="<? echo  $_GET["id"] ?>">
    81      <input type="hidden" name="recordid" value="<?php echo  $_GET["id"] ?>">
    82      <input type="hidden" name="domainid" value="<? echo  $_GET["domain"] ?>">
    82      <input type="hidden" name="domainid" value="<?php echo  $_GET["domain"] ?>">
    83      <table>
    83      <table>
    84       <tr>
    84       <tr>
    85        <th><? echo _('Name'); ?></td>
    85        <th><?php echo _('Name'); ?></td>
    86        <th>&nbsp;</td>
    86        <th>&nbsp;</td>
    87        <th><? echo _('Type'); ?></td>
    87        <th><?php echo _('Type'); ?></td>
    88        <th><? echo _('Priority'); ?></td>
    88        <th><?php echo _('Priority'); ?></td>
    89        <th><? echo _('Content'); ?></td>
    89        <th><?php echo _('Content'); ?></td>
    90        <th><? echo _('TTL'); ?></td>
    90        <th><?php echo _('TTL'); ?></td>
    91       </tr>
    91       </tr>
    92 <?
    92 <?php
    93 	$rec = get_record_from_id($_GET["id"]);
    93 	$rec = get_record_from_id($_GET["id"]);
    94 ?>
    94 ?>
    95        <tr>
    95        <tr>
    96         <td>
    96         <td>
    97 <? 
    97 <?php 
    98 if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  
    98 if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  
    99 {
    99 {
   100 ?>
   100 ?>
   101          <input type="hidden" name="name" value="<? echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" class="input">
   101          <input type="hidden" name="name" value="<?php echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" class="input">
   102 
   102 
   103 <? echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>
   103 <?php echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>
   104 <? 
   104 <?php 
   105 } 
   105 } 
   106 else 
   106 else 
   107 { 
   107 { 
   108 ?>
   108 ?>
   109          <input type="text" name="name" value="<? echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" class="input">
   109          <input type="text" name="name" value="<?php echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" class="input">
   110 <? 
   110 <?php 
   111 } 
   111 } 
   112 ?>
   112 ?>
   113 .<? echo  get_domain_name_from_id($_GET["domain"]) ?>
   113 .<?php echo  get_domain_name_from_id($_GET["domain"]) ?>
   114         </td>
   114         </td>
   115 	<td class="n">IN</td>
   115 	<td class="n">IN</td>
   116 	<td>
   116 	<td>
   117 	 <select name="type">
   117 	 <select name="type">
   118 <?
   118 <?php
   119 foreach (get_record_types() as $c)
   119 foreach (get_record_types() as $c)
   120 {
   120 {
   121 	if ($c == $rec["type"])
   121 	if ($c == $rec["type"])
   122 	{
   122 	{
   123 		$add = " SELECTED";
   123 		$add = " SELECTED";
   125 	else
   125 	else
   126 	{
   126 	{
   127 		$add = "";
   127 		$add = "";
   128 	}
   128 	}
   129 	?>
   129 	?>
   130 	<option<? echo  $add ?> value="<? echo  $c ?>"><? echo  $c ?></option><?
   130 	<option<?php echo  $add ?> value="<?php echo  $c ?>"><?php echo  $c ?></option><?php
   131 }
   131 }
   132 
   132 
   133 ?>
   133 ?>
   134          </select>
   134          </select>
   135 	</td>
   135 	</td>
   136 	<td><input type="text" name="prio" value="<? echo  $rec["prio"] ?>" class="sinput"></td>
   136 	<td><input type="text" name="prio" value="<?php echo  $rec["prio"] ?>" class="sinput"></td>
   137 	<td><input type="text" name="content" value="<? echo  $rec["content"] ?>" class="input"></td>
   137 	<td><input type="text" name="content" value="<?php echo  $rec["content"] ?>" class="input"></td>
   138 	<td><input type="text" name="ttl" value="<? echo  $rec["ttl"] ?>" class="sinput"></td>
   138 	<td><input type="text" name="ttl" value="<?php echo  $rec["ttl"] ?>" class="sinput"></td>
   139        </tr>
   139        </tr>
   140       </table>
   140       </table>
   141       <p>
   141       <p>
   142        <input type="submit" name="commit" value="<? echo _('Commit changes'); ?>" class="button">&nbsp;&nbsp;
   142        <input type="submit" name="commit" value="<?php echo _('Commit changes'); ?>" class="button">&nbsp;&nbsp;
   143        <input type="reset" name="reset" value="<? echo _('Reset changes'); ?>" class="button">
   143        <input type="reset" name="reset" value="<?php echo _('Reset changes'); ?>" class="button">
   144       </p>
   144       </p>
   145      </form>
   145      </form>
   146 <?
   146 <?php
   147 include_once("inc/footer.inc.php");
   147 include_once("inc/footer.inc.php");
   148 ?>
   148 ?>