IPv6-Option nur anzeigen wenn der betreffende Server auch IPv6 unterstützt
bernd

bernd commited on 2010-10-06 08:40:43
Zeige 3 geänderte Dateien mit 28 Einfügungen und 11 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1832 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -16,6 +16,11 @@ $vhost = empty_vhost();
16 16
 if ($id != 0)
17 17
   $vhost = get_vhost_details($id);
18 18
 
19
+$have_v6 = false;
20
+$server = (isset($vhost['server']) ? $vhost['server'] : $_SESSION['userinfo']['server']);
21
+if (ipv6_possible($server))
22
+  $have_v6 = true;
23
+
19 24
 DEBUG($vhost);
20 25
 if ($id == 0) {
21 26
   title("Neue Subdomain anlegen");
... ...
@@ -214,10 +219,7 @@ $ipaddrs = user_ipaddrs();
214 219
 $certs = user_certs();
215 220
 $available_users = available_suexec_users();
216 221
 
217
-$form .= "
218
-<h4 style=\"margin-top: 3em;\">Erweiterte Optionen</h4>
219
-<div style=\"margin-left: 2em;\">
220
-";
222
+$extended = '';
221 223
   if (count($certs))
222 224
   {
223 225
     $certselect = array(0 => 'kein Zertifikat / System-Standard benutzen');
... ...
@@ -225,7 +227,7 @@ $form .= "
225 227
     {
226 228
       $certselect[$c['id']] = $c['subject'];
227 229
     }
228
-    $form .= "
230
+    $extended .= "
229 231
       <h5>verwendetes SSL-Zertifikat</h5>
230 232
       <div style=\"margin-left: 2em;\">
231 233
       ".html_select('cert', $certselect, $vhost['certid'])."
... ...
@@ -238,7 +240,7 @@ $form .= "
238 240
     {
239 241
       $ipselect[$i] = $i;
240 242
     }
241
-    $form .= "
243
+    $extended .= "
242 244
       <h5>IP-Adresse</h5>
243 245
       <div style=\"margin-left: 2em;\">
244 246
       ".html_select('ipv4', $ipselect, $vhost['ipv4'])."
... ...
@@ -251,19 +253,25 @@ $form .= "
251 253
     {
252 254
       $userselect[$u['uid']] = $u['username'];
253 255
     }
254
-    $form .= "
256
+    $extended .= "
255 257
       <h5>SuExec-Benutzeraccount</h5>
256 258
       <div style=\"margin-left: 2em;\">
257 259
       ".html_select('suexec_user', $userselect, $vhost['suexec_user'])."
258 260
       </div>";
259 261
   }
262
+if ($have_v6) 
263
+{
260 264
   $checked = ($vhost['autoipv6'] == 1) ? ' checked="checked"' : '';
261
-$form .= '<h5>IPv6</h5>
265
+  $extended .= '<h5>IPv6</h5>
262 266
 <div style="margin-left: 2em;">
263 267
 <input type="checkbox" name="ipv6" id="ipv6" value="yes" '.$checked.'/>&#160;<label for="ipv6">Auch über IPv6 erreichbar machen</label> (<strong>Achtung:</strong> Bitte beachten Sie die <a href="http://wiki.schokokeks.org/IPv6">Hinweise zu IPv6 im Wiki</a>.)
264 268
 </div>';
265
-
266
-$form .= "</div>";
269
+}
270
+if ($extended)
271
+  $form .= "
272
+<h4 style=\"margin-top: 3em;\">Erweiterte Optionen</h4>
273
+<div style=\"margin-left: 2em;\">
274
+".$extended."</div>";
267 275
 
268 276
 
269 277
 
... ...
@@ -19,6 +19,14 @@ function list_vhosts()
19 19
   return $ret;
20 20
 }
21 21
 
22
+function ipv6_possible($serverid)
23
+{
24
+  $serverid = (int) $serverid;
25
+  $result = db_query("SELECT v6_prefix FROM system.servers WHERE id={$serverid}");
26
+  $server = mysql_fetch_assoc($result);
27
+  return ($server['v6_prefix'] != NULL);
28
+}
29
+
22 30
 function empty_vhost()
23 31
 {
24 32
   $vhost['id'] = NULL;
... ...
@@ -164,7 +164,7 @@ function get_subuser_info($username)
164 164
 function get_user_info($username)
165 165
 {
166 166
   $username = mysql_real_escape_string($username);
167
-  $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name
167
+  $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name, server
168 168
                       FROM system.v_useraccounts WHERE username='{$username}' OR uid='{$username}' LIMIT 1");
169 169
   if (mysql_num_rows($result) < 1)
170 170
   {
... ...
@@ -177,6 +177,7 @@ function get_user_info($username)
177 177
           'customerno'    => $val->customerno,
178 178
           'uid'           => $val->uid,
179 179
           'homedir'       => $val->homedir,
180
+          'server'        => $val->server,
180 181
           'name'          => $val->name,
181 182
           );
182 183
 }
183 184