93c5af8fba0aacd276f3e3cf1a7ab3d0241bc7e4
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

1) <?php
2) 
3) require_once('inc/base.php');
4) require_once('inc/security.php');
5) 
6) require_once('class/domain.php');
7) 
8) require_role(ROLE_CUSTOMER);
9) 
10) require_once('dnsinclude.php');
11) 
12) $section = 'dns_dns';
13) 
14) $data = array();
15) $type = NULL;
16) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

17) $dyndns = false;
18) $dyndns_accounts = array();
19) foreach (get_dyndns_accounts() AS $t)
20) {
21)   $dyndns_accounts[$t['id']] = $t['handle'];
22) }
23) 
24) if ($_REQUEST['type'] == "dyndns")
25) {
26)   $_REQUEST['type'] = 'a';
27)   $dyndns = true;
28) }
29) 
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

30) $new = false;
31) if ($_REQUEST['id'] == 'new')
32) {
33)   $new = true;
34)   $data = blank_dns_record($_REQUEST['type']);
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

35)   $domain = new Domain((int) $_REQUEST['domain']);
36)   $type = $_REQUEST['type'];
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

37)   if (! in_array($type, $valid_record_types))
38)     system_failure('Ungültiger Record-Typ!');
39)   $data['domain'] = $domain->id;
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

40)   if ($dyndns)
41)     $data['ttl'] = 120;
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

42) }
43) 
44) if (! $new)
45) {
46)   $data = get_dns_record($_REQUEST['id']);
47)   $type = $data['type'];
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

48)   $dyndns = isset($data['dyndns']);
49)   $domain = new Domain((int) $data['domain']);
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

50)   if (! in_array($type, $valid_record_types))
51)     system_failure('Ungültiger Record-Typ!');
52) }
53) 
54) 
55) if ($new)
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

56)   output('<h3>DNS-Record erstellen</h3>');
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

57) else
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

58)   output('<h3>DNS-Record bearbeiten</h3>');
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

59) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

60) output('<p>Record-Typ: '.strtoupper($type).'</p>');
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

61) 
62) $submit = 'Speichern';
63) if ($new) 
64)   $submit = 'Anlegen';
65) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

66) $form = '';
67) 
68) if (! $dyndns && ($type == 'a' || $type == 'aaaa'))
69) {
70)   $form .= '
71) <tr><td><label for="ip">IP-Adresse:</label></td><td><input type="text" name="ip" id="ip" value="'.$data['ip'].'" /></td></tr>
72) ';
73) }
74) 
75) if ($type == 'ptr' || $type == 'cname')
76) {
77)   $form .= '
78) <tr><td><label for="data">Ziel:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
79) ';
80) }
81) 
82) if ($dyndns)
83) {
84)   $form .= '
85) <tr><td><label for="dyndns">DynDNS-Zugang:</label></td><td>'.html_select('dyndns', $dyndns_accounts, $data['dyndns']).'</td></tr>
86) ';
87) }
88) 
89) if ($type == 'mx')
90) {
91)   $form .= '
92) <tr><td><label for="spec">Priorität:</label></td><td><input type="text" name="spec" id="spec" value="'.$data['spec'].'" /></td></tr>
93) <tr><td><label for="data">Posteingangsserver:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
94) ';
95) }
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

96) 
97) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

98) output(html_form('dns_record_edit', 'dns_record_save', "type={$type}&domain={$domain->id}&id={$_REQUEST['id']}", '<table>
99) <tr><td><label for="hostname">Hostname:</label></td><td><input type="text" name="hostname" id="hostname" value="'.$data['hostname'].'" />&#160;<strong>.'.$domain->fqdn.'</strong></td></tr>
100) '.$form.'
101) <tr><td><label for="ttl">TTL:</label></td><td><input type="text" name="ttl" id="ttl" value="'.$data['ttl'].'" /></td></tr>
102) </table>
bernd git-svn-id: https://svn.sch...

bernd authored 15 years ago

103) <p><input type="submit" value="'.$submit.'" /></p>
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

104) </p>'));