From 3722623f0c5b34a9ca454cd528db10c3ac44ec5c Mon Sep 17 00:00:00 2001 From: doktornotor Date: Thu, 13 Aug 2015 00:04:43 +0200 Subject: vhosts - rewrite garbage package --- config/vhosts/vhosts_php_edit.php | 313 ++++++++++++++++++-------------------- 1 file changed, 144 insertions(+), 169 deletions(-) (limited to 'config') diff --git a/config/vhosts/vhosts_php_edit.php b/config/vhosts/vhosts_php_edit.php index 8760686e..cb5a330f 100644 --- a/config/vhosts/vhosts_php_edit.php +++ b/config/vhosts/vhosts_php_edit.php @@ -1,21 +1,21 @@ - 0) { $y++; } if ($_GET['id'] == $x) { - $id = $x; //return the id + // Return the id + $id = $x; $host = $rowhelper['host']; $ipaddress = $rowhelper['ipaddress']; $port = $rowhelper['port']; @@ -60,29 +60,27 @@ if ($_GET['act'] == "del") { if (strlen($rowhelper['certificate']) > 0) { $ssl = true; $ssl_id = $y; - } - else { + } else { $ssl = false; } } - $x++; } - //delete vhosts entry - unset($a_vhosts[$_GET['id']]); - - //delete the SSL files and service - if ($ssl) { - unlink_if_exists("/var/etc/lighty-vhosts-".$ipaddress."-".$port."-ssl.conf"); - unlink_if_exists("/var/etc/cert-vhosts-".$ipaddress."-".$port.".pem"); - unlink_if_exists("/usr/local/etc/rc.d/vhosts-".$ipaddress."-".$port."-ssl.sh"); - $service_id = get_service_id ($a_service, 'rcfile', "vhosts-".$ipaddress."-".$port."-ssl.sh"); - if (is_int($service_id)) { - exec("kill `cat /var/run/lighty-vhosts-".$ipaddress."-".$port."-ssl.pid`"); - unset($config['installedpackages']['service'][$service_id]); - } + // Delete vhosts entry + unset($a_vhosts[$_GET['id']]); + + // Delete the SSL files and service + if ($ssl) { + unlink_if_exists("/var/etc/vhosts-{$ipaddress}-{$port}-ssl.conf"); + unlink_if_exists("/var/etc/cert-vhosts-{$ipaddress}-{$port}.pem"); + unlink_if_exists("/usr/local/etc/rc.d/vhosts-{$ipaddress}-{$port}-ssl.sh"); + $service_id = get_service_id ($a_service, 'rcfile', "vhosts-{$ipaddress}-{$port}-ssl.sh"); + if (is_int($service_id)) { + exec("kill `cat /var/run/vhosts-{$ipaddress}-{$port}-ssl.pid`"); + unset($config['installedpackages']['service'][$service_id]); } + } write_config(); header("Location: vhosts_php.php"); @@ -121,25 +119,22 @@ if ($_POST) { if (strlen($_POST['certificate']) > 0) { $ent['certificate'] = base64_encode($_POST['certificate']); - } - else { + } else { $ent['certificate'] = ''; } if (strlen($_POST['privatekey']) > 0) { $ent['privatekey'] = base64_encode($_POST['privatekey']); - } - else { + } else { $ent['privatekey'] = ''; } $ent['enabled'] = $_POST['enabled']; $ent['description'] = $_POST['description']; if (isset($id) && $a_vhosts[$id]) { - //update - $a_vhosts[$id] = $ent; - } - else { - //add + // Update + $a_vhosts[$id] = $ent; + } else { + // Add $a_vhosts[] = $ent; } @@ -151,32 +146,37 @@ if ($_POST) { } } +$pgtitle = "vHosts: Edit"; include("head.inc"); ?> - - + -

vHosts: Edit

- +
@@ -190,131 +190,106 @@ function show_advanced_config() { ?>
+ - -
- - +

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + +
Host - -
- Required. If the host is intended for internal you can use the DNS forwarder to set a host name that is valid inside the local network. default: vhost01.local -
IP Address - -
- Required. Make sure the IP and Port combination does not conflict with the local system. example: 192.168.0.1 -
Port - -
- Make sure the IP and Port combination does not conflict with the local system. default: 8001 -
Directory - -
- This vHosts directory is located in /usr/local/vhosts. The default directory is the host name. -
- example: vhost01.local -
Certificate - -
- Paste a signed certificate in X.509 PEM format here. Create certificates automatically. -
Key - -
- Paste an RSA private key in PEM format here. -
Enabled - \n"; - echo " \n"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - -
Host + +
+ Required. If the host is intended for internal you can use the DNS forwarder to set a host name that is valid inside the local network. default: vhost01.local +
IP Address + +
+ Required. Make sure the IP and Port combination does not conflict with the local system. example: 192.168.0.1 +
Port + +
+ Make sure the IP and Port combination does not conflict with the local system. default: 8001 +
Directory + +
+ This vHosts directory is located in /usr/local/vhosts. The default directory is the host name. +
+ example: vhost01.local +
Certificate + +
+ Paste a signed certificate in X.509 PEM format here. Create certificates automatically. +
Key + +
+ Paste an RSA private key in PEM format here. +
Enabled + \n"; + echo "\t\n"; switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " \n"; - echo " \n"; - break; - case "false": - echo " \n"; - echo " \n"; - break; - default: - echo " \n"; - echo " \n"; + case "true": + echo "\t\n"; + echo "\t\n"; + break; + case "false": + echo "\t\n"; + echo "\t\n"; + break; + default: + echo "\t\n"; + echo "\t\n"; } - echo " \n"; + echo "\n"; ?> -
Description - -
Enter the description here.
-
  - - - - -
- - -
-
-
-
-
-
- -
Description + +
Enter the description here.
+
  +   + + + +
+ +
+ +
-- cgit v1.2.3