Browse code

IPv6-Regelbetrieb vorbereitet: * Warnung bzgl. Testbetrieb weg * IPv6-Adresse wird (nachdem die ID feststeht) angezeigt * IPv6 wird per Default eingeschaltet

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

bernd authored on 16/12/2010 15:40:55
Showing 2 changed files
... ...
@@ -273,10 +273,14 @@ $extended = '';
273 273
   }
274 274
 if ($have_v6) 
275 275
 {
276
+  $ipv6_address = '';
277
+  if ($vhost['id'] && ($vhost['autoipv6'] == 1))
278
+    $ipv6_address = '<strong>IPv6-Adresse dieser Subdomain:</strong> '.autoipv6_address($vhost['id']);
276 279
   $checked = ($vhost['autoipv6'] == 1) ? ' checked="checked"' : '';
277 280
   $extended .= '<h5>IPv6</h5>
278 281
 <div style="margin-left: 2em;">
279
-<input type="checkbox" name="ipv6" id="ipv6" value="yes" '.$checked.'/>&#160;<label for="ipv6">Auch über IPv6 erreichbar machen</label> (<strong>Achtung:</strong> Derzeit im Testbetrieb!)
282
+<input type="checkbox" name="ipv6" id="ipv6" value="yes" '.$checked.'/>&#160;<label for="ipv6">Auch über IPv6 erreichbar machen</label><br />
283
+'.$ipv6_address.'
280 284
 </div>';
281 285
 }
282 286
 if ($extended)
... ...
@@ -9,6 +9,21 @@ require_once('class/domain.php');
9 9
 require_once("certs.php");
10 10
 
11 11
 
12
+function autoipv6_address($vhost_id)
13
+{
14
+  $result = db_query("SELECT uid, v6_prefix FROM vhosts.v_vhost LEFT JOIN system.servers ON (servers.hostname = server) WHERE v_vhost.id={$vhost_id}");
15
+  $data = mysql_fetch_assoc($result);
16
+  if (!$data['v6_prefix'])
17
+  {
18
+    warning("IPv6-Adresse nicht verfügbar, Server unterstützt kein IPv6");
19
+    return "";
20
+  }
21
+  $vh = implode(':', str_split(sprintf("%08x", $vhost_id), 4));
22
+  $ipv6 = $data['v6_prefix'] . sprintf("%04s", $data['uid']) . ':' . $vh;
23
+  return $ipv6;
24
+}
25
+
26
+
12 27
 function list_vhosts()
13 28
 {
14 29
   $uid = (int) $_SESSION['userinfo']['uid'];
... ...
@@ -53,7 +68,7 @@ function empty_vhost()
53 68
   $vhost['cert'] = NULL;
54 69
   $vhost['certid'] = NULL;
55 70
   $vhost['ipv4'] = NULL;
56
-  $vhost['autoipv6'] = 0;
71
+  $vhost['autoipv6'] = 1;
57 72
 
58 73
   $vhost['options'] = '';
59 74
   $vhost['stats'] = NULL;