1
+ − 1
<?php
+ − 2
+ − 3
require_once ( "inc/toolkit.inc.php" );
+ − 4
+ − 5
// Assigning records to user: Check for records owned by user
+ − 6
+ − 7
if ( isset ( $_POST [ "action" ]) && $_POST [ "action" ] == "record-user" ) {
13
+ − 8
foreach ( $_POST [ "rowid" ] as $x_user => $x_value ){
+ − 9
$x_userid = $db -> queryOne ( "SELECT id FROM record_owners WHERE user_id = '" . $_POST [ "userid" ] . "' AND record_id='" . $x_value . "'" );
+ − 10
if ( empty ( $x_userid )) {
+ − 11
$db -> query ( "INSERT INTO record_owners SET user_id = '" . $_POST [ "userid" ] . "',record_id='" . $x_value . "'" );
+ − 12
}
+ − 13
}
1
+ − 14
}
13
+ − 15
if ( isset ( $_POST [ 'change_slave_master' ]) && is_numeric ( $_POST [ "domain" ]) && level ( 5 ))
+ − 16
{
+ − 17
change_domain_slave_master ( $_POST [ 'domain' ], $_POST [ 'slave_master' ]);
+ − 18
}
1
+ − 19
if ( isset ( $_POST [ 'type_change' ]) && in_array ( $_POST [ 'newtype' ], $server_types ))
+ − 20
{
13
+ − 21
change_domain_type ( $_POST [ 'newtype' ], $_GET [ 'id' ]);
1
+ − 22
}
+ − 23
if ( isset ( $_POST [ "newowner" ]) && is_numeric ( $_POST [ "domain" ]) && is_numeric ( $_POST [ "newowner" ]))
+ − 24
{
+ − 25
add_owner ( $_POST [ "domain" ], $_POST [ "newowner" ]);
+ − 26
}
+ − 27
if ( isset ( $_POST [ "del_user" ]) && is_numeric ( $_POST [ "del_user" ]) && level ( 5 ))
+ − 28
{
+ − 29
delete_owner ( $_GET [ "id" ], $_POST [ "del_user" ]);
+ − 30
}
13
+ − 31
$info = get_domain_info_from_id ( $_GET [ "id" ]);
1
+ − 32
include_once ( "inc/header.inc.php" );
13
+ − 33
+ − 34
if ( level ( 5 ))
+ − 35
{
+ − 36
if ( ! isset ( $info [ "ownerid" ]))
+ − 37
{
+ − 38
?>
+ − 39
<div class="error"> <? echo _ ( 'Error' ); ?> : <? echo ( 'There is no owner for this zone, please assign someone.' ); ?> </div>
+ − 40
<?
+ − 41
}
+ − 42
$domain_type = get_domain_type ( $_GET [ 'id' ]);
+ − 43
if ( $domain_type == "SLAVE" )
+ − 44
{
+ − 45
$slave_master = get_domain_slave_master ( $_GET [ 'id' ]);
+ − 46
if ( $slave_master == "" )
+ − 47
{
1
+ − 48
?>
13
+ − 49
<div class="error"> <? echo _ ( 'Type of this zone is "slave", but there is no IP address for it\'s master given.' ); ?> </div>
+ − 50
<?
+ − 51
}
+ − 52
}
+ − 53
}
+ − 54
+ − 55
?>
+ − 56
<h2> <? echo _ ( 'Edit zone' ); ?> " <? echo get_domain_name_from_id ( $_GET [ "id" ]) ?> "</h2>
+ − 57
<?
+ − 58
+ − 59
if ( level ( 5 ))
+ − 60
{ ?>
+ − 61
<div id="meta">
+ − 62
<div id="meta-left">
+ − 63
<table>
+ − 64
<tr>
+ − 65
<th colspan="2"> <? echo _ ( 'Owner of zone' ); ?> </th>
+ − 66
</tr>
+ − 67
<?
+ − 68
if ( isset ( $info [ "ownerid" ]))
+ − 69
{
+ − 70
$userRes = get_users_from_domain_id ( $_GET [ "id" ]);
+ − 71
foreach ( $userRes as $user )
+ − 72
{ ?>
+ − 73
<tr>
+ − 74
<form method="post" action="edit.php?id= <? echo $_GET [ 'id' ] ?> ">
+ − 75
<td>
+ − 76
<? echo $user [ "fullname" ] ?>
+ − 77
</td>
+ − 78
<td>
+ − 79
<input type="hidden" name="del_user" value=" <? echo $user [ "id" ] ?> ">
+ − 80
<input type="submit" class="sbutton" name="co" value=" <? echo _ ( 'Delete' ); ?> ">
+ − 81
</td>
+ − 82
</form>
+ − 83
</tr>
+ − 84
<?
+ − 85
}
+ − 86
}
+ − 87
else
+ − 88
{
+ − 89
?>
+ − 90
<tr>
+ − 91
<td> <? echo _ ( 'No owner set or this zone!' ); ?> </td>
+ − 92
</tr>
1
+ − 93
<?
13
+ − 94
}
+ − 95
}
+ − 96
?>
+ − 97
<tr>
+ − 98
<form method="post" action="edit.php?id= <? echo $_GET [ 'id' ] ?> ">
+ − 99
<td>
+ − 100
<input type="hidden" name="domain" value=" <? echo $_GET [ "id" ] ?> ">
+ − 101
<select name="newowner">
+ − 102
<?
+ − 103
$users = show_users ();
+ − 104
foreach ( $users as $u )
+ − 105
{
+ − 106
unset ( $add );
+ − 107
if ( $u [ "id" ] == $info [ "ownerid" ])
+ − 108
{
+ − 109
$add = " SELECTED" ;
+ − 110
}
+ − 111
?>
+ − 112
<option <? echo $add ?> value=" <? echo $u [ "id" ] ?> "> <? echo $u [ "fullname" ] ?> </option> <?
+ − 113
}
+ − 114
?>
+ − 115
</select>
+ − 116
</td>
+ − 117
<td>
+ − 118
<input type="submit" class="sbutton" name="co" value=" <? echo _ ( 'Add' ); ?> ">
+ − 119
</td>
+ − 120
</form>
+ − 121
</tr>
+ − 122
</table>
+ − 123
</div> <? // eo div meta-left ?>
+ − 124
+ − 125
<?
+ − 126
if ( level ( 5 ))
1
+ − 127
{
13
+ − 128
$domain_type = get_domain_type ( $_GET [ 'id' ]);
+ − 129
?>
+ − 130
<div id="meta-right">
+ − 131
<table>
+ − 132
<tr>
+ − 133
<th colspan="2"> <? echo _ ( 'Type of zone' ); ?> </th>
+ − 134
</tr>
+ − 135
<form action=" <? echo $_SERVER [ 'PHP_SELF' ] ?> ?id= <? echo $_GET [ 'id' ] ?> " method="post">
+ − 136
<input type="hidden" name="domain" value=" <? echo $_GET [ "id" ] ?> ">
+ − 137
<tr>
+ − 138
<td>
+ − 139
<select name="newtype">
+ − 140
<?
+ − 141
foreach ( $server_types as $s )
+ − 142
{
+ − 143
unset ( $add );
+ − 144
if ( $s == $domain_type )
+ − 145
{
+ − 146
$add = " SELECTED" ;
+ − 147
}
+ − 148
?>
+ − 149
<option <? echo $add ?> value=" <? echo $s ?> "> <? echo $s ?> </option> <?
+ − 150
}
+ − 151
?>
+ − 152
</select>
+ − 153
</td>
+ − 154
<td>
+ − 155
<input type="submit" class="sbutton" name="type_change" value=" <? echo _ ( 'Change' ); ?> ">
+ − 156
</td>
+ − 157
</tr>
+ − 158
</form>
+ − 159
+ − 160
<?
+ − 161
if ( $domain_type == "SLAVE" )
+ − 162
{
+ − 163
$slave_master = get_domain_slave_master ( $_GET [ 'id' ]);
+ − 164
?>
+ − 165
<tr>
+ − 166
<th colspan="2">
+ − 167
<? echo _ ( 'IP address of master NS' ); ?>
+ − 168
</th>
+ − 169
</tr>
+ − 170
<form action=" <? echo $_SERVER [ 'PHP_SELF' ] ?> ?&id= <? echo $_GET [ 'id' ] ?> " method="post">
+ − 171
<input type="hidden" name="domain" value=" <? echo $_GET [ "id" ] ?> ">
+ − 172
<tr>
+ − 173
<td>
+ − 174
<input type="text" name="slave_master" value=" <? echo $slave_master ; ?> " class="input">
+ − 175
</td>
+ − 176
<td>
+ − 177
<input type="submit" class="sbutton" name="change_slave_master" value=" <? echo _ ( 'Change' ); ?> ">
+ − 178
</td>
+ − 179
</tr>
+ − 180
</form>
+ − 181
<?
+ − 182
}
1
+ − 183
}
+ − 184
?>
13
+ − 185
</table>
+ − 186
</div> <? // eo div meta-right ?>
+ − 187
</ div > <? // eo div meta ?>
+ − 188
< div id = "meta" >
+ − 189
<?
+ − 190
if ( $_SESSION [ $_GET [ "id" ] . "_ispartial" ] != 1 && $domain_type != "SLAVE" )
+ − 191
{
1
+ − 192
?>
13
+ − 193
<input type="button" class="button" OnClick="location.href='add_record.php?id= <? echo $_GET [ "id" ] ?> '" value=" <? echo _ ( 'Add record' ); ?> ">
+ − 194
<?
+ − 195
}
+ − 196
if ( level ( 5 ))
+ − 197
{
+ − 198
?>
+ − 199
<input type="button" class="button" OnClick="location.href='delete_domain.php?id= <? echo $_GET [ "id" ] ?> '" value=" <? echo _ ( 'Delete zone' ); ?> ">
+ − 200
<?
+ − 201
}
+ − 202
?>
+ − 203
</div> <? // eo div meta ?>
+ − 204
< div class = "showmax" >
1
+ − 205
<?
+ − 206
show_pages ( $info [ "numrec" ], ROWAMOUNT , $_GET [ "id" ]);
+ − 207
?>
13
+ − 208
</div> <? // eo div showmax ?>
+ − 209
< form action = "<? echo $_SERVER["PHP_SELF"] ?>?id=<? echo $_GET["id"] ?>" method = "post" >
+ − 210
< input type = "hidden" name = "action" value = "record-user" >
+ − 211
< table >
1
+ − 212
<?
+ − 213
$countinput = 0 ;
+ − 214
$rec_result = get_records_from_domain_id ( $_GET [ "id" ], ROWSTART , ROWAMOUNT );
+ − 215
if ( $rec_result != - 1 )
+ − 216
{
13
+ − 217
?>
+ − 218
<tr>
+ − 219
<th> </th>
+ − 220
<?
+ − 221
if ( level ( 10 ) && $domain_type != "SLAVE" )
+ − 222
{
+ − 223
echo "<th class= \" n \" >" . _ ( 'Sub-owners' ) . "</td>" ;
+ − 224
}
+ − 225
?>
+ − 226
<th> <? echo _ ( 'Name' ); ?> </th>
+ − 227
<th> <? echo _ ( 'Type' ); ?> </th>
+ − 228
<th> <? echo _ ( 'Content' ); ?> </th>
+ − 229
<th> <? echo _ ( 'Priority' ); ?> </th>
+ − 230
<th> <? echo _ ( 'TTL' ); ?> </th>
+ − 231
</tr>
+ − 232
<?
+ − 233
$recs = sort_zone ( $rec_result );
+ − 234
foreach ( $recs as $r )
+ − 235
{
+ − 236
?>
+ − 237
<tr>
+ − 238
<td class="n">
+ − 239
<?
+ − 240
if ( $domain_type != "SLAVE" )
+ − 241
{
+ − 242
if ( level ( 5 ) || ( ! ( $r [ "type" ] == "SOA" && ! $GLOBALS [ "ALLOW_SOA_EDIT" ]) && ! ( $r [ "type" ] == "NS" && ! $GLOBALS [ "ALLOW_NS_EDIT" ])))
+ − 243
{
+ − 244
?>
+ − 245
<a href="edit_record.php?id= <? echo $r [ 'id' ] ?> &domain= <? echo $_GET [ "id" ] ?> "><img src="images/edit.gif" alt="[ <? echo _ ( 'Edit record' ); ?> ]"></a>
+ − 246
<a href="delete_record.php?id= <? echo $r [ 'id' ] ?> &domain= <? echo $_GET [ "id" ] ?> "><img src="images/delete.gif" ALT="[ <? echo _ ( 'Delete record' ); ?> ]" BORDER="0"></a>
1
+ − 247
<?
13
+ − 248
}
+ − 249
}
+ − 250
if ( level ( 10 ) && $domain_type != "SLAVE" )
+ − 251
{
+ − 252
?>
+ − 253
<input type="checkbox" name="rowid[ <? echo $countinput ++ ?> ]" value=" <? echo $r [ 'id' ] ?> " />
+ − 254
<?
+ − 255
}
+ − 256
?>
+ − 257
</td>
+ − 258
<?
+ − 259
if ( level ( 10 ) && $domain_type != "SLAVE" )
+ − 260
{
1
+ − 261
?>
13
+ − 262
<td class="n">
+ − 263
<?
+ − 264
$x_result = $db -> query ( "SELECT r.user_id,u.username,u.fullname FROM record_owners as r, users as u WHERE r.record_id='" . $r [ 'id' ] . "' AND u.id=r.user_id" );
+ − 265
echo "<select style= \" width:120px; \" >" ;
+ − 266
while ( $x_r = $x_result -> fetchRow ()) {
+ − 267
echo "<option value= \" " . $x_r [ "username" ] . " \" >" . $x_r [ "fullname" ] . "</option>" ;
+ − 268
}
+ − 269
echo "</select>" ;
+ − 270
?>
+ − 271
</td>
+ − 272
<?
+ − 273
}
+ − 274
?>
+ − 275
<td class="y"> <? echo $r [ 'name' ] ?> </td>
+ − 276
<td class="y"> <? echo $r [ 'type' ] ?> </td>
+ − 277
<td class="y"> <? echo $r [ 'content' ] ?> </td>
+ − 278
<?
+ − 279
if ( $r [ 'prio' ] != 0 )
+ − 280
{
+ − 281
?>
+ − 282
<td class="y"> <? echo $r [ 'prio' ]; ?> </td>
+ − 283
<?
+ − 284
} else {
+ − 285
?>
+ − 286
<td class="n"></td> <?
+ − 287
}
+ − 288
?>
+ − 289
<td class="y"> <? echo $r [ 'ttl' ] ?> </td>
+ − 290
</tr>
+ − 291
<?
1
+ − 292
}
+ − 293
}
+ − 294
else
+ − 295
{
+ − 296
?>
13
+ − 297
<tr>
+ − 298
<td class="n">
+ − 299
<div class="warning"> <? echo _ ( 'No records for this zone.' ); ?> </div>
+ − 300
</td>
+ − 301
</tr>
1
+ − 302
<?
+ − 303
}
+ − 304
?>
13
+ − 305
</table>
1
+ − 306
13
+ − 307
<?
+ − 308
if ( $domain_type != "SLAVE" )
+ − 309
{
+ − 310
if ( level ( 10 )) { ?>
+ − 311
<img src="images/arrow.png" alt="arrow" class="edit-assign-to-user">
+ − 312
<select name="userid">
+ − 313
<?
+ − 314
$users = show_users ();
+ − 315
foreach ( $users as $user ) {
+ − 316
echo "<option value= \" " . $user [ id ] . " \" >" . $user [ fullname ] . "</option>" ;
+ − 317
}
+ − 318
?>
+ − 319
</select>
+ − 320
<input type="submit" class="button" value=" <? echo _ ( 'Assign to user' ); ?> ">
+ − 321
</form>
+ − 322
<?
+ − 323
}
1
+ − 324
}
+ − 325
include_once ( "inc/footer.inc.php" );
+ − 326
?>