13
|
1 |
<? |
1
|
2 |
|
47
|
3 |
/* PowerAdmin, a friendly web-based admin tool for PowerDNS. |
|
4 |
* See <https://rejo.zenger.nl/poweradmin> for more details. |
|
5 |
* |
|
6 |
* Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl> |
|
7 |
* |
|
8 |
* This program is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21 |
|
1
|
22 |
require_once("inc/toolkit.inc.php"); |
|
23 |
|
|
24 |
if (isset($_GET["delid"])) { |
|
25 |
$db->query("DELETE FROM record_owners WHERE id='".$_GET["delid"]."'"); |
|
26 |
} |
|
27 |
|
|
28 |
$xsid = (isset($_GET['id'])) ? $_GET['id'] : $_POST['recordid']; |
|
29 |
|
|
30 |
if(!xs(recid_to_domid($xsid))) |
|
31 |
{ |
|
32 |
error(ERR_RECORD_ACCESS_DENIED); |
|
33 |
} |
|
34 |
|
|
35 |
if ($_POST["commit"]) |
|
36 |
{ |
|
37 |
edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]); |
|
38 |
clean_page("edit.php?id=".$_POST["domainid"]); |
|
39 |
} elseif($_SESSION["partial_".get_domain_name_from_id($_GET["domain"])] == 1) |
|
40 |
{ |
37
|
41 |
$checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id='".$_GET["id"]."' AND user_id='".$_SESSION["userid"]."' LIMIT 1"); |
1
|
42 |
if (empty($checkPartial)) { |
|
43 |
error(ERR_RECORD_ACCESS_DENIED); |
|
44 |
} |
|
45 |
} |
13
|
46 |
include_once("inc/header.inc.php"); |
|
47 |
?> |
|
48 |
<h2><? echo _('Edit record in zone'); ?> "<? echo get_domain_name_from_id($_GET["domain"]) ?>"</h2> |
|
49 |
<? |
1
|
50 |
|
13
|
51 |
$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"); |
|
52 |
if (level(10) && ($x_result->numRows() > 0)) |
|
53 |
{ |
|
54 |
?> |
|
55 |
<div id="meta"> |
|
56 |
<div id="meta-left"> |
|
57 |
<table> |
|
58 |
<tr> |
|
59 |
<th><? echo _('Sub-owners'); ?></td> |
|
60 |
<th> </td> |
|
61 |
</tr> |
|
62 |
<? |
|
63 |
while ($x_r = $x_result->fetchRow()) |
|
64 |
{ |
1
|
65 |
?> |
13
|
66 |
<tr> |
|
67 |
<td class="tdbg"><? echo $x_r["fullname"]; ?></td> |
|
68 |
<td class="tdbg"><a href="<? echo $_SERVER["PHP_SELF"]; ?>?id=<? echo $_GET["id"]; ?>&domain=<? echo $_GET["domain"]; ?>&delid=<? echo $x_r["id"]; ?>"><img src="images/delete.gif" alt="trash"></a></td> |
|
69 |
</tr> |
|
70 |
<? |
|
71 |
} |
|
72 |
?> |
|
73 |
</table> |
|
74 |
</div> |
|
75 |
</div> |
|
76 |
<? |
|
77 |
} |
|
78 |
?> |
|
79 |
<form method="post" action="edit_record.php"> |
|
80 |
<input type="hidden" name="recordid" value="<? echo $_GET["id"] ?>"> |
|
81 |
<input type="hidden" name="domainid" value="<? echo $_GET["domain"] ?>"> |
|
82 |
<table> |
|
83 |
<tr> |
|
84 |
<th><? echo _('Name'); ?></td> |
|
85 |
<th> </td> |
|
86 |
<th><? echo _('Type'); ?></td> |
|
87 |
<th><? echo _('Priority'); ?></td> |
|
88 |
<th><? echo _('Content'); ?></td> |
|
89 |
<th><? echo _('TTL'); ?></td> |
|
90 |
</tr> |
1
|
91 |
<? |
|
92 |
$rec = get_record_from_id($_GET["id"]); |
|
93 |
?> |
13
|
94 |
<tr> |
|
95 |
<td> |
|
96 |
<? |
|
97 |
if ($_SESSION[$_GET["domain"]."_ispartial"] == 1) |
|
98 |
{ |
|
99 |
?> |
|
100 |
<input type="hidden" name="name" value="<? echo trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.')?>" class="input"> |
1
|
101 |
|
13
|
102 |
<? echo trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?> |
|
103 |
<? |
|
104 |
} |
|
105 |
else |
|
106 |
{ |
|
107 |
?> |
|
108 |
<input type="text" name="name" value="<? echo trim(str_replace(get_domain_name_from_id($_GET["domain"]), '', $rec["name"]), '.') ?>" class="input"> |
|
109 |
<? |
|
110 |
} |
|
111 |
?> |
|
112 |
.<? echo get_domain_name_from_id($_GET["domain"]) ?> |
|
113 |
</td> |
|
114 |
<td class="n">IN</td> |
|
115 |
<td> |
|
116 |
<select name="type"> |
1
|
117 |
<? |
|
118 |
foreach (get_record_types() as $c) |
|
119 |
{ |
|
120 |
if ($c == $rec["type"]) |
|
121 |
{ |
|
122 |
$add = " SELECTED"; |
|
123 |
} |
|
124 |
else |
|
125 |
{ |
|
126 |
$add = ""; |
|
127 |
} |
|
128 |
?> |
13
|
129 |
<option<? echo $add ?> value="<? echo $c ?>"><? echo $c ?></option><? |
1
|
130 |
} |
|
131 |
|
|
132 |
?> |
13
|
133 |
</select> |
|
134 |
</td> |
|
135 |
<td><input type="text" name="prio" value="<? echo $rec["prio"] ?>" class="sinput"></td> |
|
136 |
<td><input type="text" name="content" value="<? echo $rec["content"] ?>" class="input"></td> |
|
137 |
<td><input type="text" name="ttl" value="<? echo $rec["ttl"] ?>" class="sinput"></td> |
|
138 |
</tr> |
|
139 |
</table> |
|
140 |
<p> |
|
141 |
<input type="submit" name="commit" value="<? echo _('Commit changes'); ?>" class="button"> |
|
142 |
<input type="reset" name="reset" value="<? echo _('Reset changes'); ?>" class="button"> |
|
143 |
</p> |
|
144 |
</form> |
1
|
145 |
<? |
13
|
146 |
include_once("inc/footer.inc.php"); |
1
|
147 |
?> |