Zusätzlicher Haken für eigene IPv6-Adresse
bernd

bernd commited on 2010-12-21 14:10:09
Zeige 3 geänderte Dateien mit 17 Einfügungen und 5 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1857 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -274,12 +274,14 @@ $extended = '';
274 274
 if ($have_v6) 
275 275
 {
276 276
   $ipv6_address = '';
277
-  if ($vhost['id'] && ($vhost['autoipv6'] == 1))
278
-    $ipv6_address = '<strong>IPv6-Adresse dieser Subdomain:</strong> '.autoipv6_address($vhost['id']);
279
-  $checked = ($vhost['autoipv6'] == 1) ? ' checked="checked"' : '';
277
+  if ($vhost['id'] && ($vhost['autoipv6'] >0 ))
278
+    $ipv6_address = '<strong>IPv6-Adresse dieser Subdomain:</strong> '.autoipv6_address($vhost['id'], $vhost['autoipv6']);
279
+  $checked = ($vhost['autoipv6'] > 0) ? ' checked="checked"' : '';
280
+  $checked2 = ($vhost['autoipv6'] == 2) ? ' checked="checked"' : '';
280 281
   $extended .= '<h5>IPv6</h5>
281 282
 <div style="margin-left: 2em;">
282 283
 <input type="checkbox" name="ipv6" id="ipv6" value="yes" '.$checked.'/>&#160;<label for="ipv6">Auch über IPv6 erreichbar machen</label><br />
284
+<input type="checkbox" name="ipv6_separate" id="ipv6_separate" value="yes" '.$checked2.'/>&#160;<label for="ipv6_separate">Für diese Website eine eigene IPv6-Adresse reservieren</label><br />
283 285
 '.$ipv6_address.'
284 286
 </div>';
285 287
 }
... ...
@@ -9,7 +9,7 @@ require_once('class/domain.php');
9 9
 require_once("certs.php");
10 10
 
11 11
 
12
-function autoipv6_address($vhost_id)
12
+function autoipv6_address($vhost_id, $mode = 1)
13 13
 {
14 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 15
   $data = mysql_fetch_assoc($result);
... ...
@@ -19,7 +19,10 @@ function autoipv6_address($vhost_id)
19 19
     return "";
20 20
   }
21 21
   list($prefix, $null) = explode('/', $data['v6_prefix']);
22
+  $vh = ':1';
23
+  if ($mode == 2) {
22 24
     $vh = implode(':', str_split(sprintf("%08x", $vhost_id), 4));
25
+  }
23 26
   $ipv6 = $prefix . sprintf("%04s", $data['uid']) . ':' . $vh;
24 27
   return $ipv6;
25 28
 }
... ...
@@ -269,7 +272,10 @@ function save_vhost($vhost)
269 272
     $ipv4 = maybe_null($vhost['ipv4']);
270 273
   }
271 274
 
272
-  $autoipv6 = ( $vhost['autoipv6'] == 1) ? '1' : '0';
275
+  $autoipv6 = 1;
276
+  if ($vhost['autoipv6'] == 0 ||  $vhost['autoipv6'] == 2) {
277
+    $autoipv6 = $vhost['autoipv6'];
278
+  }
273 279
 
274 280
   $stats = maybe_null($vhost['stats']);
275 281
 
... ...
@@ -122,6 +122,10 @@ if ($_GET['action'] == 'edit')
122 122
   if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes')
123 123
   {
124 124
     $vhost['autoipv6'] = 1;
125
+    if (isset($_POST['ipv6_separate']) && $_POST['ipv6_separate'] = 'yes')
126
+    {
127
+      $vhost['autoipv6'] = 2;
128
+    }
125 129
   } else {
126 130
     $vhost['autoipv6'] = 0;
127 131
   }
128 132