CGI abschaltbar
bernd

bernd commited on 2010-03-16 11:14:01
Zeige 3 geänderte Dateien mit 18 Einfügungen und 4 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1698 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -139,12 +139,18 @@ if ($vhost['php'] == 'mod_php')
139 139
   $options['mod_php'] = 'PHP als Apache-Modul (veraltet)';
140 140
 }
141 141
 
142
+$have_cgi = ($vhost['cgi'] == 1 ? ' checked="checked" ' : '');
143
+
142 144
 $form .= "
143 145
 <div class=\"vhostoptions\" id=\"options_scriptlang\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
144 146
   <h5>PHP</h5>
145 147
   <div style=\"margin-left: 2em;\">
146 148
     ".html_select("php", $options, $vhost['php'])."
147 149
   </div>
150
+  <h5>CGI</h5>
151
+  <div style=\"margin-left: 2em;\">
152
+    <input type=\"checkbox\" name=\"cgi\" id=\"cgi\" value=\"yes\" {$have_cgi}/>&#160;<label for=\"cgi\">Erlaube CGI-Nutzung</label>
153
+  </div>
148 154
 </div>
149 155
 ";
150 156
 
... ...
@@ -12,7 +12,7 @@ require_once("certs.php");
12 12
 function list_vhosts()
13 13
 {
14 14
   $uid = (int) $_SESSION['userinfo']['uid'];
15
-  $result = db_query("SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp, stats FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid={$uid} ORDER BY domain,hostname");
15
+  $result = db_query("SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp, stats FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid={$uid} ORDER BY domain,hostname");
16 16
   $ret = array();
17 17
   while ($item = mysql_fetch_assoc($result))
18 18
     array_push($ret, $item);
... ...
@@ -30,6 +30,7 @@ function empty_vhost()
30 30
   $vhost['homedir'] = $_SESSION['userinfo']['homedir'];
31 31
   $vhost['docroot'] = NULL;
32 32
   $vhost['php'] = 'php53';
33
+  $vhost['cgi'] = 1;
33 34
   $vhost['ssl'] = NULL;
34 35
   $vhost['logtype'] = NULL;
35 36
   $vhost['errorlog'] = 0;
... ...
@@ -209,6 +210,7 @@ function save_vhost($vhost)
209 210
     $domain = 'NULL';
210 211
   $docroot = maybe_null($vhost['docroot']);
211 212
   $php = maybe_null($vhost['php']);
213
+  $cgi = ($vhost['cgi'] == 1 ? 1 : 0);
212 214
   $ssl = maybe_null($vhost['ssl']);
213 215
   $logtype = maybe_null($vhost['logtype']);
214 216
   $errorlog = (int) $vhost['errorlog'];
... ...
@@ -239,11 +241,11 @@ function save_vhost($vhost)
239 241
 
240 242
   if ($id != 0) {
241 243
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
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");
244
+    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, cgi={$cgi}, `ssl`={$ssl}, logtype={$logtype}, errorlog={$errorlog}, certid={$cert}, ipv4={$ipv4}, autoipv6={$autoipv6}, options='{$options}', stats={$stats} WHERE id={$id} LIMIT 1");
243 245
   }
244 246
   else {
245 247
     logger(LOG_INFO, 'modules/vhosts/include/vhosts', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].'');
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})");
248
+    $result = db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, cgi, `ssl`, logtype, errorlog, certid, ipv4, autoipv6, options, stats) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$cgi}, {$ssl}, {$logtype}, {$errorlog}, {$cert}, {$ipv4}, {$autoipv6}, '{$options}', {$stats})");
247 249
     $id = mysql_insert_id();
248 250
   }
249 251
   $oldvhost = get_vhost_details($id);
... ...
@@ -36,7 +36,6 @@ if ($_GET['action'] == 'edit')
36 36
   $aliaswww = in_array('aliaswww', $_POST['options']);
37 37
 
38 38
   $docroot = '';
39
-  $php = '';
40 39
   if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav')
41 40
   {
42 41
     $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domain->fqdn).'/htdocs';
... ...
@@ -70,6 +69,12 @@ if ($_GET['action'] == 'edit')
70 69
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
71 70
     }
72 71
   }
72
+  $cgi = 0;
73
+  if (isset($_POST['cgi']) && isset($_POST['cgi']) && $_POST['cgi'] == 'yes')
74
+  {
75
+    $cgi = 1;
76
+  }
77
+
73 78
   if ($_POST['vhost_type'] == 'regular') {
74 79
     $vhost['is_dav'] = 0;
75 80
     $vhost['is_svn'] = 0;
... ...
@@ -167,6 +172,7 @@ if ($_GET['action'] == 'edit')
167 172
   $vhost['domain_id'] = $domain_id;
168 173
   $vhost['docroot'] = $docroot;
169 174
   $vhost['php'] = $php;
175
+  $vhost['cgi'] = $cgi;
170 176
   $vhost['ssl'] = $ssl;
171 177
   $vhost['cert'] = $cert;
172 178
   $vhost['ipv4'] = $ipv4;
173 179