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

bernd authored on 05/02/2010 13:23:35
Showing 3 changed files
... ...
@@ -209,9 +209,7 @@ $form .= "
209 209
 $ipaddrs = user_ipaddrs();
210 210
 $certs = user_certs();
211 211
 
212
-if (count($ipaddrs) || count($certs))
213
-{
214
-  $form .= "
212
+$form .= "
215 213
 <h4 style=\"margin-top: 3em;\">Erweiterte Optionen</h4>
216 214
 <div style=\"margin-left: 2em;\">
217 215
 ";
... ...
@@ -241,8 +239,14 @@ if (count($ipaddrs) || count($certs))
241 239
       ".html_select('ipv4', $ipselect, $vhost['ipv4'])."
242 240
       </div>";
243 241
   } 
244
-  $form .= "</div>";
245
-}
242
+$checked = ($vhost['autoipv6'] == 1) ? ' checked="checked"' : '';
243
+$form .= '<h5>IPv6</h5>
244
+<div style="margin-left: 2em;">
245
+<input type="checkbox" name="ipv6" id="ipv6" value="yes" '.$checked.'/>&#160;<label for="ipv6">Auch ├╝ber IPv6 erreichbar machen</label>
246
+</div>';
247
+
248
+$form .= "</div>";
249
+
246 250
 
247 251
 
248 252
 
... ...
@@ -41,6 +41,7 @@ function empty_vhost()
41 41
   $vhost['cert'] = NULL;
42 42
   $vhost['certid'] = NULL;
43 43
   $vhost['ipv4'] = NULL;
44
+  $vhost['autoipv6'] = 0;
44 45
 
45 46
   $vhost['options'] = '';
46 47
   $vhost['stats'] = NULL;
... ...
@@ -231,15 +232,18 @@ function save_vhost($vhost)
231 232
   {
232 233
     $ipv4 = maybe_null($vhost['ipv4']);
233 234
   }
235
+
236
+  $autoipv6 = ( $vhost['autoipv6'] == 1) ? '1' : '0';
237
+
234 238
   $stats = maybe_null($vhost['stats']);
235 239
 
236 240
   if ($id != 0) {
237 241
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
238
-    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, `ssl`={$ssl}, logtype={$logtype}, errorlog={$errorlog}, certid={$cert}, ipv4={$ipv4}, options='{$options}', stats={$stats} WHERE id={$id} LIMIT 1");
242
+    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, `ssl`={$ssl}, logtype={$logtype}, errorlog={$errorlog}, certid={$cert}, ipv4={$ipv4}, autoipv6={$autoipv6}, options='{$options}', stats={$stats} WHERE id={$id} LIMIT 1");
239 243
   }
240 244
   else {
241 245
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].'');
242
-    $result = db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, errorlog, certid, ipv4, options, stats) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, {$errorlog}, {$cert}, {$ipv4}, '{$options}', {$stats})");
246
+    $result = db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, errorlog, certid, ipv4, autoipv6, options, stats) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, {$errorlog}, {$cert}, {$ipv4}, {$autoipv6}, '{$options}', {$stats})");
243 247
     $id = mysql_insert_id();
244 248
   }
245 249
   $oldvhost = get_vhost_details($id);
... ...
@@ -111,6 +111,13 @@ if ($_GET['action'] == 'edit')
111 111
 
112 112
   $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : NULL);
113 113
 
114
+  if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes')
115
+  {
116
+    $vhost['autoipv6'] = 1;
117
+  } else {
118
+    $vhost['autoipv6'] = 0;
119
+  }
120
+  
114 121
 
115 122
   $logtype = '';
116 123
   switch ($_POST['logtype']) {