Browse code

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1136 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on13/08/2008 10:06:00
Showing2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,57 @@
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
+$domain = new Domain((int) $_REQUEST['dom']);
15
+
16
+DEBUG($domain);
17
+
18
+$output .= '<h3>DNS-Records für <em>'.filter_input_general($domain->fqdn).'</em></h3>';
19
+
20
+$records = get_domain_records($domain->id);
21
+$auto_records = get_domain_auto_records($domain->fqdn);
22
+
23
+$output .= '<table><tr><th>Hostname</th><th>Typ</th><th>IP-Adresse/Inhalt</th><th>TTL</th><th>&#160;</th></tr>
24
+';
25
+foreach ($records AS $rec)
26
+{
27
+  $data = ( $rec['ip'] ? $rec['ip'] : $rec['data'] );
28
+  if ($rec['dyndns'])
29
+    $data = internal_link('dyndns_edit', '<em>DynDNS #'.$rec['dyndns'].'</em>', 'id='.$rec['dyndns']);
30
+  $ttl = ($rec['ttl'] ? $rec['ttl'] : 3600);
31
+  $output .= "<tr><td>".internal_link('dns_record_edit', $rec['fqdn'], "id={$rec['id']}")."</td><td>".strtoupper($rec['type'])."</td><td>$data</td><td>{$ttl} Sek.</td><td>".internal_link('save', '<img src="'.$prefix.'images/delete.png" width="16" height="16" alt="löschen" title="Record löschen" />', "id={$rec['id']}&type=dns&action=delete")."</td></tr>\n";
32
+}  
33
+foreach ($auto_records AS $rec)
34
+{
35
+  $data = ( $rec['ip'] ? $rec['ip'] : $rec['data'] );
36
+  $ttl = ($rec['ttl'] ? $rec['ttl'] : 3600);
37
+  $output .= "<tr><td><em>{$rec['fqdn']}</td><td>".strtoupper($rec['type'])."</td><td>$data</td><td>{$ttl} Sek.</td><td>&#160;</td></tr>\n";
38
+  
39
+}
40
+
41
+
42
+$output .= '</table>';
43
+
44
+if ($domain->autodns)
45
+  $output .= '<p style="font-size: 80%;"><em>Kursive Hostnames bezeichnen automatisch erzeugte Records. Diese können nicht geändert werden.</em></p>';
46
+else
47
+  $output .= '<p style="font-size: 80%;"><em>Für diese Domain wurde die Erzeugung automatischer Records deaktiviert.</em></p>';
48
+
49
+
50
+$output .= html_form('dns_record_new', 'dns_record_edit', 'id=new&dom='.$domain->id, 
51
+'<h4>Neuen DNS-Record anlegen</h4>
52
+<p>
53
+<label for="type">Typ:</label>&#160;'.html_select('type', array('a' => 'A', 'aaaa' => 'AAAA', 'mx' => 'MX', 'ns' => 'NS', 'spf' => 'SPF', 'txt' => 'TXT', 'cname' => 'CNAME', 'ptr' => 'PTR', 'srv' => 'SRV', 'raw' => 'RAW'), 'a').'
54
+&#160;&#160;&#160;<input type="submit" value="Anlegen" />
55
+</p>');
56
+
57
+?>
0 58
new file mode 100644
... ...
@@ -0,0 +1,64 @@
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
+
17
+$new = false;
18
+if ($_REQUEST['id'] == 'new')
19
+{
20
+  $new = true;
21
+  $data = blank_dns_record($_REQUEST['type']);
22
+  $domain = new Domain((int) $_REQUEST['dom']);
23
+  $type = $_POST['type'];
24
+  if (! in_array($type, $valid_record_types))
25
+    system_failure('Ungültiger Record-Typ!');
26
+  $data['domain'] = $domain->id;
27
+}
28
+
29
+if (! $new)
30
+{
31
+  $data = get_dns_record($_REQUEST['id']);
32
+  $type = $data['type'];
33
+  if (! in_array($type, $valid_record_types))
34
+    system_failure('Ungültiger Record-Typ!');
35
+}
36
+
37
+
38
+
39
+
40
+if ($new)
41
+  $output .= '<h3>DNS-Record erstellen</h3>';
42
+else
43
+  $output .= '<h3>DNS-Record bearbeiten</h3>';
44
+
45
+
46
+$action = 'create';
47
+if (! $new)
48
+  $action = 'edit&id='.(int)$_REQUEST['id'];
49
+  
50
+$submit = 'Speichern';
51
+if ($new) 
52
+  $submit = 'Anlegen';
53
+
54
+$domain = new Domain( (int) $data['domain'] );
55
+
56
+
57
+$output .= html_form('dns_record_edit', 'save', 'type=dns&action='.$action, 
58
+'<p>
59
+<label for="hostname">Hostname:</label>&#160;<input type="text" name="hostname" id="hostname" value="'.$data['hostname'].'" />&#160;<strong>.'.$domain->fqdn.'</strong><p>
60
+<p>Typ: 
61
+<p><input type="submit" value="'.$submit.'" /></p>
62
+</p>');
63
+
64
+?>