|
@@ -14,43 +14,19 @@
|
|
<select required="" name="dir" id="dir">
|
|
<select required="" name="dir" id="dir">
|
|
<option value="" disabled="" selected="">---</option>
|
|
<option value="" disabled="" selected="">---</option>
|
|
|
|
|
|
- <?php
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (isset($_SESSION['username'])) {
|
|
|
|
- $fsDirs = listFsDirs($_SESSION['username']);
|
|
|
|
- $dbUsedDirs = listDbDirs($_SESSION['username'], "dns", "http");
|
|
|
|
- $i = 0;
|
|
|
|
- $j = 0;
|
|
|
|
- $alreadyEnabledDirs = NULL;
|
|
|
|
- $notYetEnabledDirs = NULL;
|
|
|
|
- if ($fsDirs) {
|
|
|
|
- foreach ($fsDirs as $fsDir) {
|
|
|
|
- if ($dbUsedDirs AND in_array($fsDir, $dbUsedDirs)) {
|
|
|
|
- $alreadyEnabledDirs[$i] = $fsDir;
|
|
|
|
- $i++;
|
|
|
|
- } else {
|
|
|
|
- $notYetEnabledDirs[$j] = $fsDir;
|
|
|
|
- $j++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!is_null($notYetEnabledDirs)) {
|
|
|
|
- foreach ($notYetEnabledDirs as $dir) {
|
|
|
|
- echo "<option value='" . $dir . "'>" . $dir . "</option>";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!is_null($alreadyEnabledDirs)) {
|
|
|
|
- foreach ($alreadyEnabledDirs as $dir) {
|
|
|
|
- echo "<option disabled='' value='" . $dir . "'>" . $dir . "</option>";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ?>
|
|
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+if (isset($_SESSION['username'])) {
|
|
|
|
+ $dirsStatuses = dirsStatuses($_SESSION['username'], "dns", "http");
|
|
|
|
+
|
|
|
|
+ foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
|
|
|
+ $disabled = $alreadyEnabled ? " disabled=''" : "";
|
|
|
|
+ echo " <option" . $disabled . " value='" . $dir . "'>" . $dir . "</option>";
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+?>
|
|
|
|
+
|
|
</select>
|
|
</select>
|
|
<br>
|
|
<br>
|
|
<input value="Valider" type="submit">
|
|
<input value="Valider" type="submit">
|
|
@@ -64,7 +40,7 @@ if (isset($_POST['domain']) AND isset($_POST['dir']) AND isset($_SESSION['userna
|
|
|
|
|
|
checkDomainFormat($_POST['domain']);
|
|
checkDomainFormat($_POST['domain']);
|
|
|
|
|
|
- if (!in_array($_POST['dir'], $notYetEnabledDirs))
|
|
|
|
|
|
+ if ($dirsStatuses[$_POST['dir']] !== false)
|
|
userError("Wrong value for <code>dir</code>.");
|
|
userError("Wrong value for <code>dir</code>.");
|
|
|
|
|
|
addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http");
|
|
addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http");
|
|
@@ -78,11 +54,7 @@ if (isset($_POST['domain']) AND isset($_POST['dir']) AND isset($_SESSION['userna
|
|
ssl_certificate /etc/ssl/certs/niver.crt;
|
|
ssl_certificate /etc/ssl/certs/niver.crt;
|
|
ssl_certificate_key /etc/ssl/private/niver.key;
|
|
ssl_certificate_key /etc/ssl/private/niver.key;
|
|
|
|
|
|
- include inc/tls.conf;
|
|
|
|
-
|
|
|
|
- location / {
|
|
|
|
- try_files $uri $uri.html $uri/ =404;
|
|
|
|
- }
|
|
|
|
|
|
+ include inc/ht-tls.conf;
|
|
}
|
|
}
|
|
';
|
|
';
|
|
file_put_contents(CONF['ht']['nginx_config_path'] . "/" . $_POST['domain'] . ".conf", $nginxConf);
|
|
file_put_contents(CONF['ht']['nginx_config_path'] . "/" . $_POST['domain'] . ".conf", $nginxConf);
|