Browse code

SSL auch ├╝ber webinterface einstellbar

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

bernd authored on25/08/2007 15:25:15
Showing3 changed files
... ...
@@ -89,6 +89,15 @@ $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" valu
89 89
     </select>
90 90
     </td>
91 91
     <td id=\"defaultphp\">als Apache-Modul</td></tr>
92
+    <tr><td>SSL-Verschl├╝sselung</td>
93
+    <td><select name=\"ssl\" id=\"ssl\">
94
+      <option value=\"none\" ".($vhost['ssl'] == NULL ? 'selected="selected"' : '')." >SSL optional anbieten</option>
95
+      <option value=\"http\" ".($vhost['ssl'] == 'http' ? 'selected="selected"' : '')." >kein SSL</option>
96
+      <option value=\"https\" ".($vhost['ssl'] == 'https' ? 'selected="selected"' : '')." >nur SSL</option>
97
+      <option value=\"forward\" ".($vhost['ssl'] == 'forward' ? 'selected="selected"' : '')." >Immer auf SSL umleiten</option>
98
+    </select>
99
+    </td>
100
+    <td id=\"defaultssl\">SSL optional anbieten</td></tr>
92 101
     <tr>
93 102
       <td>Logfiles</td>
94 103
       <td><select name=\"logtype\" id=\"logtype\">
... ...
@@ -28,6 +28,7 @@ function empty_vhost()
28 28
   $vhost['homedir'] = $_SESSION['userinfo']['homedir'];
29 29
   $vhost['docroot'] = NULL;
30 30
   $vhost['php'] = 'mod_php';
31
+  $vhost['ssl'] = NULL;
31 32
   $vhost['logtype'] = NULL;
32 33
     
33 34
   $vhost['options'] = '';
... ...
@@ -135,16 +136,17 @@ function save_vhost($vhost)
135 136
     $domain = 'NULL';
136 137
   $docroot = maybe_null($vhost['docroot']);
137 138
   $php = maybe_null($vhost['php']);
139
+  $ssl = maybe_null($vhost['ssl']);
138 140
   $logtype = maybe_null($vhost['logtype']);
139 141
   $options = mysql_real_escape_string( $vhost['options'] );
140 142
 
141 143
   if ($id != 0) {
142 144
     logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
143
-    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, logtype={$logtype}, options='{$options}' WHERE id={$id} LIMIT 1");
145
+    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, `ssl`={$ssl}, logtype={$logtype}, options='{$options}' WHERE id={$id} LIMIT 1");
144 146
   }
145 147
   else {
146 148
     logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].'');
147
-    db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, logtype, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$logtype}, '{$options}')");
149
+    db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, ssl, logtype, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, '{$options}')");
148 150
   }
149 151
 }
150 152
 
... ...
@@ -59,6 +59,20 @@ if ($_GET['action'] == 'edit')
59 59
     /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
60 60
   }
61 61
 
62
+  $ssl = '';
63
+  switch ($_POST['ssl']) {
64
+    case 'http':
65
+      $ssl = 'http';
66
+      break;
67
+    case 'https':
68
+      $ssl = 'https';
69
+      break;
70
+    case 'forward':
71
+      $ssl = 'forward';
72
+      break;
73
+    /* Wenn etwas anderes kommt, ist das "beides". So einfach ist das. */
74
+  }
75
+
62 76
   $logtype = '';
63 77
   switch ($_POST['logtype']) {
64 78
     case 'anonymous':
... ...
@@ -91,6 +105,7 @@ if ($_GET['action'] == 'edit')
91 105
   $vhost['domainid'] = $domainid;
92 106
   $vhost['docroot'] = $docroot;
93 107
   $vhost['php'] = $php;
108
+  $vhost['ssl'] = $ssl;
94 109
   $vhost['logtype'] = $logtype;
95 110
     
96 111
   $vhost['options'] = $options;