edit_record.php
author rejo
Mon, 16 Apr 2007 19:48:27 +0000
changeset 3 64525a2eb098
parent 2 9a485c41cfcf
child 13 2ff220cfde13
permissions -rw-r--r--
[feladat @ 4] General update translation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
// | PowerAdmin								|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
// | Copyright (c) 1997-2002 The PowerAdmin Team			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
// | This source file is subject to the license carried by the overal	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
// | program PowerAdmin as found on http://poweradmin.sf.net		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
// | The PowerAdmin program falls under the QPL License:		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
// | http://www.trolltech.com/developer/licensing/qpl.html		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
// $Id: edit_record.php,v 1.9 2003/05/14 22:48:13 azurazu Exp $
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
require_once("inc/toolkit.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
if (isset($_GET["delid"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
   $db->query("DELETE FROM record_owners WHERE id='".$_GET["delid"]."'");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
$xsid = (isset($_GET['id'])) ? $_GET['id'] : $_POST['recordid'];
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
if(!xs(recid_to_domid($xsid)))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
    error(ERR_RECORD_ACCESS_DENIED);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
if($_SESSION["partial_".get_domain_name_from_id($_GET["domain"])] == 1 && !isset($_POST["recordid"])) 
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
    $checkPartial = $db->getOne("SELECT id FROM record_owners WHERE record_id='".$_GET["id"]."' AND user_id='".$_SESSION["userid"]."' LIMIT 1");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
    if (empty($checkPartial)) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
        error(ERR_RECORD_ACCESS_DENIED);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
    }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
*/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
if ($_POST["commit"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
        edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
        clean_page("edit.php?id=".$_POST["domainid"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
} elseif($_SESSION["partial_".get_domain_name_from_id($_GET["domain"])] == 1)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
    $checkPartial = $db->getOne("SELECT id FROM record_owners WHERE record_id='".$_GET["id"]."' AND user_id='".$_SESSION["userid"]."' LIMIT 1");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
    if (empty($checkPartial)) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
        error(ERR_RECORD_ACCESS_DENIED);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
    }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
?>
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    60
<H2><? echo _('Edit record in zone'); ?> "<?= get_domain_name_from_id($_GET["domain"]) ?>"</H2>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    61
<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>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    62
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
<FORM METHOD="post" ACTION="edit_record.php">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
<INPUT TYPE="hidden" NAME="recordid" VALUE="<?= $_GET["id"] ?>">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
<INPUT TYPE="hidden" NAME="domainid" VALUE="<?= $_GET["domain"] ?>">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    66
<TABLE BORDER="0" CELLSPACING="4">
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    67
<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>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    70
	$rec = get_record_from_id($_GET["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    72
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
<TR><TD CLASS="tdbg">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    75
<? if ($_SESSION[$_GET["domain"]."_ispartial"] == 1)  { ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
<INPUT TYPE="hidden" NAME="name" VALUE="<?= trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" CLASS="input">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    79
<?= trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
<? } else { ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
<INPUT TYPE="text" NAME="name" VALUE="<?= trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" CLASS="input">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    82
<? } ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
.<?= get_domain_name_from_id($_GET["domain"]) ?></TD><TD CLASS="tdbg">IN</TD><TD CLASS="tdbg"><SELECT NAME="type">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    87
foreach (get_record_types() as $c)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    89
	if ($c == $rec["type"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    90
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    91
		$add = " SELECTED";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    92
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    93
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    94
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    95
		$add = "";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    96
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    97
	?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    98
	<OPTION<?= $add ?> VALUE="<?= $c ?>"><?= $c ?></OPTION><?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    99
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   100
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   101
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   102
</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>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   103
</TABLE>
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   104
<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">
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   105
</FORM>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   106
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   107
<?if (level(10)) { ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   108
<table style="width:140px">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   109
<tr><td CLASS="tdbg"><b><? echo _('Sub-users'); ?></b></td><td CLASS="tdbg"> </td></tr>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   110
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   111
$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");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   112
while ($x_r = $x_result->fetchRow()) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   113
   echo "<tr><td CLASS=\"tdbg\">".$x_r["username"]."</td><td CLASS=\"tdbg\">";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   114
   echo "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$_GET["id"]."&domain=".$_GET["domain"]."&delid=".$x_r["id"]."\">";
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   115
   echo "<img src=\"images/delete.gif\" alt=\"" . _('trash') . "\" border=\"0\"/></a></td></tr>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   116
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   117
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   118
</table>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   119
<? }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   120
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   121
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   122
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   123
?>