1
+ − 1
<?php
+ − 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
13
+ − 22
require_once ( "inc/toolkit.inc.php" );
1
+ − 23
37
+ − 24
$xsid = ( isset ( $_GET [ 'id' ])) ? $_GET [ 'id' ] : $_POST [ 'zoneid' ];
+ − 25
if (( ! level ( 5 )) && (( ! xs ( $xsid ) || ( $_SESSION [ $xsid . '_ispartial' ])))) {
+ − 26
error ( ERR_RECORD_ACCESS_DENIED );
+ − 27
}
+ − 28
79
+ − 29
if ( isset ( $_POST [ "commit" ]) && isset ( $_POST [ 'zoneid' ]) && isset ( $_POST [ 'name' ]) && isset ( $_POST [ 'type' ]) && isset ( $_POST [ 'content' ]) && isset ( $_POST [ 'ttl' ]) && isset ( $_POST [ 'prio' ]) ) {
1
+ − 30
$ret = add_record ( $_POST [ "zoneid" ], $_POST [ "name" ], $_POST [ "type" ], $_POST [ "content" ], $_POST [ "ttl" ], $_POST [ "prio" ]);
+ − 31
if ( $ret != '1' ) {
+ − 32
die ( " $ret " );
+ − 33
}
+ − 34
clean_page ( "edit.php?id=" . $_POST [ "zoneid" ]);
+ − 35
}
13
+ − 36
1
+ − 37
include_once ( "inc/header.inc.php" );
+ − 38
?>
13
+ − 39
71
+ − 40
<h2> <?php echo _ ( 'Add record to zone' ); ?> " <?php echo get_domain_name_from_id ( $_GET [ "id" ]) ?> "</H2>
1
+ − 41
13
+ − 42
<form method="post">
71
+ − 43
<input type="hidden" name="zoneid" value=" <?php echo $_GET [ "id" ] ?> ">
13
+ − 44
<table border="0" cellspacing="4">
+ − 45
<tr>
71
+ − 46
<td class="n"> <?php echo _ ( 'Name' ); ?> </td>
13
+ − 47
<td class="n"> </td>
71
+ − 48
<td class="n"> <?php echo _ ( 'Type' ); ?> </td>
+ − 49
<td class="n"> <?php echo _ ( 'Priority' ); ?> </td>
+ − 50
<td class="n"> <?php echo _ ( 'Content' ); ?> </td>
+ − 51
<td class="n"> <?php echo _ ( 'TTL' ); ?> </td>
13
+ − 52
</tr>
+ − 53
<tr>
71
+ − 54
<td class="n"><input type="text" name="name" class="input">. <?php echo get_domain_name_from_id ( $_GET [ "id" ]) ?> </td>
13
+ − 55
<td class="n">IN</td>
+ − 56
<td class="n">
+ − 57
<select name="type">
71
+ − 58
<?php
1
+ − 59
$dname = get_domain_name_from_id ( $_GET [ "id" ]);
+ − 60
foreach ( get_record_types () as $c ) {
+ − 61
if ( eregi ( 'in-addr.arpa' , $dname ) && strtoupper ( $c ) == 'PTR' ) {
+ − 62
$add = " SELECTED" ;
+ − 63
} elseif ( strtoupper ( $c ) == 'A' ) {
+ − 64
$add = " SELECTED" ;
+ − 65
} else {
79
+ − 66
$add = '' ;
1
+ − 67
}
71
+ − 68
?> <option <?php echo $add ?> value=" <?php echo $c ?> "> <?php echo $c ?> </option> <?php
1
+ − 69
}
13
+ − 70
?>
+ − 71
</select>
+ − 72
</td>
+ − 73
<td class="n"><input type="text" name="prio" class="sinput"></td>
+ − 74
<td class="n"><input type="text" name="content" class="input"></td>
71
+ − 75
<td class="n"><input type="text" name="ttl" class="sinput" value=" <?php echo $DEFAULT_TTL ?> "></td>
13
+ − 76
</tr>
+ − 77
</table>
+ − 78
<br>
71
+ − 79
<input type="submit" name="commit" value=" <?php echo _ ( 'Add record' ); ?> " class="button">
13
+ − 80
</form>
1
+ − 81
71
+ − 82
<?php include_once ( "inc/footer.inc.php" ); ?>