edit_record.php
changeset 13 2ff220cfde13
parent 3 64525a2eb098
child 37 b785e54690ce
--- a/edit_record.php	Sun Apr 22 16:27:45 2007 +0000
+++ b/edit_record.php	Mon Jun 04 18:43:11 2007 +0000
@@ -1,22 +1,4 @@
-<?php
-
-// +--------------------------------------------------------------------+
-// | PowerAdmin								|
-// +--------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PowerAdmin Team			|
-// +--------------------------------------------------------------------+
-// | This source file is subject to the license carried by the overal	|
-// | program PowerAdmin as found on http://poweradmin.sf.net		|
-// | The PowerAdmin program falls under the QPL License:		|
-// | http://www.trolltech.com/developer/licensing/qpl.html		|
-// +--------------------------------------------------------------------+
-// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
-// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
-// +--------------------------------------------------------------------+
-
-//
-// $Id: edit_record.php,v 1.9 2003/05/14 22:48:13 azurazu Exp $
-//
+<?
 
 require_once("inc/toolkit.inc.php");
 
@@ -31,16 +13,6 @@
     error(ERR_RECORD_ACCESS_DENIED);
 }
 
-/*
-if($_SESSION["partial_".get_domain_name_from_id($_GET["domain"])] == 1 && !isset($_POST["recordid"])) 
-{
-    $checkPartial = $db->getOne("SELECT id FROM record_owners WHERE record_id='".$_GET["id"]."' AND user_id='".$_SESSION["userid"]."' LIMIT 1");
-    if (empty($checkPartial)) {
-        error(ERR_RECORD_ACCESS_DENIED);
-    }
-}
-*/
-
 if ($_POST["commit"])
 {
         edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]);
@@ -52,38 +24,78 @@
         error(ERR_RECORD_ACCESS_DENIED);
     }
 }
-
+include_once("inc/header.inc.php");
+?>
+    <h2><? echo _('Edit record in zone'); ?> "<? echo  get_domain_name_from_id($_GET["domain"]) ?>"</h2>
+<?
 
-include_once("inc/header.inc.php");
-
+$x_result = $db->query("SELECT r.id,u.fullname FROM record_owners as r, users as u WHERE r.record_id='".$_GET['id']."' AND u.id=r.user_id");
+if (level(10) && ($x_result->numRows() > 0)) 
+{
+?>
+    <div id="meta">
+     <div id="meta-left">
+      <table>
+       <tr>
+        <th><? echo _('Sub-owners'); ?></td>
+        <th>&nbsp;</td>
+       </tr>
+<?
+	while ($x_r = $x_result->fetchRow()) 
+	{
 ?>
-<H2><? echo _('Edit record in zone'); ?> "<?= get_domain_name_from_id($_GET["domain"]) ?>"</H2>
-<FONT CLASS="nav"><BR><A HREF="index.php"><? echo _('DNS Admin'); ?></A> &gt;&gt; <A HREF="edit.php?id=<?= $_GET["domain"] ?>"><?= get_domain_name_from_id($_GET["domain"]) ?></A> &gt;&gt; <? echo _('Edit record'); ?><BR><BR></FONT>
-
-<FORM METHOD="post" ACTION="edit_record.php">
-<INPUT TYPE="hidden" NAME="recordid" VALUE="<?= $_GET["id"] ?>">
-<INPUT TYPE="hidden" NAME="domainid" VALUE="<?= $_GET["domain"] ?>">
-<TABLE BORDER="0" CELLSPACING="4">
-<TR STYLE="font-weight: Bold"><TD CLASS="tdbg"><? echo _('Name'); ?></TD><TD CLASS="tdbg">&nbsp;</TD><TD CLASS="tdbg"><? echo _('Type'); ?></TD><TD CLASS="tdbg"><? echo _('Priority'); ?></TD><TD CLASS="tdbg"><? echo _('Content'); ?></TD><TD CLASS="tdbg"><? echo _('TTL'); ?></TD></TR>
-
+        <tr>
+	 <td class="tdbg"><? echo $x_r["fullname"]; ?></td>
+	 <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>
+	</tr>
+<?
+	}
+?>
+       </table>
+      </div>
+     </div>
+<? 
+}
+?>
+    <form method="post" action="edit_record.php">
+     <input type="hidden" name="recordid" value="<? echo  $_GET["id"] ?>">
+     <input type="hidden" name="domainid" value="<? echo  $_GET["domain"] ?>">
+     <table>
+      <tr>
+       <th><? echo _('Name'); ?></td>
+       <th>&nbsp;</td>
+       <th><? echo _('Type'); ?></td>
+       <th><? echo _('Priority'); ?></td>
+       <th><? echo _('Content'); ?></td>
+       <th><? echo _('TTL'); ?></td>
+      </tr>
 <?
 	$rec = get_record_from_id($_GET["id"]);
 ?>
