96649f21ba18d07757afa9d98998f7a22c0d86a3
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

16) 
17) require_once('inc/base.php');
18) require_once('inc/security.php');
19) 
20) require_once('class/domain.php');
21) 
bernd Erlaube *useraccounts* das...

bernd authored 14 years ago

22) require_role(ROLE_SYSTEMUSER);
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

23) 
24) require_once('dnsinclude.php');
25) 
26) $section = 'dns_dns';
27) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

28) $data = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

29) $type = null;
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

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

bernd authored 15 years ago

31) $dyndns = false;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

32) $dyndns_accounts = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

33) foreach (get_dyndns_accounts() as $t) {
34)     $dyndns_accounts[$t['id']] = $t['handle'];
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

35) }
36) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

37) if (isset($_REQUEST['type']) && $_REQUEST['type'] == "dyndns") {
38)     $_REQUEST['type'] = 'a';
39)     $dyndns = true;
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

40) }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

41) if (isset($_REQUEST['type']) && $_REQUEST['type'] == "dyndns_aaaa") {
42)     $_REQUEST['type'] = 'aaaa';
43)     $dyndns = true;
Bernd Wurst IPv6-support für DynDNS

Bernd Wurst authored 6 years ago

44) }
45) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

46) 
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

47) $new = false;
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

48) if ($_REQUEST['id'] == 'new') {
49)     $new = true;
50)     $data = blank_dns_record($_REQUEST['type']);
51)     $domain = new Domain((int) $_REQUEST['domain']);
52)     $domain->ensure_userdomain();
53)     $type = $_REQUEST['type'];
54)     if (! in_array($type, $valid_record_types)) {
55)         system_failure('Ungültiger Record-Typ!');
56)     }
57)     $data['domain'] = $domain->id;
58)     if ($dyndns) {
59)         $data['ttl'] = 120;
60)     }
61) }
62) 
63) if (! $new) {
64)     $data = get_dns_record($_REQUEST['id']);
65)     $type = $data['type'];
66)     $dyndns = isset($data['dyndns']);
67)     $domain = new Domain((int) $data['domain']);
68)     $domain->ensure_userdomain();
69)     if (! in_array($type, $valid_record_types)) {
70)         system_failure('Ungültiger Record-Typ!');
71)     }
72) }
73) 
74) 
75) if ($new) {
76)     title('DNS-Record erstellen');
77) } else {
78)     title('DNS-Record bearbeiten');
79) }
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

80) 
Bernd Wurst Text für Autorecords geände...

Bernd Wurst authored 6 years ago

81) if (strtoupper($type) == 'NS') {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

82)     output('<p style="border: 2px solid red; padding: 1em; padding-left: 4em;"><img src="'.$prefix.'images/warning.png" style="margin-left: -3em; float: left;" /><strong>Bitte beachten Sie:</strong> Das Ändern der DNS-Server für die Stammdomain wird nicht funktionieren. Bitte geben Sie unbedingt einen Hostname ein um eine Subdomain auf einen anderen DNS-Server zu delegieren.</p>');
Bernd Wurst Text für Autorecords geände...

Bernd Wurst authored 6 years ago

83) }
84) 
Bernd Wurst Warnung, wenn man bei einer...

Bernd Wurst authored 12 years ago

85) if (strtoupper($type) == 'MX' && domain_is_maildomain($domain->id)) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

86)     output('<p style="border: 2px solid red; padding: 1em; padding-left: 4em;"><img src="'.$prefix.'images/warning.png" style="margin-left: -3em; float: left;" /><strong>Bitte beachten Sie:</strong> Wenn Sie die Mail-Verarbeitung auf Servern von '.$config['company_name'].' nicht nutzen möchten, sollten Sie <a href="'.$prefix.'go/email/domains">die lokale Mail-Verarbeitung für diese Domain ausschalten</a>.</p>');
Bernd Wurst Warnung, wenn man bei einer...

Bernd Wurst authored 12 years ago

87) }
88) 
bernd Diverse XML-Fehler behoben

bernd authored 14 years ago

89) output('<p style="border: 2px solid red; padding: 1em; padding-left: 4em;"><img src="'.$prefix.'images/warning.png" style="margin-left: -3em; float: left;" /><strong>Bitte beachten Sie:</strong> Um Ihnen auch ungewöhniche Konstellationen zu ermöglichen, erlaubt dieses Webinterface sehr großzügige Eintragungen, die eventuell nicht plausibel sind oder vom DNS-Server gar nicht so verstanden werden können. Wir können sicherheitskritische Einträge herausfiltern, jedoch nicht logische Fehler automatisch erkennen. Im Fehlerfall wird meistens Ihre gesamte Domain vom DNS-Server ausgeschlossen, so lange sich Fehler in der Konfiguration befinden. Sollten Sie hier also fehlerhafte Eintragungen machen, kann dies die Erreichbarkeit der betreffenden Domain im Ganzen stören.</p>');
bernd Prüfe, ob Domain wirklich d...

