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