-
-<TR><TD CLASS="tdbg">
-
-<? if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  { ?>
-
-<INPUT TYPE="hidden" NAME="name" VALUE="<?= trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" CLASS="input">
+       <tr>
+        <td>
+<? 
+if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  
+{
+?>
+         <input type="hidden" name="name" value="<? echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" class="input">
 
-<?= trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>
-<? } else { ?>
-<INPUT TYPE="text" NAME="name" VALUE="<?= trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" CLASS="input">
-<? } ?>
-.<?= get_domain_name_from_id($_GET["domain"]) ?></TD><TD CLASS="tdbg">IN</TD><TD CLASS="tdbg"><SELECT NAME="type">
-
+<? echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>
+<? 
+} 
+else 
+{ 
+?>
+         <input type="text" name="name" value="<? echo  trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" class="input">
+<? 
+} 
+?>
+.<? echo  get_domain_name_from_id($_GET["domain"]) ?>
+        </td>
+	<td class="n">IN</td>
+	<td>
+	 <select name="type">
 <?
-
 foreach (get_record_types() as $c)
 {
 	if ($c == $rec["type"])
@@ -95,29 +107,22 @@
 		$add = "";
 	}
 	?>
-	<OPTION<?= $add ?> VALUE="<?= $c ?>"><?= $c ?></OPTION><?
+	<option<? echo  $add ?> value="<? echo  $c ?>"><? echo  $c ?></option><?
 }
 
 ?>
-</SELECT></TD><TD CLASS="tdbg"><INPUT TYPE="text" NAME="prio" VALUE="<?= $rec["prio"] ?>" CLASS="sinput"></TD><TD CLASS="tdbg"><INPUT TYPE="text" NAME="content" VALUE="<?= $rec["content"] ?>" CLASS="input"></TD><TD CLASS="tdbg"><INPUT TYPE="text" NAME="ttl" VALUE="<?= $rec["ttl"] ?>" CLASS="sinput"></TD></TR>
-</TABLE>
-<BR><INPUT TYPE="submit" NAME="commit" VALUE="<? echo _('Commit changes'); ?>" CLASS="button">&nbsp;&nbsp;<INPUT TYPE="reset" NAME="reset" VALUE="<? echo _('Reset changes'); ?>" CLASS="button">
-</FORM>
-
-<?if (level(10)) { ?>
-<table style="width:140px">
-<tr><td CLASS="tdbg"><b><? echo _('Sub-users'); ?></b></td><td CLASS="tdbg"> </td></tr>
+         </select>
+	</td>
+	<td><input type="text" name="prio" value="<? echo  $rec["prio"] ?>" class="sinput"></td>
+	<td><input type="text" name="content" value="<? echo  $rec["content"] ?>" class="input"></td>
+	<td><input type="text" name="ttl" value="<? echo  $rec["ttl"] ?>" class="sinput"></td>
+       </tr>
+      </table>
+      <p>
+       <input type="submit" name="commit" value="<? echo _('Commit changes'); ?>" class="button">&nbsp;&nbsp;
+       <input type="reset" name="reset" value="<? echo _('Reset changes'); ?>" class="button">
+      </p>
+     </form>
 <?
-$x_result = $db->query("SELECT r.id,u.username FROM record_owners as r, users as u WHERE r.record_id='".$_GET['id']."' AND u.id=r.user_id");
-while ($x_r = $x_result->fetchRow()) {
-   echo "<tr><td CLASS=\"tdbg\">".$x_r["username"]."</td><td CLASS=\"tdbg\">";
-   echo "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$_GET["id"]."&domain=".$_GET["domain"]."&delid=".$x_r["id"]."\">";
-   echo "<img src=\"images/delete.gif\" alt=\"" . _('trash') . "\" border=\"0\"/></a></td></tr>";
-}
+include_once("inc/footer.inc.php");
 ?>
-</table>
-<? }
-
-include_once("inc/footer.inc.php");
-
-?>