13
+ − 1
<?
1
+ − 2
+ − 3
require_once ( "inc/toolkit.inc.php" );
+ − 4
+ − 5
if ( isset ( $_GET [ "delid" ])) {
+ − 6
$db -> query ( "DELETE FROM record_owners WHERE id='" . $_GET [ "delid" ] . "'" );
+ − 7
}
+ − 8
+ − 9
$xsid = ( isset ( $_GET [ 'id' ])) ? $_GET [ 'id' ] : $_POST [ 'recordid' ];
+ − 10
+ − 11
if ( ! xs ( recid_to_domid ( $xsid )))
+ − 12
{
+ − 13
error ( ERR_RECORD_ACCESS_DENIED );
+ − 14
}
+ − 15
+ − 16
if ( $_POST [ "commit" ])
+ − 17
{
+ − 18
edit_record ( $_POST [ "recordid" ], $_POST [ "domainid" ], $_POST [ "name" ], $_POST [ "type" ], $_POST [ "content" ], $_POST [ "ttl" ], $_POST [ "prio" ]);
+ − 19
clean_page ( "edit.php?id=" . $_POST [ "domainid" ]);
+ − 20
} elseif ( $_SESSION [ "partial_" . get_domain_name_from_id ( $_GET [ "domain" ])] == 1 )
+ − 21
{
+ − 22
$checkPartial = $db -> getOne ( "SELECT id FROM record_owners WHERE record_id='" . $_GET [ "id" ] . "' AND user_id='" . $_SESSION [ "userid" ] . "' LIMIT 1" );
+ − 23
if ( empty ( $checkPartial )) {
+ − 24
error ( ERR_RECORD_ACCESS_DENIED );
+ − 25
}
+ − 26
}
13
+ − 27
include_once ( "inc/header.inc.php" );
+ − 28
?>
+ − 29
<h2> <? echo _ ( 'Edit record in zone' ); ?> "<? echo get_domain_name_from_id ( $_GET [ "domain" ]) ?> "</h2>
+ − 30
<?
1
+ − 31
13
+ − 32
$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" );
+ − 33
if ( level ( 10 ) && ( $x_result -> numRows () > 0 ))
+ − 34
{
+ − 35
?>
+ − 36
<div id= "meta" >
+ − 37
<div id= "meta-left" >
+ − 38
<table>
+ − 39
<tr>
+ − 40
<th> <? echo _ ( 'Sub-owners' ); ?> </td>
+ − 41
<th> </td>
+ − 42
</tr>
+ − 43
<?
+ − 44
while ( $x_r = $x_result -> fetchRow ())
+ − 45
{
1
+ − 46
?>
13
+ − 47
<tr>
+ − 48
<td class= "tdbg" > <? echo $x_r [ "fullname" ]; ?> </td>
+ − 49
<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>
+ − 50
</tr>
+ − 51
<?
+ − 52
}
+ − 53
?>
+ − 54
</table>
+ − 55
</div>
+ − 56
</div>
+ − 57
<?
+ − 58
}
+ − 59
?>
+ − 60
<form method= "post" action= "edit_record.php" >
+ − 61
<input type= "hidden" name= "recordid" value= " <? echo $_GET [ "id" ] ?> " >
+ − 62
<input type= "hidden" name= "domainid" value= " <? echo $_GET [ "domain" ] ?> " >
+ − 63
<table>
+ − 64
<tr>
+ − 65
<th> <? echo _ ( 'Name' ); ?> </td>
+ − 66
<th> </td>
+ − 67
<th> <? echo _ ( 'Type' ); ?> </td>
+ − 68
<th> <? echo _ ( 'Priority' ); ?> </td>
+ − 69
<th> <? echo _ ( 'Content' ); ?> </td>
+ − 70
<th> <? echo _ ( 'TTL' ); ?> </td>
+ − 71
</tr>
1
+ − 72
<?
+ − 73
$rec = get_record_from_id ( $_GET [ "id" ]);
+ − 74
?>
13
+ − 75
<tr>
+ − 76
<td>
+ − 77
<?
+ − 78
if ( $_SESSION [ $_GET [ "domain" ] . "_ispartial" ] == 1 )
+ − 79
{
+ − 80
?>
+ − 81
<input type= "hidden" name= "name" value= " <? echo trim ( str_replace ( get_domain_name_from_id ( $_GET [ "domain" ]), '' , $rec [ "name" ]), '.' ) ?> " class= "input" >
1
+ − 82
13
+ − 83
<? echo trim ( str_replace ( get_domain_name_from_id ( $_GET [ "domain" ]), '' , $rec [ "name" ]), '.' ) ?>
+ − 84
<?
+ − 85
}
+ − 86
else
+ − 87
{
+ − 88
?>
+ − 89
<input type= "text" name= "name" value= " <? echo trim ( str_replace ( get_domain_name_from_id ( $_GET [ "domain" ]), '' , $rec [ "name" ]), '.' ) ?> " class= "input" >
+ − 90
<?
+ − 91
}
+ − 92
?>
+ − 93
.<? echo get_domain_name_from_id ( $_GET [ "domain" ]) ?>
+ − 94
</td>
+ − 95
<td class= "n" > IN</td>
+ − 96
<td>
+ − 97
<select name= "type" >
1
+ − 98
<?
+ − 99
foreach ( get_record_types () as $c )
+ − 100
{
+ − 101
if ( $c == $rec [ "type" ])
+ − 102
{
+ − 103
$add = " SELECTED" ;
+ − 104
}
+ − 105
else
+ − 106
{
+ − 107
$add = "" ;
+ − 108
}
+ − 109
?>
13
+ − 110
<option <? echo $add ?> value= " <? echo $c ?> " > <? echo $c ?> </option> <?
1
+ − 111
}
+ − 112
+ − 113
?>
13
+ − 114
</select>
+ − 115
</td>
+ − 116
<td><input type= "text" name= "prio" value= " <? echo $rec [ "prio" ] ?> " class= "sinput" ></td>
+ − 117
<td><input type= "text" name= "content" value= " <? echo $rec [ "content" ] ?> " class= "input" ></td>
+ − 118
<td><input type= "text" name= "ttl" value= " <? echo $rec [ "ttl" ] ?> " class= "sinput" ></td>
+ − 119
</tr>
+ − 120
</table>
+ − 121
<p>
+ − 122
<input type= "submit" name= "commit" value= " <? echo _ ( 'Commit changes' ); ?> " class= "button" >
+ − 123
<input type= "reset" name= "reset" value= " <? echo _ ( 'Reset changes' ); ?> " class= "button" >
+ − 124
</p>
+ − 125
</form>
1
+ − 126
<?
13
+ − 127
include_once ( "inc/footer.inc.php" );
1
+ − 128
?>