bernd authored 15 years ago

90) 
91) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

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

bernd authored 16 years ago

93) 
94) $submit = 'Speichern';
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

95) if ($new) {
96)     $submit = 'Anlegen';
97) }
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

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

bernd authored 15 years ago

99) $form = '';
100) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

101) if (! $dyndns && ($type == 'a' || $type == 'aaaa')) {
102)     $form .= '
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

103) <tr><td><label for="ip">IP-Adresse:</label></td><td><input type="text" name="ip" id="ip" value="'.$data['ip'].'" /></td></tr>
104) ';
105) }
106) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

107) if ($type == 'ns') {
108)     $form .= '
bernd Autodns ein- und ausschaltb...

bernd authored 15 years ago

109) <tr><td><label for="data">DNS-Server:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
110) ';
111) }
112) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

113) if ($type == 'ptr' || $type == 'cname') {
114)     $form .= '
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

115) <tr><td><label for="data">Ziel:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
bernd SPF und TXT records

bernd authored 15 years ago

116) ';
117) }
118) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

119) if ($type == 'spf' || $type == 'txt') {
120)     $form .= '
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

121) <tr><td><label for="data">Inhalt:</label></td><td><input type="text" name="data" id="data" value="'.filter_output_html($data['data']).'" /></td></tr>
bernd SSHFP-Records (Thanks to Ma...

bernd authored 13 years ago

122) ';
123) }
124) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

125) if ($type == 'sshfp') {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

126)     $algs = [
Hanno Böck add ecdsa and ed25519 suppo...

Hanno Böck authored 10 years ago

127)     1 => "RSA",
128)     2 => "DSA",
129)     3 => "ECDSA",
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

130)     4 => "ED25519", ];
Hanno Böck add ecdsa and ed25519 suppo...

Hanno Böck authored 10 years ago

131) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

132)     $option="";
133)     foreach ($algs as $key => $alg) {
134)         $option .= '<option value="'.$key.'" ';
135)         if ($key == $data['spec']) {
136)             $option .= 'selected="selected"';
137)         }
138)         $option .= '>'.$alg.' ('.$key.')</option>';
139)     }
Hanno Böck add caa support

Hanno Böck authored 7 years ago

140) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

141)     $form .= '
Hanno Böck add ecdsa and ed25519 suppo...

Hanno Böck authored 10 years ago

142) <tr><td><label for="spec">Algorithmus:</label></td><td><select name="spec" id="spec">'.$option.'</select></td></tr>
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

143) <tr><td><label for="data">Fingerabdruck:</label></td><td><input type="text" name="data" id="data" value="'.filter_output_html($data['data']).'" /></td></tr>
Hanno Böck add caa support

Hanno Böck authored 7 years ago

144) ';
145) }
146) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

147) if ($type == 'caa') {
148)     $option="";
149)     foreach ($caa_properties as $key => $property) {
150)         $option .= '<option value="'.$key.'" ';
151)         if ($key == $data['spec']) {
152)             $option .= 'selected="selected"';
153)         }
154)         $option .= '>'.$property.' ('.$key.')</option>';
155)     }
156)     $form .= '
Hanno Böck add caa support

Hanno Böck authored 7 years ago

157) <tr><td><label for="spec">Property tag:</label></td><td><select name="spec" id="spec">'.$option.'</select></td></tr>
158) <tr><td><label for="data">Inhalt:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

159) ';
160) }
161) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

162) if ($dyndns) {
163)     $form .= '
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

164) <tr><td><label for="dyndns">DynDNS-Zugang:</label></td><td>'.html_select('dyndns', $dyndns_accounts, $data['dyndns']).'</td></tr>
165) ';
166) }
167) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

168) if ($type == 'mx') {
169)     $form .= '
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

170) <tr><td><label for="spec">Priorität:</label></td><td><input type="text" name="spec" id="spec" value="'.$data['spec'].'" /></td></tr>
171) <tr><td><label for="data">Posteingangsserver:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
172) ';
173) }
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

174) 
175) 
Bernd Wurst added support for SRV recor...

Bernd Wurst authored 4 years ago

176) if ($type == 'srv') {
177)     $form .= '
178) <tr><td><label for="spec">Priorität:</label></td><td><input type="text" name="spec" id="spec" value="'.$data['spec'].'" /></td></tr>
179) <tr><td><label for="data">Ziel (Server:Port):</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
180) ';
181) }
182) 
183) 
bernd DNs-record-Interface ist je...

bernd authored 15 years ago

184) output(html_form('dns_record_edit', 'dns_record_save', "type={$type}&domain={$domain->id}&id={$_REQUEST['id']}", '<table>
185) <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>
186) '.$form.'
187) <tr><td><label for="ttl">TTL:</label></td><td><input type="text" name="ttl" id="ttl" value="'.$data['ttl'].'" /></td></tr>
188) </table>
bernd git-svn-id: https://svn.sch...

bernd authored 16 years ago

189) <p><input type="submit" value="'.$submit.'" /></p>