aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Alouit <alexandre.alouit@gmail.com>2015-11-26 02:12:51 +0100
committerAlexandre Alouit <alexandre.alouit@gmail.com>2015-11-26 02:12:51 +0100
commit7508d70198192aba9678d7dedc446a1ecb127d8b (patch)
tree31a4f648824ebbacffef20ed6cc0953d04f0b9ce
parent9ea9794d8b8babae7cb670f8d187f16fbf0ed848 (diff)
improvement & bugfix
use complete files instead patch fix subdomain auto-redirection
-rw-r--r--README.md18
-rw-r--r--_todo4
-rw-r--r--install.php24
-rw-r--r--ispconfig.patch466
-rw-r--r--src/interface/web/sites/form/web_domain.tform.php798
-rw-r--r--src/interface/web/sites/lib/lang/ar_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/bg_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/br_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/cz_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/de_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/el_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/en_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/es_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/fi_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/fr_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/hr_web_domain.lng134
-rw-r--r--src/interface/web/sites/lib/lang/hu_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/id_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/it_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/ja_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/nl_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/pl_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/pt_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/ro_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/ru_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/se_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/sk_web_domain.lng133
-rw-r--r--src/interface/web/sites/lib/lang/tr_web_domain.lng133
-rw-r--r--src/interface/web/sites/templates/web_domain_edit.htm277
-rwxr-xr-xsrc/server/conf/nginx_vhost.conf.master234
-rwxr-xr-xsrc/server/plugins-available/apache2_plugin.inc.php3038
-rwxr-xr-xsrc/server/plugins-available/nginx_plugin.inc.php2932
32 files changed, 10368 insertions, 483 deletions
diff --git a/README.md b/README.md
index 4ca41ef..c16ac1d 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,11 @@ ISPConfig Let's Encrypt
=========================
-# REQUIRREMENTS
+# REQUIREMENTS
Let's Encrypt installed
-ISPConfig 3.0.5.4p8 or newer
+ISPConfig (select version in branche)
Apache or Nginx
@@ -24,6 +24,11 @@ After install, a new checkbox will be available in editing website, just check i
## MANUAL INSTALLATION
+- go to dir
+```
+cd ISPConfig-letsencrypt
+```
+
- patch or create Let's Encrypt configuration
```
cp ./cli.ini /etc/letsencrypt/cli.ini
@@ -31,12 +36,9 @@ cp ./cli.ini /etc/letsencrypt/cli.ini
patch /etc/letsencrypt/cli.ini < ./cli.ini.patch
```
-- patch ISPConfig
+- patch ISPConfig (merge all files from ./src to /usr/local/ispconfig)
```
-cp ispconfig.patch /usr/local/ispconfig/ispconfig.patch
-cd /usr/local/ispconfig
-patch -p3 < ./ispconfig.patch
-rm ./ispconfig.patch
+rsync -av ./src/ /usr/local/ispconfig/
```
- prepare apache
@@ -62,4 +64,4 @@ crontab -e
- sql queries:
```
ALTER TABLE `web_domain` ADD `ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n';
-``` \ No newline at end of file
+```
diff --git a/_todo b/_todo
index cf2c6a5..45341e3 100644
--- a/_todo
+++ b/_todo
@@ -2,4 +2,6 @@ check dns entry is correct before request to Let's Encrypt (apache and nginx plu
check dns MX entry is correct before request to Let's Encrypt (apache and nginx plugin)
check if we already have a symlink and if he's valid (apache and nginx plugin)
force ssl field to on when use Let's Encrypt (api access)
-disable ssl tab when use Let's Encrypt (webgui) \ No newline at end of file
+disable ssl tab when use Let's Encrypt (webgui)
+check dns entry is correct and MX domain
+check if is a symlink and is correct (if target is same)
diff --git a/install.php b/install.php
index f5ef25f..58ca699 100644
--- a/install.php
+++ b/install.php
@@ -141,24 +141,32 @@ if(!in_array("30 02 * * * /root/.local/share/letsencrypt/bin/letsencrypt-renewer
exec("echo '" . $line . "' >> ./crontab.tmp");
}
+/*
exec("cat ./crontab.tmp", $crontab);
- if(empty(array_diff($output, $crontab))) {
+ $diff = array_diff($output, $crontab);
+ if(empty($diff)) {
exec("crontab ./crontab.tmp");
exec("rm ./crontab.tmp");
} else {
- echo "ERROR: There was a problem with the cronjob temporary file.\n";
- exit;
+ echo "ERROR: There was a problem with the cronjob temporary file.\n";
+ exit;
}
+*/
+exec("crontab ./crontab.tmp");
+exec("rm ./crontab.tmp");
} else {
echo "Renewer already present in crontab.\n";
}
-echo "And finally, patch ISPConfig.\n";
-exec("cp ispconfig.patch /usr/local/ispconfig/ispconfig.patch");
-exec("cd /usr/local/ispconfig");
-exec("patch -p3 < ./ispconfig.patch");
-exec("rm ./ispconfig.patch");
+echo "And finally, update ISPConfig.\n";
+
+if(!is_file("/usr/bin/rsync")) {
+ echo "ERROR: Unable to find rsync binary, install it or merge ./src to /usr/local/ispconfig manually.\n";
+ exit;
+}
+
+exec("rsync -av ./src/ /usr/local/ispconfig");
echo "Done my job. Enjoy!\n";
exit;
diff --git a/ispconfig.patch b/ispconfig.patch
deleted file mode 100644
index 72073f8..0000000
--- a/ispconfig.patch
+++ /dev/null
@@ -1,466 +0,0 @@
-diff -u -r /root/ispconfig/interface/web/sites/form/web_domain.tform.php /usr/local/ispconfig/interface/web/sites/form/web_domain.tform.php
---- /root/ispconfig/interface/web/sites/form/web_domain.tform.php 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/form/web_domain.tform.php 2015-11-05 02:28:13.272000000 +0100
-@@ -232,6 +232,12 @@
- 'default' => 'n',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
-+ 'ssl_letsencrypt' => array (
-+ 'datatype' => 'VARCHAR',
-+ 'formtype' => 'CHECKBOX',
-+ 'default' => 'n',
-+ 'value' => array(0 => 'n', 1 => 'y')
-+ ),
- 'php' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'SELECT',
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/ar_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/ar_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/ar_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/ar_web_domain.lng 2015-11-06 18:36:40.896000000 +0100
-@@ -28,6 +28,7 @@
- $wb['errordocs_txt'] = 'Own Error-Documents';
- $wb['subdomain_txt'] = 'Auto-Subdomain';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Client';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/bg_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/bg_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/bg_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/bg_web_domain.lng 2015-11-06 18:36:41.096000000 +0100
-@@ -26,6 +26,7 @@
- $wb['ssi_txt'] = 'SSI';
- $wb['errordocs_txt'] = 'Собствени страници за грешки';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Клиент';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/br_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/br_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/br_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/br_web_domain.lng 2015-11-06 18:36:40.896000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = 'Suas Páginas de Erro';
- $wb['subdomain_txt'] = 'Auto-Subdomínio';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Cliente';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/cz_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/cz_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/cz_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/cz_web_domain.lng 2015-11-06 18:36:40.920000000 +0100
-@@ -27,6 +27,7 @@
- $wb['ssi_txt'] = 'SSI';
- $wb['subdomain_txt'] = 'Automatická subdoména';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Klient';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/de_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/de_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/de_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/de_web_domain.lng 2015-11-06 18:36:38.772000000 +0100
-@@ -27,6 +27,7 @@
- $wb['cgi_txt'] = 'CGI';
- $wb['ssi_txt'] = 'SSI';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Kunde';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/el_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/el_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/el_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/el_web_domain.lng 2015-11-06 18:36:39.484000000 +0100
-@@ -30,6 +30,7 @@
- $wb['errordocs_txt'] = 'Προσωπικά έγγραφα σφάλματος';
- $wb['subdomain_txt'] = 'Auto-Subdomain';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Πελάτης';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/en_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/en_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/en_web_domain.lng 2015-11-07 13:37:31.740000000 +0100
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/en_web_domain.lng 2015-11-07 13:37:36.004000000 +0100
-@@ -33,6 +33,7 @@
- $wb["errordocs_txt"] = 'Own Error-Documents';
- $wb["subdomain_txt"] = 'Auto-Subdomain';
- $wb["ssl_txt"] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb["suexec_txt"] = 'SuEXEC';
- $wb["php_txt"] = 'PHP';
- $wb["client_txt"] = 'Client';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/es_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/es_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/es_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/es_web_domain.lng 2015-11-06 18:36:38.360000000 +0100
-@@ -31,6 +31,7 @@
- $wb['errordocs_txt'] = 'Documentos propios de error';
- $wb['subdomain_txt'] = 'Auto-Subdominio';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Cliente';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/fi_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/fi_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/fi_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/fi_web_domain.lng 2015-11-06 18:36:38.376000000 +0100
-@@ -25,6 +25,7 @@
- $wb['cgi_txt'] = 'CGI';
- $wb['ssi_txt'] = 'SSI';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Asiakas';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/fr_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/fr_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/fr_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/fr_web_domain.lng 2015-11-06 18:36:41.744000000 +0100
-@@ -25,6 +25,7 @@
- $wb['ssi_txt'] = 'SSI';
- $wb['errordocs_txt'] = 'Pages derreurs personnalisées';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Client';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/hr_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/hr_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/hr_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/hr_web_domain.lng 2015-11-06 18:36:38.412000000 +0100
-@@ -30,6 +30,7 @@
- $wb['errordocs_txt'] = 'Vlastite error stranice';
- $wb['subdomain_txt'] = 'Automatska poddomena';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Klijent';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/hu_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/hu_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/hu_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/hu_web_domain.lng 2015-11-06 18:36:35.844000000 +0100
-@@ -26,6 +26,7 @@
- $wb['ssi_txt'] = 'SSI';
- $wb['errordocs_txt'] = 'Saját hibaoldal';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['disabled_txt'] = 'Letiltva';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/id_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/id_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/id_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/id_web_domain.lng 2015-11-06 18:36:36.228000000 +0100
-@@ -28,6 +28,7 @@
- $wb['errordocs_txt'] = 'Dokumen-Kesalahan Pribadi';
- $wb['subdomain_txt'] = 'Subdomain Otomatis';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Klien';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/it_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/it_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/it_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/it_web_domain.lng 2015-11-06 18:36:36.892000000 +0100
-@@ -26,6 +26,7 @@
- $wb['ssi_txt'] = 'SSI';
- $wb['errordocs_txt'] = 'Errori personalizzati';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Cliente';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/ja_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/ja_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/ja_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/ja_web_domain.lng 2015-11-06 18:36:34.476000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = '独自のエラーページを使う';
- $wb['subdomain_txt'] = '自動サブドメイン';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'クライアント';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/nl_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/nl_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/nl_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/nl_web_domain.lng 2015-11-06 18:36:35.852000000 +0100
-@@ -30,6 +30,7 @@
- $wb['errordocs_txt'] = 'Own Error-documenten';
- $wb['subdomain_txt'] = 'Auto-subdomein';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Klant';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/pl_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/pl_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/pl_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/pl_web_domain.lng 2015-11-06 18:36:35.828000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = 'Własne strony błędów';
- $wb['subdomain_txt'] = 'Automatyczna subdomena';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Klient';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/pt_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/pt_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/pt_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/pt_web_domain.lng 2015-11-06 18:36:33.296000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = 'Páginas de Erro';
- $wb['subdomain_txt'] = 'Auto-Subdomínio';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Cliente';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/ro_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/ro_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/ro_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/ro_web_domain.lng 2015-11-06 18:36:33.884000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = 'Own Error-Documents';
- $wb['subdomain_txt'] = 'Auto-Subdomain';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Client';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/ru_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/ru_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/ru_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/ru_web_domain.lng 2015-11-06 18:36:54.424000000 +0100
-@@ -25,6 +25,7 @@
- $wb['cgi_txt'] = 'CGI';
- $wb['ssi_txt'] = 'SSI';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Клиент';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/se_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/se_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/se_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/se_web_domain.lng 2015-11-06 18:36:33.256000000 +0100
-@@ -26,6 +26,7 @@
- $wb['ssi_txt'] = 'SSI';
- $wb['errordocs_txt'] = 'Own Error-Documents';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Client';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/sk_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/sk_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/sk_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/sk_web_domain.lng 2015-11-06 18:36:33.096000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = 'Vlastné Error-Dokumenty';
- $wb['subdomain_txt'] = 'Auto-Subdomény';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Klient';
-diff -u -r /root/ispconfig/interface/web/sites/lib/lang/tr_web_domain.lng /usr/local/ispconfig/interface/web/sites/lib/lang/tr_web_domain.lng
---- /root/ispconfig/interface/web/sites/lib/lang/tr_web_domain.lng 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/interface/web/sites/lib/lang/tr_web_domain.lng 2015-11-06 18:39:23.560000000 +0100
-@@ -27,6 +27,7 @@
- $wb['errordocs_txt'] = 'Özelleştirilebilir Hata Sayfaları';
- $wb['subdomain_txt'] = 'Otomatik Subdomain';
- $wb['ssl_txt'] = 'SSL';
-+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
- $wb['suexec_txt'] = 'SuEXEC';
- $wb['php_txt'] = 'PHP';
- $wb['client_txt'] = 'Müşteri';
-diff -u -r /root/ispconfig/interface/web/sites/templates/web_domain_edit.htm /usr/local/ispconfig/interface/web/sites/templates/web_domain_edit.htm
---- /root/ispconfig/interface/web/sites/templates/web_domain_edit.htm 2015-11-06 20:44:44.560000000 +0100
-+++ /usr/local/ispconfig/interface/web/sites/templates/web_domain_edit.htm 2015-11-06 20:44:05.192000000 +0100
-@@ -130,6 +130,12 @@
- <div class="multiField">
- {tmpl_var name='ssl'}
- </div>
-+ </div>
-+ <div class="ctrlHolder">
-+ <p class="label">{tmpl_var name='ssl_letsencrypt_txt'}</p>
-+ <div class="multiField">
-+ {tmpl_var name='ssl_letsencrypt'}
-+ </div>
- </div></tmpl_if>
- <div class="ctrlHolder">
- <label for="php">{tmpl_var name='php_txt'}</label>
-@@ -261,5 +267,11 @@
- submitForm('pageForm','sites/web_domain_edit.php');
- });
- </tmpl_if>
--
--</script>
-\ No newline at end of file
-+
-+ jQuery('input#ssl_letsencrypt').bind('change', function() {
-+ if(jQuery('input#ssl_letsencrypt').is(":checked")) jQuery('input#ssl').prop('checked', true);
-+ });
-+ jQuery('input#ssl').bind('change', function() {
-+ if(jQuery('input#ssl_letsencrypt').is(":checked")) jQuery('input#ssl_letsencrypt').prop('checked', false);
-+ });
-+</script>
-diff -u -r /root/ispconfig/server/conf/nginx_vhost.conf.master /usr/local/ispconfig/server/conf/nginx_vhost.conf.master
---- /root/ispconfig/server/conf/nginx_vhost.conf.master 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/server/conf/nginx_vhost.conf.master 2015-11-08 02:40:25.192000000 +0100
-@@ -105,12 +105,14 @@
- access_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/access.log combined;
-
- ## Disable .htaccess and other hidden files
-+<tmpl_if name='ssl_letsencrypt' op='!=' value='y'>
- location ~ /\. {
- deny all;
- access_log off;
- log_not_found off;
- }
--
-+</tmpl_if>
-+
- location = /favicon.ico {
- log_not_found off;
- access_log off;
-@@ -229,4 +231,4 @@
- }
- </tmpl_if>
- }
--</tmpl_loop>
-\ No newline at end of file
-+</tmpl_loop>
-diff -u -r /root/ispconfig/server/plugins-available/apache2_plugin.inc.php /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php
---- /root/ispconfig/server/plugins-available/apache2_plugin.inc.php 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php 2015-11-08 03:03:12.028000000 +0100
-@@ -935,7 +935,7 @@
-
- // Check if a SSL cert exists
- $ssl_dir = $data['new']['document_root'].'/ssl';
-- $domain = $data['new']['ssl_domain'];
-+ $domain = $data['new']['domain'];
- $key_file = $ssl_dir.'/'.$domain.'.key';
- $crt_file = $ssl_dir.'/'.$domain.'.crt';
- $bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-@@ -950,6 +950,57 @@
- }
- */
-
-+ //* Generate Let's Encrypt SSL certificat
-+ if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') {
-+//* TODO: check dns entry is correct
-+ $crt_tmp_file = "/etc/letsencrypt/live/".$domain."/cert.pem";
-+ $key_tmp_file = "/etc/letsencrypt/live/".$domain."/privkey.pem";
-+ $webroot = $data['new']['document_root']."/web";
-+
-+ //* check if we have already a Let's Encrypt cert
-+ if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
-+ exec("/root/.local/share/letsencrypt/bin/letsencrypt auth -a webroot --email postmaster@$domain --domains $domain --webroot-path $webroot --text --agree-tos");
-+ $app->log("Creating Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
-+ };
-+
-+ //* check is been correctly created
-+ if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
-+ $date = date("YmdHis");
-+//* TODO: check if is a symlink, if target same keep it, either remove it
-+ if(is_file($key_file)) {
-+ $app->system->copy($key_file, $key_file.'.old'.$date);
-+ $app->system->chmod($key_file.'.old.'.$date, 0400);
-+ $app->system->unlink($key_file);
-+ }
-+
-+ if ($web_config["website_symlinks_rel"] == 'y') {
-+ $this->create_relative_link(escapeshellcmd($key_tmp_file), escapeshellcmd($key_file));
-+ } else {
-+ exec("ln -s ".escapeshellcmd($key_tmp_file)." ".escapeshellcmd($key_file));
-+ }
-+
-+ if(is_file($crt_file)) {
-+ $app->system->copy($crt_file, $crt_file.'.old.'.$date);
-+ $app->system->chmod($crt_file.'.old.'.$date, 0400);
-+ $app->system->unlink($crt_file);
-+ }
-+
-+ if($web_config["website_symlinks_rel"] == 'y') {
-+ $this->create_relative_link(escapeshellcmd($crt_tmp_file), escapeshellcmd($crt_file));
-+ } else {
-+ exec("ln -s ".escapeshellcmd($crt_tmp_file)." ".escapeshellcmd($crt_file));
-+ }
-+
-+ /* we don't need to store it.
-+ /* Update the DB of the (local) Server */
-+ $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key' WHERE domain = '".$data['new']['domain']."'");
-+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-+ /* Update also the master-DB of the Server-Farm */
-+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key' WHERE domain = '".$data['new']['domain']."'");
-+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-+ }
-+ };
-+
- if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
-
- //$vhost_data['document_root'] = $data['new']['document_root'].'/' . $web_folder;
-diff -u -r /root/ispconfig/server/plugins-available/nginx_plugin.inc.php /usr/local/ispconfig/server/plugins-available/nginx_plugin.inc.php
---- /root/ispconfig/server/plugins-available/nginx_plugin.inc.php 2015-06-05 10:06:30.000000000 +0200
-+++ /usr/local/ispconfig/server/plugins-available/nginx_plugin.inc.php 2015-11-08 03:13:36.524000000 +0100
-@@ -1102,10 +1102,66 @@
-
- // Check if a SSL cert exists
- $ssl_dir = $data['new']['document_root'].'/ssl';
-+ if(!isset($data['new']['ssl_domain']) OR empty($data['new']['ssl_domain'])) { $data['new']['ssl_domain'] = $data['new']['domain']; }
- $domain = $data['new']['ssl_domain'];
-+ $tpl->setVar('ssl_domain', $domain);
- $key_file = $ssl_dir.'/'.$domain.'.key';
- $crt_file = $ssl_dir.'/'.$domain.'.crt';
-
-+
-+ $tpl->setVar('ssl_letsencrypt', "n");
-+ //* Generate Let's Encrypt SSL certificat
-+ if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') {
-+ $tpl->setVar('ssl_letsencrypt', "y");
-+ //* TODO: check dns entry is correct
-+ $crt_tmp_file = "/etc/letsencrypt/live/".$domain."/fullchain.pem";
-+ $key_tmp_file = "/etc/letsencrypt/live/".$domain."/privkey.pem";
-+ $webroot = $data['new']['document_root']."/web";
-+
-+ //* check if we have already a Let's Encrypt cert
-+ if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
-+ exec("/root/.local/share/letsencrypt/bin/letsencrypt auth -a webroot --email postmaster@$domain --domains $domain --webroot-path $webroot --text --agree-tos");
-+ $app->log("Creating Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
-+ };
-+
-+ //* check is been correctly created
-+ if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
-+ $date = date("YmdHis");
-+//* TODO: check if is a symlink, if target same keep it, either remove it
-+ if(is_file($key_file)) {
-+ $app->system->copy($key_file, $key_file.'.old'.$date);
-+ $app->system->chmod($key_file.'.old.'.$date, 0400);
-+ $app->system->unlink($key_file);
-+ }
-+
-+ if ($web_config["website_symlinks_rel"] == 'y') {
-+ $this->create_relative_link(escapeshellcmd($key_tmp_file), escapeshellcmd($key_file));
-+ } else {
-+ exec("ln -s ".escapeshellcmd($key_tmp_file)." ".escapeshellcmd($key_file));
-+ }
-+
-+ if(is_file($crt_file)) {
-+ $app->system->copy($crt_file, $crt_file.'.old.'.$date);
-+ $app->system->chmod($crt_file.'.old.'.$date, 0400);
-+ $app->system->unlink($crt_file);
-+ }
-+
-+ if($web_config["website_symlinks_rel"] == 'y') {
-+ $this->create_relative_link(escapeshellcmd($crt_tmp_file), escapeshellcmd($crt_file));
-+ } else {
-+ exec("ln -s ".escapeshellcmd($crt_tmp_file)." ".escapeshellcmd($crt_file));
-+ }
-+
-+ /* we don't need to store it.
-+ /* Update the DB of the (local) Server */
-+ $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = '".$data['new']['domain']."'");
-+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-+ /* Update also the master-DB of the Server-Farm */
-+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = '".$data['new']['domain']."'");
-+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-+ }
-+ };
-+
- if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) {
- $vhost_data['ssl_enabled'] = 1;
- $app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG); \ No newline at end of file
diff --git a/src/interface/web/sites/form/web_domain.tform.php b/src/interface/web/sites/form/web_domain.tform.php
new file mode 100644
index 0000000..de5164d
--- /dev/null
+++ b/src/interface/web/sites/form/web_domain.tform.php
@@ -0,0 +1,798 @@
+<?php
+
+/*
+ Form Definition
+
+ Tabledefinition
+
+ Datatypes:
+ - INTEGER (Forces the input to Int)
+ - DOUBLE
+ - CURRENCY (Formats the values to currency notation)
+ - VARCHAR (no format check, maxlength: 255)
+ - TEXT (no format check)
+ - DATE (Dateformat, automatic conversion to timestamps)
+
+ Formtype:
+ - TEXT (Textfield)
+ - TEXTAREA (Textarea)
+ - PASSWORD (Password textfield, input is not shown when edited)
+ - SELECT (Select option field)
+ - RADIO
+ - CHECKBOX
+ - CHECKBOXARRAY
+ - FILE
+
+ VALUE:
+ - Wert oder Array
+
+ Hint:
+ The ID field of the database table is not part of the datafield definition.
+ The ID field must be always auto incement (int or bigint).
+
+ Search:
+ - searchable = 1 or searchable = 2 include the field in the search
+ - searchable = 1: this field will be the title of the search result
+ - searchable = 2: this field will be included in the description of the search result
+
+
+*/
+
+$form["title"] = "Web Domain";
+$form["description"] = "";
+$form["name"] = "web_domain";
+$form["action"] = "web_domain_edit.php";
+$form["db_table"] = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_domain_list.php";
+$form["auth"] = 'yes'; // yes / no
+
+$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+// Clients may not change the website basic settings if they are not resellers
+if($app->auth->has_clients($_SESSION['s']['user']['userid']) || $app->auth->is_admin()) {
+ $web_domain_edit_readonly = false;
+} else {
+ $web_domain_edit_readonly = true;
+}
+
+$wildcard_available = true;
+$ssl_available = true;
+if(!$app->auth->is_admin()) {
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ if($client['limit_wildcard'] != 'y') $wildcard_available = false;
+ if($client['limit_ssl'] != 'y') $ssl_available = false;
+}
+
+$form["tabs"]['domain'] = array (
+ 'title' => "Domain",
+ 'width' => 100,
+ 'template' => "templates/web_domain_edit.htm",
+ 'readonly' => $web_domain_edit_readonly,
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'server_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'no_server_error'),
+ ),
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'value' => ''
+ ),
+ 'ip_address' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ /*'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
+ 'keyfield'=> 'ip_address',
+ 'valuefield'=> 'ip_address'
+ ),*/
+ 'value' => '',
+ 'searchable' => 2
+ ),
+ 'ipv6_address' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ /*'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address",
+ 'keyfield'=> 'ip_address',
+ 'valuefield'=> 'ip_address'
+ ),*/
+ 'value' => '',
+ 'searchable' => 2
+ ),
+ 'domain' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'filters' => array( 0 => array( 'event' => 'SAVE',
+ 'type' => 'IDNTOASCII'),
+ 1 => array( 'event' => 'SHOW',
+ 'type' => 'IDNTOUTF8'),
+ 2 => array( 'event' => 'SAVE',
+ 'type' => 'TOLOWER')
+ ),
+ 'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
+ 'class' => 'validate_domain',
+ 'function' => 'web_domain',
+ 'errmsg'=> 'domain_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255',
+ 'searchable' => 1
+ ),
+ 'type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'y',
+ 'value' => array('vhost' => 'Site', 'alias' => 'Alias')
+ ),
+ 'parent_domain_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'site' AND {AUTHSQL} ORDER BY domain",
+ 'keyfield'=> 'domain_id',
+ 'valuefield'=> 'domain'
+ ),
+ 'value' => ''
+ ),
+ 'vhost_type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'y',
+ 'value' => array('name' => 'Namebased', 'ip' => 'IP-Based')
+ ),
+ 'hd_quota' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'hd_quota_error_empty'),
+ 1 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(\-1|[0-9]{1,10})$/',
+ 'errmsg'=> 'hd_quota_error_regex'),
+ ),
+ 'default' => '-1',
+ 'value' => '',
+ 'width' => '7',
+ 'maxlength' => '7'
+ ),
+ 'traffic_quota' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'traffic_quota_error_empty'),
+ 1 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(\-1|[0-9]{1,10})$/',
+ 'errmsg'=> 'traffic_quota_error_regex'),
+ ),
+ 'default' => '-1',
+ 'value' => '',
+ 'width' => '7',
+ 'maxlength' => '7'
+ ),
+ 'cgi' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'ssi' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'suexec' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'errordocs' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'CHECKBOX',
+ 'default' => '1',
+ 'value' => array(0 => '0', 1 => '1')
+ ),
+ 'subdomain' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'www',
+ 'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
+ 'class' => 'validate_domain',
+ 'function' => 'web_domain_autosub',
+ 'errmsg'=> 'domain_error_autosub'),
+ ),
+ 'value' => ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
+ ),
+ 'ssl' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'ssl_letsencrypt' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'php' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'fast-cgi',
+ 'valuelimit' => 'client:web_php_options',
+ 'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
+ 'searchable' => 2
+ ),
+ 'fastcgi_php_version' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ /*'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
+ 'keyfield'=> 'ip_address',
+ 'valuefield'=> 'ip_address'
+ ),*/
+ 'value' => ''
+ ),
+ 'perl' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'ruby' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'python' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'active' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ )
+);
+
+
+$form["tabs"]['redirect'] = array (
+ 'title' => "Redirect",
+ 'width' => 100,
+ 'template' => "templates/web_domain_redirect.htm",
+ 'readonly' => false,
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'redirect_type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+ ),
+ 'redirect_path' => array (
+ 'datatype' => 'VARCHAR',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+ 'errmsg'=> 'redirect_error_regex'),
+ ),
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'seo_redirect' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
+ ),
+ 'rewrite_rules' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ )
+);
+
+if($ssl_available) {
+ $form["tabs"]['ssl'] = array (
+ 'title' => "SSL",
+ 'width' => 100,
+ 'template' => "templates/web_domain_ssl.htm",
+ 'readonly' => false,
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'ssl_state' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+ 'errmsg'=> 'ssl_state_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'ssl_locality' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+ 'errmsg'=> 'ssl_locality_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'ssl_organisation' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+ 'errmsg'=> 'ssl_organisation_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'ssl_organisation_unit' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+ 'errmsg'=> 'ssl_organistaion_unit_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ /*
+ 'ssl_country' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^(([\.]{0})|([A-Z]{2,2}))$/',
+ 'errmsg'=> 'ssl_country_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '2',
+ 'maxlength' => '2'
+ ),
+ */
+ 'ssl_country' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+ 'keyfield'=> 'iso',
+ 'valuefield'=> 'printable_name'
+ ),
+ 'value' => ''
+ ),
+ 'ssl_domain' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'ssl_key' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXTAREA',
+ 'default' => '',
+ 'value' => '',
+ 'cols' => '30',
+ 'rows' => '10'
+ ),
+ 'ssl_request' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXTAREA',
+ 'default' => '',
+ 'value' => '',
+ 'cols' => '30',
+ 'rows' => '10'
+ ),
+ 'ssl_cert' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXTAREA',
+ 'default' => '',
+ 'value' => '',
+ 'cols' => '30',
+ 'rows' => '10'
+ ),
+ 'ssl_bundle' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXTAREA',
+ 'default' => '',
+ 'value' => '',
+ 'cols' => '30',
+ 'rows' => '10'
+ ),
+ 'ssl_action' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt')
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ )
+ );
+}
+
+//* Statistics
+$form["tabs"]['stats'] = array (
+ 'title' => "Stats",
+ 'width' => 100,
+ 'template' => "templates/web_domain_stats.htm",
+ 'readonly' => false,
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'stats_password' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'PASSWORD',
+ 'validators' => array(
+ 0 => array(
+ 'type' => 'CUSTOM',
+ 'class' => 'validate_password',
+ 'function' => 'password_check',
+ 'errmsg' => 'weak_password_txt'
+ )
+ ),
+ 'encryption' => 'CRYPT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'stats_type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'webalizer',
+ 'value' => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats', '' => 'None')
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ )
+);
+
+// if($_SESSION["s"]["user"]["typ"] == 'admin') {
+
+//* Backup
+$form["tabs"]['backup'] = array (
+ 'title' => "Backup",
+ 'width' => 100,
+ 'template' => "templates/web_domain_backup.htm",
+ 'readonly' => false,
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'backup_interval' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
+ ),
+ 'backup_copies' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
+ ),
+ 'backup_excludes' => array (
+ 'datatype' => 'VARCHAR',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '@^(?!.*\.\.)[-a-zA-Z0-9_/.~,*]*$@',
+ 'errmsg'=> 'backup_excludes_error_regex'),
+ ),
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ ),
+ 'plugins' => array (
+ 'backup_records' => array (
+ 'class' => 'plugin_backuplist',
+ 'options' => array(
+ )
+ )
+ )
+);
+
+// }
+
+if($_SESSION["s"]["user"]["typ"] == 'admin') {
+
+ $form["tabs"]['advanced'] = array (
+ 'title' => "Options",
+ 'width' => 100,
+ 'template' => "templates/web_domain_advanced.htm",
+ 'readonly' => false,
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'document_root' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'documentroot_error_empty'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'system_user' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'sysuser_error_empty'),
+ 1 => array(
+ 'type' => 'CUSTOM',
+ 'class' => 'validate_systemuser',
+ 'function' => 'check_sysuser',
+ 'check_names' => true,
+ 'errmsg' => 'invalid_system_user_or_group_txt'
+ ),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'system_group' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'sysgroup_error_empty'),
+ 1 => array(
+ 'type' => 'CUSTOM',
+ 'class' => 'validate_systemuser',
+ 'function' => 'check_sysgroup',
+ 'check_names' => true,
+ 'errmsg' => 'invalid_system_user_or_group_txt'
+ ),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'allow_override' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'allow_override_error_empty'),
+ ),
+ 'default' => 'All',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'php_fpm_use_socket' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
+ 'pm' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'dynamic',
+ 'value' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
+ ),
+ 'pm_max_children' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^([1-9][0-9]{0,10})$/',
+ 'errmsg'=> 'pm_max_children_error_regex'),
+ ),
+ 'default' => '10',
+ 'value' => '',
+ 'width' => '3',
+ 'maxlength' => '3'
+ ),
+ 'pm_start_servers' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^([1-9][0-9]{0,10})$/',
+ 'errmsg'=> 'pm_start_servers_error_regex'),
+ ),
+ 'default' => '2',
+ 'value' => '',
+ 'width' => '3',
+ 'maxlength' => '3'
+ ),
+ 'pm_min_spare_servers' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^([1-9][0-9]{0,10})$/',
+ 'errmsg'=> 'pm_min_spare_servers_error_regex'),
+ ),
+ 'default' => '1',
+ 'value' => '',
+ 'width' => '3',
+ 'maxlength' => '3'
+ ),
+ 'pm_max_spare_servers' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^([1-9][0-9]{0,10})$/',
+ 'errmsg'=> 'pm_max_spare_servers_error_regex'),
+ ),
+ 'default' => '5',
+ 'value' => '',
+ 'width' => '3',
+ 'maxlength' => '3'
+ ),
+ 'pm_process_idle_timeout' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^([1-9][0-9]{0,10})$/',
+ 'errmsg'=> 'pm_process_idle_timeout_error_regex'),
+ ),
+ 'default' => '10',
+ 'value' => '',
+ 'width' => '3',
+ 'maxlength' => '6'
+ ),
+ 'pm_max_requests' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'REGEX',
+ 'regex' => '/^([0-9]{1,11})$/',
+ 'errmsg'=> 'pm_max_requests_error_regex'),
+ ),
+ 'default' => '0',
+ 'value' => '',
+ 'width' => '3',
+ 'maxlength' => '6'
+ ),
+ 'php_open_basedir' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ /*'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'php_open_basedir_error_empty'),
+ ), */
+ 'default' => 'All',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'custom_php_ini' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'apache_directives' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array(
+ 'type' => 'CUSTOM',
+ 'class' => 'validate_domain',
+ 'function' => 'web_apache_directives',
+ 'errmsg' => 'apache_directive_blockd_error'
+ ),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'nginx_directives' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'proxy_directives' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'added_date' => array (
+ 'datatype' => 'DATE',
+ 'formtype' => 'TEXT',
+ 'default' => date($app->lng('conf_format_dateshort')),
+ 'value' => '',
+ 'separator' => '',
+ 'width' => '15',
+ 'maxlength' => '15',
+ 'rows' => '',
+ 'cols' => ''
+ ),
+ 'added_by' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => $_SESSION['s']['user']['username'],
+ 'value' => '',
+ 'separator' => '',
+ 'width' => '30',
+ 'maxlength' => '255',
+ 'rows' => '',
+ 'cols' => ''
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ )
+ );
+
+}
+
+
+?>
diff --git a/src/interface/web/sites/lib/lang/ar_web_domain.lng b/src/interface/web/sites/lib/lang/ar_web_domain.lng
new file mode 100644
index 0000000..a8928e2
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/ar_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'State';
+$wb['ssl_locality_txt'] = 'Locality';
+$wb['ssl_organisation_txt'] = 'Organisation';
+$wb['ssl_organisation_unit_txt'] = 'Organisation Unit';
+$wb['ssl_country_txt'] = 'Country';
+$wb['ssl_request_txt'] = 'SSL Request';
+$wb['ssl_cert_txt'] = 'SSL Certificate';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Type';
+$wb['parent_domain_id_txt'] = 'Parent Website';
+$wb['redirect_type_txt'] = 'Redirect Type';
+$wb['redirect_path_txt'] = 'Redirect Path';
+$wb['active_txt'] = 'Active';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux User';
+$wb['system_group_txt'] = 'Linux Group';
+$wb['ip_address_txt'] = 'IP-Address';
+$wb['vhost_type_txt'] = 'VHost Type';
+$wb['hd_quota_txt'] = 'Harddisk Quota';
+$wb['traffic_quota_txt'] = 'Traffic Quota';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Own Error-Documents';
+$wb['subdomain_txt'] = 'Auto-Subdomain';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Client';
+$wb['limit_web_domain_txt'] = 'The max. number of web domains for your account is reached.';
+$wb['limit_web_aliasdomain_txt'] = 'The max. number of aliasdomains for your account is reached.';
+$wb['limit_web_subdomain_txt'] = 'The max. number of web subdomains for your account is reached.';
+$wb['apache_directives_txt'] = 'Apache directives';
+$wb['domain_error_empty'] = 'Domain is empty.';
+$wb['domain_error_unique'] = 'There is already a website or sub / aliasdomain with this domain name.';
+$wb['domain_error_regex'] = 'Domain name invalid.';
+$wb['hd_quota_error_empty'] = 'Harddisk quota is 0 or empty.';
+$wb['traffic_quota_error_empty'] = 'Traffic quota is empty.';
+$wb['error_ssl_state_empty'] = 'SSL State is empty.';
+$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisation is empty.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit is empty.';
+$wb['error_ssl_country_empty'] = 'SSL Country is empty.';
+$wb['client_group_id_txt'] = 'Client';
+$wb['stats_password_txt'] = 'Webstatistics password';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/bg_web_domain.lng b/src/interface/web/sites/lib/lang/bg_web_domain.lng
new file mode 100644
index 0000000..5d6d786
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/bg_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'State';
+$wb['ssl_locality_txt'] = 'Locality';
+$wb['ssl_organisation_txt'] = 'Организация';
+$wb['ssl_organisation_unit_txt'] = 'Organisation Unit';
+$wb['ssl_country_txt'] = 'Държава';
+$wb['ssl_request_txt'] = 'SSL Request';
+$wb['ssl_cert_txt'] = 'SSL Certificate';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['server_id_txt'] = 'Сървър';
+$wb['domain_txt'] = 'Домейн';
+$wb['type_txt'] = 'Тип';
+$wb['parent_domain_id_txt'] = 'Parent Website';
+$wb['redirect_type_txt'] = 'Redirect Type';
+$wb['redirect_path_txt'] = 'Redirect Path';
+$wb['active_txt'] = 'Активен';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux потребител';
+$wb['system_group_txt'] = 'Linux група';
+$wb['ip_address_txt'] = 'IP адрес';
+$wb['vhost_type_txt'] = 'VHost Type';
+$wb['hd_quota_txt'] = 'Harddisk Quota';
+$wb['traffic_quota_txt'] = 'Трафик квота';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Собствени страници за грешки';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Клиент';
+$wb['limit_web_domain_txt'] = 'Достигнат е максималният разрешен брой домейни.';
+$wb['limit_web_aliasdomain_txt'] = 'Достигнат е максималният разрешен брой aliasdomains.';
+$wb['limit_web_subdomain_txt'] = 'Достигнат е максималният разрешен брой поддомейни.';
+$wb['apache_directives_txt'] = 'Apache директиви';
+$wb['domain_error_empty'] = 'Не е посочен домейн.';
+$wb['domain_error_unique'] = 'Вече съществува такъв домейн.';
+$wb['domain_error_regex'] = 'Невалидно име на домейн.';
+$wb['hd_quota_error_empty'] = 'Не е посочена Harddisk.';
+$wb['traffic_quota_error_empty'] = 'Не е посочена Трафик квота.';
+$wb['error_ssl_state_empty'] = 'Не е посочен SSL State.';
+$wb['error_ssl_locality_empty'] = 'Не е посочен SSL Locality.';
+$wb['error_ssl_organisation_empty'] = 'Не е посочена SSL организация.';
+$wb['error_ssl_organisation_unit_empty'] = 'Не е посочен SSL Organisation Unit.';
+$wb['error_ssl_country_empty'] = 'Не е посочена SSL държава.';
+$wb['subdomain_txt'] = 'Auto-Subdomain';
+$wb['client_group_id_txt'] = 'Клиент';
+$wb['stats_password_txt'] = 'Парола за уеб статистика';
+$wb['ssl_domain_txt'] = 'SSL Домейн';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Максимална квота за дисково пространсво';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Трафик квота';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Трафик квота exceeded';
+$wb['backup_interval_txt'] = 'Интервал за бекъп';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics Потребителско име';
+$wb['stats_type_txt'] = 'Webstatistics програма';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['ipv6_address_txt'] = 'IPv6-адрес';
+$wb['none_txt'] = 'Нищо';
+$wb['disabled_txt'] = 'Забранен';
+$wb['no_redirect_txt'] = 'Без редирект';
+$wb['no_flag_txt'] = 'Без флаг';
+$wb['save_certificate_txt'] = 'Запиши сертификат';
+$wb['create_certificate_txt'] = 'Направи сертификат';
+$wb['delete_certificate_txt'] = 'Изтрий сертификат';
+$wb['nginx_directives_txt'] = 'nginx директиви';
+$wb['seo_redirect_txt'] = 'SEO редирект';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Използвай сокет за PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'квотата за дисковото пространство е грешна.';
+$wb['traffic_quota_error_regex'] = 'Трафик квота е грешна.';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/br_web_domain.lng b/src/interface/web/sites/lib/lang/br_web_domain.lng
new file mode 100644
index 0000000..9c5192e
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/br_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Estado';
+$wb['ssl_locality_txt'] = 'Localização';
+$wb['ssl_organisation_txt'] = 'Empresa';
+$wb['ssl_organisation_unit_txt'] = 'Departamento';
+$wb['ssl_country_txt'] = 'País';
+$wb['ssl_request_txt'] = 'Requisição SSL';
+$wb['ssl_cert_txt'] = 'Certificado SSL';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['server_id_txt'] = 'Servidor';
+$wb['domain_txt'] = 'Domínio';
+$wb['type_txt'] = 'Tipo';
+$wb['parent_domain_id_txt'] = 'Site Parente';
+$wb['redirect_type_txt'] = 'Tipo Redirecionamento';
+$wb['redirect_path_txt'] = 'Caminho de redirecionamento';
+$wb['active_txt'] = 'Ativo';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Usuário Linux';
+$wb['system_group_txt'] = 'Groupo Linux';
+$wb['ip_address_txt'] = 'Endereço-IP';
+$wb['vhost_type_txt'] = 'Tipo de VHost';
+$wb['hd_quota_txt'] = 'Cota de Disco';
+$wb['traffic_quota_txt'] = 'Cota de Tráfego';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Suas Páginas de Erro';
+$wb['subdomain_txt'] = 'Auto-Subdomínio';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Cliente';
+$wb['limit_web_domain_txt'] = 'O número máximo de domínios web para sua conta foi atingido.';
+$wb['limit_web_aliasdomain_txt'] = 'O número máximo de aliases domínio para sua conta foi atingido.';
+$wb['limit_web_subdomain_txt'] = 'O número máximo de sub-domínios para sua conta foi atingido.';
+$wb['apache_directives_txt'] = 'Diretivas do Apache';
+$wb['domain_error_empty'] = 'Domínio em branco.';
+$wb['domain_error_unique'] = 'Já existe site, alias ou sub-domínio com este nome';
+$wb['domain_error_regex'] = 'Nome de domínio inválido.';
+$wb['hd_quota_error_empty'] = 'Quota de disco está em branco.';
+$wb['traffic_quota_error_empty'] = 'Quota de tráfego está em branco.';
+$wb['error_ssl_state_empty'] = 'Estado do SSL está em branco.';
+$wb['error_ssl_locality_empty'] = 'Localização do SSL está em branco.';
+$wb['error_ssl_organisation_empty'] = 'Empresa do SSL está em branco.';
+$wb['error_ssl_organisation_unit_empty'] = 'Departamento do SSL está em branco.';
+$wb['error_ssl_country_empty'] = 'País do SSL em branco.';
+$wb['client_group_id_txt'] = 'Cliente';
+$wb['stats_password_txt'] = 'Senha do diretório de estatísticas';
+$wb['ssl_domain_txt'] = 'Domínio SSL';
+$wb['allow_override_txt'] = 'Permitir Sobrescrever';
+$wb['limit_web_quota_free_txt'] = 'Cota Max. de disco disponível';
+$wb['ssl_state_error_regex'] = 'Estado inválido para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_locality_error_regex'] = 'Localidade inválida para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_organisation_error_regex'] = 'Empresa inválida para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Departamento inválido para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_country_error_regex'] = 'País inválido para SSL. São caracteres válidos: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Cota máxima de Tráfego disponível';
+$wb['redirect_error_regex'] = 'Caminho de redirecionamento inválido. Exemplos de caminhos válidos: /test/ ou http://www.dominio.ext/test/';
+$wb['php_open_basedir_txt'] = 'open_basedir do PHP';
+$wb['traffic_quota_exceeded_txt'] = 'Cota de tráfego excedida';
+$wb['backup_interval_txt'] = 'Intervalo de Backup';
+$wb['backup_copies_txt'] = 'Número de cópias';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Estátisticas Web usuário';
+$wb['stats_type_txt'] = 'Tipo de Estatística Web';
+$wb['custom_php_ini_txt'] = 'php.ini personalizado';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'Não';
+$wb['disabled_txt'] = 'Desativado';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Salvar certificado';
+$wb['create_certificate_txt'] = 'Criar certificado';
+$wb['delete_certificate_txt'] = 'Deletar certificado';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/cz_web_domain.lng b/src/interface/web/sites/lib/lang/cz_web_domain.lng
new file mode 100644
index 0000000..73bcdb7
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/cz_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Stát';
+$wb['ssl_locality_txt'] = 'Lokalita';
+$wb['ssl_organisation_txt'] = 'Organizace';
+$wb['ssl_organisation_unit_txt'] = 'Organizační jednotka';
+$wb['ssl_country_txt'] = 'Země';
+$wb['ssl_request_txt'] = 'SSL požadavek';
+$wb['ssl_cert_txt'] = 'SSL certifikát';
+$wb['ssl_bundle_txt'] = 'SSL bundle';
+$wb['ssl_action_txt'] = 'SSL akce';
+$wb['ssl_domain_txt'] = 'SSL doména';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Doména';
+$wb['type_txt'] = 'Typ';
+$wb['parent_domain_id_txt'] = 'Rodičovská webová stránka';
+$wb['redirect_type_txt'] = 'Typ přesměrování';
+$wb['redirect_path_txt'] = 'Cesta přesměrování';
+$wb['active_txt'] = 'Aktivní';
+$wb['document_root_txt'] = 'Kořenový adresář dokumentů';
+$wb['system_user_txt'] = 'Linuxový uživatel';
+$wb['system_group_txt'] = 'Linuxová skupina';
+$wb['ip_address_txt'] = 'IP adresa';
+$wb['vhost_type_txt'] = 'VHost typ';
+$wb['hd_quota_txt'] = 'Disková kvóta';
+$wb['traffic_quota_txt'] = 'Přenosová kvóta';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['subdomain_txt'] = 'Automatická subdoména';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Klient';
+$wb['limit_web_domain_txt'] = 'Dosažen maximální počet web domén pro Váš účet.';
+$wb['limit_web_aliasdomain_txt'] = 'Dosažen maximální počet alias domén pro Váš účet.';
+$wb['limit_web_subdomain_txt'] = 'Dosažen maximální počet subdomén pro Váš účet.';
+$wb['apache_directives_txt'] = 'Apache direktivy';
+$wb['domain_error_empty'] = 'Doména je prázdná.';
+$wb['domain_error_unique'] = 'Webová stránka nebo sub / alias doména s tímto doménovým jménem již existuje.';
+$wb['domain_error_regex'] = 'Neplatné doménové jméno.';
+$wb['hd_quota_error_empty'] = 'Disková kvóta je 0 nebo je prázdná.';
+$wb['traffic_quota_error_empty'] = 'Přenosová kvóta je prázdná.';
+$wb['error_ssl_state_empty'] = 'SSL stav je prázdný.';
+$wb['error_ssl_locality_empty'] = 'SSL lokalita je prázdná.';
+$wb['error_ssl_organisation_empty'] = 'SSL organizace je prázdná.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL organizační jednotka je prázdná.';
+$wb['error_ssl_country_empty'] = 'SSL země je prázdná.';
+$wb['client_group_id_txt'] = 'Klient';
+$wb['stats_password_txt'] = 'Heslo k webovým statistikám';
+$wb['allow_override_txt'] = 'Povolit přepis (Allow Override)';
+$wb['limit_web_quota_free_txt'] = 'Max. dostupná disková kvóta';
+$wb['ssl_state_error_regex'] = 'Neplatný SSL stav. Platné znaky jsou: a-z, 0-9 a .,-_';
+$wb['ssl_locality_error_regex'] = 'Neplatná SSL lokalita. Platné znaky jsou: a-z, 0-9 a .,-_';
+$wb['ssl_organisation_error_regex'] = 'Neplatná SSL organizace. Platné znaky jsou: a-z, 0-9 a .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Neplatná SSL organizační jednotka. Platné znaky jsou: a-z, 0-9 a .,-_';
+$wb['ssl_country_error_regex'] = 'Neplatná SSL země. Platné znaky jsou: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. dostupná přenosová kvóta';
+$wb['redirect_error_regex'] = 'Neplatná cesta přesměrování. Platné přesměrování je například: /test/ nebo http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Přenosová kvóta překročena';
+$wb['backup_interval_txt'] = 'Interval zálohování';
+$wb['backup_copies_txt'] = 'Počet kopií zálohy';
+$wb['errordocs_txt'] = 'Vlastní Error (chybové) dokumenty';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webové statistiky: uživatelské jméno';
+$wb['stats_type_txt'] = 'Webové statistiky: program';
+$wb['custom_php_ini_txt'] = 'Vlastní nastavení php.ini';
+$wb['none_txt'] = 'Žádná';
+$wb['disabled_txt'] = 'Zakázáno';
+$wb['no_redirect_txt'] = 'Žádné přesměrování';
+$wb['no_flag_txt'] = 'Žádný příznak';
+$wb['save_certificate_txt'] = 'Uložit certifikát';
+$wb['create_certificate_txt'] = 'Vytvořit certifikát';
+$wb['delete_certificate_txt'] = 'Smazat certifikát';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO přesměrování';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Kvóta pevného disku je neplatná.';
+$wb['traffic_quota_error_regex'] = 'Traffik kvóta je neplatná.';
+$wb['ssl_key_txt'] = 'SSL klíč';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP verze';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generovat heslo';
+$wb['repeat_password_txt'] = 'Opakujte heslo';
+$wb['password_mismatch_txt'] = 'Hesla se neshodují.';
+$wb['password_match_txt'] = 'Hesla se shodují.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'Nebyl zvolen žádný server';
+$wb['no_backup_txt'] = 'Žádné zálohování';
+$wb['daily_backup_txt'] = 'Denně';
+$wb['weekly_backup_txt'] = 'Týdně';
+$wb['monthly_backup_txt'] = 'Měsíčně';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Proměnné';
+$wb['added_by_txt'] = 'Kdo vytvořil účet';
+$wb['added_date_txt'] = 'Datum vytvoření účtu';
+$wb['backup_excludes_txt'] = 'Vyloučené adresáře';
+$wb['backup_excludes_note_txt'] = '(Oddělte více adresářů čárkami. Vzor: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'Vyloučené adresáře obsahují neplatné znaky.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Neplatné nastavení php.ini';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+?>
+
diff --git a/src/interface/web/sites/lib/lang/de_web_domain.lng b/src/interface/web/sites/lib/lang/de_web_domain.lng
new file mode 100644
index 0000000..260aef1
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/de_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Bundesland';
+$wb['ssl_locality_txt'] = 'Ort';
+$wb['ssl_organisation_txt'] = 'Firma';
+$wb['ssl_organisation_unit_txt'] = 'Abteilung';
+$wb['ssl_country_txt'] = 'Land';
+$wb['ssl_key_txt'] = 'SSL-Key';
+$wb['ssl_request_txt'] = 'SSL-Request';
+$wb['ssl_cert_txt'] = 'SSL-Zertifikat';
+$wb['ssl_bundle_txt'] = 'SSL-Bundle';
+$wb['ssl_action_txt'] = 'SSL-Aktion';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Typ';
+$wb['parent_domain_id_txt'] = 'Zugehörige Webseite';
+$wb['web_folder_error_regex'] = 'Ungültige Verzeichnisangabe, bitte keinen / eingeben.';
+$wb['redirect_type_txt'] = 'Weiterleitungstyp';
+$wb['redirect_path_txt'] = 'Weiterleitungspfad';
+$wb['active_txt'] = 'Aktiv';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux-Benutzer';
+$wb['system_group_txt'] = 'Linux-Gruppe';
+$wb['ip_address_txt'] = 'IP-Adresse';
+$wb['vhost_type_txt'] = 'vHost-Typ';
+$wb['hd_quota_txt'] = 'Speicherplatzbeschränkung';
+$wb['traffic_quota_txt'] = 'Transfervolumenbeschränkung';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Kunde';
+$wb['limit_web_domain_txt'] = 'Die maximale Anzahl an Webdomains für Ihr Konto wurde erreicht.';
+$wb['limit_web_aliasdomain_txt'] = 'Die maximale Anzahl an Aliasdomains für Ihr Konto wurde erreicht.';
+$wb['limit_web_subdomain_txt'] = 'Die maximale Anzahl an Subdomains für Ihr Konto wurde erreicht.';
+$wb['apache_directives_txt'] = 'Apache Direktiven';
+$wb['domain_error_empty'] = 'Domain ist leer.';
+$wb['domain_error_unique'] = 'Domain muss eindeutig sein';
+$wb['domain_error_regex'] = 'Domain Name ungültig.';
+$wb['domain_error_autosub'] = 'Es existiert bereits eine Subdomain mit diesen Einstellungen.';
+$wb['hd_quota_error_empty'] = 'Speicherplatzbeschränkung ist leer.';
+$wb['traffic_quota_error_empty'] = 'Transfervolumenbeschränkung ist leer.';
+$wb['errordocs_txt'] = 'Eigene Fehlerseiten';
+$wb['error_ssl_state_empty'] = 'Bundesland (SSL) ist leer.';
+$wb['error_ssl_locality_empty'] = 'Ort (SSL) ist leer.';
+$wb['error_ssl_organisation_empty'] = 'Organisation (SSL) ist leer.';
+$wb['error_ssl_organisation_unit_empty'] = 'Abteilung (SSL) ist leer.';
+$wb['error_ssl_country_empty'] = 'Land (SSL) ist leer.';
+$wb['subdomain_txt'] = 'Auto Subdomain';
+$wb['client_group_id_txt'] = 'Kunde';
+$wb['stats_password_txt'] = 'Webstatistik Passwort';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. mögliche Speicherplatzbeschränkung';
+$wb['ssl_state_error_regex'] = 'Ungültiges SSL-Bundesland. Gültige Zeichen sind: a-z, 0-9 und .,-_&äöüÄÖÜ';
+$wb['ssl_locality_error_regex'] = 'Ungültiger SSL-Ort. Gülige Zeichen sind: a-z, 0-9 und .,-_&äöüÄÖÜ';
+$wb['ssl_organisation_error_regex'] = 'Ungültige SSL-Firma. Gültige Zeichen sind: a-z, 0-9 und .,-_&äöüÄÖÜ';
+$wb['ssl_organistaion_unit_error_regex'] = 'Ungültige SSL-Abteilung. Gültige Zeichen sind: a-z, 0-9 und .,-_&äöüÄÖÜ';
+$wb['ssl_country_error_regex'] = 'Ungültiges SSL-Land. Gültige Zeichen sind: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. mögliche Transfervolumenbeschränkung';
+$wb['redirect_error_regex'] = 'Ungültiger Weiterleitungspfad. Gültige Angaben sind beispielsweise: /test/ oder http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['backup_interval_txt'] = 'Backup Intervall';
+$wb['backup_copies_txt'] = 'Anzahl an Backups';
+$wb['traffic_quota_exceeded_txt'] = 'Transfervolumen verbraucht.';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistik Benutzername';
+$wb['stats_type_txt'] = 'Webstatistik Programm';
+$wb['custom_php_ini_txt'] = 'Individuelle php.ini Einstellungen';
+$wb['error_ssl_cert_empty'] = 'SSL Zertifikat Feld ist leer.';
+$wb['none_txt'] = 'Keine';
+$wb['disabled_txt'] = 'Deaktiviert';
+$wb['no_redirect_txt'] = 'Kein Redirect';
+$wb['no_flag_txt'] = 'Kein Flag';
+$wb['save_certificate_txt'] = 'Zertifikat speichern';
+$wb['create_certificate_txt'] = 'Zertifikat erstellen';
+$wb['delete_certificate_txt'] = 'Zertifikat löschen';
+$wb['nginx_directives_txt'] = 'nginx Direktiven';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Nicht-www -> www';
+$wb['www_to_non_www_txt'] = 'www -> Nicht-www';
+$wb['php_fpm_use_socket_txt'] = 'Benutze Socket für PHP-FPM';
+$wb['ipv6_address_txt'] = 'IPv6 Adresse';
+$wb['error_no_sni_txt'] = 'SNI für SSL ist auf diesem Server nicht aktiviert. Sie können daher nur ein SSL Zertifikat pro IP Adresse eintragen.';
+$wb['python_txt'] = 'Python';
+$wb['perl_txt'] = 'Perl';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Die Werte der PHP-FPM pm Einstellungen müssen wie folgt sein: pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children muß eine positive ganze Zahl sein.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers muß eine positive ganze Zahl sein.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers muß eine positive ganze Zahl sein.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers muß eine positive ganze Zahl sein.';
+$wb['hd_quota_error_regex'] = 'Speicherplatzbeschränkung ist ungültig.';
+$wb['traffic_quota_error_regex'] = 'Transfervolumenbeschränkung ist ungültig.';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM FastCGI Prozess Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout muß eine positive ganze Zahl sein.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests muß eine ganze Zahl >= 0 sein.';
+$wb['pm_ondemand_hint_txt'] = 'Bitte beachten Sie, daß Ihre PHP Version >= 5.3.9 sein muß, wenn Sie den ondemand Process-Manager nutzen möchten. Wenn Sie ondemand für eine ältere PHP Version auswählen, wird PHP nicht mehr starten!';
+$wb['generate_password_txt'] = 'Passwort erzeugen';
+$wb['repeat_password_txt'] = 'Passwort wiederholen';
+$wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.';
+$wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
+$wb['available_php_directive_snippets_txt'] = 'Verfügbare PHP Direktiven Schnipsel:';
+$wb['available_apache_directive_snippets_txt'] = 'Verfügbare Apache Direktiven Schnipsel:';
+$wb['available_nginx_directive_snippets_txt'] = 'Verfügbare nginx Direktiven Schnipsel:';
+$wb['proxy_directives_txt'] = 'Proxy Direktiven';
+$wb['available_proxy_directive_snippets_txt'] = 'Verfügbare Proxy Direktiven Schnipsel:';
+$wb['no_server_error'] = 'Kein Server ausgewählt.';
+$wb['no_backup_txt'] = 'Kein Backup';
+$wb['daily_backup_txt'] = 'Täglich';
+$wb['weekly_backup_txt'] = 'Wöchentlich';
+$wb['monthly_backup_txt'] = 'Monatlich';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Unzulässige Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Erlaubte Direktiven:';
+$wb['configuration_error_txt'] = 'KONFIGURATIONSFEHLER';
+$wb['variables_txt'] = 'Variablen';
+$wb['added_by_txt'] = 'Hinzugefügt von';
+$wb['added_date_txt'] = 'Hinzugefügt am';
+$wb['backup_excludes_txt'] = 'Auszuschließende Verzeichnisse';
+$wb['backup_excludes_note_txt'] = '(Mehrere Verzeichnisse mit Kommas trennen. Beispiel: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'Die auszuschließenden Verzeichnisse enthalten ungültige Zeichen.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Unzulässige php.ini-Einstellungen';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Die Apache Direktive wurde durch die Sicherheitsrichtline blockiert:';
+?>
diff --git a/src/interface/web/sites/lib/lang/el_web_domain.lng b/src/interface/web/sites/lib/lang/el_web_domain.lng
new file mode 100644
index 0000000..bb544bd
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/el_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['backup_interval_txt'] = 'Προγραμματισμός Backup';
+$wb['backup_copies_txt'] = 'Πλήθος αντιγράφων';
+$wb['ssl_state_txt'] = 'Κατάσταση';
+$wb['ssl_locality_txt'] = 'Τοποθεσία';
+$wb['ssl_organisation_txt'] = 'Οργανισμός';
+$wb['ssl_organisation_unit_txt'] = 'Τμήμα Οργανισμού';
+$wb['ssl_country_txt'] = 'Χώρα';
+$wb['ssl_request_txt'] = 'SSL Request';
+$wb['ssl_cert_txt'] = 'Πιστοποιητικό SSL';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Τύπος';
+$wb['parent_domain_id_txt'] = 'Γονικό Website';
+$wb['redirect_type_txt'] = 'Τύπος Ανακατεύθυνσης';
+$wb['redirect_path_txt'] = 'Διαδρομή Ανακατεύθυνσης';
+$wb['active_txt'] = 'Ενεργό';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Χρήστης Linux';
+$wb['system_group_txt'] = 'Ομάδα Linux';
+$wb['ip_address_txt'] = 'Διεύθυνση IP';
+$wb['vhost_type_txt'] = 'VHost Type';
+$wb['hd_quota_txt'] = 'Όριο αποθηκευτικού χώρου';
+$wb['traffic_quota_txt'] = 'Όριο κίνησης';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Προσωπικά έγγραφα σφάλματος';
+$wb['subdomain_txt'] = 'Auto-Subdomain';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Πελάτης';
+$wb['limit_web_domain_txt'] = 'Έχετε φτάσει το μέγιστο πλήθος των web domains για τον λογαριασμό σας.';
+$wb['limit_web_aliasdomain_txt'] = 'Έχετε φτάσει το μέγιστο πλήθος των aliasdomains για τον λογαριασμό σας.';
+$wb['limit_web_subdomain_txt'] = 'Έχετε φτάσει το μέγιστο πλήθος των web subdomains για τον λογαριασμό σας.';
+$wb['apache_directives_txt'] = 'Apache directives';
+$wb['domain_error_empty'] = 'Το Domain δεν έχει οριστεί.';
+$wb['domain_error_unique'] = 'Υπάρχει ήδη ένα website ή ένα sub / aliasdomain με αυτό το όνομα domain.';
+$wb['domain_error_regex'] = 'Domain name invalid.';
+$wb['hd_quota_error_empty'] = 'Το όριο αποθηκευτικού χώρου είναι 0 ή δεν έχει οριστεί.';
+$wb['traffic_quota_error_empty'] = 'Το όριο κίνησης δεν έχει οριστεί.';
+$wb['error_ssl_state_empty'] = 'Κενή περιφέρεια SSL.';
+$wb['error_ssl_locality_empty'] = 'Κενή τοποθεσία SSL.';
+$wb['error_ssl_organisation_empty'] = 'Ο Οργανισμός SSL δεν έχει οριστεί.';
+$wb['error_ssl_organisation_unit_empty'] = 'Το SSL τμήμα Οργανισμού δεν έχει οριστεί.';
+$wb['error_ssl_country_empty'] = 'Κενή χώρα SSL.';
+$wb['error_ssl_cert_empty'] = 'Το πεδίο SSL Certificate δεν έχει οριστεί';
+$wb['client_group_id_txt'] = 'Πελάτης';
+$wb['stats_password_txt'] = 'Συνθηματικο Στατιστικών Web';
+$wb['allow_override_txt'] = 'Apache AllowOverride';
+$wb['limit_web_quota_free_txt'] = 'Όριο αποθηκευτικού χώρου';
+$wb['ssl_state_error_regex'] = 'Άκυρη πολιτεία-περιφέρεια SSL. Έγκυροι χαρακτήρες: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Άκυρο SSL Locality. Έγκυροι χαρακτήρες: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Άκυρος Οργανισμός SSL. Έγκυροι χαρακτήρες: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Άκυρη μονάδα οργανισμού SSL. Έγκυροι χαρακτήρες: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Άκυρη Χώρα SSL. Έγκυροι χαρακτήρες: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Όριο κίνησης';
+$wb['redirect_error_regex'] = 'Μη έγκυρη διαδρομή ανακατεύθυνσης. Έγκυρες τιμές είναι: /test/ ή http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Ξεπεράστηκε το όριο κίνησης δεδομένων';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Όνομα Χρήστη Στατιστικών Web';
+$wb['stats_type_txt'] = 'Πρόγραμμα Στατιστικών Web';
+$wb['custom_php_ini_txt'] = 'Προσαρμοσμένες ρυθμίσεις php.ini';
+$wb['none_txt'] = 'Καμία';
+$wb['disabled_txt'] = 'Απενεργοπ.';
+$wb['no_redirect_txt'] = 'Χωρίς Ανακατεύθυνση';
+$wb['no_flag_txt'] = 'Χωρίς Σημαία';
+$wb['save_certificate_txt'] = 'Αποθήκευση Πιστοποιητικού';
+$wb['create_certificate_txt'] = 'Δημιουργία Πιστοποιητικού';
+$wb['delete_certificate_txt'] = 'Διαγραφή Πιστοποιητικού';
+$wb['ipv6_address_txt'] = 'Διεύθυνση IPv6';
+$wb['nginx_directives_txt'] = 'Ντιρεκτίβες nginx';
+$wb['seo_redirect_txt'] = 'Ανακατεύθυνση SEO';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/en_web_domain.lng b/src/interface/web/sites/lib/lang/en_web_domain.lng
new file mode 100644
index 0000000..38675dc
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/en_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb["backup_interval_txt"] = 'Backup interval';
+$wb["backup_copies_txt"] = 'Number of backup copies';
+$wb["ssl_state_txt"] = 'State';
+$wb["ssl_locality_txt"] = 'Locality';
+$wb["ssl_organisation_txt"] = 'Organisation';
+$wb["ssl_organisation_unit_txt"] = 'Organisation Unit';
+$wb["ssl_country_txt"] = 'Country';
+$wb["ssl_key_txt"] = 'SSL Key';
+$wb["ssl_request_txt"] = 'SSL Request';
+$wb["ssl_cert_txt"] = 'SSL Certificate';
+$wb["ssl_bundle_txt"] = 'SSL Bundle';
+$wb["ssl_action_txt"] = 'SSL Action';
+$wb["ssl_domain_txt"] = 'SSL Domain';
+$wb["server_id_txt"] = 'Server';
+$wb["domain_txt"] = 'Domain';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb["type_txt"] = 'Type';
+$wb["parent_domain_id_txt"] = 'Parent Website';
+$wb["redirect_type_txt"] = 'Redirect Type';
+$wb["redirect_path_txt"] = 'Redirect Path';
+$wb["active_txt"] = 'Active';
+$wb["document_root_txt"] = 'Documentroot';
+$wb["system_user_txt"] = 'Linux User';
+$wb["system_group_txt"] = 'Linux Group';
+$wb["ip_address_txt"] = 'IPv4-Address';
+$wb["ipv6_address_txt"] = 'IPv6-Address';
+$wb["vhost_type_txt"] = 'VHost Type';
+$wb["hd_quota_txt"] = 'Harddisk Quota';
+$wb["traffic_quota_txt"] = 'Traffic Quota';
+$wb["cgi_txt"] = 'CGI';
+$wb["ssi_txt"] = 'SSI';
+$wb["errordocs_txt"] = 'Own Error-Documents';
+$wb["subdomain_txt"] = 'Auto-Subdomain';
+$wb["ssl_txt"] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb["suexec_txt"] = 'SuEXEC';
+$wb["php_txt"] = 'PHP';
+$wb["client_txt"] = 'Client';
+$wb["limit_web_domain_txt"] = 'The max. number of web domains for your account is reached.';
+$wb["limit_web_aliasdomain_txt"] = 'The max. number of aliasdomains for your account is reached.';
+$wb["limit_web_subdomain_txt"] = 'The max. number of web subdomains for your account is reached.';
+$wb["apache_directives_txt"] = 'Apache Directives';
+$wb["domain_error_empty"] = 'Domain is empty.';
+$wb["domain_error_unique"] = 'There is already a website or sub / aliasdomain with this domain name.';
+$wb["domain_error_regex"] = 'Domain name invalid.';
+$wb["domain_error_autosub"] = 'There is already a subdomain with these settings.';
+$wb["hd_quota_error_empty"] = 'Harddisk quota is 0 or empty.';
+$wb["traffic_quota_error_empty"] = 'Traffic quota is empty.';
+$wb["error_ssl_state_empty"] = 'SSL State is empty.';
+$wb["error_ssl_locality_empty"] = 'SSL Locality is empty.';
+$wb["error_ssl_organisation_empty"] = 'SSL Organisation is empty.';
+$wb["error_ssl_organisation_unit_empty"] = 'SSL Organisation Unit is empty.';
+$wb["error_ssl_country_empty"] = 'SSL Country is empty.';
+$wb["error_ssl_cert_empty"] = 'SSL Certificate field is empty';
+$wb["client_group_id_txt"] = 'Client';
+$wb["stats_password_txt"] = 'Set Webstatistics password';
+$wb["allow_override_txt"] = 'Apache AllowOverride';
+$wb["limit_web_quota_free_txt"] = 'Max. available Harddisk Quota';
+$wb["ssl_state_error_regex"] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_&äöüÄÖÜ';
+$wb["ssl_locality_error_regex"] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_&äöüÄÖÜ';
+$wb["ssl_organisation_error_regex"] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_&äöüÄÖÜ';
+$wb["ssl_organistaion_unit_error_regex"] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_&äöüÄÖÜ';
+$wb["ssl_country_error_regex"] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb["limit_traffic_quota_free_txt"] = 'Max. available Traffic Quota';
+$wb["redirect_error_regex"] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb["php_open_basedir_txt"] = 'PHP open_basedir';
+$wb["traffic_quota_exceeded_txt"] = 'Traffic quota exceeded';
+$wb["ruby_txt"] = 'Ruby';
+$wb["stats_user_txt"] = 'Webstatistics username';
+$wb["stats_type_txt"] = 'Webstatistics program';
+$wb["custom_php_ini_txt"] = 'Custom php.ini settings';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb["nginx_directives_txt"] = 'nginx Directives';
+$wb["seo_redirect_txt"] = 'SEO Redirect';
+$wb["non_www_to_www_txt"] = 'Non-www -&gt; www';
+$wb["www_to_non_www_txt"] = 'www -&gt; non-www';
+$wb["php_fpm_use_socket_txt"] = 'Use Socket For PHP-FPM';
+$wb["error_no_sni_txt"] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb["python_txt"] = 'Python';
+$wb["perl_txt"] = 'Perl';
+$wb["pm_max_children_txt"] = 'PHP-FPM pm.max_children';
+$wb["pm_start_servers_txt"] = 'PHP-FPM pm.start_servers';
+$wb["pm_min_spare_servers_txt"] = 'PHP-FPM pm.min_spare_servers';
+$wb["pm_max_spare_servers_txt"] = 'PHP-FPM pm.max_spare_servers';
+$wb["error_php_fpm_pm_settings_txt"] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb["pm_max_children_error_regex"] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb["pm_start_servers_error_regex"] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb["pm_min_spare_servers_error_regex"] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb["pm_max_spare_servers_error_regex"] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb["hd_quota_error_regex"] = 'Harddisk quota is invalid.';
+$wb["traffic_quota_error_regex"] = 'Traffic quota is invalid.';
+$wb["fastcgi_php_version_txt"] = 'PHP Version';
+$wb["pm_txt"] = 'PHP-FPM Process Manager';
+$wb["pm_process_idle_timeout_txt"] = 'PHP-FPM pm.process_idle_timeout';
+$wb["pm_max_requests_txt"] = 'PHP-FPM pm.max_requests';
+$wb["pm_process_idle_timeout_error_regex"] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb["pm_max_requests_error_regex"] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb["pm_ondemand_hint_txt"] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = "CONFIGURATION ERROR";
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?> \ No newline at end of file
diff --git a/src/interface/web/sites/lib/lang/es_web_domain.lng b/src/interface/web/sites/lib/lang/es_web_domain.lng
new file mode 100644
index 0000000..d594432
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/es_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['backup_interval_txt'] = 'Intervalo de copia de seguridad';
+$wb['backup_copies_txt'] = 'Número de copias de seguridad';
+$wb['ssl_state_txt'] = 'Estado/Provincia';
+$wb['ssl_locality_txt'] = 'Localidad';
+$wb['ssl_organisation_txt'] = 'Organización';
+$wb['ssl_organisation_unit_txt'] = 'Departamento de la organización';
+$wb['ssl_country_txt'] = 'País';
+$wb['ssl_request_txt'] = 'SSL Request';
+$wb['ssl_cert_txt'] = 'SSL Certificate';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['ssl_domain_txt'] = 'SSL Dominio';
+$wb['server_id_txt'] = 'Servidor';
+$wb['domain_txt'] = 'Dominio';
+$wb['type_txt'] = 'Tipo';
+$wb['parent_domain_id_txt'] = 'Sitio web padre';
+$wb['redirect_type_txt'] = 'Tipo redirección';
+$wb['redirect_path_txt'] = 'Ruta redirección';
+$wb['active_txt'] = 'Activar';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Usuario Linux';
+$wb['system_group_txt'] = 'Grupo Linux';
+$wb['ip_address_txt'] = 'IPv4-Address';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['vhost_type_txt'] = 'VHost Tipo';
+$wb['hd_quota_txt'] = 'Couta disco duro';
+$wb['traffic_quota_txt'] = 'Cuota de tráfico';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Documentos propios de error';
+$wb['subdomain_txt'] = 'Auto-Subdominio';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Cliente';
+$wb['limit_web_domain_txt'] = 'Se ha alcanzado el número máximo de dominios web de esta cuenta';
+$wb['limit_web_aliasdomain_txt'] = 'Se ha alcanzado el número máximo de alias de dominios de esta cuenta';
+$wb['limit_web_subdomain_txt'] = 'Se ha alcanzado el número máximo de subdominios web de esta cuenta';
+$wb['apache_directives_txt'] = 'Directivas de Apache';
+$wb['domain_error_empty'] = 'El dominio está vacío.';
+$wb['domain_error_unique'] = 'Ya existe un sitio web o sub/aliasdominio con este nombre de dominio.';
+$wb['domain_error_regex'] = 'El nombre de dominio no es válido';
+$wb['hd_quota_error_empty'] = 'Cuota de disco duro es 0 o vacío.';
+$wb['traffic_quota_error_empty'] = 'Cuota de tráfico está vacío.';
+$wb['error_ssl_state_empty'] = 'Estado SSL está vacío.';
+$wb['error_ssl_locality_empty'] = 'Sitio SSL está vacío.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organización está vacío.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Unidad de Organización está vacío.';
+$wb['error_ssl_country_empty'] = 'País SSL está vacío.';
+$wb['error_ssl_cert_empty'] = 'Campo de certificado SSL está vacío.';
+$wb['client_group_id_txt'] = 'Cliente';
+$wb['stats_password_txt'] = 'Contraseña de estadísticas Web ';
+$wb['allow_override_txt'] = 'Apache AllowOverride';
+$wb['limit_web_quota_free_txt'] = 'Max. cuota disco duro disponible';
+$wb['ssl_state_error_regex'] = 'Estado no válido de SSL. Los caracteres válidos son: a-z, 0-9 y,-_.';
+$wb['ssl_locality_error_regex'] = 'Invalid Sitio válido SSL. Los caracteres válidos son: a-z, 0-9 y,-_.';
+$wb['ssl_organisation_error_regex'] = 'Organización no válido SSL. Los caracteres válidos son: a-z, 0-9 y,-_.';
+$wb['ssl_organistaion_unit_error_regex'] = 'Unidad de Organización no válido SSL. Los caracteres válidos son: a-z, 0-9 y,-_.';
+$wb['ssl_country_error_regex'] = 'País no válido SSL. Los caracteres válidos son: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. Cuota de tráfico disponible';
+$wb['redirect_error_regex'] = 'Redirección no válida camino. Redirecciones válidos son, por ejemplo,: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Cuota de tráfico excedida';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Estadísticas Web nombre de usuario';
+$wb['stats_type_txt'] = 'Estadísticas Web del programa';
+$wb['custom_php_ini_txt'] = 'Configuración personalizada de php.ini';
+$wb['none_txt'] = 'Ninguno';
+$wb['disabled_txt'] = 'Desactivado';
+$wb['no_redirect_txt'] = 'No redirigir';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Guardar el certificado';
+$wb['create_certificate_txt'] = 'Crear el certificado';
+$wb['delete_certificate_txt'] = 'Eliminar certificado';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -> www';
+$wb['www_to_non_www_txt'] = 'www -> non-www';
+$wb['php_fpm_use_socket_txt'] = 'Usar Socket para PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI para SSL no está activado en este servidor. Sólo es posible activar un certificado SSL en cada dirección IP.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Los valores de configuración de PHP-FPM pm debe ser como sigue: pm.max_children> = pm.max_spare_servers> = pm.start_servers> = pm.min_spare_servers> 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children debe ser un valor entero positivo.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers debe ser un valor entero positivo.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers debe ser un valor entero positivo.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers debe ser un valor entero positivo.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['perl_txt'] = 'Perl';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/fi_web_domain.lng b/src/interface/web/sites/lib/lang/fi_web_domain.lng
new file mode 100644
index 0000000..3070aa0
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/fi_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Lääni';
+$wb['ssl_locality_txt'] = 'Lokaali';
+$wb['ssl_organisation_txt'] = 'Organisaatio';
+$wb['ssl_organisation_unit_txt'] = 'Organisaatioyksikkö';
+$wb['ssl_country_txt'] = 'Maa';
+$wb['ssl_request_txt'] = 'SSL-pyyntö';
+$wb['ssl_cert_txt'] = 'SSL-sertifikaatti';
+$wb['ssl_bundle_txt'] = 'SSL-paketti';
+$wb['ssl_action_txt'] = 'SSL-toiminto';
+$wb['server_id_txt'] = 'Palvelin';
+$wb['domain_txt'] = 'Verkkotunnus';
+$wb['type_txt'] = 'Tyyppi';
+$wb['parent_domain_id_txt'] = 'Pääsivusto';
+$wb['redirect_type_txt'] = 'Edelleenohjauksen tyyppi';
+$wb['redirect_path_txt'] = 'Edelleenohjausosoite';
+$wb['active_txt'] = 'Käytössä';
+$wb['document_root_txt'] = 'Dokumenttikansio';
+$wb['system_user_txt'] = 'Linux-käyttäjä';
+$wb['system_group_txt'] = 'Käyttäjäryhmä';
+$wb['ip_address_txt'] = 'IP-osoite';
+$wb['vhost_type_txt'] = 'Virtuaali-isännän tyyppi';
+$wb['hd_quota_txt'] = 'Levytila';
+$wb['traffic_quota_txt'] = 'Liikenneraja';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Asiakas';
+$wb['limit_web_domain_txt'] = 'Käyttäjätunnuksella on jo sallittu määrä verkkotunnuksia.';
+$wb['limit_web_aliasdomain_txt'] = 'Käyttäjätunnuksella on jo sallittu määrä aliasverkkotunnuksia.';
+$wb['limit_web_subdomain_txt'] = 'Käyttäjätunnuksella on jo sallittu määrä aliverkkotunnuksia.';
+$wb['apache_directives_txt'] = 'Apachen direktiivit';
+$wb['domain_error_empty'] = 'Verkkotunnus-kenttä on tyhjä.';
+$wb['domain_error_unique'] = 'Tämä verkkotunnus on jo olemassa.';
+$wb['domain_error_regex'] = 'Verkkotunnus on vääränlainen.';
+$wb['hd_quota_error_empty'] = 'Levytila-kenttä on tyhjä.';
+$wb['traffic_quota_error_empty'] = 'Liikenneraja-kenttä on tyhjä.';
+$wb['errordocs_txt'] = 'Omat virhesivut';
+$wb['subdomain_txt'] = 'Automaattinen aliverkkotunnus';
+$wb['error_ssl_state_empty'] = 'SSL-lääni-kenttä on tyhjä.';
+$wb['error_ssl_locality_empty'] = 'SSL-lokaali-kenttä on tyhjä.';
+$wb['error_ssl_organisation_empty'] = 'SSL-organisaatio-kenttä on tyhjä.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL-organisaatioyksikkö-kenttä on tyhjä.';
+$wb['error_ssl_country_empty'] = 'SSL-maa-kenttä on tyhjä.';
+$wb['client_group_id_txt'] = 'Asiakas';
+$wb['stats_password_txt'] = 'Tilastoinnin salasana';
+$wb['ssl_domain_txt'] = 'SSL-verkkotunnus';
+$wb['allow_override_txt'] = 'Salli ohitus';
+$wb['limit_web_quota_free_txt'] = 'Suurin sallittu levytila';
+$wb['ssl_state_error_regex'] = 'Virheellinen SSL-lääni. Kelvolliset merkit ovat: a-z, 0-9 js .,-_';
+$wb['ssl_locality_error_regex'] = 'Virheellinen SSL-llokaali. Kelvolliset merkit ovat: a-z, 0-9 js .,-_';
+$wb['ssl_organisation_error_regex'] = 'Virheellinen SSL-organisaatio. Kelvolliset merkit ovat: a-z, 0-9 js .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Virheellinen SSL-organisaatioyksikkö. Kelvolliset merkit ovat: a-z, 0-9 js .,-_';
+$wb['ssl_country_error_regex'] = 'Virheellinen SSL-lääni. Kelvolliset merkit ovat: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Suurin sallittu liikennemäärä';
+$wb['redirect_error_regex'] = 'VIrheellinen edelleenohjausosoite. Kelvollisia ovat esimerkiksi: /testi/ tai http://www.domain.tld/testi/';
+$wb['php_open_basedir_txt'] = 'PHP:n avoin peruskansio';
+$wb['traffic_quota_exceeded_txt'] = 'Liikenneraja ylitetty';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/fr_web_domain.lng b/src/interface/web/sites/lib/lang/fr_web_domain.lng
new file mode 100644
index 0000000..7dea746
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/fr_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Pays';
+$wb['ssl_locality_txt'] = 'Localité';
+$wb['ssl_organisation_txt'] = 'Organisation';
+$wb['ssl_organisation_unit_txt'] = 'Unité d\'organisation';
+$wb['ssl_country_txt'] = 'Pays';
+$wb['ssl_request_txt'] = 'Requête SSL';
+$wb['ssl_cert_txt'] = 'Certificat SSL';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'Action SSL';
+$wb['server_id_txt'] = 'Serveur';
+$wb['domain_txt'] = 'Domaine';
+$wb['type_txt'] = 'Type';
+$wb['parent_domain_id_txt'] = 'Site web parent';
+$wb['redirect_type_txt'] = 'Type de redirection';
+$wb['redirect_path_txt'] = 'Chemin de redirection';
+$wb['active_txt'] = 'Actif';
+$wb['document_root_txt'] = 'Racine du document';
+$wb['system_user_txt'] = 'Utilisateur Linux';
+$wb['system_group_txt'] = 'Groupe Linux';
+$wb['ip_address_txt'] = 'Adresse IP';
+$wb['vhost_type_txt'] = 'Type de VHost';
+$wb['hd_quota_txt'] = 'Quota disque';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Pages derreurs personnalisées';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Client';
+$wb['limit_web_domain_txt'] = 'Le nombre maximum de noms de domaine pour votre compte a été atteint.';
+$wb['limit_web_aliasdomain_txt'] = 'Le nombre maximum d\'alias de domaine pour votre compte a été atteint.';
+$wb['limit_web_subdomain_txt'] = 'Le nombre maximum de sous-domaines pour votre compte a été atteint.';
+$wb['apache_directives_txt'] = 'Directives Apache';
+$wb['domain_error_empty'] = 'Le nom de domaine est vide.';
+$wb['domain_error_unique'] = 'Le nom de domaine doit être unique.';
+$wb['domain_error_regex'] = 'Le nom de domaine est invalide.';
+$wb['hd_quota_error_empty'] = 'Le quota disque est vide.';
+$wb['error_ssl_state_empty'] = 'Létat du SSL est vide.';
+$wb['error_ssl_locality_empty'] = 'La localité du SSL est vide.';
+$wb['error_ssl_organisation_empty'] = 'L\'organisation du SSL est vide.';
+$wb['error_ssl_organisation_unit_empty'] = 'L\'unité d\'organisation du SSL est vide.';
+$wb['error_ssl_country_empty'] = 'Le pays du SSL est vide.';
+$wb['subdomain_txt'] = 'Auto sous-domaine';
+$wb['client_group_id_txt'] = 'Client';
+$wb['stats_password_txt'] = 'Mot de passe statistiques web';
+$wb['backup_interval_txt'] = 'Intervalle de sauvegarde';
+$wb['backup_copies_txt'] = 'Nombre de copies de sauvegarde';
+$wb['ssl_domain_txt'] = 'Domaine SSL';
+$wb['traffic_quota_txt'] = 'Quota de trafic';
+$wb['traffic_quota_error_empty'] = 'Le quota de trafic est vide.';
+$wb['error_ssl_cert_empty'] = 'Le champ certificat SSL est vide';
+$wb['allow_override_txt'] = 'AllowOverride Apache';
+$wb['limit_web_quota_free_txt'] = 'Quota max espace disque disponible';
+$wb['ssl_state_error_regex'] = 'Etat SSL invalide. Les caractères valides sont: a-z, 0-9 et .,-_';
+$wb['ssl_locality_error_regex'] = 'Localité SSL invalide. Les caractères valides sont: a-z, 0-9 et .,-_';
+$wb['ssl_organisation_error_regex'] = 'Organisation SSL invalide. Les caractères valides sont: a-z, 0-9 et .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Unité dorganisation SSL invalide. Les caractères valides sont: a-z, 0-9 et .,-_';
+$wb['ssl_country_error_regex'] = 'Pays SSL invalide. Les caractères valides sont: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Quota de trafic max disponible';
+$wb['redirect_error_regex'] = 'Chemin de redirection invalide. Exemple de redirections valides: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'open_basedir PHP';
+$wb['traffic_quota_exceeded_txt'] = 'Quota de trafic dépassé';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Nom d\'utilisateur statistiques web';
+$wb['stats_type_txt'] = 'Programme de statistiques web';
+$wb['custom_php_ini_txt'] = 'Paramètres php.ini personnalisés';
+$wb['ipv6_address_txt'] = 'Adresse IPv6';
+$wb['none_txt'] = 'Aucun';
+$wb['disabled_txt'] = 'Désactivé';
+$wb['no_redirect_txt'] = 'Aucune redirection';
+$wb['no_flag_txt'] = 'Aucun flag';
+$wb['save_certificate_txt'] = 'Enregister le certificat';
+$wb['create_certificate_txt'] = 'Créer le certificat';
+$wb['delete_certificate_txt'] = 'Supprimer le certificat';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'Redirection SEO';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Utiliser Socket pour PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI pour SSL n\'est pas activé sur ce serveur. Vous ne pouvez activer qu\'un seul certificat SSL par adresse IP.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Les valeurs de configuration de PHP-FPM pm doivent être comme suit : pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'La valeur PHP-FPM pm.max_children doit être un entier positif.';
+$wb['pm_start_servers_error_regex'] = 'La valeur de PHP-FPM pm.start_servers doit être un entier positif.';
+$wb['pm_min_spare_servers_error_regex'] = 'La valeur de PHP-FPM pm.min_spare_servers doit être un entier positif.';
+$wb['pm_max_spare_servers_error_regex'] = 'La valeur de PHP-FPM pm.max_spare_servers doit être un entier positif.';
+$wb['hd_quota_error_regex'] = 'Le quota de disque dur est invalide.';
+$wb['traffic_quota_error_regex'] = 'Le quota de trafic est invalide.';
+$wb['ssl_key_txt'] = 'Clé SSL';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'Version de PHP';
+$wb['pm_txt'] = 'Manager de process PHP-FPM';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'La valeur de PHP-FPM pm.process_idle_timeout doit être un entier positif.';
+$wb['pm_max_requests_error_regex'] = 'La valeur de PHP-FPM pm.max_requests doit être un entier positif >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Votre version de PHP doit être >= 5.3.9 pour utiliser le manager de process ondemand. Si vous choisissez ondemand avec une version de PHP plus ancienne, PHP ne pourra plus démarrer !';
+$wb['generate_password_txt'] = 'Générer un mot de passe';
+$wb['repeat_password_txt'] = 'Vérification du mot de passe';
+$wb['password_mismatch_txt'] = 'Les mots de passe ne correspondent pas.';
+$wb['password_match_txt'] = 'Les mots de passe correspondent.';
+$wb['web_folder_error_regex'] = 'Le dossier saisi est invalide. Ne saisissez pas de ./ (slash).';
+$wb['domain_error_autosub'] = 'Un sous-domaine avec cette configuration existe déjà.';
+$wb['available_php_directive_snippets_txt'] = 'Directives PHP Snippets disponibles :';
+$wb['available_apache_directive_snippets_txt'] = 'Directives Apache Snippets disponibles :';
+$wb['available_nginx_directive_snippets_txt'] = 'Directives nginx Snippets disponibles :';
+$wb['proxy_directives_txt'] = 'Directives Proxy';
+$wb['available_proxy_directive_snippets_txt'] = 'Directives Proxy Snippets disponibles :';
+$wb['no_server_error'] = 'Aucun serveur sélectionné.';
+$wb['no_backup_txt'] = 'Pas de Backup';
+$wb['daily_backup_txt'] = 'Quotidien';
+$wb['weekly_backup_txt'] = 'Hebdomadaire';
+$wb['monthly_backup_txt'] = 'Mensuel';
+$wb['rewrite_rules_txt'] = 'Règles de réécriture';
+$wb['invalid_rewrite_rules_txt'] = 'Règles de réécriture incorrectes';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Directives autorisées :';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/hr_web_domain.lng b/src/interface/web/sites/lib/lang/hr_web_domain.lng
new file mode 100644
index 0000000..c7b0e4a
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/hr_web_domain.lng
@@ -0,0 +1,134 @@
+<?php
+$wb['backup_interval_txt'] = 'Interval backupa';
+$wb['backup_copies_txt'] = 'Broj backup kopija';
+$wb['ssl_state_txt'] = 'Županija';
+$wb['ssl_locality_txt'] = 'Grad';
+$wb['ssl_organisation_txt'] = 'Organizacija';
+$wb['ssl_organisation_unit_txt'] = 'Organizacijski sektor';
+$wb['ssl_country_txt'] = 'Država';
+$wb['ssl_request_txt'] = 'SSL zahtjev';
+$wb['ssl_cert_txt'] = 'SSL certifikat';
+$wb['ssl_bundle_txt'] = 'SSL paket';
+$wb['ssl_action_txt'] = 'SSL akcija';
+$wb['ssl_domain_txt'] = 'SSL domena';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domena';
+$wb['type_txt'] = 'Vrsta';
+$wb['parent_domain_id_txt'] = 'Glavna web stranica';
+$wb['redirect_type_txt'] = 'Vrsta redirekcije';
+$wb['redirect_path_txt'] = 'Redirect Path';
+$wb['active_txt'] = 'Aktivno';
+$wb['document_root_txt'] = 'Početni direktorij';
+$wb['system_user_txt'] = 'Linux korisnik';
+$wb['system_group_txt'] = 'Linux grupa';
+$wb['ip_address_txt'] = 'IP adresa';
+$wb['vhost_type_txt'] = 'Vrsta VHosta';
+$wb['hd_quota_txt'] = 'Limit kvote (prostor)';
+$wb['traffic_quota_txt'] = 'Limit prometa';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Vlastite error stranice';
+$wb['subdomain_txt'] = 'Automatska poddomena';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Klijent';
+$wb['limit_web_domain_txt'] = 'Iskorišten je maksimalan broj domena.';
+$wb['limit_web_aliasdomain_txt'] = 'Iskorišten je maksimalan broj alias domena.';
+$wb['limit_web_subdomain_txt'] = 'Iskorišten je maksimalan broj poddomena.';
+$wb['apache_directives_txt'] = 'Apache direktive';
+$wb['domain_error_empty'] = 'Naziv domene je prazan.';
+$wb['domain_error_unique'] = 'Već postoji web stranica ili poddomena / alias sa nazivom te domene.';
+$wb['domain_error_regex'] = 'Naziv domene nije ispravan.';
+$wb['hd_quota_error_empty'] = 'Limit kvote (prostor) je 0 ili je prazno.';
+$wb['traffic_quota_error_empty'] = 'Limit prometa je prazan.';
+$wb['error_ssl_state_empty'] = 'Niste unijeli županiju.';
+$wb['error_ssl_locality_empty'] = 'Niste unijeli grad.';
+$wb['error_ssl_organisation_empty'] = 'Niste unijeli organizaciju.';
+$wb['error_ssl_organisation_unit_empty'] = 'Niste unijeli organizacjski sektor.';
+$wb['error_ssl_country_empty'] = 'Niste unijeli državu.';
+$wb['error_ssl_cert_empty'] = 'Polje SSL certifikata je prazno';
+$wb['client_group_id_txt'] = 'Klijent';
+$wb['stats_password_txt'] = 'Šifra za statistiku';
+$wb['allow_override_txt'] = 'Apache AllowOverride';
+$wb['limit_web_quota_free_txt'] = 'Maksimalan limit kvote (prostor)';
+$wb['ssl_state_error_regex'] = 'Neispravan unos županije. Dozvoljeni znakovi: a-z, 0-9 i .,-_';
+$wb['ssl_locality_error_regex'] = 'Neispravan unos grada. Dozvoljeni znakovi: a-z, 0-9 i .,-_';
+$wb['ssl_organisation_error_regex'] = 'Neispravan unos organizacije. Dozvoljeni znakovi: a-z, 0-9 i .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Neispravan unos organizacijskog sektora. Dozvoljeni znakovi: a-z, 0-9 i .,-_';
+$wb['ssl_country_error_regex'] = 'Neispravan unos države. Dozvoljeni znakovi: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Maksimalan limit prometa web stranice';
+$wb['redirect_error_regex'] = 'Neispravna putanja redirekcije. Ispravne redirekcije su npr.: /test/ ili http://www.domena.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Iskoristili ste limit prometa web stranice.';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Korisničko ime za statistiku';
+$wb['stats_type_txt'] = 'Program za statistiku';
+$wb['custom_php_ini_txt'] = 'Vlastite php.ini postavke';
+$wb['ipv6_address_txt'] = 'IPv6 adresa';
+$wb['none_txt'] = 'Ništa';
+$wb['disabled_txt'] = 'Onemogućeno';
+$wb['no_redirect_txt'] = 'Bez redirekcije';
+$wb['no_flag_txt'] = 'Bez markiranja';
+$wb['save_certificate_txt'] = 'Spremi certifikat';
+$wb['create_certificate_txt'] = 'Kreiraj certifikat';
+$wb['delete_certificate_txt'] = 'Obriši certifikat';
+$wb['nginx_directives_txt'] = 'nginx direktive';
+$wb['seo_redirect_txt'] = 'SEO redirekcija';
+$wb['non_www_to_www_txt'] = 'Non-www -> www';
+$wb['www_to_non_www_txt'] = 'www -> non-www';
+$wb['php_fpm_use_socket_txt'] = 'Koristi socket za PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI za SSL nije aktiviran na ovom serveru. Možete omogućiti samo jedan SSL certifikat na svakoj IP adresi.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Vrijednosti PHP-FPM pm postavki moraju biti slijedeće: pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children mora biti pozitivan broj.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers mora biti pozitivan broj.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers mora biti pozitivan broj.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers mora biti pozitivan broj.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generiraj šifru';
+$wb['repeat_password_txt'] = 'Ponovi šifru';
+$wb['password_mismatch_txt'] = 'Šifre nisu identične.';
+$wb['password_match_txt'] = 'Šifre su identične.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'Već postoji poddomena sa ovim postavkama.';
+$wb['available_php_directive_snippets_txt'] = 'Dostupne PHP direktive:';
+$wb['available_apache_directive_snippets_txt'] = 'Dostupne Apache direktive:';
+$wb['available_nginx_directive_snippets_txt'] = 'Dostupne nginx direktive:';
+$wb['proxy_directives_txt'] = 'Proxy direktive';
+$wb['available_proxy_directive_snippets_txt'] = 'Dostupne Proxy direktive:';
+$wb['no_server_error'] = 'Nije izabran server.';
+$wb['no_backup_txt'] = 'Bez backup-a';
+$wb['daily_backup_txt'] = 'Dnevni backup';
+$wb['weekly_backup_txt'] = 'Tjedni backup';
+$wb['monthly_backup_txt'] = 'Mjesečni backup';
+$wb['rewrite_rules_txt'] = 'Rewrite pravila';
+$wb['invalid_rewrite_rules_txt'] = 'Neispravna Rewrite pravila';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Dozvoljene direktive:';
+$wb['configuration_error_txt'] = 'KONFIGURACIJSKA GREŠKA';
+$wb['variables_txt'] = 'Varijable';
+$wb['added_by_txt'] = 'Dodao';
+$wb['added_date_txt'] = 'Dodano';
+$wb['backup_excludes_txt'] = 'Izbačeni direktoriji';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'Izbačeni direktorij sadrži nedozvoljene znakove.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Neispravne php.ini postavke';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+?>
+
+
diff --git a/src/interface/web/sites/lib/lang/hu_web_domain.lng b/src/interface/web/sites/lib/lang/hu_web_domain.lng
new file mode 100644
index 0000000..9b3ff59
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/hu_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Megye';
+$wb['ssl_locality_txt'] = 'Város';
+$wb['ssl_organisation_txt'] = 'Cég';
+$wb['ssl_organisation_unit_txt'] = 'Osztály';
+$wb['ssl_country_txt'] = 'Ország';
+$wb['ssl_request_txt'] = 'SSL Kérés';
+$wb['ssl_cert_txt'] = 'SSL Certificate';
+$wb['ssl_bundle_txt'] = 'SSL Csomag';
+$wb['ssl_action_txt'] = 'SSL Akció';
+$wb['server_id_txt'] = 'Szerver';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Tipus';
+$wb['parent_domain_id_txt'] = 'Szülő Weboldal';
+$wb['redirect_type_txt'] = 'Átirányítás tipusa';
+$wb['redirect_path_txt'] = 'Átirányítás útvonal';
+$wb['active_txt'] = 'Aktív';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux felhasználó';
+$wb['system_group_txt'] = 'Linux csoport';
+$wb['ip_address_txt'] = 'IP-ím';
+$wb['vhost_type_txt'] = 'VHost Típus';
+$wb['hd_quota_txt'] = 'Táhely Korlát';
+$wb['traffic_quota_txt'] = 'Forgalom Korlát';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Saját hibaoldal';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['disabled_txt'] = 'Letiltva';
+$wb['client_txt'] = 'Ügyfél';
+$wb['limit_web_domain_txt'] = 'Nincs több weboldal lehetőség.';
+$wb['limit_web_aliasdomain_txt'] = 'Nincs több aliasdomain lehetőség.';
+$wb['limit_web_subdomain_txt'] = 'Nincs több aldomain lehetőség.';
+$wb['apache_directives_txt'] = 'Apache direktivák';
+$wb['domain_error_empty'] = 'Domain üres';
+$wb['domain_error_unique'] = 'Domain már foglalt.';
+$wb['domain_error_regex'] = 'Domain név hibás.';
+$wb['hd_quota_error_empty'] = 'Tárgely korlát üres.';
+$wb['traffic_quota_error_empty'] = 'Forgalom kvóta üres.';
+$wb['subdomain_txt'] = 'Automatikus Aldomain';
+$wb['error_ssl_state_empty'] = 'SSL State is empty.';
+$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisation is empty.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit is empty.';
+$wb['error_ssl_country_empty'] = 'SSL Country is empty.';
+$wb['client_group_id_txt'] = 'Ügyfél';
+$wb['stats_password_txt'] = 'Statisztika jelszó';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Mentés időpont';
+$wb['backup_copies_txt'] = 'Mentések száma';
+$wb['ruby_txt'] = 'Ruby';
+$wb['no_redirect_txt'] = 'Nincs átirányítás';
+$wb['no_flag_txt'] = 'No flag';
+$wb['none_txt'] = 'Nincs';
+$wb['save_certificate_txt'] = 'Save Certificate';
+$wb['create_certificate_txt'] = 'Create Certificate';
+$wb['delete_certificate_txt'] = 'Delete Certificate';
+$wb['stats_user_txt'] = 'Webstatistika felhasználónév';
+$wb['stats_type_txt'] = 'Webstatistika program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/id_web_domain.lng b/src/interface/web/sites/lib/lang/id_web_domain.lng
new file mode 100644
index 0000000..3506258
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/id_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Negara Bagian';
+$wb['ssl_locality_txt'] = 'Daerah';
+$wb['ssl_organisation_txt'] = 'Organisasi';
+$wb['ssl_organisation_unit_txt'] = 'Unit Organisasi';
+$wb['ssl_country_txt'] = 'Negara';
+$wb['ssl_request_txt'] = 'SSL Request';
+$wb['ssl_cert_txt'] = 'Sertifikat SSL';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Tipe';
+$wb['parent_domain_id_txt'] = 'Situs Web Induk';
+$wb['redirect_type_txt'] = 'Tipe Pengalihan';
+$wb['redirect_path_txt'] = 'Path Pengalihan';
+$wb['active_txt'] = 'Aktif';
+$wb['document_root_txt'] = 'Root Dokumen';
+$wb['system_user_txt'] = 'Pengguna Linux';
+$wb['system_group_txt'] = 'Grup Linux';
+$wb['ip_address_txt'] = 'Alamat IP';
+$wb['vhost_type_txt'] = 'Tipe VHost';
+$wb['hd_quota_txt'] = 'Kuota Harddisk';
+$wb['traffic_quota_txt'] = 'Kuota Trafik';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Dokumen-Kesalahan Pribadi';
+$wb['subdomain_txt'] = 'Subdomain Otomatis';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Klien';
+$wb['limit_web_domain_txt'] = 'Jumlah maks domain web untuk akun Anda telah tercapai.';
+$wb['limit_web_aliasdomain_txt'] = 'Jumlah maks alias domain untuk akun Anda telah tercapai.';
+$wb['limit_web_subdomain_txt'] = 'Jumlah maks subdomain web untuk akun Anda telah tercapai.';
+$wb['apache_directives_txt'] = 'Perintah-perintah Apache';
+$wb['domain_error_empty'] = 'Domain kosong.';
+$wb['domain_error_unique'] = 'Sudah ada situs web atau sub/alias domain dengan nama domain ini.';
+$wb['domain_error_regex'] = 'Nama domain tidak valid.';
+$wb['hd_quota_error_empty'] = 'Kuota Harddisk 0 atau kosong.';
+$wb['traffic_quota_error_empty'] = 'Kuota Trafik kosong.';
+$wb['error_ssl_state_empty'] = 'SSL Negara Bagian kosong.';
+$wb['error_ssl_locality_empty'] = 'SSL Daerah kosong.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisasi kosong.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Unit Organisasi kosong.';
+$wb['error_ssl_country_empty'] = 'SSL Negara kosong.';
+$wb['client_group_id_txt'] = 'Klien';
+$wb['stats_password_txt'] = 'Kata Sandi Statistik Web';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Kuota Harddisk Maks yang tersedia';
+$wb['ssl_state_error_regex'] = 'Negara Bagian SSL tidak valid. Karakter yang valid adalah: a-z, 0-9 dan .,-_';
+$wb['ssl_locality_error_regex'] = 'Daerah SSL tidak valid. Karakter yang valid adalah: a-z, 0-9 dan .,-_';
+$wb['ssl_organisation_error_regex'] = 'Organisasi SSL tidak valid. Karakter yang valid adalah: a-z, 0-9 dan .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Unit Organisasi SSL tidak valid. Karakter yang valid adalah: a-z, 0-9 dan .,-_';
+$wb['ssl_country_error_regex'] = 'Negara SSL tidak valid. Karakter yang valid adalah: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Maks Kuota Trafik yang tersedia';
+$wb['redirect_error_regex'] = 'Path pengalihan tidak valid. Pengalihat yang valid adalah sebagai contoh: /test/ atau http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Kuota Trafik terlampaui';
+$wb['backup_interval_txt'] = 'Interval Pencadangan';
+$wb['backup_copies_txt'] = 'Jumlah salinan pencadangan';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Nama Pengguna Statistik Web';
+$wb['stats_type_txt'] = 'Program Statistik Web';
+$wb['custom_php_ini_txt'] = 'Pengaturan php.ini kastem';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/it_web_domain.lng b/src/interface/web/sites/lib/lang/it_web_domain.lng
new file mode 100644
index 0000000..fcf69b4
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/it_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Stato';
+$wb['ssl_locality_txt'] = 'Locality';
+$wb['ssl_organisation_txt'] = 'Organizzazione';
+$wb['ssl_organisation_unit_txt'] = 'Organisation Unit';
+$wb['ssl_country_txt'] = 'Regione';
+$wb['ssl_request_txt'] = 'Richiesta SSL';
+$wb['ssl_cert_txt'] = 'Certificato SSL';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Dominio';
+$wb['type_txt'] = 'Tipo';
+$wb['parent_domain_id_txt'] = 'Parent Website';
+$wb['redirect_type_txt'] = 'Tipo Redirect';
+$wb['redirect_path_txt'] = 'Percorso Redirect';
+$wb['active_txt'] = 'Attivo';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Utente Linux';
+$wb['system_group_txt'] = 'Gruppo Linux';
+$wb['ip_address_txt'] = 'Indirizzo IP';
+$wb['vhost_type_txt'] = 'Tipo VHost';
+$wb['hd_quota_txt'] = 'Quota Harddisk';
+$wb['traffic_quota_txt'] = 'Quota Traffico';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Errori personalizzati';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Cliente';
+$wb['limit_web_domain_txt'] = 'The max. number of web domains for your account is reached.';
+$wb['limit_web_aliasdomain_txt'] = 'The max. number of aliasdomains for your account is reached.';
+$wb['limit_web_subdomain_txt'] = 'The max. number of web subdomains for your account is reached.';
+$wb['apache_directives_txt'] = 'Apache directives';
+$wb['domain_error_empty'] = 'Domain is empty.';
+$wb['domain_error_unique'] = 'Domain must be unique.';
+$wb['domain_error_regex'] = 'Domain name invalid.';
+$wb['hd_quota_error_empty'] = 'Harddisk quota is empty.';
+$wb['traffic_quota_error_empty'] = 'Traffic quota is empty.';
+$wb['error_ssl_state_empty'] = 'SSL State is empty.';
+$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisation is empty.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit is empty.';
+$wb['error_ssl_country_empty'] = 'SSL Country is empty.';
+$wb['subdomain_txt'] = 'Auto-Subdomain';
+$wb['client_group_id_txt'] = 'Client';
+$wb['stats_password_txt'] = 'Webstatistics password';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/ja_web_domain.lng b/src/interface/web/sites/lib/lang/ja_web_domain.lng
new file mode 100644
index 0000000..2a34ff8
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/ja_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'State(都道府県)';
+$wb['ssl_locality_txt'] = 'Locality(地域)';
+$wb['ssl_organisation_txt'] = 'Organisation(組織)';
+$wb['ssl_organisation_unit_txt'] = 'Organisation Unit(部署)';
+$wb['ssl_country_txt'] = 'Country(国)';
+$wb['ssl_request_txt'] = 'SSL CSR';
+$wb['ssl_cert_txt'] = 'SSL Certificate';
+$wb['ssl_bundle_txt'] = 'Chainファイル';
+$wb['ssl_action_txt'] = 'SSL 証明書の操作';
+$wb['server_id_txt'] = 'サーバー';
+$wb['domain_txt'] = 'ドメイン';
+$wb['type_txt'] = '種別';
+$wb['parent_domain_id_txt'] = 'Parent Website';
+$wb['redirect_type_txt'] = 'リダイレクトの方式';
+$wb['redirect_path_txt'] = 'リダイレクト先';
+$wb['active_txt'] = '有効';
+$wb['document_root_txt'] = 'ドキュメントルート';
+$wb['system_user_txt'] = 'Linuxユーザー';
+$wb['system_group_txt'] = 'Linuxグループ';
+$wb['ip_address_txt'] = 'IPアドレス';
+$wb['vhost_type_txt'] = 'VHost Type';
+$wb['hd_quota_txt'] = 'ディスクの容量';
+$wb['traffic_quota_txt'] = 'トラフィックの許容量';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = '独自のエラーページを使う';
+$wb['subdomain_txt'] = '自動サブドメイン';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'クライアント';
+$wb['limit_web_domain_txt'] = 'ウェブドメインが最大数に達したため、これ以上追加できません。';
+$wb['limit_web_aliasdomain_txt'] = 'エイリアスドメインが最大数に達した為、これ以上追加できません。';
+$wb['limit_web_subdomain_txt'] = 'ウェブサブドメインが最大数に達しました。';
+$wb['apache_directives_txt'] = 'Apache ディレクティブ';
+$wb['domain_error_empty'] = 'ドメインを指定してください';
+$wb['domain_error_unique'] = '同名のサブドメインまたはエイリアスドメインが存在します。';
+$wb['domain_error_regex'] = 'ドメイン名が不正です。';
+$wb['hd_quota_error_empty'] = 'ディスクの容量を入力してください。';
+$wb['traffic_quota_error_empty'] = 'トラフィックの許容量を入力してください。';
+$wb['error_ssl_state_empty'] = 'SSL の State(都道府県)を入力してください。';
+$wb['error_ssl_locality_empty'] = 'SSL の Locality(地域)を入力してください。';
+$wb['error_ssl_organisation_empty'] = 'SSL の Organization(組織)を入力してください。';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL の Organization Unit(部署)を入力してください。';
+$wb['error_ssl_country_empty'] = 'SSL の Country(国)を入力してください。';
+$wb['client_group_id_txt'] = 'クライアント';
+$wb['stats_password_txt'] = 'アクセス統計ページのパスワード';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/nl_web_domain.lng b/src/interface/web/sites/lib/lang/nl_web_domain.lng
new file mode 100644
index 0000000..e1ecbf2
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/nl_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Aantal backup exemplaren';
+$wb['ssl_state_txt'] = 'Provincie/staat';
+$wb['ssl_locality_txt'] = 'Plaatsnaam';
+$wb['ssl_organisation_txt'] = 'Organisatie';
+$wb['ssl_organisation_unit_txt'] = 'Organisatie afdeling';
+$wb['ssl_country_txt'] = 'Land';
+$wb['ssl_request_txt'] = 'SSL Request';
+$wb['ssl_cert_txt'] = 'SSL Certificaat';
+$wb['ssl_bundle_txt'] = 'SSL Bundel';
+$wb['ssl_action_txt'] = 'SSL Actie';
+$wb['ssl_domain_txt'] = 'SSL Domein';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domein';
+$wb['type_txt'] = 'Type';
+$wb['parent_domain_id_txt'] = 'Parent website';
+$wb['redirect_type_txt'] = 'Redirect type';
+$wb['redirect_path_txt'] = 'Redirect pad';
+$wb['active_txt'] = 'Actief';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux gebruiker';
+$wb['system_group_txt'] = 'Linux Groep';
+$wb['ip_address_txt'] = 'IP-Adres';
+$wb['vhost_type_txt'] = 'VHost type';
+$wb['hd_quota_txt'] = 'Harddisk quota';
+$wb['traffic_quota_txt'] = 'Traffic quota';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Own Error-documenten';
+$wb['subdomain_txt'] = 'Auto-subdomein';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Klant';
+$wb['limit_web_domain_txt'] = 'Het max.aantal web domeinen voor uw account is bereikt.';
+$wb['limit_web_aliasdomain_txt'] = 'Het max. aantal aliasdomeinen voor uw account is bereikt.';
+$wb['limit_web_subdomain_txt'] = 'Het max. aantal web subdomeinen voor uw account is bereikt.';
+$wb['apache_directives_txt'] = 'Apache directives';
+$wb['domain_error_empty'] = 'Domein is niet ingvuld.';
+$wb['domain_error_unique'] = 'Er is al een website of sub / aliasdomein met deze domeinnaam.';
+$wb['domain_error_regex'] = 'Domeinnaam ongeldig.';
+$wb['hd_quota_error_empty'] = 'Harddisk quota is 0 of leeg.';
+$wb['traffic_quota_error_empty'] = 'Traffic quota is niet ingvuld.';
+$wb['error_ssl_state_empty'] = 'SSL State is niet ingvuld.';
+$wb['error_ssl_locality_empty'] = 'SSL Plaatsnaam is niet ingvuld.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisatie is niet ingvuld.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisatie afdeling is niet ingvuld.';
+$wb['error_ssl_country_empty'] = 'SSL land is niet ingvuld.';
+$wb['client_group_id_txt'] = 'Klant';
+$wb['stats_password_txt'] = 'Webstatististieken wachtwoord';
+$wb['allow_override_txt'] = 'Apache AllowOverride';
+$wb['limit_web_quota_free_txt'] = 'Max. beschikbare harddisk quota';
+$wb['ssl_state_error_regex'] = 'Ongeldige SSL Provincie/staat. Geldige karakters zijn: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Ongeldige SSL plaatsnaam. Geldige karakters zijn: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Ongeldige SSL Organisation. Geldige karakters zijn: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Ongeldige SSL Organisation Unit. Geldige karakters zijn: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Ongeldige SSL land. Geldige karakters zijn: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. beschikbare traffic quota';
+$wb['redirect_error_regex'] = 'Ongeldig redirect pad. Heldige redirects zijn bijvoorbeeld: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota overschreden';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatististieken gebruikersnaam';
+$wb['stats_type_txt'] = 'Webstatististieken programma';
+$wb['custom_php_ini_txt'] = 'Custom php.ini instellingen';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/pl_web_domain.lng b/src/interface/web/sites/lib/lang/pl_web_domain.lng
new file mode 100644
index 0000000..e3f5171
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/pl_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Województwo';
+$wb['ssl_locality_txt'] = 'Lokalizacja';
+$wb['ssl_organisation_txt'] = 'Organizacja';
+$wb['ssl_organisation_unit_txt'] = 'Jednosta organizacji';
+$wb['ssl_country_txt'] = 'Państwo';
+$wb['ssl_request_txt'] = 'Żądanie SSL';
+$wb['ssl_cert_txt'] = 'Certyfikat SSL';
+$wb['ssl_bundle_txt'] = 'Paczka SSL';
+$wb['ssl_action_txt'] = 'Akcja SSL';
+$wb['server_id_txt'] = 'Serwer';
+$wb['domain_txt'] = 'Domena';
+$wb['type_txt'] = 'Typ';
+$wb['parent_domain_id_txt'] = 'Macierzysta strona www';
+$wb['redirect_type_txt'] = 'Rodzaj przekierowania';
+$wb['redirect_path_txt'] = 'Ścieżka przekierowania';
+$wb['active_txt'] = 'Aktywny';
+$wb['document_root_txt'] = 'Katalog strony';
+$wb['system_user_txt'] = 'Użytkownik systemowy';
+$wb['system_group_txt'] = 'Grupa systemowa';
+$wb['ip_address_txt'] = 'Adres IP';
+$wb['vhost_type_txt'] = 'Rodzaj VHosta';
+$wb['hd_quota_txt'] = 'Limit dysku twardego';
+$wb['traffic_quota_txt'] = 'Limit ruchu na serwerze';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Własne strony błędów';
+$wb['subdomain_txt'] = 'Automatyczna subdomena';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Klient';
+$wb['limit_web_domain_txt'] = 'Maksymalna ilość domen dla Twojego konta została przekroczona.';
+$wb['limit_web_aliasdomain_txt'] = 'Maksymalna ilość aliasów domen dla Twojego konta została przekroczona.';
+$wb['limit_web_subdomain_txt'] = 'Maksymalna ilość subdomen dla Twojego konta została przekroczona.';
+$wb['apache_directives_txt'] = 'Dyrektywy Apache';
+$wb['domain_error_empty'] = 'Domena jest pusta.';
+$wb['domain_error_unique'] = 'Istnieje już strona www, alias lub subdomena dla tej domeny.';
+$wb['domain_error_regex'] = 'Nazwa domeny jest niepoprawna.';
+$wb['hd_quota_error_empty'] = 'Limit twardego dysku jest pusty.';
+$wb['traffic_quota_error_empty'] = 'Limit ruchu na serwerze jest pusty.';
+$wb['error_ssl_state_empty'] = 'Stan SSL jest pusty.';
+$wb['error_ssl_locality_empty'] = 'Lokalność SSL jest pusta.';
+$wb['error_ssl_organisation_empty'] = 'Organizacja SSL jest pusta.';
+$wb['error_ssl_organisation_unit_empty'] = 'Jednosta ogranizacji SSL jest pusta.';
+$wb['error_ssl_country_empty'] = 'Państwo SSL jest puste.';
+$wb['client_group_id_txt'] = 'Klient';
+$wb['stats_password_txt'] = 'Hasło statystyk strony www';
+$wb['ssl_domain_txt'] = 'Domena SSL';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Maksymalny dostępny limit dysku';
+$wb['ssl_state_error_regex'] = 'Nieprawidłowy stan SSL. Dozwolone znaki to: a-z, 0-9 oraz .,-_';
+$wb['ssl_locality_error_regex'] = 'Nieprawidłowa lokalizacja SSL. Dozwolone znaki to: a-z, 0-9 oraz .,-_';
+$wb['ssl_organisation_error_regex'] = 'Nieprawidłowa organizacja SSL. Dozwolone znaki to: a-z, 0-9 oraz .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Nieprawidłowa jednostka organizacji SSL. Dozwolone znaki to: a-z, 0-9 oraz .,-_';
+$wb['ssl_country_error_regex'] = 'Nieprawidłowy kraj SSL. Dozwolone znaki to: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Maksymalny dostępny limit transferu';
+$wb['redirect_error_regex'] = 'Nieprawidłowa ścieżka przekierowania. Poprawne przekierowania to np.: /test/ lub http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Limit transferu przekroczony.';
+$wb['backup_interval_txt'] = 'Odstęp między kopiami zapasowymi';
+$wb['backup_copies_txt'] = 'Liczba kopii zapasowych';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Nazwa użytkownika statystyk';
+$wb['stats_type_txt'] = 'Rodzaj statystyk';
+$wb['custom_php_ini_txt'] = 'Własne ustawienia php.ini';
+$wb['error_ssl_cert_empty'] = 'Pole certyfikatu SSL jest puste';
+$wb['none_txt'] = 'Brak';
+$wb['disabled_txt'] = 'Wyłączone';
+$wb['no_redirect_txt'] = 'Bez przekierowania';
+$wb['no_flag_txt'] = 'Bez flagi';
+$wb['save_certificate_txt'] = 'Zapisz certyfikat';
+$wb['create_certificate_txt'] = 'Utwórz certyfikat';
+$wb['delete_certificate_txt'] = 'Usuń certyfikat';
+$wb['ipv6_address_txt'] = 'Adres IPv6';
+$wb['nginx_directives_txt'] = 'Dyrektywy nginx';
+$wb['seo_redirect_txt'] = 'Przekierowanie SEO';
+$wb['non_www_to_www_txt'] = 'bez www -> www';
+$wb['www_to_non_www_txt'] = 'www -> bez www';
+$wb['php_fpm_use_socket_txt'] = 'Użyj gniazda dla PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI dla SSL nie jest aktywowane na tym serwerze. Możesz utworzyć tylko jeden certyfikat SSL dla jednego adresu IP.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Wartości ustawień PHP-FPM pm muszą być następujące: pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children musi być całkowitą liczną dodatnią.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers musi być całkowitą liczną dodatnią.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers musi być całkowitą liczną dodatnią.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers musi być całkowitą liczną dodatnią.';
+$wb['hd_quota_error_regex'] = 'Limit dysku jest nieprawidłowy.';
+$wb['traffic_quota_error_regex'] = 'Limit transferu jest nieprawidłowy.';
+$wb['ssl_key_txt'] = 'Klucz SSL';
+$wb['web_folder_error_regex'] = 'Wprowadzono nieprawidłowy katalog. Proszę nie wpisywać znaku slash [ / ]';
+$wb['domain_error_autosub'] = 'Istnieje już subdomena z tymi ustawieniami.';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'Wersja PHP';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout musi być całkowitą wartością dodatnią';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests musi być całkowitą wartością >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Musisz mieć PHP w wersji >= 5.3.9 aby użyć ondemand process manager. Jeżeli wybierzesz ondemand dla starszej wersji, PHP nie zadziała w ogóle!';
+$wb['generate_password_txt'] = 'Generuj hasło';
+$wb['repeat_password_txt'] = 'Powtórz hasło';
+$wb['password_mismatch_txt'] = 'Hasła nie pasują';
+$wb['password_match_txt'] = 'Hasła pasują';
+$wb['available_php_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw PHP:';
+$wb['available_apache_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw Apache:';
+$wb['available_nginx_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw nginx:';
+$wb['proxy_directives_txt'] = 'Dyrektywy Proxy';
+$wb['available_proxy_directive_snippets_txt'] = 'Dostępne zestawy dyrektyw Proxy:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/pt_web_domain.lng b/src/interface/web/sites/lib/lang/pt_web_domain.lng
new file mode 100644
index 0000000..e279f8d
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/pt_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Estado';
+$wb['ssl_locality_txt'] = 'Localização';
+$wb['ssl_organisation_txt'] = 'Empresa';
+$wb['ssl_organisation_unit_txt'] = 'Departamento';
+$wb['ssl_country_txt'] = 'País';
+$wb['ssl_request_txt'] = 'Requisição SSL';
+$wb['ssl_cert_txt'] = 'Certificado SSL';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['server_id_txt'] = 'Servidor';
+$wb['domain_txt'] = 'Domínio';
+$wb['type_txt'] = 'Tipo';
+$wb['parent_domain_id_txt'] = 'Site Parente';
+$wb['redirect_type_txt'] = 'Tipo Redireccionamento';
+$wb['redirect_path_txt'] = 'Pasta de redireccionamento';
+$wb['active_txt'] = 'Activo';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Utilizador Linux';
+$wb['system_group_txt'] = 'Groupo Linux';
+$wb['ip_address_txt'] = 'Endereço-IP';
+$wb['vhost_type_txt'] = 'Tipo de VHost';
+$wb['hd_quota_txt'] = 'Cota de Disco';
+$wb['traffic_quota_txt'] = 'Cota de Tráfego';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Páginas de Erro';
+$wb['subdomain_txt'] = 'Auto-Subdomínio';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Cliente';
+$wb['limit_web_domain_txt'] = 'O número máximo de domínios web para a conta foi atingido.';
+$wb['limit_web_aliasdomain_txt'] = 'O número máximo de aliases domínio para a conta foi atingido.';
+$wb['limit_web_subdomain_txt'] = 'O número máximo de sub-domínios para a conta foi atingido.';
+$wb['apache_directives_txt'] = 'Directivas do Apache';
+$wb['domain_error_empty'] = 'Domínio em branco.';
+$wb['domain_error_unique'] = 'Já existe site, alias ou sub-domínio com este nome';
+$wb['domain_error_regex'] = 'Nome de domínio inválido.';
+$wb['hd_quota_error_empty'] = 'Quota de disco está em branco.';
+$wb['traffic_quota_error_empty'] = 'Quota de tráfego está em branco.';
+$wb['error_ssl_state_empty'] = 'Estado do SSL está em branco.';
+$wb['error_ssl_locality_empty'] = 'Localização do SSL está em branco.';
+$wb['error_ssl_organisation_empty'] = 'Empresa do SSL está em branco.';
+$wb['error_ssl_organisation_unit_empty'] = 'Departamento do SSL está em branco.';
+$wb['error_ssl_country_empty'] = 'País do SSL em branco.';
+$wb['client_group_id_txt'] = 'Cliente';
+$wb['stats_password_txt'] = 'Senha da pasta de estatísticas';
+$wb['ssl_domain_txt'] = 'Domínio SSL';
+$wb['allow_override_txt'] = 'Permitir Sobrescrever';
+$wb['limit_web_quota_free_txt'] = 'Cota Max. de disco disponível';
+$wb['ssl_state_error_regex'] = 'Estado inválido para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_locality_error_regex'] = 'Localidade inválida para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_organisation_error_regex'] = 'Empresa inválida para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Departamento inválido para SSL. São caracteres válidos: a-z, 0-9 e .,-_';
+$wb['ssl_country_error_regex'] = 'País inválido para SSL. São caracteres válidos: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Cota máxima de Tráfego disponível';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/ro_web_domain.lng b/src/interface/web/sites/lib/lang/ro_web_domain.lng
new file mode 100644
index 0000000..9dbd4c1
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/ro_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Judet';
+$wb['ssl_locality_txt'] = 'Localitate';
+$wb['ssl_organisation_txt'] = 'Organizatie';
+$wb['ssl_organisation_unit_txt'] = 'Unitate din Organizatie';
+$wb['ssl_country_txt'] = 'Tara';
+$wb['ssl_request_txt'] = 'SSL Cerere';
+$wb['ssl_cert_txt'] = 'SSL Certificat';
+$wb['ssl_bundle_txt'] = 'SSL Bundle (pachet)';
+$wb['ssl_action_txt'] = 'SSL Actiune';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Tip';
+$wb['parent_domain_id_txt'] = 'Parinte Website';
+$wb['redirect_type_txt'] = 'Redirect Tip';
+$wb['redirect_path_txt'] = 'Redirect Path';
+$wb['active_txt'] = 'Active';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux User';
+$wb['system_group_txt'] = 'Linux Group';
+$wb['ip_address_txt'] = 'IP-Address';
+$wb['vhost_type_txt'] = 'VHost Type';
+$wb['hd_quota_txt'] = 'Harddisk Quota';
+$wb['traffic_quota_txt'] = 'Traffic Quota';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Own Error-Documents';
+$wb['subdomain_txt'] = 'Auto-Subdomain';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Client';
+$wb['limit_web_domain_txt'] = 'Numarul maxim de domenii web pe contl dumneavoastra a fost atins';
+$wb['limit_web_aliasdomain_txt'] = 'Numarul maxim de aliasuri pe contul dumneavoastra a fost atins';
+$wb['limit_web_subdomain_txt'] = 'Numarul maxim de web subdomenii pe contul dumneavoastra a fost atins';
+$wb['apache_directives_txt'] = 'Apache directive';
+$wb['domain_error_empty'] = 'Domain este necompletat';
+$wb['domain_error_unique'] = 'deja exista un domeniu /subdomeniu asemanator';
+$wb['domain_error_regex'] = 'Domain name invalid.';
+$wb['hd_quota_error_empty'] = 'Harddisk quota necompletata';
+$wb['traffic_quota_error_empty'] = 'Traffic quota necompletata';
+$wb['error_ssl_state_empty'] = 'SSL Judet necompletata';
+$wb['error_ssl_locality_empty'] = 'SSL Localitate necompletata';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisation necompletata';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit necompletata';
+$wb['error_ssl_country_empty'] = 'SSL Tara necompletata';
+$wb['client_group_id_txt'] = 'Client';
+$wb['stats_password_txt'] = 'Webstatistics password';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/ru_web_domain.lng b/src/interface/web/sites/lib/lang/ru_web_domain.lng
new file mode 100644
index 0000000..8e94444
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/ru_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Область/край';
+$wb['ssl_locality_txt'] = 'Locality';
+$wb['ssl_organisation_txt'] = 'Компания';
+$wb['ssl_organisation_unit_txt'] = 'Organisation Unit';
+$wb['ssl_country_txt'] = 'Страна';
+$wb['ssl_request_txt'] = 'Запрос SSL';
+$wb['ssl_cert_txt'] = 'SSL сертификат';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['server_id_txt'] = 'Сервер';
+$wb['domain_txt'] = 'Домен';
+$wb['type_txt'] = 'Тип';
+$wb['parent_domain_id_txt'] = 'Дочерний Web-сайт';
+$wb['redirect_type_txt'] = 'Тип редиректа';
+$wb['redirect_path_txt'] = 'Путь редиректа';
+$wb['active_txt'] = 'Активен?';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Пользователь Linux';
+$wb['system_group_txt'] = 'Группа Linux';
+$wb['ip_address_txt'] = 'IP-адрес';
+$wb['vhost_type_txt'] = 'VHost Тип';
+$wb['hd_quota_txt'] = 'Квота HDD';
+$wb['traffic_quota_txt'] = 'Квота трафика';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Клиент';
+$wb['limit_web_domain_txt'] = 'Достигнуто макс. число web-сайтов для вашего аккаунта.';
+$wb['limit_web_aliasdomain_txt'] = 'Достигнуто макс. число алиасов доменовдля вашего аккаунта.';
+$wb['limit_web_subdomain_txt'] = 'Достигнуто максимальное количество субдоменов для вашего аккаунта.';
+$wb['apache_directives_txt'] = 'Директивы Apache';
+$wb['domain_error_empty'] = 'Домен пустой.';
+$wb['domain_error_unique'] = 'Домен должен быть уникальным.';
+$wb['domain_error_regex'] = 'Имя домен неправильно.';
+$wb['hd_quota_error_empty'] = 'Пустое значение квоты HDD.';
+$wb['traffic_quota_error_empty'] = 'Пустое значение квоты трафика.';
+$wb['errordocs_txt'] = 'Общие Error-Documents';
+$wb['error_ssl_state_empty'] = 'SSL область/край пуст.';
+$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';
+$wb['error_ssl_organisation_empty'] = 'SSL организация пуста.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit is empty.';
+$wb['error_ssl_country_empty'] = 'SSL страна пуста.';
+$wb['subdomain_txt'] = 'Авто-субдомен';
+$wb['client_group_id_txt'] = 'Клиент';
+$wb['stats_password_txt'] = 'Пароль к Web-статистике';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Макс. доступная квота HDD';
+$wb['ssl_state_error_regex'] = 'Неверная область/край SSL. Корректные имволы: a-z, 0-9 и .,-_';
+$wb['ssl_locality_error_regex'] = 'Неверное SSL Locality. Корректные символы: a-z, 0-9 и .,-_';
+$wb['ssl_organisation_error_regex'] = 'Неверная SSL организация. кореектные символы: a-z, 0-9 и .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Неверный SSL Organisation Unit. Корректные символы: a-z, 0-9 и .,-_';
+$wb['ssl_country_error_regex'] = 'Неверная SSL Country. Разрешенные символы: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Макс.доступная квота трафика';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/se_web_domain.lng b/src/interface/web/sites/lib/lang/se_web_domain.lng
new file mode 100644
index 0000000..eb9e787
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/se_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Status';
+$wb['ssl_locality_txt'] = 'Locality';
+$wb['ssl_organisation_txt'] = 'Organisation';
+$wb['ssl_organisation_unit_txt'] = 'Organisationsenhet';
+$wb['ssl_country_txt'] = 'Land';
+$wb['ssl_request_txt'] = 'SSL-förfrågan';
+$wb['ssl_cert_txt'] = 'SSL-certifikat';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Action';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Domän';
+$wb['type_txt'] = 'Typ';
+$wb['parent_domain_id_txt'] = 'Föräldrawebbsida';
+$wb['redirect_type_txt'] = 'Omdirigeringstyp';
+$wb['redirect_path_txt'] = 'Omdirigeringssökväg';
+$wb['active_txt'] = 'Aktiv';
+$wb['document_root_txt'] = 'Dokumentroot';
+$wb['system_user_txt'] = 'Linuxanvändare';
+$wb['system_group_txt'] = 'Linux Group';
+$wb['ip_address_txt'] = 'IP-Address';
+$wb['vhost_type_txt'] = 'VHost Type';
+$wb['hd_quota_txt'] = 'Harddisk Quota';
+$wb['traffic_quota_txt'] = 'Traffic Quota';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Own Error-Documents';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Client';
+$wb['limit_web_domain_txt'] = 'The max. number of web domains for your account is reached.';
+$wb['limit_web_aliasdomain_txt'] = 'The max. number of aliasdomains for your account is reached.';
+$wb['limit_web_subdomain_txt'] = 'The max. number of web subdomains for your account is reached.';
+$wb['apache_directives_txt'] = 'Apache directives';
+$wb['domain_error_empty'] = 'Domain is empty.';
+$wb['domain_error_unique'] = 'Domain must be unique.';
+$wb['domain_error_regex'] = 'Domain name invalid.';
+$wb['hd_quota_error_empty'] = 'Harddisk quota is empty.';
+$wb['traffic_quota_error_empty'] = 'Traffic quota is empty.';
+$wb['error_ssl_state_empty'] = 'SSL State is empty.';
+$wb['error_ssl_locality_empty'] = 'SSL Locality is empty.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organisation is empty.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organisation Unit is empty.';
+$wb['error_ssl_country_empty'] = 'SSL Country is empty.';
+$wb['subdomain_txt'] = 'Auto-Subdomain';
+$wb['client_group_id_txt'] = 'Client';
+$wb['stats_password_txt'] = 'Webstatistics password';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'Ingen server vald';
+$wb['no_backup_txt'] = 'Ingen backup';
+$wb['daily_backup_txt'] = 'Daglig';
+$wb['weekly_backup_txt'] = 'Veckovis';
+$wb['monthly_backup_txt'] = 'Månatlig';
+$wb['rewrite_rules_txt'] = 'Omskrivningsregler';
+$wb['invalid_rewrite_rules_txt'] = 'Ogiltiga omskrivningsregler';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variabler';
+$wb['added_by_txt'] = 'Tillagd av';
+$wb['added_date_txt'] = 'Tillagd datum';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Ogiltiga php.ini-inställningar';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/sk_web_domain.lng b/src/interface/web/sites/lib/lang/sk_web_domain.lng
new file mode 100644
index 0000000..affc3f2
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/sk_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Štát';
+$wb['ssl_locality_txt'] = 'Lokalita';
+$wb['ssl_organisation_txt'] = 'Organizácia';
+$wb['ssl_organisation_unit_txt'] = 'Organizačná zložka';
+$wb['ssl_country_txt'] = 'Krajina';
+$wb['ssl_request_txt'] = 'SSL Požiadavka';
+$wb['ssl_cert_txt'] = 'SSL Certifikát';
+$wb['ssl_bundle_txt'] = 'SSL Bundle';
+$wb['ssl_action_txt'] = 'SSL Akcia';
+$wb['server_id_txt'] = 'Server';
+$wb['domain_txt'] = 'Doména';
+$wb['type_txt'] = 'Typ';
+$wb['parent_domain_id_txt'] = 'Parent Website';
+$wb['redirect_type_txt'] = 'Redirect Type';
+$wb['redirect_path_txt'] = 'Redirect Path';
+$wb['active_txt'] = 'Aktívne';
+$wb['document_root_txt'] = 'DocumentRoot';
+$wb['system_user_txt'] = 'Linuxový uživateľ';
+$wb['system_group_txt'] = 'Linuxová Skupina';
+$wb['ip_address_txt'] = 'IP-Adresa';
+$wb['vhost_type_txt'] = 'VHost Typ';
+$wb['hd_quota_txt'] = 'Harddisk Kvóta';
+$wb['traffic_quota_txt'] = 'Kvóta vyťaženia';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Vlastné Error-Dokumenty';
+$wb['subdomain_txt'] = 'Auto-Subdomény';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Klient';
+$wb['limit_web_domain_txt'] = 'Max. počet internetových domén pre Váš účet je dosiahnutý.';
+$wb['limit_web_aliasdomain_txt'] = 'Max. počet alias domén pre Váš účet je dosiahnutý.';
+$wb['limit_web_subdomain_txt'] = 'Max. počet webových subdomény účtu je dosiahnutý.';
+$wb['apache_directives_txt'] = 'Apache smerníce';
+$wb['domain_error_empty'] = 'Doména je prázdna.';
+$wb['domain_error_unique'] = 'Existuje už webová stránka alebo sub / alias doména k tejto doméne.';
+$wb['domain_error_regex'] = 'Doménové meno neplatné.';
+$wb['hd_quota_error_empty'] = 'Harddisk kvóta je prázdna.';
+$wb['traffic_quota_error_empty'] = 'Kvóta vyťaženia je prázdna.';
+$wb['error_ssl_state_empty'] = 'SSL Štát je prázdny.';
+$wb['error_ssl_locality_empty'] = 'SSL Lokalita je prázdna.';
+$wb['error_ssl_organisation_empty'] = 'SSL Organizácia je prázdna.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Organizačné zložka je prázdna.';
+$wb['error_ssl_country_empty'] = 'SSL Krajina je prázdna.';
+$wb['client_group_id_txt'] = 'Klient';
+$wb['stats_password_txt'] = 'Webštatistika heslo';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. available Harddisk Quota';
+$wb['ssl_state_error_regex'] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_locality_error_regex'] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organisation_error_regex'] = 'Invalid SSL Organisation. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Invalid SSL Organisation Unit. Valid characters are: a-z, 0-9 and .,-_';
+$wb['ssl_country_error_regex'] = 'Invalid SSL Country. Valid characters are: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. available Traffic Quota';
+$wb['redirect_error_regex'] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/lib/lang/tr_web_domain.lng b/src/interface/web/sites/lib/lang/tr_web_domain.lng
new file mode 100644
index 0000000..4802840
--- /dev/null
+++ b/src/interface/web/sites/lib/lang/tr_web_domain.lng
@@ -0,0 +1,133 @@
+<?php
+$wb['ssl_state_txt'] = 'Mevki';
+$wb['ssl_locality_txt'] = 'Semt';
+$wb['ssl_organisation_txt'] = 'Kuruluş';
+$wb['ssl_organisation_unit_txt'] = 'Kuruluş Ünitesi';
+$wb['ssl_country_txt'] = 'Ülke';
+$wb['ssl_request_txt'] = 'SSL İsteği';
+$wb['ssl_cert_txt'] = 'SSL Sertifikası';
+$wb['ssl_bundle_txt'] = 'SSL Yığını';
+$wb['ssl_action_txt'] = 'SSL Eylemi';
+$wb['server_id_txt'] = 'Sunucu';
+$wb['domain_txt'] = 'Domain';
+$wb['type_txt'] = 'Çeşit';
+$wb['parent_domain_id_txt'] = 'Ana Website';
+$wb['redirect_type_txt'] = 'Yönlendirme Çeşidi';
+$wb['redirect_path_txt'] = 'Yönlendirme Yolu';
+$wb['active_txt'] = 'Aktif';
+$wb['document_root_txt'] = 'Documentroot';
+$wb['system_user_txt'] = 'Linux Kullanıcısı';
+$wb['system_group_txt'] = 'Linux Grubu';
+$wb['ip_address_txt'] = 'IP Adresi';
+$wb['vhost_type_txt'] = 'VHost Çeşidi';
+$wb['hd_quota_txt'] = 'Harddisk Kotası';
+$wb['traffic_quota_txt'] = 'Trafik Kotası';
+$wb['cgi_txt'] = 'CGI';
+$wb['ssi_txt'] = 'SSI';
+$wb['errordocs_txt'] = 'Özelleştirilebilir Hata Sayfaları';
+$wb['subdomain_txt'] = 'Otomatik Subdomain';
+$wb['ssl_txt'] = 'SSL';
+$wb['ssl_letsencrypt_txt'] = 'Let\'s Encrypt';
+$wb['suexec_txt'] = 'SuEXEC';
+$wb['php_txt'] = 'PHP';
+$wb['client_txt'] = 'Müşteri';
+$wb['limit_web_domain_txt'] = 'Hesabınızdaki max. web domaini sayısına ulaştınız.';
+$wb['limit_web_aliasdomain_txt'] = 'Hesabınızdaki max. aliasdomain sayısına ulaştınız.';
+$wb['limit_web_subdomain_txt'] = 'Hesabınızdaki max. web subdomain sayısına ulaştınız.';
+$wb['apache_directives_txt'] = 'Apache direktifleri';
+$wb['domain_error_empty'] = 'Domain boş.';
+$wb['domain_error_unique'] = 'Bu isimde websitesi veya sub / aliasdomain zaten var.';
+$wb['domain_error_regex'] = 'Domain ismi geçersiz.';
+$wb['hd_quota_error_empty'] = 'Harddisk kotası boş.';
+$wb['traffic_quota_error_empty'] = 'Trafik kotası boş.';
+$wb['error_ssl_state_empty'] = 'SSL Mevkisi boş .';
+$wb['error_ssl_locality_empty'] = 'SSL Semti boş.';
+$wb['error_ssl_organisation_empty'] = 'SSL Kuruluşu boş.';
+$wb['error_ssl_organisation_unit_empty'] = 'SSL Kuruluş Ünitesi boş.';
+$wb['error_ssl_country_empty'] = 'SSL Ülkesi boş.';
+$wb['client_group_id_txt'] = 'Müşteri';
+$wb['stats_password_txt'] = 'Web istatistikleri şifresi';
+$wb['ssl_domain_txt'] = 'SSL Domain';
+$wb['allow_override_txt'] = 'Allow Override';
+$wb['limit_web_quota_free_txt'] = 'Max. kullanılabilir Harddisk Kotası';
+$wb['ssl_state_error_regex'] = 'Geçersiz SSL Durumu. İzin verilen karakterler: a-z, 0-9 ve .,-_';
+$wb['ssl_locality_error_regex'] = 'Geçersiz SSL Yöresi. İzin verilen karakterler: a-z, 0-9 ve .,-_';
+$wb['ssl_organisation_error_regex'] = 'Geçersiz SSL Organizasyonu. İzin verilen karakterler: a-z, 0-9 ve .,-_';
+$wb['ssl_organistaion_unit_error_regex'] = 'Geçersiz SSL Organizasyon Unitesi. İzin verilen karakterler: a-z, 0-9 ve .,-_';
+$wb['ssl_country_error_regex'] = 'Geçersiz SSL Ülkesi. İzin verilen karakterler: A-Z';
+$wb['limit_traffic_quota_free_txt'] = 'Max. kullanılabilir Trafik Kotası';
+$wb['redirect_error_regex'] = 'Geçersiz yönlendirme yolu. Geçerli yönlendirmeler örneğin: /test/ veya http://www.domain.tld/test/';
+$wb['php_open_basedir_txt'] = 'PHP open_basedir';
+$wb['backup_interval_txt'] = 'Backup interval';
+$wb['backup_copies_txt'] = 'Number of backup copies';
+$wb['traffic_quota_exceeded_txt'] = 'Traffic quota exceeded';
+$wb['ruby_txt'] = 'Ruby';
+$wb['stats_user_txt'] = 'Webstatistics username';
+$wb['stats_type_txt'] = 'Webstatistics program';
+$wb['custom_php_ini_txt'] = 'Custom php.ini settings';
+$wb['error_ssl_cert_empty'] = 'SSL Certificate field is empty';
+$wb['none_txt'] = 'None';
+$wb['disabled_txt'] = 'Disabled';
+$wb['no_redirect_txt'] = 'No redirect';
+$wb['no_flag_txt'] = 'No flag';
+$wb['save_certificate_txt'] = 'Save certificate';
+$wb['create_certificate_txt'] = 'Create certificate';
+$wb['delete_certificate_txt'] = 'Delete certificate';
+$wb['ipv6_address_txt'] = 'IPv6-Address';
+$wb['nginx_directives_txt'] = 'nginx Directives';
+$wb['seo_redirect_txt'] = 'SEO Redirect';
+$wb['non_www_to_www_txt'] = 'Non-www -&gt; www';
+$wb['www_to_non_www_txt'] = 'www -&gt; non-www';
+$wb['php_fpm_use_socket_txt'] = 'Use Socket For PHP-FPM';
+$wb['error_no_sni_txt'] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
+$wb['python_txt'] = 'Python';
+$wb['pm_max_children_txt'] = 'PHP-FPM pm.max_children';
+$wb['pm_start_servers_txt'] = 'PHP-FPM pm.start_servers';
+$wb['pm_min_spare_servers_txt'] = 'PHP-FPM pm.min_spare_servers';
+$wb['pm_max_spare_servers_txt'] = 'PHP-FPM pm.max_spare_servers';
+$wb['error_php_fpm_pm_settings_txt'] = 'Values of PHP-FPM pm settings must be as follows: pm.max_children &gt;= pm.max_spare_servers &gt;= pm.start_servers &gt;= pm.min_spare_servers &gt; 0';
+$wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children must be a positive integer value.';
+$wb['pm_start_servers_error_regex'] = 'PHP-FPM pm.start_servers must be a positive integer value.';
+$wb['pm_min_spare_servers_error_regex'] = 'PHP-FPM pm.min_spare_servers must be a positive integer value.';
+$wb['pm_max_spare_servers_error_regex'] = 'PHP-FPM pm.max_spare_servers must be a positive integer value.';
+$wb['hd_quota_error_regex'] = 'Harddisk quota is invalid.';
+$wb['traffic_quota_error_regex'] = 'Traffic quota is invalid.';
+$wb['ssl_key_txt'] = 'SSL Key';
+$wb['perl_txt'] = 'Perl';
+$wb['fastcgi_php_version_txt'] = 'PHP Version';
+$wb['pm_txt'] = 'PHP-FPM Process Manager';
+$wb['pm_process_idle_timeout_txt'] = 'PHP-FPM pm.process_idle_timeout';
+$wb['pm_max_requests_txt'] = 'PHP-FPM pm.max_requests';
+$wb['pm_process_idle_timeout_error_regex'] = 'PHP-FPM pm.process_idle_timeout must be a positive integer value.';
+$wb['pm_max_requests_error_regex'] = 'PHP-FPM pm.max_requests must be an integer value >= 0.';
+$wb['pm_ondemand_hint_txt'] = 'Please note that you must have PHP version >= 5.3.9 in order to use the ondemand process manager. If you select ondemand for an older PHP version, PHP will not start anymore!';
+$wb['generate_password_txt'] = 'Generate Password';
+$wb['repeat_password_txt'] = 'Repeat Password';
+$wb['password_mismatch_txt'] = 'The passwords do not match.';
+$wb['password_match_txt'] = 'The passwords do match.';
+$wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
+$wb['domain_error_autosub'] = 'There is already a subdomain with these settings.';
+$wb['available_php_directive_snippets_txt'] = 'Available PHP Directive Snippets:';
+$wb['available_apache_directive_snippets_txt'] = 'Available Apache Directive Snippets:';
+$wb['available_nginx_directive_snippets_txt'] = 'Available nginx Directive Snippets:';
+$wb['proxy_directives_txt'] = 'Proxy Directives';
+$wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
+$wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
+$wb['configuration_error_txt'] = 'CONFIGURATION ERROR';
+$wb['variables_txt'] = 'Variables';
+$wb['added_by_txt'] = 'Added by';
+$wb['added_date_txt'] = 'Added date';
+$wb['backup_excludes_txt'] = 'Excluded Directories';
+$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas. Example: web/cache/*,web/backup)';
+$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.';
+$wb['invalid_custom_php_ini_settings_txt'] = 'Invalid php.ini settings';
+$wb['invalid_system_user_or_group_txt'] = 'Invalid system user or group';
+$wb['apache_directive_blocked_error'] = 'Apache directive blocked by security settings:';
+?>
diff --git a/src/interface/web/sites/templates/web_domain_edit.htm b/src/interface/web/sites/templates/web_domain_edit.htm
new file mode 100644
index 0000000..2ac3bcb
--- /dev/null
+++ b/src/interface/web/sites/templates/web_domain_edit.htm
@@ -0,0 +1,277 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<tmpl_if name="config_error_msg">
+<div style="background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px;">
+ <p style="font-face:bold">{tmpl_var name='configuration_error_txt'}</p>
+ <div>
+ <div style="float:left;width:150px;">{tmpl_var name='config_error_tstamp'} :&nbsp;</div><div style="padding-left:150px;">{tmpl_var name='config_error_msg'}</div>
+ </div>
+</div>
+</tmpl_if>
+
+<div class="panel panel_web_domain">
+
+ <div class="pnl_formsarea">
+ <fieldset class="inlineLabels">
+ <tmpl_if name="is_admin">
+ <div class="ctrlHolder">
+ <tmpl_if name="edit_disabled">
+ <label for="server_id_disabled">{tmpl_var name='server_id_txt'}</label>
+ <select name="server_id_disabled" id="server_id_disabled" class="selectInput" disabled="disabled">
+ {tmpl_var name='server_id'}
+ </select>
+ <input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
+ <tmpl_else>
+ <label for="server_id">{tmpl_var name='server_id_txt'}</label>
+ <select name="server_id" id="server_id" class="selectInput">
+ {tmpl_var name='server_id'}
+ </select>
+ </tmpl_if>
+ </div>
+ <div class="ctrlHolder">
+ <label for="client_group_id">{tmpl_var name='client_group_id_txt'}</label>
+ <select name="client_group_id" id="client_group_id" class="selectInput">
+ {tmpl_var name='client_group_id'}
+ </select>
+ </div>
+ <tmpl_else>
+ <input type="hidden" id="server_id" name="server_id" value="{tmpl_var name='server_id_value'}" />
+ </tmpl_if>
+ <tmpl_if name="is_reseller">
+ <div class="ctrlHolder">
+ <label for="client_group_id">{tmpl_var name='client_group_id_txt'}</label>
+ <select name="client_group_id" id="client_group_id" class="selectInput">
+ {tmpl_var name='client_group_id'}
+ </select>
+ </div>
+ </tmpl_if>
+ <div class="ctrlHolder">
+ <label for="ip_address">{tmpl_var name='ip_address_txt'}</label>
+ <select name="ip_address" id="ip_address" class="selectInput formLengthIPv4">
+ {tmpl_var name='ip_address'}
+ </select>
+ </div>
+ <div class="ctrlHolder">
+ <label for="ipv6_address">{tmpl_var name='ipv6_address_txt'}</label>
+ <select name="ipv6_address" id="ipv6_address" class="selectInput formLengthIPv6">
+ {tmpl_var name='ipv6_address'}
+ </select>
+ </div>
+ <div class="ctrlHolder">
+ <label for="domain">{tmpl_var name='domain_txt'}</label>
+ <tmpl_if name="domain_option">
+ <select name="domain" id="domain" class="selectInput">
+ {tmpl_var name='domain_option'}
+ </select>
+ <tmpl_else>
+ <input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
+ </tmpl_if>
+ </div>
+ <div class="ctrlHolder">
+ <label for="hd_quota">{tmpl_var name='hd_quota_txt'}</label>
+ <input name="hd_quota" id="hd_quota" value="{tmpl_var name='hd_quota'}" size="7" maxlength="7" type="text" class="textInput formLengthLimit" />&nbsp;MB
+ </div>
+ <div class="ctrlHolder">
+ <label for="traffic_quota">{tmpl_var name='traffic_quota_txt'}</label>
+ <input name="traffic_quota" id="traffic_quota" value="{tmpl_var name='traffic_quota'}" size="7" maxlength="7" type="text" class="textInput formLengthLimit" />&nbsp;MB <tmpl_var name='traffic_quota_exceeded_txt'>
+ </div>
+ <tmpl_if name="limit_cgi" op="==" value="y"><div class="ctrlHolder">
+ <p class="label">{tmpl_var name='cgi_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='cgi'}
+ </div>
+ </div></tmpl_if>
+ <tmpl_if name="limit_ssi" op="==" value="y"><div class="ctrlHolder">
+ <p class="label">{tmpl_var name='ssi_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='ssi'}
+ </div>
+ </div></tmpl_if>
+ <tmpl_if name="limit_perl" op="==" value="y"><div class="ctrlHolder apache">
+ <p class="label">{tmpl_var name='perl_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='perl'}
+ </div>
+ </div></tmpl_if>
+ <tmpl_if name="limit_ruby" op="==" value="y"><div class="ctrlHolder apache">
+ <p class="label">{tmpl_var name='ruby_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='ruby'}
+ </div>
+ </div></tmpl_if>
+ <tmpl_if name="limit_python" op="==" value="y"><div class="ctrlHolder apache">
+ <p class="label">{tmpl_var name='python_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='python'}
+ </div>
+ </div></tmpl_if>
+ <tmpl_if name="force_suexec" op="==" value="n"><div class="ctrlHolder apache">
+ <p class="label">{tmpl_var name='suexec_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='suexec'}
+ </div>
+ </div></tmpl_if>
+ <tmpl_if name="limit_hterror" op="==" value="y"><div class="ctrlHolder">
+ <p class="label">{tmpl_var name='errordocs_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='errordocs'}
+ </div>
+ </div></tmpl_if>
+
+ <div class="ctrlHolder">
+ <label for="subdomain">{tmpl_var name='subdomain_txt'}</label>
+ <select name="subdomain" id="subdomain" class="selectInput formLengthHalf">
+ {tmpl_var name='subdomain'}
+ </select>
+ </div>
+ <tmpl_if name="limit_ssl" op="==" value="y"><div class="ctrlHolder">
+ <p class="label">{tmpl_var name='ssl_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='ssl'}
+ </div>
+ </div>
+ <div class="ctrlHolder">
+ <p class="label">{tmpl_var name='ssl_letsencrypt_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='ssl_letsencrypt'}
+ </div>
+ </div></tmpl_if>
+ <div class="ctrlHolder">
+ <label for="php">{tmpl_var name='php_txt'}</label>
+ <select name="php" id="php" class="selectInput formLengthHalf">
+ {tmpl_var name='php'}
+ </select>
+ </div>
+ <div class="ctrlHolder fastcgi_php_version">
+ <label for="fastcgi_php_version">{tmpl_var name='fastcgi_php_version_txt'}</label>
+ <select name="fastcgi_php_version" id="fastcgi_php_version" class="selectInput formLengthHalf">
+ {tmpl_var name='fastcgi_php_version'}
+ </select>
+ </div>
+ <div class="ctrlHolder">
+ <p class="label">{tmpl_var name='active_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='active'}
+ </div>
+ </div>
+ </fieldset>
+
+ <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+ <div class="buttonHolder buttons">
+ <button id="dom-edit-submit" class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}"><span>{tmpl_var name='btn_save_txt'}</span></button>
+ <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onclick="loadContent('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+ </div>
+ </div>
+
+</div>
+<script language="JavaScript" type="text/javascript">
+ var serverId;
+ var clientGroupId = jQuery('#client_group_id').val();
+ var serverIdDisabled = jQuery('#server_id_disabled').val();
+ if(serverIdDisabled > 0){
+ serverId = serverIdDisabled;
+ } else {
+ serverId = jQuery('#server_id').val();
+ jQuery('#server_id').change(function(){
+ serverId = $(this).val();
+ adjustForm();
+ reloadWebIP();
+ reloadFastcgiPHPVersions();
+ });
+ }
+ adjustForm(true);
+ reloadFastcgiPHPVersions(true);
+
+ jQuery('#client_group_id').change(function(){
+ clientGroupId = $(this).val();
+ reloadWebIP();
+ reloadFastcgiPHPVersions();
+ });
+
+ if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm'){
+ jQuery('.fastcgi_php_version:hidden').show();
+ } else {
+ jQuery('.fastcgi_php_version:visible').hide();
+ }
+ //resetFormChanged();
+
+ jQuery('#php').change(function(){
+ reloadFastcgiPHPVersions();
+ if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm'){
+ jQuery('.fastcgi_php_version:hidden').show();
+ } else {
+ jQuery('.fastcgi_php_version:visible').hide();
+ }
+ });
+
+ function adjustForm(noFormChange){
+ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
+ if(data.servertype == "nginx"){
+ var selected = jQuery('#php').val();
+ jQuery('.apache').hide();
+ if(selected != "no" && selected != "php-fpm") {
+ jQuery('#php option[value="php-fpm"]').attr('selected', 'selected').val('php-fpm');
+ }
+ jQuery('#php option[value="fast-cgi"]').hide();
+ jQuery('#php option[value="cgi"]').hide();
+ jQuery('#php option[value="mod"]').hide();
+ jQuery('#php option[value="suphp"]').hide();
+ } else {
+ jQuery('.apache').show();
+ jQuery('#php option[value="fast-cgi"]').show();
+ jQuery('#php option[value="cgi"]').show();
+ jQuery('#php option[value="mod"]').show();
+ jQuery('#php option[value="suphp"]').show();
+ }
+ if(noFormChange) {
+ resetFormChanged();
+ jQuery('#php').addClass('no-page-form-change').change();
+ jQuery('#php').removeClass('no-page-form-change');
+ } else {
+ jQuery('#php').change();
+ }
+ });
+ }
+
+ function reloadWebIP() {
+ loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId+'&client_group_id='+clientGroupId);
+ loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId);
+ }
+
+ function reloadFastcgiPHPVersions(noFormChange) {
+ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi", client_group_id : clientGroupId}, function(data) {
+ var options = '<option value="">Default</option>';
+ var phpfastcgiselected = '';
+ $.each(data, function(key, val) {
+ if($('#fastcgi_php_version').val() == key){
+ phpfastcgiselected = ' selected="selected"';
+ } else {
+ phpfastcgiselected = '';
+ }
+ options += '<option value="'+key+'"'+phpfastcgiselected+'>'+val+'</option>';
+ });
+ $('#fastcgi_php_version').html(options).change();
+ if(noFormChange) resetFormChanged();
+ });
+ }
+
+ <tmpl_if name="readonly_tab">
+ jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').bind('click mousedown', function(e) { e.preventDefault(); }).focus(function() { $(this).blur(); });
+ jQuery('#dom-edit-submit').click(function() {
+ submitForm('pageForm','sites/web_domain_edit.php');
+ });
+ <tmpl_else>
+ jQuery('#dom-edit-submit').click(function() {
+ submitForm('pageForm','sites/web_domain_edit.php');
+ });
+ </tmpl_if>
+
+ jQuery('input#ssl_letsencrypt').bind('change', function() {
+ if(jQuery('input#ssl_letsencrypt').is(":checked")) jQuery('input#ssl').prop('checked', true);
+ });
+ jQuery('input#ssl').bind('change', function() {
+ if(jQuery('input#ssl_letsencrypt').is(":checked")) jQuery('input#ssl_letsencrypt').prop('checked', false);
+ });
+</script>
diff --git a/src/server/conf/nginx_vhost.conf.master b/src/server/conf/nginx_vhost.conf.master
new file mode 100755
index 0000000..5fce663
--- /dev/null
+++ b/src/server/conf/nginx_vhost.conf.master
@@ -0,0 +1,234 @@
+server {
+ listen <tmpl_var name='ip_address'>:80;
+<tmpl_if name='ipv6_enabled'>
+ listen [<tmpl_var name='ipv6_address'>]:80;
+</tmpl_if>
+
+<tmpl_if name='ssl_enabled'>
+ listen <tmpl_var name='ip_address'>:443 ssl;
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+<tmpl_if name='ipv6_enabled'>
+ listen [<tmpl_var name='ipv6_address'>]:443 ssl;
+</tmpl_if>
+ ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt;
+ ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key;
+</tmpl_if>
+
+ server_name <tmpl_var name='domain'> <tmpl_var name='alias'>;
+
+ root <tmpl_var name='web_document_root_www'>;
+
+<tmpl_if name='seo_redirect_enabled'>
+ if ($http_host <tmpl_var name='seo_redirect_operator'> "<tmpl_var name='seo_redirect_origin_domain'>") {
+ rewrite ^ $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri? permanent;
+ }
+</tmpl_if>
+<tmpl_loop name="alias_seo_redirects">
+ if ($http_host <tmpl_var name='alias_seo_redirect_operator'> "<tmpl_var name='alias_seo_redirect_origin_domain'>") {
+ rewrite ^ $scheme://<tmpl_var name='alias_seo_redirect_target_domain'>$request_uri? permanent;
+ }
+</tmpl_loop>
+<tmpl_loop name="local_redirects">
+ if ($http_host <tmpl_var name='local_redirect_operator'> "<tmpl_var name='local_redirect_origin_domain'>") {
+ rewrite ^<tmpl_var name='local_redirect_exclude'>(.*)$ <tmpl_var name='local_redirect_target'>$2 <tmpl_var name='local_redirect_type'>;
+ }
+</tmpl_loop>
+
+<tmpl_loop name="own_redirects">
+<tmpl_if name='use_rewrite'>
+ <tmpl_if name='exclude_own_hostname'>if ($http_host != "<tmpl_var name='exclude_own_hostname'>") { </tmpl_if>rewrite ^<tmpl_var name='rewrite_exclude'>(.*)$ <tmpl_var name='rewrite_target'>$2 <tmpl_var name='rewrite_type'>;<tmpl_if name='exclude_own_hostname'> }</tmpl_if>
+</tmpl_if>
+<tmpl_if name='use_proxy'>
+ location / {
+ proxy_pass <tmpl_var name='rewrite_target'>;
+ <tmpl_if name='rewrite_subdir'>rewrite ^/<tmpl_var name='rewrite_subdir'>(.*) /$1;</tmpl_if>
+<tmpl_loop name="proxy_directives">
+ <tmpl_var name='proxy_directive'>
+</tmpl_loop>
+ }
+</tmpl_if>
+</tmpl_loop>
+<tmpl_if name='use_proxy' op='!=' value='y'>
+ index index.html index.htm index.php index.cgi index.pl index.xhtml;
+
+<tmpl_if name='ssi' op='==' value='y'>
+ location ~ \.shtml$ {
+ ssi on;
+ }
+</tmpl_if>
+
+<tmpl_if name='errordocs'>
+ error_page 400 /error/400.html;
+ error_page 401 /error/401.html;
+ error_page 403 /error/403.html;
+ error_page 404 /error/404.html;
+ error_page 405 /error/405.html;
+ error_page 500 /error/500.html;
+ error_page 502 /error/502.html;
+ error_page 503 /error/503.html;
+ recursive_error_pages on;
+ location = /error/400.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/401.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/403.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/404.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/405.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/500.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/502.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+ location = /error/503.html {
+ <tmpl_var name='web_document_root_www_proxy'>
+ internal;
+ }
+</tmpl_if>
+
+ error_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log;
+ access_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/access.log combined;
+
+ ## Disable .htaccess and other hidden files
+<tmpl_if name='ssl_letsencrypt' op='!=' value='y'>
+ location ~ /\. {
+ deny all;
+ access_log off;
+ log_not_found off;
+ }
+</tmpl_if>
+
+ location = /favicon.ico {
+ log_not_found off;
+ access_log off;
+ }
+
+ location = /robots.txt {
+ allow all;
+ log_not_found off;
+ access_log off;
+ }
+
+ location /stats/ {
+ <tmpl_var name='web_document_root_www_proxy'>
+ index index.html index.php;
+ auth_basic "Members Only";
+ auth_basic_user_file <tmpl_var name='stats_auth_passwd_file'>;
+ }
+
+ location ^~ /awstats-icon {
+ alias /usr/share/awstats/icon;
+ }
+
+ location ~ \.php$ {
+ try_files <tmpl_var name='rnd_php_dummy_file'> @php;
+ }
+
+<tmpl_if name='php' op='==' value='php-fpm'>
+ location @php {
+ try_files $uri =404;
+ include /etc/nginx/fastcgi_params;
+<tmpl_if name='use_tcp'>
+ fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>;
+</tmpl_if>
+<tmpl_if name='use_socket'>
+ fastcgi_pass unix:<tmpl_var name='fpm_socket'>;
+</tmpl_if>
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ #fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_intercept_errors on;
+ }
+</tmpl_else>
+ location @php {
+ deny all;
+ }
+</tmpl_if>
+
+<tmpl_if name='cgi' op='==' value='y'>
+ location /cgi-bin/ {
+ try_files $uri =404;
+ include /etc/nginx/fastcgi_params;
+ root <tmpl_var name='document_root'>;
+ gzip off;
+ fastcgi_pass unix:/var/run/fcgiwrap.socket;
+ fastcgi_index index.cgi;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_intercept_errors on;
+ }
+</tmpl_if>
+
+<tmpl_loop name="rewrite_rules">
+ <tmpl_var name='rewrite_rule'>
+</tmpl_loop>
+
+<tmpl_loop name="nginx_directives">
+ <tmpl_var name='nginx_directive'>
+</tmpl_loop>
+
+<tmpl_loop name="basic_auth_locations">
+ location <tmpl_var name='htpasswd_location'> { ##merge##
+ auth_basic "Members Only";
+ auth_basic_user_file <tmpl_var name='htpasswd_path'>.htpasswd;
+
+ location ~ \.php$ {
+ try_files <tmpl_var name='rnd_php_dummy_file'> @php;
+ }
+ }
+</tmpl_loop>
+</tmpl_if>
+}
+
+<tmpl_loop name="redirects">
+server {
+ listen <tmpl_var name='ip_address'>:80;
+<tmpl_if name='ipv6_enabled'>
+ listen [<tmpl_var name='ipv6_address'>]:80;
+</tmpl_if>
+
+<tmpl_if name='ssl_enabled'>
+ listen <tmpl_var name='ip_address'>:443 ssl;
+<tmpl_if name='ipv6_enabled'>
+ listen [<tmpl_var name='ipv6_address'>]:443 ssl;
+</tmpl_if>
+ ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt;
+ ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key;
+</tmpl_if>
+
+ server_name <tmpl_var name='rewrite_domain'>;
+<tmpl_if name='alias_seo_redirects2'>
+<tmpl_loop name="alias_seo_redirects2">
+ if ($http_host <tmpl_var name='alias_seo_redirect_operator'> "<tmpl_var name='alias_seo_redirect_origin_domain'>") {
+ rewrite ^ $scheme://<tmpl_var name='alias_seo_redirect_target_domain'>$request_uri? permanent;
+ }
+</tmpl_loop>
+</tmpl_if>
+<tmpl_if name='use_rewrite'>
+ rewrite ^ <tmpl_var name='rewrite_target'>$request_uri? <tmpl_var name='rewrite_type'>;
+</tmpl_if>
+<tmpl_if name='use_proxy'>
+ location / {
+ proxy_pass <tmpl_var name='rewrite_target'>;
+ <tmpl_if name='rewrite_subdir'>rewrite ^/<tmpl_var name='rewrite_subdir'>(.*) /$1;</tmpl_if>
+<tmpl_loop name="proxy_directives">
+ <tmpl_var name='proxy_directive'>
+</tmpl_loop>
+ }
+</tmpl_if>
+}
+</tmpl_loop>
diff --git a/src/server/plugins-available/apache2_plugin.inc.php b/src/server/plugins-available/apache2_plugin.inc.php
new file mode 100755
index 0000000..4dbbd78
--- /dev/null
+++ b/src/server/plugins-available/apache2_plugin.inc.php
@@ -0,0 +1,3038 @@
+<?php
+
+/*
+Copyright (c) 2007 - 2012, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class apache2_plugin {
+
+ var $plugin_name = 'apache2_plugin';
+ var $class_name = 'apache2_plugin';
+
+ // private variables
+ var $action = '';
+ var $ssl_certificate_changed = false;
+
+ //* This function is called during ispconfig installation to determine
+ // if a symlink shall be created for this plugin.
+ function onInstall() {
+ global $conf;
+
+ if($conf['services']['web'] == true) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+
+ /*
+ This function is called when the plugin is loaded
+ */
+
+ function onLoad() {
+ global $app;
+
+ /*
+ Register for the events
+ */
+ $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+ $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+ $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
+
+ $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+ $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+ $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+ $app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
+ $app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
+ $app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
+
+ $app->plugins->registerEvent('webdav_user_insert', $this->plugin_name, 'webdav');
+ $app->plugins->registerEvent('webdav_user_update', $this->plugin_name, 'webdav');
+ $app->plugins->registerEvent('webdav_user_delete', $this->plugin_name, 'webdav');
+
+ $app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete');
+
+ $app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user');
+ $app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user');
+ $app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user');
+
+ $app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
+ $app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
+
+ $app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'ftp_user_delete');
+
+ }
+
+ // Handle the creation of SSL certificates
+ function ssl($event_name, $data) {
+ global $app, $conf;
+
+ $app->uses('system');
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+ if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
+ $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR);
+
+ //* Only vhosts can have a ssl cert
+ if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return;
+
+ // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl');
+ if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
+
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+
+ //* Create a SSL Certificate, but only if this is not a mirror server.
+ if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) {
+
+ $this->ssl_certificate_changed = true;
+
+ //* Rename files if they exist
+ if(file_exists($key_file)){
+ $app->system->rename($key_file, $key_file.'.bak');
+ $app->system->chmod($key_file.'.bak', 0400);
+ }
+ if(file_exists($key_file2)){
+ $app->system->rename($key_file2, $key_file2.'.bak');
+ $app->system->chmod($key_file2.'.bak', 0400);
+ }
+ if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak');
+ if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak');
+
+ $rand_file = $ssl_dir.'/random_file';
+ $rand_data = md5(uniqid(microtime(), 1));
+ for($i=0; $i<1000; $i++) {
+ $rand_data .= md5(uniqid(microtime(), 1));
+ $rand_data .= md5(uniqid(microtime(), 1));
+ $rand_data .= md5(uniqid(microtime(), 1));
+ $rand_data .= md5(uniqid(microtime(), 1));
+ }
+ $app->system->file_put_contents($rand_file, $rand_data);
+
+ $ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15);
+
+ $ssl_cnf = " RANDFILE = $rand_file
+
+ [ req ]
+ default_bits = 2048
+ default_md = sha256
+ default_keyfile = keyfile.pem
+ distinguished_name = req_distinguished_name
+ attributes = req_attributes
+ prompt = no
+ output_password = $ssl_password
+
+ [ req_distinguished_name ]
+ C = ".trim($data['new']['ssl_country'])."
+ ST = ".trim($data['new']['ssl_state'])."
+ L = ".trim($data['new']['ssl_locality'])."
+ O = ".trim($data['new']['ssl_organisation'])."
+ OU = ".trim($data['new']['ssl_organisation_unit'])."
+ CN = $domain
+ emailAddress = webmaster@".$data['new']['domain']."
+
+ [ req_attributes ]
+ challengePassword = A challenge password";
+
+ $ssl_cnf_file = $ssl_dir.'/openssl.conf';
+ $app->system->file_put_contents($ssl_cnf_file, $ssl_cnf);
+
+ $rand_file = escapeshellcmd($rand_file);
+ $key_file = escapeshellcmd($key_file);
+ $openssl_cmd_key_file = $key_file;
+ if(substr($domain, 0, 2) == '*.' && strpos($key_file, '/ssl/\*.') !== false) $key_file = str_replace('/ssl/\*.', '/ssl/*.', $key_file); // wildcard certificate
+ $key_file2 = escapeshellcmd($key_file2);
+ $openssl_cmd_key_file2 = $key_file2;
+ if(substr($domain, 0, 2) == '*.' && strpos($key_file2, '/ssl/\*.') !== false) $key_file2 = str_replace('/ssl/\*.', '/ssl/*.', $key_file2); // wildcard certificate
+ $ssl_days = 3650;
+ $csr_file = escapeshellcmd($csr_file);
+ $openssl_cmd_csr_file = $csr_file;
+ if(substr($domain, 0, 2) == '*.' && strpos($csr_file, '/ssl/\*.') !== false) $csr_file = str_replace('/ssl/\*.', '/ssl/*.', $csr_file); // wildcard certificate
+ $config_file = escapeshellcmd($ssl_cnf_file);
+ $crt_file = escapeshellcmd($crt_file);
+ $openssl_cmd_crt_file = $crt_file;
+ if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate
+
+ if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) {
+
+ exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $openssl_cmd_key_file 2048");
+ exec("openssl req -new -sha256 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file -out $openssl_cmd_csr_file -days $ssl_days -config $config_file");
+ exec("openssl rsa -passin pass:$ssl_password -in $openssl_cmd_key_file -out $openssl_cmd_key_file2");
+
+ if(file_exists($web_config['CA_path'].'/openssl.cnf'))
+ {
+ exec("openssl ca -batch -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file");
+ $app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed. openssl ca -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file", LOGLEVEL_ERROR);
+ };
+ if (@filesize($crt_file)==0 || !file_exists($crt_file)){
+ exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file -in $openssl_cmd_csr_file -out $openssl_cmd_crt_file -days $ssl_days -config $config_file ");
+ $app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ };
+
+ }
+
+ $app->system->chmod($key_file, 0400);
+ $app->system->chmod($key_file2, 0400);
+ @$app->system->unlink($config_file);
+ @$app->system->unlink($rand_file);
+ $ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
+ $ssl_cert = $app->db->quote($app->system->file_get_contents($crt_file));
+ $ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ }
+
+ //* Save a SSL certificate to disk
+ if($data["new"]["ssl_action"] == 'save') {
+ $this->ssl_certificate_changed = true;
+ $ssl_dir = $data["new"]["document_root"]."/ssl";
+ $domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.".csr";
+ $crt_file = $ssl_dir.'/'.$domain.".crt";
+ $bundle_file = $ssl_dir.'/'.$domain.".bundle";
+
+ //* Backup files
+ if(file_exists($key_file)){
+ $app->system->copy($key_file, $key_file.'~');
+ $app->system->chmod($key_file.'~', 0400);
+ }
+ if(file_exists($key_file2)){
+ $app->system->copy($key_file2, $key_file2.'~');
+ $app->system->chmod($key_file2.'~', 0400);
+ }
+ if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~');
+ if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~');
+ if(file_exists($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'~');
+
+ //* Write new ssl files
+ if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]);
+ if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]);
+ if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file, $data["new"]["ssl_bundle"]);
+
+ //* Write the key file, if field is empty then import the key into the db
+ if(trim($data["new"]["ssl_key"]) != '') {
+ $app->system->file_put_contents($key_file2, $data["new"]["ssl_key"]);
+ $app->system->chmod($key_file2, 0400);
+ } else {
+ $ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
+ }
+
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
+ }
+
+ //* Delete a SSL certificate
+ if($data['new']['ssl_action'] == 'del') {
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"];
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ $bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+ if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf'))
+ {
+ exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke ".escapeshellcmd($crt_file));
+ $app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ };
+ $app->system->unlink($csr_file);
+ $app->system->unlink($crt_file);
+ $app->system->unlink($bundle_file);
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
+ }
+
+ }
+
+
+ function insert($event_name, $data) {
+ global $app, $conf;
+
+ $this->action = 'insert';
+ // just run the update function
+ $this->update($event_name, $data);
+
+
+ }
+
+
+ function update($event_name, $data) {
+ global $app, $conf;
+
+ if($this->action != 'insert') $this->action = 'update';
+
+ if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) {
+
+ $old_parent_domain_id = intval($data['old']['parent_domain_id']);
+ $new_parent_domain_id = intval($data['new']['parent_domain_id']);
+
+ // If the parent_domain_id has been changed, we will have to update the old site as well.
+ if($this->action == 'update' && $data['new']['parent_domain_id'] != $data['old']['parent_domain_id']) {
+ $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$old_parent_domain_id." AND active = 'y'");
+ $data['new'] = $tmp;
+ $data['old'] = $tmp;
+ $this->action = 'update';
+ $this->update($event_name, $data);
+ }
+
+ // This is not a vhost, so we need to update the parent record instead.
+ $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$new_parent_domain_id." AND active = 'y'");
+ $data['new'] = $tmp;
+ $data['old'] = $tmp;
+ $this->action = 'update';
+ }
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+
+ //* Check if this is a chrooted setup
+ if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
+ $apache_chrooted = true;
+ $app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
+ } else {
+ $apache_chrooted = false;
+ }
+
+ if($data['new']['document_root'] == '') {
+ if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN);
+ return 0;
+ }
+ if($app->system->is_allowed_user($data['new']['system_user'], $app->system->is_user($data['new']['system_user']), true) == false
+ || $app->system->is_allowed_group($data['new']['system_group'], $app->system->is_group($data['new']['system_group']), true) == false) {
+ $app->log('Websites cannot be owned by the root user or group. User: '.$data['new']['system_user'].' Group: '.$data['new']['system_group'], LOGLEVEL_WARN);
+ return 0;
+ }
+ if(trim($data['new']['domain']) == '') {
+ $app->log('domain is empty', LOGLEVEL_WARN);
+ return 0;
+ }
+
+ $web_folder = 'web';
+ $log_folder = 'log';
+ $old_web_folder = 'web';
+ $old_log_folder = 'log';
+ if($data['new']['type'] == 'vhostsubdomain') {
+ // new one
+ $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+ if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
+ $web_folder = $data['new']['web_folder'];
+ $log_folder .= '/' . $subdomain_host;
+ unset($tmp);
+
+ if(isset($data['old']['parent_domain_id'])) {
+ // old one
+ $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
+ if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id'];
+ $old_web_folder = $data['old']['web_folder'];
+ $old_log_folder .= '/' . $subdomain_host;
+ unset($tmp);
+ }
+ }
+
+ // Create group and user, if not exist
+ $app->uses('system');
+
+ if($web_config['connect_userid_to_webid'] == 'y') {
+ //* Calculate the uid and gid
+ $connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']);
+ $fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']);
+ $fixed_uid_param = '--uid '.$fixed_uid_gid;
+ $fixed_gid_param = '--gid '.$fixed_uid_gid;
+
+ //* Check if a ispconfigend user and group exists and create them
+ if(!$app->system->is_group('ispconfigend')) {
+ exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
+ }
+ if(!$app->system->is_user('ispconfigend')) {
+ exec('useradd -g ispconfigend -d /usr/local/ispconfig --uid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
+ }
+ } else {
+ $fixed_uid_param = '';
+ $fixed_gid_param = '';
+ }
+
+ $groupname = escapeshellcmd($data['new']['system_group']);
+ if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
+ exec('groupadd '.$fixed_gid_param.' '.$groupname);
+ if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
+ $app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG);
+ }
+
+ $username = escapeshellcmd($data['new']['system_user']);
+ if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) {
+ if($web_config['add_web_users_to_sshusers_group'] == 'y') {
+ exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false");
+ if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false");
+ } else {
+ exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
+ if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
+ }
+ $app->log('Adding the user: '.$username, LOGLEVEL_DEBUG);
+ }
+
+ //* If the client of the site has been changed, we have a change of the document root
+ if($this->action == 'update' && $data['new']['document_root'] != $data['old']['document_root']) {
+
+ //* Get the old client ID
+ $old_client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+ $old_client_id = intval($old_client['client_id']);
+ unset($old_client);
+
+ //* Remove the old symlinks
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ // create the symlinks, if not exist
+ if(is_link($tmp_symlink)) {
+ exec('rm -f '.escapeshellcmd($tmp_symlink));
+ $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+ //* Remove protection of old folders
+ $app->system->web_folder_protection($data['old']['document_root'], false);
+
+ if($data["new"]["type"] != "vhostsubdomain") {
+ //* Move the site data
+ $tmp_docroot = explode('/', $data['new']['document_root']);
+ unset($tmp_docroot[count($tmp_docroot)-1]);
+ $new_dir = implode('/', $tmp_docroot);
+
+ $tmp_docroot = explode('/', $data['old']['document_root']);
+ unset($tmp_docroot[count($tmp_docroot)-1]);
+ $old_dir = implode('/', $tmp_docroot);
+
+ //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
+ if(@is_dir($data['new']['document_root'])) {
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+ $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
+ $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
+ }
+
+ //* Unmount the old log directory bfore we move the log dir
+ exec('umount '.escapeshellcmd($old_dir.'/log'));
+
+ //* Create new base directory, if it does not exist yet
+ if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
+ $app->system->web_folder_protection($data['old']['document_root'], false);
+ exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
+ //$app->system->rename($data['old']['document_root'],$new_dir);
+ $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG);
+
+ // Handle the change in php_open_basedir
+ $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']);
+
+ //* Change the owner of the website files to the new website owner
+ exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
+
+ //* Change the home directory and group of the website user
+ $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod';
+ $command .= ' --home '.escapeshellcmd($data['new']['document_root']);
+ $command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
+ exec($command);
+ }
+
+ if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+ //* Change the log mount
+ /*
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ */
+
+ $fstab_line_old = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind';
+
+ if($web_config['network_filesystem'] == 'y') {
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0';
+ $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1);
+ } else {
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait 0 0';
+ $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1);
+ }
+
+ exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
+
+ }
+
+ //print_r($data);
+
+ // Check if the directories are there and create them if necessary.
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+
+ if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
+ if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
+ //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
+ if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
+ if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
+ if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
+ if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
+
+ //* Create the new private directory
+ if(!is_dir($data['new']['document_root'].'/private')) {
+ $app->system->mkdirpath($data['new']['document_root'].'/private');
+ $app->system->chmod($data['new']['document_root'].'/private', 0710);
+ $app->system->chown($data['new']['document_root'].'/private', $username);
+ $app->system->chgrp($data['new']['document_root'].'/private', $groupname);
+ }
+
+
+ // Remove the symlink for the site, if site is renamed
+ if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
+ if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']);
+ if(is_link($data['old']['document_root'].'/'.$old_log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$old_log_folder);
+
+ //* remove old log mount
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+
+ //* Unmount log directory
+ exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder));
+ }
+
+ //* Create the log dir if nescessary and mount it
+ if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) {
+ if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
+ if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
+ $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
+ $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root');
+ $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root');
+ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
+ exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
+ //* add mountpoint to fstab
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0';
+ $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
+ }
+
+ $app->system->web_folder_protection($data['new']['document_root'], true);
+
+ // Get the client ID
+ $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['new']['sys_groupid']));
+ $client_id = intval($client['client_id']);
+ unset($client);
+
+ // Remove old symlinks, if site is renamed
+ if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ // remove the symlinks, if not exist
+ if(is_link($tmp_symlink)) {
+ exec('rm -f '.escapeshellcmd($tmp_symlink));
+ $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+ }
+
+ // Create the symlinks for the sites
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ //* Remove symlink if target folder has been changed.
+ if($data['old']['document_root'] != '' && $data['old']['document_root'] != $data['new']['document_root'] && is_link($tmp_symlink)) {
+ $app->system->unlink($tmp_symlink);
+ }
+ // create the symlinks, if not exist
+ if(!is_link($tmp_symlink)) {
+ // exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+ if ($web_config["website_symlinks_rel"] == 'y') {
+ $this->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink));
+ } else {
+ exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+ }
+
+ $app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+
+
+ // Install the Standard or Custom Error, Index and other related files
+ // /usr/local/ispconfig/server/conf is for the standard files
+ // /usr/local/ispconfig/server/conf-custom is for the custom files
+ // setting a local var here
+
+ // normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
+ if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
+
+ // Copy the error pages
+ if($data['new']['errordocs']) {
+ $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ else {
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
+ exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
+ }
+ else {
+ exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ }
+ exec('chmod -R a+r '.$error_page_path);
+ }
+
+ if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+
+ if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ }
+ else {
+ if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+ }
+ else {
+ exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+ if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ }
+ exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+
+ //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
+ } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
+
+ $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ else {
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
+ }
+ else {
+ exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ }
+ exec('chmod -R a+r '.$error_page_path);
+ exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path);
+ } // end copy error docs
+
+ // Set the quota for the user, but only for vhosts, not vhostsubdomains
+ if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') {
+ if($data['new']['hd_quota'] > 0) {
+ $blocks_soft = $data['new']['hd_quota'] * 1024;
+ $blocks_hard = $blocks_soft + 1024;
+ } else {
+ $blocks_soft = $blocks_hard = 0;
+ }
+ exec("setquota -u $username $blocks_soft $blocks_hard 0 0 -a &> /dev/null");
+ exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null');
+ }
+
+ if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) {
+ // Chown and chmod the directories below the document root
+ $this->_exec('chown -R '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
+ // The document root itself has to be owned by root in normal level and by the web owner in security level 20
+ if($web_config['security_level'] == 20) {
+ $this->_exec('chown '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
+ } else {
+ $this->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
+ }
+ }
+
+ //* add the Apache user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update
+ if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user']));
+
+ //* If the security level is set to high
+ if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) {
+
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+
+ //* Check if we have the new private folder and create it if nescessary
+ if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private');
+
+ if($web_config['security_level'] == 20) {
+
+ $app->system->chmod($data['new']['document_root'], 0755);
+ $app->system->chmod($data['new']['document_root'].'/web', 0711);
+ $app->system->chmod($data['new']['document_root'].'/webdav', 0710);
+ $app->system->chmod($data['new']['document_root'].'/private', 0710);
+ $app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+
+ // make tmp directory writable for Apache and the website users
+ $app->system->chmod($data['new']['document_root'].'/tmp', 0770);
+
+ // Set Log directory to 755 to make the logs accessible by the FTP user
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
+ }
+
+ if($web_config['add_web_users_to_sshusers_group'] == 'y') {
+ $command = 'usermod';
+ $command .= ' --groups sshusers';
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
+ $this->_exec($command);
+ }
+
+ //* if we have a chrooted Apache environment
+ if($apache_chrooted) {
+ $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+ //* add the apache user to the client group in the chroot environment
+ $tmp_groupfile = $app->system->server_conf['group_datei'];
+ $app->system->server_conf['group_datei'] = $web_config['website_basedir'].'/etc/group';
+ $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user']));
+ $app->system->server_conf['group_datei'] = $tmp_groupfile;
+ unset($tmp_groupfile);
+ }
+
+ //* Chown all default directories
+ $app->system->chown($data['new']['document_root'], 'root');
+ $app->system->chgrp($data['new']['document_root'], 'root');
+ $app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+ $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+ $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
+ }
+ $app->system->chown($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chown($data['new']['document_root'].'/tmp', $username);
+ $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+ $app->system->chown($data['new']['document_root'].'/webdav', $username);
+ $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
+ $app->system->chown($data['new']['document_root'].'/private', $username);
+ $app->system->chgrp($data['new']['document_root'].'/private', $groupname);
+
+ // If the security Level is set to medium
+ } else {
+
+ $app->system->chmod($data['new']['document_root'], 0755);
+ $app->system->chmod($data['new']['document_root'].'/web', 0755);
+ $app->system->chmod($data['new']['document_root'].'/webdav', 0755);
+ $app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+ $app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755);
+
+ // make temp directory writable for Apache and the website users
+ $app->system->chmod($data['new']['document_root'].'/tmp', 0770);
+
+ // Set Log directory to 755 to make the logs accessible by the FTP user
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
+ }
+
+ $app->system->chown($data['new']['document_root'], 'root');
+ $app->system->chgrp($data['new']['document_root'], 'root');
+ $app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+ $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+ $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
+ }
+
+ $app->system->chown($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chown($data['new']['document_root'].'/tmp', $username);
+ $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+ $app->system->chown($data['new']['document_root'].'/webdav', $username);
+ $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
+ }
+ } elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) {
+ if($web_config['security_level'] == 20) {
+ $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+ } else {
+ $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+ }
+ }
+
+ //* Protect web folders
+ $app->system->web_folder_protection($data['new']['document_root'], true);
+
+ if($data['new']['type'] == 'vhost') {
+ // Change the ownership of the error log to the root user
+ if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
+ $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+ $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+ }
+
+ //* Write the custom php.ini file, if custom_php_ini fieled is not empty
+ $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user'];
+ if($data['new']['type'] == 'vhostsubdomain') $custom_php_ini_dir .= '_' . $web_folder;
+ if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
+
+ //* add open_basedir restriction to custom php.ini content, required for suphp only
+ if(!stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') {
+ $data['new']['custom_php_ini'] .= "\nopen_basedir = '".$data['new']['php_open_basedir']."'\n";
+ }
+
+ $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
+
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir);
+ if(substr($custom_fastcgi_php_ini_dir, -1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir, 0, -1);
+ }
+
+ //* Create custom php.ini
+ if(trim($data['new']['custom_php_ini']) != '') {
+ $has_custom_php_ini = true;
+ if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir);
+ $php_ini_content = '';
+ if($data['new']['php'] == 'mod') {
+ $master_php_ini_path = $web_config['php_ini_path_apache'];
+ } else {
+ if($data["new"]['php'] == 'fast-cgi') {
+ if(trim($data['new']['fastcgi_php_version']) != '' && file_exists($custom_fastcgi_php_ini_dir)){
+ $master_php_ini_path = $custom_fastcgi_php_ini_dir;
+ } elseif(file_exists($fastcgi_config["fastcgi_phpini_path"])){
+ $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"];
+ } else {
+ $master_php_ini_path = $web_config['php_ini_path_cgi'];
+ }
+ } else {
+ $master_php_ini_path = $web_config['php_ini_path_cgi'];
+ }
+ }
+
+ //* Add php.ini to the path in case that the master_php_ini_path is a directory
+ if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) {
+ if(substr($master_php_ini_path, -1) == '/') $master_php_ini_path = substr($master_php_ini_path, 0, -1);
+ $master_php_ini_path .= '/php.ini';
+ }
+
+ if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) {
+ $php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
+ }
+ $php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini']));
+ $app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content);
+ } else {
+ $has_custom_php_ini = false;
+ if(is_file($custom_php_ini_dir.'/php.ini')) $app->system->unlink($custom_php_ini_dir.'/php.ini');
+ }
+
+
+ //* Create the vhost config file
+ $app->load('tpl');
+
+ $tpl = new tpl();
+ $tpl->newTemplate('vhost.conf.master');
+
+ $vhost_data = $data['new'];
+ //unset($vhost_data['ip_address']);
+ $vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder;
+ $vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder;
+ $vhost_data['web_basedir'] = $web_config['website_basedir'];
+ $vhost_data['security_level'] = $web_config['security_level'];
+ $vhost_data['allow_override'] = ($data['new']['allow_override'] == '')?'All':$data['new']['allow_override'];
+ $vhost_data['php_open_basedir'] = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
+ $vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
+ $vhost_data['has_custom_php_ini'] = $has_custom_php_ini;
+ $vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir);
+
+ // Custom Apache directives
+ // Make sure we only have Unix linebreaks
+ $vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']);
+ $vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']);
+ $trans = array('{DOCROOT}' => $vhost_data['web_document_root_www']);
+ $vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans);
+
+ // Check if a SSL cert exists
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ $bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+
+ /*
+ if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) {
+ $vhost_data['ssl_enabled'] = 1;
+ $app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+ } else {
+ $vhost_data['ssl_enabled'] = 0;
+ $app->log('SSL Disabled. '.$domain,LOGLEVEL_DEBUG);
+ }
+ */
+
+ //* Generate Let's Encrypt SSL certificat
+ if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') {
+ //* be sure to have good domain
+ $lddomain = (string) "--domains $domain";
+ if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
+ $lddomain .= (string) " --domains www." . $domain;
+ }
+
+ $crt_tmp_file = "/etc/letsencrypt/live/".$lddomain."/cert.pem";
+ $key_tmp_file = "/etc/letsencrypt/live/".$lddomain."/privkey.pem";
+ $webroot = $data['new']['document_root']."/web";
+
+ //* check if we have already a Let's Encrypt cert
+ if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
+ $app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ exec("/root/.local/share/letsencrypt/bin/letsencrypt auth -a webroot --email postmaster@$domain --domains $lddomain --webroot-path $webroot --text --agree-tos");
+ };
+
+ //* check is been correctly created
+ if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
+ $date = date("YmdHis");
+ if(is_file($key_file)) {
+ $app->system->copy($key_file, $key_file.'.old'.$date);
+ $app->system->chmod($key_file.'.old.'.$date, 0400);
+ $app->system->unlink($key_file);
+ }
+
+ if ($web_config["website_symlinks_rel"] == 'y') {
+ $this->create_relative_link(escapeshellcmd($key_tmp_file), escapeshellcmd($key_file));
+ } else {
+ exec("ln -s ".escapeshellcmd($key_tmp_file)." ".escapeshellcmd($key_file));
+ }
+
+ if(is_file($crt_file)) {
+ $app->system->copy($crt_file, $crt_file.'.old.'.$date);
+ $app->system->chmod($crt_file.'.old.'.$date, 0400);
+ $app->system->unlink($crt_file);
+ }
+
+ if($web_config["website_symlinks_rel"] == 'y') {
+ $this->create_relative_link(escapeshellcmd($crt_tmp_file), escapeshellcmd($crt_file));
+ } else {
+ exec("ln -s ".escapeshellcmd($crt_tmp_file)." ".escapeshellcmd($crt_file));
+ }
+
+ /* we don't need to store it.
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key' WHERE domain = '".$data['new']['domain']."'");
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key' WHERE domain = '".$data['new']['domain']."'");
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ }
+ };
+
+ if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
+
+ //$vhost_data['document_root'] = $data['new']['document_root'].'/' . $web_folder;
+
+ // Set SEO Redirect
+ if($data['new']['seo_redirect'] != ''){
+ $vhost_data['seo_redirect_enabled'] = 1;
+ $tmp_seo_redirects = $this->get_seo_redirects($data['new']);
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ foreach($tmp_seo_redirects as $key => $val){
+ $vhost_data[$key] = $val;
+ }
+ } else {
+ $vhost_data['seo_redirect_enabled'] = 0;
+ }
+ } else {
+ $vhost_data['seo_redirect_enabled'] = 0;
+ }
+
+ $tpl->setVar($vhost_data);
+ $tpl->setVar('apache_version', $app->system->getapacheversion());
+
+ // Rewrite rules
+ $rewrite_rules = array();
+ if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') {
+ if(substr($data['new']['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/';
+ if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){
+ $rewrite_target = 'http'.substr($data['new']['redirect_path'], 8);
+ $rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'], 8);
+ } else {
+ $rewrite_target = $data['new']['redirect_path'];
+ $rewrite_target_ssl = $data['new']['redirect_path'];
+ }
+ /* Disabled path extension
+ if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') {
+ $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';
+ }
+ */
+
+ switch($data['new']['subdomain']) {
+ case 'www':
+ $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ $rewrite_rules[] = array( 'rewrite_domain' => '^' . $this->_rewrite_quote('www.'.$data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ break;
+ case '*':
+ $rewrite_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ break;
+ default:
+ $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ }
+ }
+
+ $server_alias = array();
+
+ // get autoalias
+ $auto_alias = $web_config['website_autoalias'];
+ if($auto_alias != '') {
+ // get the client username
+ $client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = '" . intval($client_id) . "'");
+ $aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]');
+ $aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']);
+ $auto_alias = str_replace($aa_search, $aa_replace, $auto_alias);
+ unset($client);
+ unset($aa_search);
+ unset($aa_replace);
+ $server_alias[] .= $auto_alias.' ';
+ }
+
+ // get alias domains (co-domains and subdomains)
+ $aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND type != 'vhostsubdomain'");
+ $alias_seo_redirects = array();
+ switch($data['new']['subdomain']) {
+ case 'www':
+ $server_alias[] .= 'www.'.$data['new']['domain'].' ';
+ break;
+ case '*':
+ $server_alias[] .= '*.'.$data['new']['domain'].' ';
+ break;
+ }
+ if(is_array($aliases)) {
+ foreach($aliases as $alias) {
+ switch($alias['subdomain']) {
+ case 'www':
+ $server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+ break;
+ case '*':
+ $server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
+ break;
+ default:
+ $server_alias[] .= $alias['domain'].' ';
+ break;
+ }
+ $app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
+ // Add SEO redirects for alias domains
+ if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ $alias_seo_redirects[] = $tmp_seo_redirects;
+ }
+ }
+
+ // Rewriting
+ if($alias['redirect_type'] != '' && $alias['redirect_path'] != '') {
+ if(substr($alias['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $alias['redirect_path'])) $alias['redirect_path'] .= '/';
+ if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){
+ $rewrite_target = 'http'.substr($alias['redirect_path'], 8);
+ $rewrite_target_ssl = 'https'.substr($alias['redirect_path'], 8);
+ } else {
+ $rewrite_target = $alias['redirect_path'];
+ $rewrite_target_ssl = $alias['redirect_path'];
+ }
+ /* Disabled the path extension
+ if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') {
+ $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';
+ }
+ */
+
+ switch($alias['subdomain']) {
+ case 'www':
+ $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($alias['domain']),
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ $rewrite_rules[] = array( 'rewrite_domain' => '^' . $this->_rewrite_quote('www.'.$alias['domain']),
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ break;
+ case '*':
+ $rewrite_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($alias['domain']),
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ break;
+ default:
+ if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2));
+ else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']);
+ $rewrite_rules[] = array( 'rewrite_domain' => $domain_rule,
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+ 'rewrite_target' => $rewrite_target,
+ 'rewrite_target_ssl' => $rewrite_target_ssl,
+ 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+ 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+ }
+ }
+ }
+ }
+
+ //* If we have some alias records
+ if(count($server_alias) > 0) {
+ $server_alias_str = '';
+ $n = 0;
+
+ // begin a new ServerAlias line after 30 alias domains
+ foreach($server_alias as $tmp_alias) {
+ if($n % 30 == 0) $server_alias_str .= "\n ServerAlias ";
+ $server_alias_str .= $tmp_alias;
+ }
+ unset($tmp_alias);
+
+ $tpl->setVar('alias', trim($server_alias_str));
+ } else {
+ $tpl->setVar('alias', '');
+ }
+
+ if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0) {
+ $tpl->setVar('rewrite_enabled', 1);
+ } else {
+ $tpl->setVar('rewrite_enabled', 0);
+ }
+
+ //$tpl->setLoop('redirects',$rewrite_rules);
+
+ /**
+ * install fast-cgi starter script and add script aliasd config
+ * first we create the script directory if not already created, then copy over the starter script
+ * settings are copied over from the server ini config for now
+ * TODO: Create form for fastcgi configs per site.
+ */
+
+
+ if ($data['new']['php'] == 'fast-cgi') {
+
+ $fastcgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+ $fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path);
+
+ if (!is_dir($fastcgi_starter_path)) {
+ $app->system->mkdirpath($fastcgi_starter_path);
+ //exec('chown '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path));
+
+
+ $app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path, LOGLEVEL_DEBUG);
+ }
+
+ //exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path));
+ $app->system->chown($fastcgi_starter_path, $data['new']['system_user']);
+ $app->system->chgrp($fastcgi_starter_path, $data['new']['system_group']);
+
+ $fcgi_tpl = new tpl();
+ $fcgi_tpl->newTemplate('php-fcgi-starter.master');
+ $fcgi_tpl->setVar('apache_version', $app->system->getapacheversion());
+
+ // Support for multiple PHP versions (FastCGI)
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_fastcgi_php = false;
+ if(substr($custom_fastcgi_php_ini_dir, -1) != '/') $custom_fastcgi_php_ini_dir .= '/';
+ } else {
+ $default_fastcgi_php = true;
+ }
+
+ if($has_custom_php_ini) {
+ $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
+ } else {
+ if($default_fastcgi_php){
+ $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+ } else {
+ $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_fastcgi_php_ini_dir));
+ }
+ }
+ $fcgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root']));
+ $fcgi_tpl->setVar('php_fcgi_children', escapeshellcmd($fastcgi_config['fastcgi_children']));
+ $fcgi_tpl->setVar('php_fcgi_max_requests', escapeshellcmd($fastcgi_config['fastcgi_max_requests']));
+ if($default_fastcgi_php){
+ $fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($fastcgi_config['fastcgi_bin']));
+ } else {
+ $fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($custom_fastcgi_php_executable));
+ }
+ $fcgi_tpl->setVar('security_level', intval($web_config['security_level']));
+ $fcgi_tpl->setVar('domain', escapeshellcmd($data['new']['domain']));
+
+ $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
+ $fcgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir));
+
+ $fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+ $app->system->file_put_contents($fcgi_starter_script, $fcgi_tpl->grab());
+ unset($fcgi_tpl);
+
+ $app->log('Creating fastcgi starter script: '.$fcgi_starter_script, LOGLEVEL_DEBUG);
+
+ $app->system->chmod($fcgi_starter_script, 0755);
+ $app->system->chown($fcgi_starter_script, $data['new']['system_user']);
+ $app->system->chgrp($fcgi_starter_script, $data['new']['system_group']);
+
+ $tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']);
+ $tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path);
+ $tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+ $tpl->setVar('fastcgi_config_syntax', $fastcgi_config['fastcgi_config_syntax']);
+ $tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']);
+
+ } else {
+ //remove the php fastgi starter script if available
+ $fastcgi_starter_script = $fastcgi_config['fastcgi_starter_script'].($data['old']['type'] == 'vhostsubdomain' ? '_web' . $data['old']['domain_id'] : '');
+ if ($data['old']['php'] == 'fast-cgi') {
+ $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+ $fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path);
+ if($data['old']['type'] == 'vhost') {
+ if(is_file($fastcgi_starter_script)) @unlink($fastcgi_starter_script);
+ if (is_dir($fastcgi_starter_path)) @rmdir($fastcgi_starter_path);
+ } else {
+ if(is_file($fastcgi_starter_script)) @unlink($fastcgi_starter_script);
+ }
+ }
+ }
+
+
+
+ /**
+ * PHP-FPM
+ */
+ // Support for multiple PHP versions
+ if($data['new']['php'] == 'php-fpm'){
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ } else {
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ }
+
+ if($default_php_fpm){
+ $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ } else {
+ $pool_dir = $custom_php_fpm_pool_dir;
+ }
+ if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
+ $pool_name = 'web'.$data['new']['domain_id'];
+ $socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
+ if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
+
+ $apache_modules = $app->system->getapachemodules();
+
+ // Use sockets, but not with apache 2.4 on centos (mod_proxy_fcgi) as socket support is buggy in that version
+ if($data['new']['php_fpm_use_socket'] == 'y' && in_array('fastcgi_module',$apache_modules)){
+ $use_tcp = 0;
+ $use_socket = 1;
+ } else {
+ $use_tcp = 1;
+ $use_socket = 0;
+ }
+ $tpl->setVar('use_tcp', $use_tcp);
+ $tpl->setVar('use_socket', $use_socket);
+ $fpm_socket = $socket_dir.$pool_name.'.sock';
+ $tpl->setVar('fpm_socket', $fpm_socket);
+ $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
+
+ /**
+ * install cgi starter script and add script alias to config.
+ * This is needed to allow cgi with suexec (to do so, we need a bin in the document-path!)
+ * first we create the script directory if not already created, then copy over the starter script.
+ * TODO: we have to fetch the data from the server-settings.
+ */
+ if ($data['new']['php'] == 'cgi') {
+ //$cgi_config = $app->getconf->get_server_config($conf['server_id'], 'cgi');
+
+ $cgi_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+ $cgi_config['cgi_starter_script'] = 'php-cgi-starter'.($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '');
+ $cgi_config['cgi_bin'] = '/usr/bin/php-cgi';
+
+ $cgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $cgi_config['cgi_starter_path']);
+ $cgi_starter_path = str_replace('[client_id]', $client_id, $cgi_starter_path);
+
+ if (!is_dir($cgi_starter_path)) {
+ $app->system->mkdirpath($cgi_starter_path);
+ $app->system->chown($cgi_starter_path, $data['new']['system_user']);
+ $app->system->chgrp($cgi_starter_path, $data['new']['system_group']);
+ $app->system->chmod($cgi_starter_path, 0755);
+
+ $app->log('Creating cgi starter script directory: '.$cgi_starter_path, LOGLEVEL_DEBUG);
+ }
+
+ $cgi_tpl = new tpl();
+ $cgi_tpl->newTemplate('php-cgi-starter.master');
+ $cgi_tpl->setVar('apache_version', $app->system->getapacheversion());
+
+ // This works because PHP "rewrites" a symlink to the physical path
+ $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
+ $cgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir));
+ $cgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root']));
+
+ // This will NOT work!
+ //$cgi_tpl->setVar('open_basedir', '/var/www/' . $data['new']['domain']);
+ $cgi_tpl->setVar('php_cgi_bin', $cgi_config['cgi_bin']);
+ $cgi_tpl->setVar('security_level', $web_config['security_level']);
+
+ $cgi_tpl->setVar('has_custom_php_ini', $has_custom_php_ini);
+ if($has_custom_php_ini) {
+ $cgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
+ } else {
+ $cgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+ }
+
+ $cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+ $app->system->file_put_contents($cgi_starter_script, $cgi_tpl->grab());
+ unset($cgi_tpl);
+
+ $app->log('Creating cgi starter script: '.$cgi_starter_script, LOGLEVEL_DEBUG);
+
+
+ $app->system->chmod($cgi_starter_script, 0755);
+ $app->system->chown($cgi_starter_script, $data['new']['system_user']);
+ $app->system->chgrp($cgi_starter_script, $data['new']['system_group']);
+
+ $tpl->setVar('cgi_starter_path', $cgi_starter_path);
+ $tpl->setVar('cgi_starter_script', $cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+
+ }
+
+ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
+ //* Make a backup copy of vhost file
+ if(file_exists($vhost_file)) $app->system->copy($vhost_file, $vhost_file.'~');
+
+ //* create empty vhost array
+ $vhosts = array();
+
+ //* Add vhost for ipv4 IP
+ $tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80);
+ if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
+ if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects);
+ $vhosts[] = $tmp_vhost_arr;
+ unset($tmp_vhost_arr);
+
+ //* Add vhost for ipv4 IP with SSL
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+
+ if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) {
+ $tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443');
+ if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
+ $ipv4_ssl_alias_seo_redirects = $alias_seo_redirects;
+ if(is_array($ipv4_ssl_alias_seo_redirects) && !empty($ipv4_ssl_alias_seo_redirects)){
+ for($i=0;$i<count($ipv4_ssl_alias_seo_redirects);$i++){
+ $ipv4_ssl_alias_seo_redirects[$i]['ssl_enabled'] = 1;
+ }
+ }
+ if(count($ipv4_ssl_alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv4_ssl_alias_seo_redirects);
+ $vhosts[] = $tmp_vhost_arr;
+ unset($tmp_vhost_arr, $ipv4_ssl_alias_seo_redirects);
+ $app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
+ }
+
+ //* Add vhost for IPv6 IP
+ if($data['new']['ipv6_address'] != '') {
+ if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
+ if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
+ $explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']);
+ $explode_v6=explode(':', $data['new']['ipv6_address']);
+
+ for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
+ $explode_v6[$i] = $explode_v6prefix[$i];
+ }
+ $data['new']['ipv6_address'] = implode(':', $explode_v6);
+ }
+ }
+
+ $tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80);
+ if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
+ if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects);
+ $vhosts[] = $tmp_vhost_arr;
+ unset($tmp_vhost_arr);
+
+ //* Add vhost for ipv6 IP with SSL
+ if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) {
+ $tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443');
+ if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
+ $ipv6_ssl_alias_seo_redirects = $alias_seo_redirects;
+ if(is_array($ipv6_ssl_alias_seo_redirects) && !empty($ipv6_ssl_alias_seo_redirects)){
+ for($i=0;$i<count($ipv6_ssl_alias_seo_redirects);$i++){
+ $ipv6_ssl_alias_seo_redirects[$i]['ssl_enabled'] = 1;
+ }
+ }
+ if(count($ipv6_ssl_alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv6_ssl_alias_seo_redirects);
+ $vhosts[] = $tmp_vhost_arr;
+ unset($tmp_vhost_arr, $ipv6_ssl_alias_seo_redirects);
+ $app->log('Enable SSL for IPv6: '.$domain, LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* Set the vhost loop
+ $tpl->setLoop('vhosts', $vhosts);
+
+ //* Write vhost file
+ $app->system->file_put_contents($vhost_file, $tpl->grab());
+ $app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+ unset($tpl);
+
+ /*
+ * maybe we have some webdav - user. If so, add them...
+ */
+ $this->_patchVhostWebdav($vhost_file, $data['new']['document_root'] . '/webdav');
+
+ //* Set the symlink to enable the vhost
+ //* First we check if there is a old type of symlink and remove it
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) $app->system->unlink($vhost_symlink);
+
+ //* Remove old or changed symlinks
+ if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') {
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* New symlink
+ if($data['new']['subdomain'] == '*') {
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
+ } else {
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
+ }
+ if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
+ symlink($vhost_file, $vhost_symlink);
+ $app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+
+ // remove old symlink and vhost file, if domain name of the site has changed
+ if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
+ $app->system->unlink($vhost_file);
+ $app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
+ }
+
+ //* Create .htaccess and .htpasswd file for website statistics
+ //if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) {
+ if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
+ $ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
+ $app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
+ $app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
+ unset($ht_file);
+ //}
+
+ if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
+ if(trim($data['new']['stats_password']) != '') {
+ $htp_file = 'admin:'.trim($data['new']['stats_password']);
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+ $app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
+ $app->system->web_folder_protection($data['new']['document_root'], true);
+ $app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
+ unset($htp_file);
+ }
+ }
+
+ //* Create awstats configuration
+ if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
+ $this->awstats_update($data, $web_config);
+ }
+
+ $this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
+
+ if($web_config['check_apache_config'] == 'y') {
+ //* Test if apache starts with the new configuration file
+ $apache_online_status_before_restart = $this->_checkTcp('localhost', 80);
+ $app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+
+ $retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure
+ $app->log('Apache restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG);
+
+ // wait a few seconds, before we test the apache status again
+ $apache_online_status_after_restart = false;
+ sleep(2);
+ for($i = 0; $i < 5; $i++) {
+ $apache_online_status_after_restart = $this->_checkTcp('localhost', 80);
+ if($apache_online_status_after_restart) break;
+ sleep(1);
+ }
+ //* Check if apache restarted successfully if it was online before
+ $app->log('Apache online status after restart is: '.($apache_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+ if($apache_online_status_before_restart && !$apache_online_status_after_restart || $retval['retval'] > 0) {
+ $app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN);
+ if(is_array($retval['output']) && !empty($retval['output'])){
+ $app->log('Reason for Apache restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN);
+ $app->dbmaster->datalogError(implode("\n", $retval['output']));
+ } else {
+ // if no output is given, check again
+ $webserver_binary = '';
+ exec('which apache2ctl', $webserver_check_output, $webserver_check_retval);
+ if($webserver_check_retval == 0){
+ $webserver_binary = 'apache2ctl';
+ } else {
+ unset($webserver_check_output, $webserver_check_retval);
+ exec('which apache2', $webserver_check_output, $webserver_check_retval);
+ if($webserver_check_retval == 0){
+ $webserver_binary = 'apache2';
+ } else {
+ unset($webserver_check_output, $webserver_check_retval);
+ exec('which httpd2', $webserver_check_output, $webserver_check_retval);
+ if($webserver_check_retval == 0){
+ $webserver_binary = 'httpd2';
+ } else {
+ unset($webserver_check_output, $webserver_check_retval);
+ exec('which httpd', $webserver_check_output, $webserver_check_retval);
+ if($webserver_check_retval == 0){
+ $webserver_binary = 'httpd';
+ } else {
+ unset($webserver_check_output, $webserver_check_retval);
+ exec('which apache', $webserver_check_output, $webserver_check_retval);
+ if($webserver_check_retval == 0){
+ $webserver_binary = 'apache';
+ }
+ }
+ }
+ }
+ }
+ if($webserver_binary != ''){
+ exec($webserver_binary.' -t 2>&1', $tmp_output, $tmp_retval);
+ if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){
+ $app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN);
+ $app->dbmaster->datalogError(implode("\n", $tmp_output));
+ }
+ unset($tmp_output, $tmp_retval);
+ }
+ }
+ $app->system->copy($vhost_file, $vhost_file.'.err');
+ if(is_file($vhost_file.'~')) {
+ //* Copy back the last backup file
+ $app->system->copy($vhost_file.'~', $vhost_file);
+ } else {
+ //* There is no backup file, so we create a empty vhost file with a warning message inside
+ $app->system->file_put_contents($vhost_file, "# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
+ }
+ if($this->ssl_certificate_changed === true) {
+
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ $bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+
+ //* Backup the files that might have caused the error
+ if(is_file($key_file)){
+ $app->system->copy($key_file, $key_file.'.err');
+ $app->system->chmod($key_file.'.err', 0400);
+ }
+ if(is_file($key_file2)){
+ $app->system->copy($key_file2, $key_file2.'.err');
+ $app->system->chmod($key_file2.'.err', 0400);
+ }
+ if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err');
+ if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err');
+ if(is_file($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'.err');
+
+ //* Restore the ~ backup files
+ if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file);
+ if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2);
+ if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file);
+ if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file);
+ if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~', $bundle_file);
+
+ $app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN);
+ }
+
+ $app->services->restartService('httpd', 'restart');
+ }
+ } else {
+ //* We do not check the apache config after changes (is faster)
+ if($apache_chrooted) {
+ $app->services->restartServiceDelayed('httpd', 'restart');
+ } else {
+ // request a httpd reload when all records have been processed
+ $app->services->restartServiceDelayed('httpd', 'reload');
+ }
+ }
+
+ //* The vhost is written and apache has been restarted, so we
+ // can reset the ssl changed var to false and cleanup some files
+ $this->ssl_certificate_changed = false;
+
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ $bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+
+ if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~');
+ if(@is_file($key2_file.'~')) $app->system->unlink($key2_file.'~');
+ if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~');
+ if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~');
+ if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~');
+
+ // Remove the backup copy of the config file.
+ if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~');
+
+ //* Unset action to clean it for next processed vhost.
+ $this->action = '';
+ }
+
+ function delete($event_name, $data) {
+ global $app, $conf;
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $app->uses('system');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+ $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
+
+ if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false);
+
+ //* Check if this is a chrooted setup
+ if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
+ $apache_chrooted = true;
+ } else {
+ $apache_chrooted = false;
+ }
+
+ //* Remove the mounts
+ $log_folder = 'log';
+ $web_folder = '';
+ if($data['old']['type'] == 'vhostsubdomain') {
+ $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+ if($tmp['domain'] != ''){
+ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
+ } else {
+ // get log folder from /etc/fstab
+ /*
+ $bind_mounts = $app->system->file_get_contents('/etc/fstab');
+ $bind_mount_lines = explode("\n", $bind_mounts);
+ if(is_array($bind_mount_lines) && !empty($bind_mount_lines)){
+ foreach($bind_mount_lines as $bind_mount_line){
+ $bind_mount_line = preg_replace('/\s+/', ' ', $bind_mount_line);
+ $bind_mount_parts = explode(' ', $bind_mount_line);
+ if(is_array($bind_mount_parts) && !empty($bind_mount_parts)){
+ if($bind_mount_parts[0] == '/var/log/ispconfig/httpd/'.$data['old']['domain'] && $bind_mount_parts[2] == 'none' && strpos($bind_mount_parts[3], 'bind') !== false){
+ $subdomain_host = str_replace($data['old']['document_root'].'/log/', '', $bind_mount_parts[1]);
+ }
+ }
+ }
+ }
+ */
+ // we are deleting the parent domain, so we can delete everything in the log directory
+ $subdomain_hosts = array();
+ $files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..'));
+ if(is_array($files) && !empty($files)){
+ foreach($files as $file){
+ if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){
+ $subdomain_hosts[] = $file;
+ }
+ }
+ }
+ }
+ if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
+ $log_folders = array();
+ foreach($subdomain_hosts as $subdomain_host){
+ $log_folders[] = $log_folder.'/'.$subdomain_host;
+ }
+ } else {
+ if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id'];
+ $log_folder .= '/' . $subdomain_host;
+ }
+ $web_folder = $data['old']['web_folder'];
+ unset($tmp);
+ unset($subdomain_hosts);
+ }
+
+ if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){
+ if(is_array($log_folders) && !empty($log_folders)){
+ foreach($log_folders as $log_folder){
+ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
+ exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
+ }
+ } else {
+ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
+ exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
+ }
+ }
+
+ //* remove mountpoint from fstab
+ if(is_array($log_folders) && !empty($log_folders)){
+ foreach($log_folders as $log_folder){
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ }
+ } else {
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ }
+ unset($log_folders);
+
+ if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['parent_domain_id'] > 0) {
+ //* This is a alias domain or subdomain, so we have to update the website instead
+ $parent_domain_id = intval($data['old']['parent_domain_id']);
+ $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$parent_domain_id." AND active = 'y'");
+ $data['new'] = $tmp;
+ $data['old'] = $tmp;
+ $this->action = 'update';
+ // just run the update function
+ $this->update($event_name, $data);
+
+ } else {
+ //* This is a website
+ // Deleting the vhost file, symlink and the data directory
+ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
+
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)){
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)){
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)){
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+
+ $app->system->unlink($vhost_file);
+ $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+
+ if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
+ $docroot = escapeshellcmd($data['old']['document_root']);
+ if($docroot != '' && !stristr($docroot, '..')) {
+ if($data['old']['type'] == 'vhost') {
+ // this is a vhost - we delete everything in here.
+ exec('rm -rf '.$docroot);
+ } elseif(!stristr($data['old']['web_folder'], '..')) {
+ // this is a vhost subdomain
+ // IMPORTANT: do some folder checks before we delete this!
+ $do_delete = true;
+ $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
+ if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
+ if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
+
+ $path_elements = explode('/', $delete_folder);
+
+ if($path_elements[0] == 'web' || $path_elements[0] === '') {
+ // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
+ // we use strict check as otherwise directories named '0' may not be deleted
+ $do_delete = false;
+ } else {
+ // read all vhost subdomains with same parent domain
+ $used_paths = array();
+ $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
+ foreach($tmp as $tmprec) {
+ // we normalize the folder entries because we need to compare them
+ $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
+ if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
+ if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
+
+ // add this path and it's parent paths to used_paths array
+ while(strpos($tmp_folder, '/') !== false) {
+ if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+ $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
+ }
+ if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+ }
+ unset($tmp);
+
+ // loop and check if the path is still used and stop at first used one
+ // set do_delete to false so nothing gets deleted if the web_folder itself is still used
+ $do_delete = false;
+ while(count($path_elements) > 0) {
+ $tmp_folder = implode('/', $path_elements);
+ if(in_array($tmp_folder, $used_paths) == true) break;
+
+ // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
+ $delete_folder = $tmp_folder;
+ $do_delete = true;
+ array_pop($path_elements);
+ }
+ unset($tmp_folder);
+ unset($used_paths);
+ }
+
+ if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
+
+ unset($delete_folder);
+ unset($path_elements);
+ }
+ }
+
+ //remove the php fastgi starter script if available
+ if ($data['old']['php'] == 'fast-cgi') {
+ $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+ if($data['old']['type'] == 'vhost') {
+ if (is_dir($fastcgi_starter_path)) {
+ exec('rm -rf '.$fastcgi_starter_path);
+ }
+ } else {
+ $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
+ if (file_exists($fcgi_starter_script)) {
+ exec('rm -f '.$fcgi_starter_script);
+ }
+ }
+ }
+
+ // remove PHP-FPM pool
+ if ($data['old']['php'] == 'php-fpm') {
+ $this->php_fpm_pool_delete($data, $web_config);
+ }
+
+ //remove the php cgi starter script if available
+ if ($data['old']['php'] == 'cgi') {
+ // TODO: fetch the date from the server-settings
+ $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+
+ $cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']);
+ if($data['old']['type'] == 'vhost') {
+ if (is_dir($cgi_starter_path)) {
+ exec('rm -rf '.$cgi_starter_path);
+ }
+ } else {
+ $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
+ if (file_exists($cgi_starter_script)) {
+ exec('rm -f '.$cgi_starter_script);
+ }
+ }
+ }
+
+ $app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG);
+
+ // Delete the symlinks for the sites
+ $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+ $client_id = intval($client['client_id']);
+ unset($client);
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ // delete the symlink
+ if(is_link($tmp_symlink)) {
+ $app->system->unlink($tmp_symlink);
+ $app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+ // end removing symlinks
+ }
+
+ // Delete the log file directory
+ $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
+ if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+ $app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
+
+ if($data['old']['type'] == 'vhost') {
+ //delete the web user
+ $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
+ $command .= ' '.escapeshellcmd($data['old']['system_user']);
+ exec($command);
+ if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+ }
+
+ //* Remove the awstats configuration file
+ if($data['old']['stats_type'] == 'awstats') {
+ $this->awstats_delete($data, $web_config);
+ }
+
+ if($data['old']['type'] == 'vhostsubdomain') {
+ $app->system->web_folder_protection($parent_web_document_root, true);
+ }
+
+ if($apache_chrooted) {
+ $app->services->restartServiceDelayed('httpd', 'restart');
+ } else {
+ // request a httpd reload when all records have been processed
+ $app->services->restartServiceDelayed('httpd', 'reload');
+ }
+
+ }
+ if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
+ }
+
+ //* This function is called when a IP on the server is inserted, updated or deleted
+ function server_ip($event_name, $data) {
+ global $app, $conf;
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+
+ $app->load('tpl');
+
+ $tpl = new tpl();
+ $tpl->newTemplate('apache_ispconfig.conf.master');
+ $tpl->setVar('apache_version', $app->system->getapacheversion());
+ $records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
+
+ $records_out= array();
+ if(is_array($records)) {
+ foreach($records as $rec) {
+ if($rec['ip_type'] == 'IPv6') {
+ $ip_address = '['.$rec['ip_address'].']';
+ } else {
+ $ip_address = $rec['ip_address'];
+ }
+ $ports = explode(',', $rec['virtualhost_port']);
+ if(is_array($ports)) {
+ foreach($ports as $port) {
+ $port = intval($port);
+ if($port > 0 && $port < 65536 && $ip_address != '') {
+ $records_out[] = array('ip_address' => $ip_address, 'port' => $port);
+ }
+ }
+ }
+ }
+ }
+
+
+ if(count($records_out) > 0) {
+ $tpl->setLoop('ip_adresses', $records_out);
+ }
+
+ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/ispconfig.conf');
+ $app->system->file_put_contents($vhost_file, $tpl->grab());
+ $app->log('Writing the conf file: '.$vhost_file, LOGLEVEL_DEBUG);
+ unset($tpl);
+
+ }
+
+ //* Create or update the .htaccess folder protection
+ function web_folder_user($event_name, $data) {
+ global $app, $conf;
+
+ $app->uses('system');
+
+ if($event_name == 'web_folder_user_delete') {
+ $folder_id = $data['old']['web_folder_id'];
+ } else {
+ $folder_id = $data['new']['web_folder_id'];
+ }
+
+ $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".intval($folder_id));
+ $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
+
+ if(!is_array($folder) or !is_array($website)) {
+ $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ $web_folder = 'web';
+ if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
+ //* Get the folder path.
+ if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+ if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
+ $folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
+ if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
+ //* Check if the resulting path is inside the docroot
+ if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) {
+ $app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Create the folder path, if it does not exist
+ if(!is_dir($folder_path)) {
+ $app->system->mkdirpath($folder_path);
+ $app->system->chown($folder_path, $website['system_user']);
+ $app->system->chgrp($folder_path, $website['system_group']);
+ }
+
+ //* Create empty .htpasswd file, if it does not exist
+ if(!is_file($folder_path.'.htpasswd')) {
+ $app->system->touch($folder_path.'.htpasswd');
+ $app->system->chmod($folder_path.'.htpasswd', 0751);
+ $app->system->chown($folder_path.'.htpasswd', $website['system_user']);
+ $app->system->chgrp($folder_path.'.htpasswd', $website['system_group']);
+ $app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+
+ /*
+ $auth_users = $app->db->queryAllRecords("SELECT * FROM web_folder_user WHERE active = 'y' AND web_folder_id = ".intval($folder_id));
+ $htpasswd_content = '';
+ if(is_array($auth_users) && !empty($auth_users)){
+ foreach($auth_users as $auth_user){
+ $htpasswd_content .= $auth_user['username'].':'.$auth_user['password']."\n";
+ }
+ }
+ $htpasswd_content = trim($htpasswd_content);
+ @file_put_contents($folder_path.'.htpasswd', $htpasswd_content);
+ $app->log('Changed .htpasswd file: '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+ */
+
+ if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') {
+ $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+ $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
+ }
+
+ //* Add or remove the user from .htpasswd file
+ if($event_name == 'web_folder_user_delete') {
+ $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+ $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
+ } else {
+ if($data['new']['active'] == 'y') {
+ $app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1);
+ $app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG);
+ }
+ }
+
+
+ //* Create the .htaccess file
+ //if(!is_file($folder_path.'.htaccess')) {
+ $begin_marker = '### ISPConfig folder protection begin ###';
+ $end_marker = "### ISPConfig folder protection end ###\n\n";
+ $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
+
+ if(file_exists($folder_path.'.htaccess')) {
+ $old_content = $app->system->file_get_contents($folder_path.'.htaccess');
+
+ if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
+ $ht_file = str_replace($matches[0], $ht_file, $old_content);
+ } else {
+ $ht_file .= $old_content;
+ }
+ }
+ unset($old_content);
+
+ $app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
+ $app->system->chmod($folder_path.'.htaccess', 0751);
+ $app->system->chown($folder_path.'.htaccess', $website['system_user']);
+ $app->system->chgrp($folder_path.'.htaccess', $website['system_group']);
+ $app->log('Created/modified file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ //}
+
+ }
+
+ //* Remove .htaccess and .htpasswd file, when folder protection is removed
+ function web_folder_delete($event_name, $data) {
+ global $app, $conf;
+
+ $folder_id = $data['old']['web_folder_id'];
+
+ $folder = $data['old'];
+ $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
+
+ if(!is_array($folder) or !is_array($website)) {
+ $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ $web_folder = 'web';
+ if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
+ //* Get the folder path.
+ if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+ if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
+ $folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
+ if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
+ //* Check if the resulting path is inside the docroot
+ if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+ $app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Remove .htpasswd file
+ if(is_file($folder_path.'.htpasswd')) {
+ $app->system->unlink($folder_path.'.htpasswd');
+ $app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+
+ //* Remove .htaccess file
+ if(is_file($folder_path.'.htaccess')) {
+ $begin_marker = '### ISPConfig folder protection begin ###';
+ $end_marker = "### ISPConfig folder protection end ###\n\n";
+
+ $ht_file = $app->system->file_get_contents($folder_path.'.htaccess');
+
+ if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+ $ht_file = str_replace($matches[0], '', $ht_file);
+ } else {
+ $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+ }
+
+ if(trim($ht_file) == '') {
+ $app->system->unlink($folder_path.'.htaccess');
+ $app->log('Removed file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ } else {
+ $app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
+ $app->log('Removed protection content from file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+ //* Update folder protection, when path has been changed
+ function web_folder_update($event_name, $data) {
+ global $app, $conf;
+
+ $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
+
+ if(!is_array($website)) {
+ $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ $web_folder = 'web';
+ if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
+ //* Get the folder path.
+ if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1);
+ if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1);
+ $old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']);
+ if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/';
+
+ if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1);
+ if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1);
+ $new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']);
+ if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/';
+
+ //* Check if the resulting path is inside the docroot
+ if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) {
+ $app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
+ return false;
+ }
+ if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) {
+ $app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Check if the resulting path is inside the docroot
+ if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+ $app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
+ return false;
+ }
+ if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+ $app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Create the folder path, if it does not exist
+ if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path);
+
+ $begin_marker = '### ISPConfig folder protection begin ###';
+ $end_marker = "### ISPConfig folder protection end ###\n\n";
+
+ if($data['old']['path'] != $data['new']['path']) {
+
+
+ //* move .htpasswd file
+ if(is_file($old_folder_path.'.htpasswd')) {
+ $app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd');
+ $app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+
+ //* delete old .htaccess file
+ if(is_file($old_folder_path.'.htaccess')) {
+ $ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess');
+
+ if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+ $ht_file = str_replace($matches[0], '', $ht_file);
+ } else {
+ $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+ }
+
+ if(trim($ht_file) == '') {
+ $app->system->unlink($old_folder_path.'.htaccess');
+ $app->log('Removed file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ } else {
+ $app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file);
+ $app->log('Removed protection content from file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ }
+ }
+
+ }
+
+ //* Create the .htaccess file
+ if($data['new']['active'] == 'y') {
+ $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
+
+ if(file_exists($new_folder_path.'.htaccess')) {
+ $old_content = $app->system->file_get_contents($new_folder_path.'.htaccess');
+
+ if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
+ $ht_file = str_replace($matches[0], $ht_file, $old_content);
+ } else {
+ $ht_file .= $old_content;
+ }
+ }
+
+ $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
+ $app->system->chmod($new_folder_path.'.htaccess', 0751);
+ $app->system->chown($new_folder_path.'.htaccess', $website['system_user']);
+ $app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']);
+ $app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+
+ //* Create empty .htpasswd file, if it does not exist
+ if(!is_file($folder_path.'.htpasswd')) {
+ $app->system->touch($new_folder_path.'.htpasswd');
+ $app->system->chmod($new_folder_path.'.htpasswd', 0751);
+ $app->system->chown($new_folder_path.'.htpasswd', $website['system_user']);
+ $app->system->chgrp($new_folder_path.'.htpasswd', $website['system_group']);
+ $app->log('Created file '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* Remove .htaccess file
+ if($data['new']['active'] == 'n' && is_file($new_folder_path.'.htaccess')) {
+ $ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess');
+
+ if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+ $ht_file = str_replace($matches[0], '', $ht_file);
+ } else {
+ $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+ }
+
+ if(trim($ht_file) == '') {
+ $app->system->unlink($new_folder_path.'.htaccess');
+ $app->log('Removed file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ } else {
+ $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
+ $app->log('Removed protection content from file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+ }
+ }
+
+
+ }
+
+ public function ftp_user_delete($event_name, $data) {
+ global $app, $conf;
+
+ $ftpquota_file = $data['old']['dir'].'/.ftpquota';
+ if(file_exists($ftpquota_file)) $app->system->unlink($ftpquota_file);
+
+ }
+
+
+
+ /**
+ * This function is called when a Webdav-User is inserted, updated or deleted.
+ *
+ * @author Oliver Vogel
+ * @param string $event_name
+ * @param array $data
+ */
+ public function webdav($event_name, $data) {
+ global $app, $conf;
+
+ /*
+ * load the server configuration options
+ */
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+
+ if (($event_name == 'webdav_user_insert') || ($event_name == 'webdav_user_update')) {
+
+ /*
+ * Get additional informations
+ */
+ $sitedata = $app->db->queryOneRecord('SELECT document_root, domain, system_user, system_group FROM web_domain WHERE domain_id = ' . $data['new']['parent_domain_id']);
+ $documentRoot = $sitedata['document_root'];
+ $domain = $sitedata['domain'];
+ $user = $sitedata['system_user'];
+ $group = $sitedata['system_group'];
+ $webdav_user_dir = $documentRoot . '/webdav/' . $data['new']['dir'];
+
+ /* Check if this is a chrooted setup */
+ if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
+ $apache_chrooted = true;
+ $app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
+ } else {
+ $apache_chrooted = false;
+ }
+
+ //* We dont want to have relative paths here
+ if(stristr($webdav_user_dir, '..') || stristr($webdav_user_dir, './')) {
+ $app->log('Folder path '.$webdav_user_dir.' contains ./ or .. '.$documentRoot, LOGLEVEL_WARN);
+ return false;
+ }
+
+ //* Check if the resulting path exists if yes, if it is inside the docroot
+ if(is_dir($webdav_user_dir) && substr(realpath($webdav_user_dir), 0, strlen($documentRoot)) != $documentRoot) {
+ $app->log('Folder path '.$webdav_user_dir.' is outside of docroot '.$documentRoot, LOGLEVEL_WARN);
+ return false;
+ }
+
+ /*
+ * First the webdav-root - folder has to exist
+ */
+ if(!is_dir($webdav_user_dir)) {
+ $app->log('Webdav User directory '.$webdav_user_dir.' does not exist. Creating it now.', LOGLEVEL_DEBUG);
+ $app->system->mkdirpath($webdav_user_dir);
+ }
+
+ /*
+ * The webdav - Root needs the group/user as owner and the apache as read and write
+ */
+ //$this->_exec('chown ' . $user . ':' . $group . ' ' . escapeshellcmd($documentRoot . '/webdav/'));
+ //$this->_exec('chmod 770 ' . escapeshellcmd($documentRoot . '/webdav/'));
+ $app->system->chown($documentRoot . '/webdav', $user);
+ $app->system->chgrp($documentRoot . '/webdav', $group);
+ $app->system->chmod($documentRoot . '/webdav', 0770);
+
+ /*
+ * The webdav folder (not the webdav-root!) needs the same (not in ONE step, because the
+ * pwd-files are owned by root)
+ */
+ //$this->_exec('chown ' . $user . ':' . $group . ' ' . escapeshellcmd($webdav_user_dir.' -R'));
+ //$this->_exec('chmod 770 ' . escapeshellcmd($webdav_user_dir.' -R'));
+ $app->system->chown($webdav_user_dir, $user);
+ $app->system->chgrp($webdav_user_dir, $group);
+ $app->system->chmod($webdav_user_dir, 0770);
+
+ /*
+ * if the user is active, we have to write/update the password - file
+ * if the user is inactive, we have to inactivate the user by removing the user from the file
+ */
+ if ($data['new']['active'] == 'y') {
+ $this->_writeHtDigestFile( $webdav_user_dir . '.htdigest', $data['new']['username'], $data['new']['dir'], $data['new']['password']);
+ }
+ else {
+ /* empty pwd removes the user! */
+ $this->_writeHtDigestFile( $webdav_user_dir . '.htdigest', $data['new']['username'], $data['new']['dir'], '');
+ }
+
+ /*
+ * Next step, patch the vhost - file
+ */
+ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'] . '/' . $domain . '.vhost');
+ $this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav');
+
+ /*
+ * Last, restart apache
+ */
+ if($apache_chrooted) {
+ $app->services->restartServiceDelayed('httpd', 'restart');
+ } else {
+ // request a httpd reload when all records have been processed
+ $app->services->restartServiceDelayed('httpd', 'reload');
+ }
+
+ }
+
+ if ($event_name == 'webdav_user_delete') {
+ /*
+ * Get additional informations
+ */
+ $sitedata = $app->db->queryOneRecord('SELECT document_root, domain FROM web_domain WHERE domain_id = ' . $data['old']['parent_domain_id']);
+ $documentRoot = $sitedata['document_root'];
+ $domain = $sitedata['domain'];
+
+ /*
+ * We dont't want to destroy any (transfer)-Data. So we do NOT delete any dir.
+ * So the only thing, we have to do, is to delete the user from the password-file
+ */
+ $this->_writeHtDigestFile( $documentRoot . '/webdav/' . $data['old']['dir'] . '.htdigest', $data['old']['username'], $data['old']['dir'], '');
+
+ /*
+ * Next step, patch the vhost - file
+ */
+ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'] . '/' . $domain . '.vhost');
+ $this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav');
+
+ /*
+ * Last, restart apache
+ */
+ if($apache_chrooted) {
+ $app->services->restartServiceDelayed('httpd', 'restart');
+ } else {
+ // request a httpd reload when all records have been processed
+ $app->services->restartServiceDelayed('httpd', 'reload');
+ }
+ }
+ }
+
+
+ /**
+ * This function writes the htdigest - files used by webdav and digest
+ * more info: see http://riceball.com/d/node/424
+ * @author Oliver Vogel
+ * @param string $filename The name of the digest-file
+ * @param string $username The name of the webdav-user
+ * @param string $authname The name of the realm
+ * @param string $pwd The password-hash of the user
+ */
+ private function _writeHtDigestFile($filename, $username, $authname, $pwdhash ) {
+ global $app;
+
+ $changed = false;
+ if(is_file($filename) && !is_link($filename)) {
+ $in = fopen($filename, 'r');
+ $output = '';
+ /*
+ * read line by line and search for the username and authname
+ */
+ while (preg_match("/:/", $line = fgets($in))) {
+ $line = rtrim($line);
+ $tmp = explode(':', $line);
+ if ($tmp[0] == $username && $tmp[1] == $authname) {
+ /*
+ * found the user. delete or change it?
+ */
+ if ($pwdhash != '') {
+ $output .= $tmp[0] . ':' . $tmp[1] . ':' . $pwdhash . "\n";
+ }
+ $changed = true;
+ }
+ else {
+ $output .= $line . "\n";
+ }
+ }
+ fclose($in);
+ }
+ /*
+ * if we didn't change anything, we have to add the new user at the end of the file
+ */
+ if (!$changed) {
+ $output .= $username . ':' . $authname . ':' . $pwdhash . "\n";
+ }
+
+
+ /*
+ * Now lets write the new file
+ */
+ if(trim($output) == '') {
+ $app->system->unlink($filename);
+ } else {
+ $app->system->file_put_contents($filename, $output);
+ }
+ }
+
+ /**
+ * This function patches the vhost-file and adds all webdav - user.
+ * This function is written, because the creation of the vhost - file is sophisticated and
+ * i don't want to make it more "heavy" by also adding this code too...
+ * @author Oliver Vogel
+ * @param string $fileName The Name of the .vhost-File (path included)
+ * @param string $webdavRoot The root of the webdav-folder
+ */
+ private function _patchVhostWebdav($fileName, $webdavRoot) {
+ global $app;
+ $in = fopen($fileName, 'r');
+ $output = '';
+ $inWebdavSection = false;
+
+ /*
+ * read line by line and search for the username and authname
+ */
+ while ($line = fgets($in)) {
+ /*
+ * is the "replace-comment" found...
+ */
+ if (trim($line) == '# WEBDAV BEGIN') {
+ /*
+ * The begin of the webdav - section is found, so ignore all lines til the end is found
+ */
+ $inWebdavSection = true;
+
+ $output .= " # WEBDAV BEGIN\n";
+
+ /*
+ * add all the webdav-dirs to the webdav-section
+ */
+ $files = @scandir($webdavRoot);
+ if(is_array($files)) {
+ foreach($files as $file) {
+ if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/", $file)) {
+ /*
+ * found a htdigest - file, so add it to webdav
+ */
+ $fn = substr($file, 0, strlen($file) - strlen('.htdigest'));
+ $output .= "\n";
+ // $output .= " Alias /" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
+ // $output .= " <Location /" . $fn . ">\n";
+ $output .= " Alias /webdav/" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
+ $output .= " <Location /webdav/" . $fn . ">\n";
+ $output .= " DAV On\n";
+ $output .= ' BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On'."\n";
+ $output .= " AuthType Digest\n";
+ $output .= " AuthName \"" . $fn . "\"\n";
+ $output .= " AuthUserFile " . $webdavRoot . '/' . $file . "\n";
+ $output .= " Require valid-user \n";
+ $output .= " Options +Indexes \n";
+ $output .= " Order allow,deny \n";
+ $output .= " Allow from all \n";
+ $output .= " </Location> \n";
+ }
+ }
+ }
+ }
+ /*
+ * is the "replace-comment-end" found...
+ */
+ if (trim($line) == '# WEBDAV END') {
+ /*
+ * The end of the webdav - section is found, so stop ignoring
+ */
+ $inWebdavSection = false;
+ }
+
+ /*
+ * Write the line to the output, if it is not in the section
+ */
+ if (!$inWebdavSection) {
+ $output .= $line;
+ }
+ }
+ fclose($in);
+
+ /*
+ * Now lets write the new file
+ */
+ $app->system->file_put_contents($fileName, $output);
+
+ }
+
+ //* Update the awstats configuration file
+ private function awstats_update ($data, $web_config) {
+ global $app;
+
+ $web_folder = $data['new']['web_folder'];
+ if($data['new']['type'] == 'vhost') $web_folder = 'web';
+ $awstats_conf_dir = $web_config['awstats_conf_dir'];
+
+ if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats");
+ if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
+ if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
+ $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
+ }
+
+ $content = '';
+ $content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
+ $content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
+ $content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
+ $content .= "HostAliases=\"www.".$data['new']['domain']." localhost 127.0.0.1\"\n";
+
+ $app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content);
+ $app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG);
+ }
+
+ if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
+ if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
+ $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ } else {
+ $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ }
+ }
+
+ //* Delete the awstats configuration file
+ private function awstats_delete ($data, $web_config) {
+ global $app;
+
+ $awstats_conf_dir = $web_config['awstats_conf_dir'];
+
+ if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
+ $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
+ $app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* Update the PHP-FPM pool configuration file
+ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) {
+ global $app, $conf;
+ //$reload = false;
+
+ if($data['new']['php'] == 'php-fpm'){
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ } else {
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ }
+
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
+
+ if($data['new']['php'] != 'php-fpm'){
+ if(@is_file($pool_dir.$pool_name.'.conf')){
+ $app->system->unlink($pool_dir.$pool_name.'.conf');
+ //$reload = true;
+ }
+ if($data['old']['php'] == 'php-fpm'){
+ if(!$default_php_fpm){
+ $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
+ } else {
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+ //if($reload == true) $app->services->restartService('php-fpm','reload');
+ return;
+ }
+
+ $app->load('tpl');
+ $tpl = new tpl();
+ $tpl->newTemplate('php_fpm_pool.conf.master');
+ $tpl->setVar('apache_version', $app->system->getapacheversion());
+
+ $apache_modules = $app->system->getapachemodules();
+
+ // Use sockets, but not with apache 2.4 on centos (mod_proxy_fcgi) as socket support is buggy in that version
+ if($data['new']['php_fpm_use_socket'] == 'y' && in_array('fastcgi_module',$apache_modules)){
+ $use_tcp = 0;
+ $use_socket = 1;
+ if(!is_dir($socket_dir)) $app->system->mkdirpath($socket_dir);
+ } else {
+ $use_tcp = 1;
+ $use_socket = 0;
+ }
+ $tpl->setVar('use_tcp', $use_tcp);
+ $tpl->setVar('use_socket', $use_socket);
+
+ $fpm_socket = $socket_dir.$pool_name.'.sock';
+ $tpl->setVar('fpm_socket', $fpm_socket);
+ $tpl->setVar('fpm_listen_mode', '0660');
+
+ $tpl->setVar('fpm_pool', $pool_name);
+ $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
+ $tpl->setVar('fpm_user', $data['new']['system_user']);
+ $tpl->setVar('fpm_group', $data['new']['system_group']);
+ $tpl->setVar('pm', $data['new']['pm']);
+ $tpl->setVar('pm_max_children', $data['new']['pm_max_children']);
+ $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']);
+ $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']);
+ $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']);
+ $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']);
+ $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']);
+ $tpl->setVar('document_root', $data['new']['document_root']);
+ $tpl->setVar('security_level', $web_config['security_level']);
+ $tpl->setVar('domain', $data['new']['domain']);
+ $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
+ $tpl->setVar('php_open_basedir', $php_open_basedir);
+ if($php_open_basedir != ''){
+ $tpl->setVar('enable_php_open_basedir', '');
+ } else {
+ $tpl->setVar('enable_php_open_basedir', ';');
+ }
+
+ // Custom php.ini settings
+ $final_php_ini_settings = array();
+ $custom_php_ini_settings = trim($data['new']['custom_php_ini']);
+ if($custom_php_ini_settings != ''){
+ // Make sure we only have Unix linebreaks
+ $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
+ $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings);
+ $ini_settings = explode("\n", $custom_php_ini_settings);
+ if(is_array($ini_settings) && !empty($ini_settings)){
+ foreach($ini_settings as $ini_setting){
+ $ini_setting = trim($ini_setting);
+ if(substr($ini_setting, 0, 1) == ';') continue;
+ if(substr($ini_setting, 0, 1) == '#') continue;
+ if(substr($ini_setting, 0, 2) == '//') continue;
+ list($key, $value) = explode('=', $ini_setting, 2);
+ $value = trim($value);
+ if($value != ''){
+ $key = trim($key);
+ switch (strtolower($value)) {
+ case '0':
+ // PHP-FPM might complain about invalid boolean value if you use 0
+ $value = 'off';
+ case '1':
+ case 'on':
+ case 'off':
+ case 'true':
+ case 'false':
+ case 'yes':
+ case 'no':
+ $final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
+ break;
+ default:
+ $final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
+ }
+ }
+ }
+ }
+ }
+
+ $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
+
+ $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());
+ $app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ unset($tpl);
+
+ // delete pool in all other PHP versions
+ $default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
+ if($default_pool_dir != $pool_dir){
+ if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
+ $app->system->unlink($default_pool_dir.$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+ $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$conf["server_id"]);
+ if(is_array($php_versions) && !empty($php_versions)){
+ foreach($php_versions as $php_version){
+ if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+ if($php_version['php_fpm_pool_dir'] != $pool_dir){
+ if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
+ $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
+ }
+ }
+ }
+ }
+ // Reload current PHP-FPM after all others
+ sleep(1);
+ if(!$default_php_fpm){
+ $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
+ } else {
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+
+ //$reload = true;
+
+ //if($reload == true) $app->services->restartService('php-fpm','reload');
+ }
+
+ //* Delete the PHP-FPM pool configuration file
+ private function php_fpm_pool_delete ($data, $web_config) {
+ global $app, $conf;
+
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+
+ if($default_php_fpm){
+ $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ } else {
+ $pool_dir = $custom_php_fpm_pool_dir;
+ }
+
+ if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
+ $pool_name = 'web'.$data['old']['domain_id'];
+
+ if ( @is_file($pool_dir.$pool_name.'.conf') ) {
+ $app->system->unlink($pool_dir.$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+
+ //$app->services->restartService('php-fpm','reload');
+ }
+
+ // delete pool in all other PHP versions
+ $default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
+ if($default_pool_dir != $pool_dir){
+ if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
+ $app->system->unlink($default_pool_dir.$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+ $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$data['old']['server_id']);
+ if(is_array($php_versions) && !empty($php_versions)){
+ foreach($php_versions as $php_version){
+ if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+ if($php_version['php_fpm_pool_dir'] != $pool_dir){
+ if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
+ $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
+ }
+ }
+ }
+ }
+
+ // Reload current PHP-FPM after all others
+ sleep(1);
+ if(!$default_php_fpm){
+ $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
+ } else {
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+
+ function client_delete($event_name, $data) {
+ global $app, $conf;
+
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
+
+ $client_id = intval($data['old']['client_id']);
+ if($client_id > 0) {
+
+ $client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
+ if(is_dir($client_dir) && !stristr($client_dir, '..')) {
+ // remove symlinks from $client_dir
+ $files = array_diff(scandir($client_dir), array('.', '..'));
+ if(is_array($files) && !empty($files)){
+ foreach($files as $file){
+ if(is_link($client_dir.'/'.$file)){
+ unlink($client_dir.'/'.$file);
+ $app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+ @rmdir($client_dir);
+ $app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG);
+ }
+
+ if($app->system->is_group('client'.$client_id)){
+ $this->_exec('groupdel client'.$client_id);
+ $app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG);
+ }
+ }
+
+ }
+
+ //* Wrapper for exec function for easier debugging
+ private function _exec($command) {
+ global $app;
+ $app->log('exec: '.$command, LOGLEVEL_DEBUG);
+ exec($command);
+ }
+
+ private function _checkTcp ($host, $port) {
+
+ $fp = @fsockopen($host, $port, $errno, $errstr, 2);
+
+ if ($fp) {
+ fclose($fp);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function create_relative_link($f, $t) {
+ global $app;
+
+ // $from already exists
+ $from = realpath($f);
+
+ // realpath requires the traced file to exist - so, lets touch it first, then remove
+ @$app->system->unlink($t); touch($t);
+ $to = realpath($t);
+ @$app->system->unlink($t);
+
+ // Remove from the left side matching path elements from $from and $to
+ // and get path elements counts
+ $a1 = explode('/', $from); $a2 = explode('/', $to);
+ for ($c = 0; $a1[$c] == $a2[$c]; $c++) {
+ unset($a1[$c]); unset($a2[$c]);
+ }
+ $cfrom = implode('/', $a1);
+
+ // Check if a path is fully a subpath of another - no way to create symlink in the case
+ if (count($a1) == 0 || count($a2) == 0) return false;
+
+ // Add ($cnt_to-1) number of "../" elements to left side of $cfrom
+ for ($c = 0; $c < (count($a2)-1); $c++) { $cfrom = '../'.$cfrom; }
+
+ return symlink($cfrom, $to);
+ }
+
+ private function _rewrite_quote($string) {
+ return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
+ }
+
+ private function _is_url($string) {
+ return preg_match('/^(f|ht)tp(s)?:\/\//i', $string);
+ }
+
+ private function get_seo_redirects($web, $prefix = ''){
+ $seo_redirects = array();
+
+ if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*';
+
+ if($web['subdomain'] == 'www' || $web['subdomain'] == '*'){
+ if($web['seo_redirect'] == 'non_www_to_www'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = str_replace('.', '\.', $web['domain']);
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '';
+ }
+ if($web['seo_redirect'] == '*_domain_tld_to_www_domain_tld'){
+ // ^(example\.com|(?!\bwww\b)\.example\.com)$
+ // ^(example\.com|((?:\w+(?:-\w+)*\.)*)((?!www\.)\w+(?:-\w+)*)(\.example\.com))$
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = '('.str_replace('.', '\.', $web['domain']).'|((?:\w+(?:-\w+)*\.)*)((?!www\.)\w+(?:-\w+)*)(\.'.str_replace('.', '\.', $web['domain']).'))';
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '';
+ }
+ if($web['seo_redirect'] == '*_to_www_domain_tld'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = 'www\.'.str_replace('.', '\.', $web['domain']);
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '!';
+ }
+ }
+ if($web['seo_redirect'] == 'www_to_non_www'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = 'www\.'.str_replace('.', '\.', $web['domain']);
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '';
+ }
+ if($web['seo_redirect'] == '*_domain_tld_to_domain_tld'){
+ // ^(.+)\.example\.com$
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = '(.+)\.'.str_replace('.', '\.', $web['domain']);
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '';
+ }
+ if($web['seo_redirect'] == '*_to_domain_tld'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = str_replace('.', '\.', $web['domain']);
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '!';
+ }
+ return $seo_redirects;
+ }
+
+} // end class
+
+?>
diff --git a/src/server/plugins-available/nginx_plugin.inc.php b/src/server/plugins-available/nginx_plugin.inc.php
new file mode 100755
index 0000000..02d9be4
--- /dev/null
+++ b/src/server/plugins-available/nginx_plugin.inc.php
@@ -0,0 +1,2932 @@
+<?php
+
+/*
+Copyright (c) 2007 - 2012, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class nginx_plugin {
+
+ var $plugin_name = 'nginx_plugin';
+ var $class_name = 'nginx_plugin';
+
+ // private variables
+ var $action = '';
+ var $ssl_certificate_changed = false;
+
+ //* This function is called during ispconfig installation to determine
+ // if a symlink shall be created for this plugin.
+ function onInstall() {
+ global $conf;
+
+ if($conf['services']['web'] == true && !@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+
+ /*
+ This function is called when the plugin is loaded
+ */
+
+ function onLoad() {
+ global $app;
+
+ /*
+ Register for the events
+ */
+ $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+ $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+ $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
+
+ $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+ $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+ $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+ $app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
+ $app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
+ $app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
+
+ /*
+ $app->plugins->registerEvent('webdav_user_insert',$this->plugin_name,'webdav');
+ $app->plugins->registerEvent('webdav_user_update',$this->plugin_name,'webdav');
+ $app->plugins->registerEvent('webdav_user_delete',$this->plugin_name,'webdav');
+ */
+
+ $app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete');
+
+ $app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user');
+ $app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user');
+ $app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user');
+
+ $app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
+ $app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
+ }
+
+ // Handle the creation of SSL certificates
+ function ssl($event_name, $data) {
+ global $app, $conf;
+
+ $app->uses('system');
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+ if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
+ $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR);
+
+ //* Only vhosts can have a ssl cert
+ if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return;
+
+ // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl');
+ if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
+
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+
+ //* Create a SSL Certificate
+ if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) {
+
+ $this->ssl_certificate_changed = true;
+
+ //* Rename files if they exist
+ if(file_exists($key_file)){
+ $app->system->rename($key_file, $key_file.'.bak');
+ $app->system->chmod($key_file.'.bak', 0400);
+ }
+ if(file_exists($key_file2)){
+ $app->system->rename($key_file2, $key_file2.'.bak');
+ $app->system->chmod($key_file2.'.bak', 0400);
+ }
+ if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak');
+ if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak');
+
+ $rand_file = $ssl_dir.'/random_file';
+ $rand_data = md5(uniqid(microtime(), 1));
+ for($i=0; $i<1000; $i++) {
+ $rand_data .= md5(uniqid(microtime(), 1));
+ $rand_data .= md5(uniqid(microtime(), 1));
+ $rand_data .= md5(uniqid(microtime(), 1));
+ $rand_data .= md5(uniqid(microtime(), 1));
+ }
+ $app->system->file_put_contents($rand_file, $rand_data);
+
+ $ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15);
+
+ $ssl_cnf = " RANDFILE = $rand_file
+
+ [ req ]
+ default_bits = 2048
+ default_md = sha256
+ default_keyfile = keyfile.pem
+ distinguished_name = req_distinguished_name
+ attributes = req_attributes
+ prompt = no
+ output_password = $ssl_password
+
+ [ req_distinguished_name ]
+ C = ".trim($data['new']['ssl_country'])."
+ ST = ".trim($data['new']['ssl_state'])."
+ L = ".trim($data['new']['ssl_locality'])."
+ O = ".trim($data['new']['ssl_organisation'])."
+ OU = ".trim($data['new']['ssl_organisation_unit'])."
+ CN = $domain
+ emailAddress = webmaster@".$data['new']['domain']."
+
+ [ req_attributes ]
+ challengePassword = A challenge password";
+
+ $ssl_cnf_file = $ssl_dir.'/openssl.conf';
+ $app->system->file_put_contents($ssl_cnf_file, $ssl_cnf);
+
+ $rand_file = escapeshellcmd($rand_file);
+ $key_file = escapeshellcmd($key_file);
+ $openssl_cmd_key_file = $key_file;
+ if(substr($domain, 0, 2) == '*.' && strpos($key_file, '/ssl/\*.') !== false) $key_file = str_replace('/ssl/\*.', '/ssl/*.', $key_file); // wildcard certificate
+ $key_file2 = escapeshellcmd($key_file2);
+ $openssl_cmd_key_file2 = $key_file2;
+ if(substr($domain, 0, 2) == '*.' && strpos($key_file2, '/ssl/\*.') !== false) $key_file2 = str_replace('/ssl/\*.', '/ssl/*.', $key_file2); // wildcard certificate
+ $ssl_days = 3650;
+ $csr_file = escapeshellcmd($csr_file);
+ $openssl_cmd_csr_file = $csr_file;
+ if(substr($domain, 0, 2) == '*.' && strpos($csr_file, '/ssl/\*.') !== false) $csr_file = str_replace('/ssl/\*.', '/ssl/*.', $csr_file); // wildcard certificate
+ $config_file = escapeshellcmd($ssl_cnf_file);
+ $crt_file = escapeshellcmd($crt_file);
+ $openssl_cmd_crt_file = $crt_file;
+ if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate
+
+ if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) {
+
+ exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $openssl_cmd_key_file 2048");
+ exec("openssl req -new -sha256 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file -out $openssl_cmd_csr_file -days $ssl_days -config $config_file");
+ exec("openssl rsa -passin pass:$ssl_password -in $openssl_cmd_key_file -out $openssl_cmd_key_file2");
+
+ if(file_exists($web_config['CA_path'].'/openssl.cnf'))
+ {
+ exec("openssl ca -batch -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file");
+ $app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed. openssl ca -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file", LOGLEVEL_ERROR);
+ };
+ if (@filesize($crt_file)==0 || !file_exists($crt_file)){
+ exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file -in $openssl_cmd_csr_file -out $openssl_cmd_crt_file -days $ssl_days -config $config_file ");
+ $app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ };
+
+ }
+
+ $app->system->chmod($key_file, 0400);
+ $app->system->chmod($key_file2, 0400);
+ @$app->system->unlink($config_file);
+ @$app->system->unlink($rand_file);
+ $ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
+ $ssl_cert = $app->db->quote($app->system->file_get_contents($crt_file));
+ $ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ }
+
+ //* Save a SSL certificate to disk
+ if($data["new"]["ssl_action"] == 'save') {
+ $this->ssl_certificate_changed = true;
+ $ssl_dir = $data["new"]["document_root"]."/ssl";
+ $domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.".csr";
+ $crt_file = $ssl_dir.'/'.$domain.".crt";
+ //$bundle_file = $ssl_dir.'/'.$domain.".bundle";
+
+ //* Backup files
+ if(file_exists($key_file)){
+ $app->system->copy($key_file, $key_file.'~');
+ $app->system->chmod($key_file.'~', 0400);
+ }
+ if(file_exists($key_file2)){
+ $app->system->copy($key_file2, $key_file2.'~');
+ $app->system->chmod($key_file2.'~', 0400);
+ }
+ if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~');
+ if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~');
+ //if(file_exists($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'~');
+
+ //* Write new ssl files
+ if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]);
+ if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]);
+ //if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
+ if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2, $data["new"]["ssl_key"]);
+ $app->system->chmod($key_file2, 0400);
+
+ // for nginx, bundle files have to be appended to the certificate file
+ if(trim($data["new"]["ssl_bundle"]) != ''){
+ if(file_exists($crt_file)){
+ $crt_file_contents = trim($app->system->file_get_contents($crt_file));
+ } else {
+ $crt_file_contents = '';
+ }
+ if($crt_file_contents != '') $crt_file_contents .= "\n";
+ $crt_file_contents .= $data["new"]["ssl_bundle"];
+ $app->system->file_put_contents($crt_file, $app->file->unix_nl($crt_file_contents));
+ unset($crt_file_contents);
+ }
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
+ }
+
+ //* Delete a SSL certificate
+ if($data['new']['ssl_action'] == 'del') {
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"];
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ //$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+ if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf'))
+ {
+ exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke ".escapeshellcmd($crt_file));
+ $app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ };
+ $app->system->unlink($csr_file);
+ $app->system->unlink($crt_file);
+ //$app->system->unlink($bundle_file);
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
+ }
+
+ }
+
+
+ function insert($event_name, $data) {
+ global $app, $conf;
+
+ $this->action = 'insert';
+ // just run the update function
+ $this->update($event_name, $data);
+
+
+ }
+
+
+ function update($event_name, $data) {
+ global $app, $conf;
+
+ //* Check if the apache plugin is enabled
+ if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
+ $app->log('The nginx plugin cannot be used together with the apache2 plugin.', LOGLEVEL_WARN);
+ return 0;
+ }
+
+ if($this->action != 'insert') $this->action = 'update';
+
+ if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) {
+
+ $old_parent_domain_id = intval($data['old']['parent_domain_id']);
+ $new_parent_domain_id = intval($data['new']['parent_domain_id']);
+
+ // If the parent_domain_id has been changed, we will have to update the old site as well.
+ if($this->action == 'update' && $data['new']['parent_domain_id'] != $data['old']['parent_domain_id']) {
+ $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$old_parent_domain_id." AND active = 'y'");
+ $data['new'] = $tmp;
+ $data['old'] = $tmp;
+ $this->action = 'update';
+ $this->update($event_name, $data);
+ }
+
+ // This is not a vhost, so we need to update the parent record instead.
+ $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$new_parent_domain_id." AND active = 'y'");
+ $data['new'] = $tmp;
+ $data['old'] = $tmp;
+ $this->action = 'update';
+ }
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+
+ //* Check if this is a chrooted setup
+ if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
+ $nginx_chrooted = true;
+ $app->log('Info: nginx is chrooted.', LOGLEVEL_DEBUG);
+ } else {
+ $nginx_chrooted = false;
+ }
+
+ if($data['new']['document_root'] == '') {
+ if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN);
+ return 0;
+ }
+
+ if($app->system->is_allowed_user($data['new']['system_user'], $app->system->is_user($data['new']['system_user']), true) == false
+ || $app->system->is_allowed_group($data['new']['system_group'], $app->system->is_group($data['new']['system_group']), true) == false) {
+ $app->log('Websites cannot be owned by the root user or group. User: '.$data['new']['system_user'].' Group: '.$data['new']['system_group'], LOGLEVEL_WARN);
+ return 0;
+ }
+
+ if(trim($data['new']['domain']) == '') {
+ $app->log('domain is empty', LOGLEVEL_WARN);
+ return 0;
+ }
+
+ $web_folder = 'web';
+ $log_folder = 'log';
+ $old_web_folder = 'web';
+ $old_log_folder = 'log';
+ if($data['new']['type'] == 'vhostsubdomain') {
+ // new one
+ $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+ if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
+ $web_folder = $data['new']['web_folder'];
+ $log_folder .= '/' . $subdomain_host;
+ unset($tmp);
+
+ if(isset($data['old']['parent_domain_id'])) {
+ // old one
+ $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
+ if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id'];
+ $old_web_folder = $data['old']['web_folder'];
+ $old_log_folder .= '/' . $subdomain_host;
+ unset($tmp);
+ }
+ }
+
+ // Create group and user, if not exist
+ $app->uses('system');
+
+ if($web_config['connect_userid_to_webid'] == 'y') {
+ //* Calculate the uid and gid
+ $connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']);
+ $fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']);
+ $fixed_uid_param = '--uid '.$fixed_uid_gid;
+ $fixed_gid_param = '--gid '.$fixed_uid_gid;
+
+ //* Check if a ispconfigend user and group exists and create them
+ if(!$app->system->is_group('ispconfigend')) {
+ exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
+ }
+ if(!$app->system->is_user('ispconfigend')) {
+ exec('useradd -g ispconfigend -d /usr/local/ispconfig --uid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
+ }
+ } else {
+ $fixed_uid_param = '';
+ $fixed_gid_param = '';
+ }
+
+ $groupname = escapeshellcmd($data['new']['system_group']);
+ if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
+ exec('groupadd '.$fixed_gid_param.' '.$groupname);
+ if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
+ $app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG);
+ }
+
+ $username = escapeshellcmd($data['new']['system_user']);
+ if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) {
+ if($web_config['add_web_users_to_sshusers_group'] == 'y') {
+ exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false");
+ if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false");
+ } else {
+ exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
+ if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
+ }
+ $app->log('Adding the user: '.$username, LOGLEVEL_DEBUG);
+ }
+
+ //* If the client of the site has been changed, we have a change of the document root
+ if($this->action == 'update' && $data['new']['document_root'] != $data['old']['document_root']) {
+
+ //* Get the old client ID
+ $old_client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+ $old_client_id = intval($old_client['client_id']);
+ unset($old_client);
+
+ //* Remove the old symlinks
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ // create the symlinks, if not exist
+ if(is_link($tmp_symlink)) {
+ exec('rm -f '.escapeshellcmd($tmp_symlink));
+ $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+ if($data["new"]["type"] != "vhostsubdomain") {
+ //* Move the site data
+ $tmp_docroot = explode('/', $data['new']['document_root']);
+ unset($tmp_docroot[count($tmp_docroot)-1]);
+ $new_dir = implode('/', $tmp_docroot);
+
+ $tmp_docroot = explode('/', $data['old']['document_root']);
+ unset($tmp_docroot[count($tmp_docroot)-1]);
+ $old_dir = implode('/', $tmp_docroot);
+
+ //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
+ if(@is_dir($data['new']['document_root'])) {
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+ $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
+ $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
+ }
+
+ //* Unmount the old log directory bfore we move the log dir
+ exec('umount '.escapeshellcmd($old_dir.'/log'));
+
+ //* Create new base directory, if it does not exist yet
+ if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
+ $app->system->web_folder_protection($data['old']['document_root'], false);
+ exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
+ //$app->system->rename($data['old']['document_root'],$new_dir);
+ $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG);
+
+ // Handle the change in php_open_basedir
+ $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']);
+
+ //* Change the owner of the website files to the new website owner
+ exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
+
+ //* Change the home directory and group of the website user
+ $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod';
+ $command .= ' --home '.escapeshellcmd($data['new']['document_root']);
+ $command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
+ exec($command);
+ }
+
+ if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+ //* Change the log mount
+ /*
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ */
+
+ $fstab_line_old = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind';
+
+ if($web_config['network_filesystem'] == 'y') {
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0';
+ $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1);
+ } else {
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait 0 0';
+ $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1);
+ }
+
+ exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
+
+ }
+
+ //print_r($data);
+
+ // Check if the directories are there and create them if necessary.
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+
+ if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
+ if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
+ //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
+ if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
+ if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
+ if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
+ //if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
+
+ //* Create the new private directory
+ if(!is_dir($data['new']['document_root'].'/private')) {
+ $app->system->mkdirpath($data['new']['document_root'].'/private');
+ $app->system->chmod($data['new']['document_root'].'/private', 0710);
+ $app->system->chown($data['new']['document_root'].'/private', $username);
+ $app->system->chgrp($data['new']['document_root'].'/private', $groupname);
+ }
+
+
+ // Remove the symlink for the site, if site is renamed
+ if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
+ if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']);
+ if(is_link($data['old']['document_root'].'/'.$old_log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$old_log_folder);
+
+ //* remove old log mount
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+
+ //* Unmount log directory
+ exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder));
+ }
+
+ //* Create the log dir if nescessary and mount it
+ if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) {
+ if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
+ if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
+ $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
+ $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root');
+ $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root');
+ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
+ exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
+ //* add mountpoint to fstab
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0';
+ $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
+ }
+
+ $app->system->web_folder_protection($data['new']['document_root'], true);
+
+ // Get the client ID
+ $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['new']['sys_groupid']));
+ $client_id = intval($client['client_id']);
+ unset($client);
+
+ // Remove old symlinks, if site is renamed
+ if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ // remove the symlinks, if not exist
+ if(is_link($tmp_symlink)) {
+ exec('rm -f '.escapeshellcmd($tmp_symlink));
+ $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+ }
+
+ // Create the symlinks for the sites
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ //* Remove symlink if target folder has been changed.
+ if($data['old']['document_root'] != '' && $data['old']['document_root'] != $data['new']['document_root'] && is_link($tmp_symlink)) {
+ $app->system->unlink($tmp_symlink);
+ }
+ // create the symlinks, if not exist
+ if(!is_link($tmp_symlink)) {
+ // exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+ if ($web_config["website_symlinks_rel"] == 'y') {
+ $this->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink));
+ } else {
+ exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+ }
+
+ $app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+
+
+ // Install the Standard or Custom Error, Index and other related files
+ // /usr/local/ispconfig/server/conf is for the standard files
+ // /usr/local/ispconfig/server/conf-custom is for the custom files
+ // setting a local var here
+
+ // normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
+ if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
+
+ // Copy the error pages
+ if($data['new']['errordocs']) {
+ $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ else {
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
+ exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
+ }
+ else {
+ exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ }
+ exec('chmod -R a+r '.$error_page_path);
+ }
+
+ if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+
+ if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ //if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
+ // exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ //}
+ }
+ else {
+ if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+ }
+ else {
+ exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+ if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ //if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+ }
+ }
+ exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+
+ //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
+ } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
+
+ $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ else {
+ if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
+ exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
+ }
+ else {
+ exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
+ }
+ }
+ exec('chmod -R a+r '.$error_page_path);
+ exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path);
+ } // end copy error docs
+
+ // Set the quota for the user, but only for vhosts, not vhostsubdomains
+ if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') {
+ if($data['new']['hd_quota'] > 0) {
+ $blocks_soft = $data['new']['hd_quota'] * 1024;
+ $blocks_hard = $blocks_soft + 1024;
+ } else {
+ $blocks_soft = $blocks_hard = 0;
+ }
+ exec("setquota -u $username $blocks_soft $blocks_hard 0 0 -a &> /dev/null");
+ exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null');
+ }
+
+ if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) {
+ // Chown and chmod the directories below the document root
+ $this->_exec('chown -R '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
+ // The document root itself has to be owned by root in normal level and by the web owner in security level 20
+ if($web_config['security_level'] == 20) {
+ $this->_exec('chown '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
+ } else {
+ $this->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
+ }
+ }
+
+ //* add the nginx user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update
+ if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user']));
+
+ //* If the security level is set to high
+ if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) {
+
+ $app->system->web_folder_protection($data['new']['document_root'], false);
+
+ //* Check if we have the new private folder and create it if nescessary
+ if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private');
+
+ if($web_config['security_level'] == 20) {
+
+ $app->system->chmod($data['new']['document_root'], 0755);
+ $app->system->chmod($data['new']['document_root'].'/web', 0751);
+ //$app->system->chmod($data['new']['document_root'].'/webdav',0710);
+ $app->system->chmod($data['new']['document_root'].'/private', 0710);
+ $app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+
+ // make tmp directory writable for nginx and the website users
+ $app->system->chmod($data['new']['document_root'].'/tmp', 0770);
+
+ // Set Log directory to 755 to make the logs accessible by the FTP user
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
+ }
+
+ if($web_config['add_web_users_to_sshusers_group'] == 'y') {
+ $command = 'usermod';
+ $command .= ' --groups sshusers';
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
+ $this->_exec($command);
+ }
+
+ //* if we have a chrooted nginx environment
+ if($nginx_chrooted) {
+ $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+ //* add the nginx user to the client group in the chroot environment
+ $tmp_groupfile = $app->system->server_conf['group_datei'];
+ $app->system->server_conf['group_datei'] = $web_config['website_basedir'].'/etc/group';
+ $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user']));
+ $app->system->server_conf['group_datei'] = $tmp_groupfile;
+ unset($tmp_groupfile);
+ }
+
+ //* Chown all default directories
+ $app->system->chown($data['new']['document_root'], 'root');
+ $app->system->chgrp($data['new']['document_root'], 'root');
+ $app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+ $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+ $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
+ }
+ $app->system->chown($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chown($data['new']['document_root'].'/tmp', $username);
+ $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+ //$app->system->chown($data['new']['document_root'].'/webdav',$username);
+ //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
+ $app->system->chown($data['new']['document_root'].'/private', $username);
+ $app->system->chgrp($data['new']['document_root'].'/private', $groupname);
+
+ // If the security Level is set to medium
+ } else {
+
+ $app->system->chmod($data['new']['document_root'], 0755);
+ $app->system->chmod($data['new']['document_root'].'/web', 0755);
+ //$app->system->chmod($data['new']['document_root'].'/webdav',0755);
+ $app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+ $app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755);
+
+ // make temp directory writable for nginx and the website users
+ $app->system->chmod($data['new']['document_root'].'/tmp', 0770);
+
+ // Set Log directory to 755 to make the logs accessible by the FTP user
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
+ }
+
+ $app->system->chown($data['new']['document_root'], 'root');
+ $app->system->chgrp($data['new']['document_root'], 'root');
+ $app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+ $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
+ if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
+ $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+ $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
+ }
+
+ $app->system->chown($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+ $app->system->chown($data['new']['document_root'].'/tmp', $username);
+ $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/web/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+ //$app->system->chown($data['new']['document_root'].'/webdav',$username);
+ //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
+ }
+ } elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) {
+ if($web_config['security_level'] == 20) {
+ $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+ } else {
+ $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+ $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+ $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+ }
+ }
+
+ //* Protect web folders
+ $app->system->web_folder_protection($data['new']['document_root'], true);
+
+ if($data['new']['type'] == 'vhost') {
+ // Change the ownership of the error log to the root user
+ if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
+ $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+ $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+ }
+
+ // Change the ownership of the error log to the owner of the website
+ /*
+ if(!@is_file($data['new']['document_root'].'/log/error.log')) exec('touch '.escapeshellcmd($data['new']['document_root']).'/log/error.log');
+ $app->system->chown($data['new']['document_root'].'/log/error.log',$username);
+ $app->system->chgrp($data['new']['document_root'].'/log/error.log',$groupname);
+ */
+
+
+ /*
+ //* Write the custom php.ini file, if custom_php_ini filed is not empty
+ $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user'];
+ if(!is_dir($web_config['website_basedir'].'/conf')) mkdir($web_config['website_basedir'].'/conf');
+ if(trim($data['new']['custom_php_ini']) != '') {
+ $has_custom_php_ini = true;
+ if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir);
+ $php_ini_content = '';
+ if($data['new']['php'] == 'mod') {
+ $master_php_ini_path = $web_config['php_ini_path_apache'];
+ } else {
+ if($data["new"]['php'] == 'fast-cgi' && file_exists($fastcgi_config["fastcgi_phpini_path"])) {
+ $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"];
+ } else {
+ $master_php_ini_path = $web_config['php_ini_path_cgi'];
+ }
+ }
+ if($master_php_ini_path != '' && substr($master_php_ini_path,-7) == 'php.ini' && is_file($master_php_ini_path)) {
+ $php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
+ }
+ $php_ini_content .= str_replace("\r",'',trim($data['new']['custom_php_ini']));
+ $app->system->file_put_contents($custom_php_ini_dir.'/php.ini',$php_ini_content);
+ } else {
+ $has_custom_php_ini = false;
+ if(is_file($custom_php_ini_dir.'/php.ini')) $app->system->unlink($custom_php_ini_dir.'/php.ini');
+ }
+ */
+
+ //* Create the vhost config file
+ $app->load('tpl');
+
+ $tpl = new tpl();
+ $tpl->newTemplate('nginx_vhost.conf.master');
+
+ $vhost_data = $data['new'];
+ //unset($vhost_data['ip_address']);
+ $vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder;
+ $vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder;
+ $vhost_data['web_basedir'] = $web_config['website_basedir'];
+
+ // IPv6
+ if($data['new']['ipv6_address'] != ''){
+ $tpl->setVar('ipv6_enabled', 1);
+ if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
+ if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
+ $explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']);
+ $explode_v6=explode(':', $data['new']['ipv6_address']);
+
+ for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
+ $explode_v6[$i] = $explode_v6prefix[$i];
+ }
+ $data['new']['ipv6_address'] = implode(':', $explode_v6);
+ $vhost_data['ipv6_address'] = $data['new']['ipv6_address'];
+ }
+ }
+ }
+
+ // PHP-FPM
+ // Support for multiple PHP versions
+ /*
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ */
+ if($data['new']['php'] != 'no'){
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ } else {
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ }
+
+ if($default_php_fpm){
+ $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ } else {
+ $pool_dir = $custom_php_fpm_pool_dir;
+ }
+ if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
+ $pool_name = 'web'.$data['new']['domain_id'];
+ $socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
+ if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
+
+ if($data['new']['php_fpm_use_socket'] == 'y'){
+ $use_tcp = 0;
+ $use_socket = 1;
+ } else {
+ $use_tcp = 1;
+ $use_socket = 0;
+ }
+ $tpl->setVar('use_tcp', $use_tcp);
+ $tpl->setVar('use_socket', $use_socket);
+ $fpm_socket = $socket_dir.$pool_name.'.sock';
+ $tpl->setVar('fpm_socket', $fpm_socket);
+ $tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(), 1)).'.htm');
+ $vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1;
+
+ // backwards compatibility; since ISPConfig 3.0.5, the PHP mode for nginx is called 'php-fpm' instead of 'fast-cgi'. The following line makes sure that old web sites that have 'fast-cgi' in the database still get PHP-FPM support.
+ if($vhost_data['php'] == 'fast-cgi') $vhost_data['php'] = 'php-fpm';
+
+ // Custom rewrite rules
+ /*
+ $final_rewrite_rules = array();
+ $custom_rewrite_rules = $data['new']['rewrite_rules'];
+ // Make sure we only have Unix linebreaks
+ $custom_rewrite_rules = str_replace("\r\n", "\n", $custom_rewrite_rules);
+ $custom_rewrite_rules = str_replace("\r", "\n", $custom_rewrite_rules);
+ $custom_rewrite_rule_lines = explode("\n", $custom_rewrite_rules);
+ if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){
+ foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ }
+ }
+ $tpl->setLoop('rewrite_rules', $final_rewrite_rules);
+ */
+
+ // Custom rewrite rules
+ $final_rewrite_rules = array();
+
+ if(isset($data['new']['rewrite_rules']) && trim($data['new']['rewrite_rules']) != '') {
+ $custom_rewrite_rules = trim($data['new']['rewrite_rules']);
+ $custom_rewrites_are_valid = true;
+ // use this counter to make sure all curly brackets are properly closed
+ $if_level = 0;
+ // Make sure we only have Unix linebreaks
+ $custom_rewrite_rules = str_replace("\r\n", "\n", $custom_rewrite_rules);
+ $custom_rewrite_rules = str_replace("\r", "\n", $custom_rewrite_rules);
+ $custom_rewrite_rule_lines = explode("\n", $custom_rewrite_rules);
+ if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){
+ foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){
+ // ignore comments
+ if(substr(ltrim($custom_rewrite_rule_line), 0, 1) == '#'){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // empty lines
+ if(trim($custom_rewrite_rule_line) == ''){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // rewrite
+ if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ if(preg_match('@^\s*rewrite\s+(^/)?(\'[^\']+\'|"[^"]+")+(\$)?\s+(\'[^\']+\'|"[^"]+")+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ if(preg_match('@^\s*rewrite\s+(^/)?(\'[^\']+\'|"[^"]+")+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+(\'[^\']+\'|"[^"]+")+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // if
+ if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ $if_level += 1;
+ continue;
+ }
+ // if - check for files, directories, etc.
+ if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ $if_level += 1;
+ continue;
+ }
+ // break
+ if(preg_match('@^\s*break\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // return code [ text ]
+ if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // return code URL
+ // return URL
+ if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // set
+ if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $custom_rewrite_rule_line)){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ continue;
+ }
+ // closing curly bracket
+ if(trim($custom_rewrite_rule_line) == '}'){
+ $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+ $if_level -= 1;
+ continue;
+ }
+ $custom_rewrites_are_valid = false;
+ break;
+ }
+ }
+ if(!$custom_rewrites_are_valid || $if_level != 0){
+ $final_rewrite_rules = array();
+ }
+ }
+ $tpl->setLoop('rewrite_rules', $final_rewrite_rules);
+
+ // Custom nginx directives
+ $final_nginx_directives = array();
+ $nginx_directives = $data['new']['nginx_directives'];
+ // Make sure we only have Unix linebreaks
+ $nginx_directives = str_replace("\r\n", "\n", $nginx_directives);
+ $nginx_directives = str_replace("\r", "\n", $nginx_directives);
+ $nginx_directive_lines = explode("\n", $nginx_directives);
+ if(is_array($nginx_directive_lines) && !empty($nginx_directive_lines)){
+ $trans = array('{DOCROOT}' => $vhost_data['web_document_root_www'], '{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_socket : '127.0.0.1:'.$vhost_data['fpm_port']).';');
+ foreach($nginx_directive_lines as $nginx_directive_line){
+ $final_nginx_directives[] = array('nginx_directive' => strtr($nginx_directive_line, $trans));
+ }
+ }
+ $tpl->setLoop('nginx_directives', $final_nginx_directives);
+
+ // Check if a SSL cert exists
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ if(!isset($data['new']['ssl_domain']) OR empty($data['new']['ssl_domain'])) { $data['new']['ssl_domain'] = $data['new']['domain']; }
+ $domain = $data['new']['ssl_domain'];
+ $tpl->setVar('ssl_domain', $domain);
+ $key_file = $ssl_dir.'/'.$domain.'.key';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+
+
+ $tpl->setVar('ssl_letsencrypt', "n");
+ //* Generate Let's Encrypt SSL certificat
+ if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') {
+ //* be sure to have good domain
+ $lddomain = (string) "--domains $domain";
+ if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
+ $lddomain .= (string) " --domains www." . $domain;
+ }
+
+ $tpl->setVar('ssl_letsencrypt', "y");
+ //* TODO: check dns entry is correct
+ $crt_tmp_file = "/etc/letsencrypt/live/".$lddomain."/fullchain.pem";
+ $key_tmp_file = "/etc/letsencrypt/live/".$lddomain."/privkey.pem";
+ $webroot = $data['new']['document_root']."/web";
+
+ //* check if we have already a Let's Encrypt cert
+ if(!file_exists($crt_tmp_file) && !file_exists($key_tmp_file)) {
+ $app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
+ exec("/root/.local/share/letsencrypt/bin/letsencrypt auth -a webroot --email postmaster@$domain --domains $lddomain --webroot-path $webroot --text --agree-tos");
+ };
+
+ //* check is been correctly created
+ if(file_exists($crt_tmp_file) OR file_exists($key_tmp_file)) {
+ $date = date("YmdHis");
+//* TODO: check if is a symlink, if target same keep it, either remove it
+ if(is_file($key_file)) {
+ $app->system->copy($key_file, $key_file.'.old'.$date);
+ $app->system->chmod($key_file.'.old.'.$date, 0400);
+ $app->system->unlink($key_file);
+ }
+
+ if ($web_config["website_symlinks_rel"] == 'y') {
+ $this->create_relative_link(escapeshellcmd($key_tmp_file), escapeshellcmd($key_file));
+ } else {
+ exec("ln -s ".escapeshellcmd($key_tmp_file)." ".escapeshellcmd($key_file));
+ }
+
+ if(is_file($crt_file)) {
+ $app->system->copy($crt_file, $crt_file.'.old.'.$date);
+ $app->system->chmod($crt_file.'.old.'.$date, 0400);
+ $app->system->unlink($crt_file);
+ }
+
+ if($web_config["website_symlinks_rel"] == 'y') {
+ $this->create_relative_link(escapeshellcmd($crt_tmp_file), escapeshellcmd($crt_file));
+ } else {
+ exec("ln -s ".escapeshellcmd($crt_tmp_file)." ".escapeshellcmd($crt_file));
+ }
+
+ /* we don't need to store it.
+ /* Update the DB of the (local) Server */
+ $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ /* Update also the master-DB of the Server-Farm */
+ $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = '".$data['new']['domain']."'");
+ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
+ }
+ };
+
+ if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) {
+ $vhost_data['ssl_enabled'] = 1;
+ $app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
+ } else {
+ $vhost_data['ssl_enabled'] = 0;
+ $app->log('SSL Disabled. '.$domain, LOGLEVEL_DEBUG);
+ }
+
+ // Set SEO Redirect
+ if($data['new']['seo_redirect'] != ''){
+ $vhost_data['seo_redirect_enabled'] = 1;
+ $tmp_seo_redirects = $this->get_seo_redirects($data['new']);
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ foreach($tmp_seo_redirects as $key => $val){
+ $vhost_data[$key] = $val;
+ }
+ } else {
+ $vhost_data['seo_redirect_enabled'] = 0;
+ }
+ } else {
+ $vhost_data['seo_redirect_enabled'] = 0;
+ }
+
+
+
+ // Rewrite rules
+ $own_rewrite_rules = array();
+ $rewrite_rules = array();
+ $local_rewrite_rules = array();
+ if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') {
+ if(substr($data['new']['redirect_path'], -1) != '/') $data['new']['redirect_path'] .= '/';
+ if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){
+ if($data['new']['redirect_type'] != 'proxy'){
+ $data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'], 8);
+ } else {
+ $data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'], 8);
+ }
+ }
+
+ // Custom proxy directives
+ if($data['new']['redirect_type'] == 'proxy' && trim($data['new']['proxy_directives'] != '')){
+ $final_proxy_directives = array();
+ $proxy_directives = $data['new']['proxy_directives'];
+ // Make sure we only have Unix linebreaks
+ $proxy_directives = str_replace("\r\n", "\n", $proxy_directives);
+ $proxy_directives = str_replace("\r", "\n", $proxy_directives);
+ $proxy_directive_lines = explode("\n", $proxy_directives);
+ if(is_array($proxy_directive_lines) && !empty($proxy_directive_lines)){
+ foreach($proxy_directive_lines as $proxy_directive_line){
+ $final_proxy_directives[] = array('proxy_directive' => $proxy_directive_line);
+ }
+ }
+ } else {
+ $final_proxy_directives = false;
+ }
+
+ switch($data['new']['subdomain']) {
+ case 'www':
+ $exclude_own_hostname = '';
+ if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+ $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+ break;
+ }
+ $rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ } else { // URL - check if URL is local
+ $tmp_redirect_path = $data['new']['redirect_path'];
+ if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+ $tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+ if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+ // URL is local
+ if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+ if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+ //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+ $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
+ break;
+ } else {
+ $rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ $exclude_own_hostname = $tmp_redirect_path_parts['host'];
+ }
+ } else {
+ // external URL
+ $rewrite_exclude = '(.?)/';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['use_proxy'] = 'y';
+ $rewrite_subdir = $tmp_redirect_path_parts['path'];
+ if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+ if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+ if($rewrite_subdir == '/') $rewrite_subdir = '';
+ }
+ }
+ unset($tmp_redirect_path);
+ unset($tmp_redirect_path_parts);
+ }
+ $own_rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+ 'rewrite_target' => $data['new']['redirect_path'],
+ 'rewrite_exclude' => $rewrite_exclude,
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'exclude_own_hostname' => $exclude_own_hostname,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+ break;
+ case '*':
+ $exclude_own_hostname = '';
+ if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+ $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+ break;
+ }
+ $rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ } else { // URL - check if URL is local
+ $tmp_redirect_path = $data['new']['redirect_path'];
+ if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+ $tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+
+ //if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+ if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+ // URL is local
+ if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+ if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+ //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+ $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
+ break;
+ } else {
+ $rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ $exclude_own_hostname = $tmp_redirect_path_parts['host'];
+ }
+ } else {
+ // external URL
+ $rewrite_exclude = '(.?)/';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['use_proxy'] = 'y';
+ $rewrite_subdir = $tmp_redirect_path_parts['path'];
+ if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+ if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+ if($rewrite_subdir == '/') $rewrite_subdir = '';
+ }
+ }
+ unset($tmp_redirect_path);
+ unset($tmp_redirect_path_parts);
+ }
+ $own_rewrite_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+ 'rewrite_target' => $data['new']['redirect_path'],
+ 'rewrite_exclude' => $rewrite_exclude,
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'exclude_own_hostname' => $exclude_own_hostname,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+ break;
+ default:
+ if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+ $exclude_own_hostname = '';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+ $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+ break;
+ }
+ $rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ } else { // URL - check if URL is local
+ $tmp_redirect_path = $data['new']['redirect_path'];
+ if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+ $tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+ if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+ // URL is local
+ if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+ if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+ //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+ $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
+ break;
+ } else {
+ $rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ $exclude_own_hostname = $tmp_redirect_path_parts['host'];
+ }
+ } else {
+ // external URL
+ $rewrite_exclude = '(.?)/';
+ if($data['new']['redirect_type'] == 'proxy'){
+ $vhost_data['use_proxy'] = 'y';
+ $rewrite_subdir = $tmp_redirect_path_parts['path'];
+ if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+ if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+ if($rewrite_subdir == '/') $rewrite_subdir = '';
+ }
+ }
+ unset($tmp_redirect_path);
+ unset($tmp_redirect_path_parts);
+ }
+ $own_rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']),
+ 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+ 'rewrite_target' => $data['new']['redirect_path'],
+ 'rewrite_exclude' => $rewrite_exclude,
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'exclude_own_hostname' => $exclude_own_hostname,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+ }
+ }
+
+ $tpl->setVar($vhost_data);
+
+ $server_alias = array();
+
+ // get autoalias
+ $auto_alias = $web_config['website_autoalias'];
+ if($auto_alias != '') {
+ // get the client username
+ $client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = '" . intval($client_id) . "'");
+ $aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]');
+ $aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']);
+ $auto_alias = str_replace($aa_search, $aa_replace, $auto_alias);
+ unset($client);
+ unset($aa_search);
+ unset($aa_replace);
+ $server_alias[] .= $auto_alias.' ';
+ }
+
+ switch($data['new']['subdomain']) {
+ case 'www':
+ $server_alias[] = 'www.'.$data['new']['domain'].' ';
+ break;
+ case '*':
+ $server_alias[] = '*.'.$data['new']['domain'].' ';
+ break;
+ }
+
+ // get alias domains (co-domains and subdomains)
+ $aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND type != 'vhostsubdomain'");
+ $alias_seo_redirects = array();
+ if(is_array($aliases)) {
+ foreach($aliases as $alias) {
+
+ // Custom proxy directives
+ if($alias['redirect_type'] == 'proxy' && trim($alias['proxy_directives'] != '')){
+ $final_proxy_directives = array();
+ $proxy_directives = $alias['proxy_directives'];
+ // Make sure we only have Unix linebreaks
+ $proxy_directives = str_replace("\r\n", "\n", $proxy_directives);
+ $proxy_directives = str_replace("\r", "\n", $proxy_directives);
+ $proxy_directive_lines = explode("\n", $proxy_directives);
+ if(is_array($proxy_directive_lines) && !empty($proxy_directive_lines)){
+ foreach($proxy_directive_lines as $proxy_directive_line){
+ $final_proxy_directives[] = array('proxy_directive' => $proxy_directive_line);
+ }
+ }
+ } else {
+ $final_proxy_directives = false;
+ }
+
+ if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'], 0, 1) == '/') {
+ switch($alias['subdomain']) {
+ case 'www':
+ $server_alias[] = 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+ break;
+ case '*':
+ $server_alias[] = '*.'.$alias['domain'].' '.$alias['domain'].' ';
+ break;
+ default:
+ $server_alias[] = $alias['domain'].' ';
+ break;
+ }
+ $app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
+ // Add SEO redirects for alias domains
+ if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ $alias_seo_redirects[] = $tmp_seo_redirects;
+ }
+ }
+ }
+
+ // Local Rewriting (inside vhost server {} container)
+ if($alias['redirect_type'] != '' && substr($alias['redirect_path'], 0, 1) == '/' && $alias['redirect_type'] != 'proxy') { // proxy makes no sense with local path
+ if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
+ $rewrite_exclude = '(?!/\b('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+ switch($alias['subdomain']) {
+ case 'www':
+ // example.com
+ $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => $alias['domain'],
+ 'local_redirect_operator' => '=',
+ 'local_redirect_exclude' => $rewrite_exclude,
+ 'local_redirect_target' => $alias['redirect_path'],
+ 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+
+ // www.example.com
+ $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => 'www.'.$alias['domain'],
+ 'local_redirect_operator' => '=',
+ 'local_redirect_exclude' => $rewrite_exclude,
+ 'local_redirect_target' => $alias['redirect_path'],
+ 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+ break;
+ case '*':
+ $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$',
+ 'local_redirect_operator' => '~*',
+ 'local_redirect_exclude' => $rewrite_exclude,
+ 'local_redirect_target' => $alias['redirect_path'],
+ 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+ break;
+ default:
+ $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => $alias['domain'],
+ 'local_redirect_operator' => '=',
+ 'local_redirect_exclude' => $rewrite_exclude,
+ 'local_redirect_target' => $alias['redirect_path'],
+ 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+ }
+ }
+
+ // External Rewriting (extra server {} containers)
+ if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'], 0, 1) != '/') {
+ if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
+ if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){
+ if($alias['redirect_type'] != 'proxy'){
+ $alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'], 8);
+ } else {
+ $alias['redirect_path'] = 'http'.substr($alias['redirect_path'], 8);
+ }
+ }
+
+ switch($alias['subdomain']) {
+ case 'www':
+ if($alias['redirect_type'] == 'proxy'){
+ $tmp_redirect_path = $alias['redirect_path'];
+ $tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+ $rewrite_subdir = $tmp_redirect_path_parts['path'];
+ if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+ if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+ if($rewrite_subdir == '/') $rewrite_subdir = '';
+ }
+
+ if($alias['redirect_type'] != 'proxy'){
+ if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+ }
+ // Add SEO redirects for alias domains
+ $alias_seo_redirects2 = array();
+ if($alias['seo_redirect'] != ''){
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ $alias_seo_redirects2[] = $tmp_seo_redirects;
+ }
+ }
+ $rewrite_rules[] = array( 'rewrite_domain' => $alias['domain'],
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+ 'rewrite_target' => $alias['redirect_path'],
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+ 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+
+ // Add SEO redirects for alias domains
+ $alias_seo_redirects2 = array();
+ if($alias['seo_redirect'] != ''){
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www');
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ $alias_seo_redirects2[] = $tmp_seo_redirects;
+ }
+ }
+ $rewrite_rules[] = array( 'rewrite_domain' => 'www.'.$alias['domain'],
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+ 'rewrite_target' => $alias['redirect_path'],
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+ 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+ break;
+ case '*':
+ if($alias['redirect_type'] == 'proxy'){
+ $tmp_redirect_path = $alias['redirect_path'];
+ $tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+ $rewrite_subdir = $tmp_redirect_path_parts['path'];
+ if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+ if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+ if($rewrite_subdir == '/') $rewrite_subdir = '';
+ }
+
+ if($alias['redirect_type'] != 'proxy'){
+ if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+ }
+ // Add SEO redirects for alias domains
+ $alias_seo_redirects2 = array();
+ if($alias['seo_redirect'] != ''){
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ $alias_seo_redirects2[] = $tmp_seo_redirects;
+ }
+ }
+ $rewrite_rules[] = array( 'rewrite_domain' => $alias['domain'].' *.'.$alias['domain'],
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+ 'rewrite_target' => $alias['redirect_path'],
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+ 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+ break;
+ default:
+ if($alias['redirect_type'] == 'proxy'){
+ $tmp_redirect_path = $alias['redirect_path'];
+ $tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+ $rewrite_subdir = $tmp_redirect_path_parts['path'];
+ if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+ if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+ if($rewrite_subdir == '/') $rewrite_subdir = '';
+ }
+
+ if($alias['redirect_type'] != 'proxy'){
+ if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+ }
+ if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2);
+ else $domain_rule = $alias['domain'];
+ // Add SEO redirects for alias domains
+ $alias_seo_redirects2 = array();
+ if($alias['seo_redirect'] != ''){
+ if(substr($alias['domain'], 0, 2) === '*.'){
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
+ } else {
+ $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
+ }
+ if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+ $alias_seo_redirects2[] = $tmp_seo_redirects;
+ }
+ }
+ $rewrite_rules[] = array( 'rewrite_domain' => $domain_rule,
+ 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+ 'rewrite_target' => $alias['redirect_path'],
+ 'rewrite_subdir' => $rewrite_subdir,
+ 'proxy_directives' => $final_proxy_directives,
+ 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+ 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+ 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+ }
+ }
+ }
+ }
+
+ //* If we have some alias records
+ if(count($server_alias) > 0) {
+ $server_alias_str = '';
+ $n = 0;
+
+ foreach($server_alias as $tmp_alias) {
+ $server_alias_str .= $tmp_alias;
+ }
+ unset($tmp_alias);
+
+ $tpl->setVar('alias', trim($server_alias_str));
+ } else {
+ $tpl->setVar('alias', '');
+ }
+
+ if(count($rewrite_rules) > 0) {
+ $tpl->setLoop('redirects', $rewrite_rules);
+ }
+ if(count($own_rewrite_rules) > 0) {
+ $tpl->setLoop('own_redirects', $own_rewrite_rules);
+ }
+ if(count($local_rewrite_rules) > 0) {
+ $tpl->setLoop('local_redirects', $local_rewrite_rules);
+ }
+ if(count($alias_seo_redirects) > 0) {
+ $tpl->setLoop('alias_seo_redirects', $alias_seo_redirects);
+ }
+
+ //* Create basic http auth for website statistics
+ $tpl->setVar('stats_auth_passwd_file', $data['new']['document_root']."/web/stats/.htpasswd_stats");
+
+ // Create basic http auth for other directories
+ $basic_auth_locations = $this->_create_web_folder_auth_configuration($data['new']);
+ if(is_array($basic_auth_locations) && !empty($basic_auth_locations)) $tpl->setLoop('basic_auth_locations', $basic_auth_locations);
+
+ $vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
+ //* Make a backup copy of vhost file
+ if(file_exists($vhost_file)) copy($vhost_file, $vhost_file.'~');
+
+ //* Write vhost file
+ $app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab()));
+ $app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+ unset($tpl);
+
+ //* Set the symlink to enable the vhost
+ //* First we check if there is a old type of symlink and remove it
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) unlink($vhost_symlink);
+
+ //* Remove old or changed symlinks
+ if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') {
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* New symlink
+ if($data['new']['subdomain'] == '*') {
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
+ } else {
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
+ }
+ if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
+ symlink($vhost_file, $vhost_symlink);
+ $app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+
+ // remove old symlink and vhost file, if domain name of the site has changed
+ if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)) {
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
+ $app->system->unlink($vhost_file);
+ $app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
+ }
+
+ // create password file for stats directory
+ if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
+ if(trim($data['new']['stats_password']) != '') {
+ $htp_file = 'admin:'.trim($data['new']['stats_password']);
+ $app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
+ $app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
+ unset($htp_file);
+ }
+ }
+
+ //* Create awstats configuration
+ if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
+ $this->awstats_update($data, $web_config);
+ }
+
+ $this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
+
+ if($web_config['check_apache_config'] == 'y') {
+ //* Test if nginx starts with the new configuration file
+ $nginx_online_status_before_restart = $this->_checkTcp('localhost', 80);
+ $app->log('nginx status is: '.($nginx_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+
+ $retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure
+ $app->log('nginx restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG);
+
+ // wait a few seconds, before we test the apache status again
+ sleep(2);
+
+ //* Check if nginx restarted successfully if it was online before
+ $nginx_online_status_after_restart = $this->_checkTcp('localhost', 80);
+ $app->log('nginx online status after restart is: '.($nginx_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+ if($nginx_online_status_before_restart && !$nginx_online_status_after_restart || $retval['retval'] > 0) {
+ $app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN);
+ if(is_array($retval['output']) && !empty($retval['output'])){
+ $app->log('Reason for nginx restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN);
+ $app->dbmaster->datalogError(implode("\n", $retval['output']));
+ } else {
+ // if no output is given, check again
+ exec('nginx -t 2>&1', $tmp_output, $tmp_retval);
+ if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){
+ $app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN);
+ $app->dbmaster->datalogError(implode("\n", $tmp_output));
+ }
+ unset($tmp_output, $tmp_retval);
+ }
+ $app->system->copy($vhost_file, $vhost_file.'.err');
+
+ if(is_file($vhost_file.'~')) {
+ //* Copy back the last backup file
+ $app->system->copy($vhost_file.'~', $vhost_file);
+ } else {
+ //* There is no backup file, so we create a empty vhost file with a warning message inside
+ $app->system->file_put_contents($vhost_file, "# nginx did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
+ }
+
+ if($this->ssl_certificate_changed === true) {
+
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ //$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+
+ //* Backup the files that might have caused the error
+ if(is_file($key_file)){
+ $app->system->copy($key_file, $key_file.'.err');
+ $app->system->chmod($key_file.'.err', 0400);
+ }
+ if(is_file($key_file2)){
+ $app->system->copy($key_file2, $key_file2.'.err');
+ $app->system->chmod($key_file2.'.err', 0400);
+ }
+ if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err');
+ if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err');
+ //if(is_file($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'.err');
+
+ //* Restore the ~ backup files
+ if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file);
+ if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2);
+ if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file);
+ if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file);
+ //if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~',$bundle_file);
+
+ $app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN);
+ }
+
+ $app->services->restartService('httpd', 'restart');
+ }
+ } else {
+ //* We do not check the nginx config after changes (is faster)
+ $app->services->restartServiceDelayed('httpd', 'reload');
+ }
+
+ //* The vhost is written and apache has been restarted, so we
+ // can reset the ssl changed var to false and cleanup some files
+ $this->ssl_certificate_changed = false;
+
+ $ssl_dir = $data['new']['document_root'].'/ssl';
+ $domain = $data['new']['ssl_domain'];
+ $key_file = $ssl_dir.'/'.$domain.'.key.org';
+ $key_file2 = $ssl_dir.'/'.$domain.'.key';
+ $csr_file = $ssl_dir.'/'.$domain.'.csr';
+ $crt_file = $ssl_dir.'/'.$domain.'.crt';
+ //$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
+
+ if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~');
+ if(@is_file($key2_file.'~')) $app->system->unlink($key2_file.'~');
+ if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~');
+ if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~');
+ //if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~');
+
+ // Remove the backup copy of the config file.
+ if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~');
+
+ //* Unset action to clean it for next processed vhost.
+ $this->action = '';
+
+ }
+
+ function delete($event_name, $data) {
+ global $app, $conf;
+
+ // load the server configuration options
+ $app->uses('getconf');
+ $app->uses('system');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+
+ if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false);
+
+ //* Check if this is a chrooted setup
+ if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
+ $nginx_chrooted = true;
+ } else {
+ $nginx_chrooted = false;
+ }
+
+ //* Remove the mounts
+ $log_folder = 'log';
+ $web_folder = '';
+ if($data['old']['type'] == 'vhostsubdomain') {
+ $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+ if($tmp['domain'] != ''){
+ $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
+ } else {
+ // get log folder from /etc/fstab
+ /*
+ $bind_mounts = $app->system->file_get_contents('/etc/fstab');
+ $bind_mount_lines = explode("\n", $bind_mounts);
+ if(is_array($bind_mount_lines) && !empty($bind_mount_lines)){
+ foreach($bind_mount_lines as $bind_mount_line){
+ $bind_mount_line = preg_replace('/\s+/', ' ', $bind_mount_line);
+ $bind_mount_parts = explode(' ', $bind_mount_line);
+ if(is_array($bind_mount_parts) && !empty($bind_mount_parts)){
+ if($bind_mount_parts[0] == '/var/log/ispconfig/httpd/'.$data['old']['domain'] && $bind_mount_parts[2] == 'none' && strpos($bind_mount_parts[3], 'bind') !== false){
+ $subdomain_host = str_replace($data['old']['document_root'].'/log/', '', $bind_mount_parts[1]);
+ }
+ }
+ }
+ }
+ */
+ // we are deleting the parent domain, so we can delete everything in the log directory
+ $subdomain_hosts = array();
+ $files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..'));
+ if(is_array($files) && !empty($files)){
+ foreach($files as $file){
+ if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){
+ $subdomain_hosts[] = $file;
+ }
+ }
+ }
+ }
+ if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
+ $log_folders = array();
+ foreach($subdomain_hosts as $subdomain_host){
+ $log_folders[] = $log_folder.'/'.$subdomain_host;
+ }
+ } else {
+ if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id'];
+ $log_folder .= '/' . $subdomain_host;
+ }
+ $web_folder = $data['old']['web_folder'];
+ unset($tmp);
+ unset($subdomain_hosts);
+ }
+
+ if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){
+ if(is_array($log_folders) && !empty($log_folders)){
+ foreach($log_folders as $log_folder){
+ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
+ exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
+ }
+ } else {
+ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
+ exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
+ }
+ }
+
+ //* remove mountpoint from fstab
+ if(is_array($log_folders) && !empty($log_folders)){
+ foreach($log_folders as $log_folder){
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ }
+ } else {
+ $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind';
+ $app->system->removeLine('/etc/fstab', $fstab_line);
+ }
+ unset($log_folders);
+
+ if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['parent_domain_id'] > 0) {
+ //* This is a alias domain or subdomain, so we have to update the website instead
+ $parent_domain_id = intval($data['old']['parent_domain_id']);
+ $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$parent_domain_id." AND active = 'y'");
+ $data['new'] = $tmp;
+ $data['old'] = $tmp;
+ $this->action = 'update';
+ // just run the update function
+ $this->update($event_name, $data);
+
+ } else {
+ //* This is a website
+ // Deleting the vhost file, symlink and the data directory
+ $vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
+
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)){
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)){
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+ $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
+ if(is_link($vhost_symlink)){
+ $app->system->unlink($vhost_symlink);
+ $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
+ }
+
+ $app->system->unlink($vhost_file);
+ $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+
+ if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
+ $docroot = escapeshellcmd($data['old']['document_root']);
+ if($docroot != '' && !stristr($docroot, '..')) {
+ if($data['old']['type'] == 'vhost') {
+ // this is a vhost - we delete everything in here.
+ exec('rm -rf '.$docroot);
+ } elseif(!stristr($data['old']['web_folder'], '..')) {
+ // this is a vhost subdomain
+ // IMPORTANT: do some folder checks before we delete this!
+ $do_delete = true;
+ $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
+ if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
+ if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
+
+ $path_elements = explode('/', $delete_folder);
+
+ if($path_elements[0] == 'web' || $path_elements[0] === '') {
+ // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
+ // we use strict check as otherwise directories named '0' may not be deleted
+ $do_delete = false;
+ } else {
+ // read all vhost subdomains with same parent domain
+ $used_paths = array();
+ $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
+ foreach($tmp as $tmprec) {
+ // we normalize the folder entries because we need to compare them
+ $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
+ if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
+ if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
+
+ // add this path and it's parent paths to used_paths array
+ while(strpos($tmp_folder, '/') !== false) {
+ if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+ $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
+ }
+ if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+ }
+ unset($tmp);
+
+ // loop and check if the path is still used and stop at first used one
+ // set do_delete to false so nothing gets deleted if the web_folder itself is still used
+ $do_delete = false;
+ while(count($path_elements) > 0) {
+ $tmp_folder = implode('/', $path_elements);
+ if(in_array($tmp_folder, $used_paths) == true) break;
+
+ // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
+ $delete_folder = $tmp_folder;
+ $do_delete = true;
+ array_pop($path_elements);
+ }
+ unset($tmp_folder);
+ unset($used_paths);
+ }
+
+ if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
+
+ unset($delete_folder);
+ unset($path_elements);
+ }
+ }
+
+ //remove the php fastgi starter script if available
+ if ($data['old']['php'] == 'fast-cgi') {
+ $this->php_fpm_pool_delete($data, $web_config);
+ $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['fastcgi_starter_path']);
+ if($data['old']['type'] == 'vhost') {
+ if (is_dir($fastcgi_starter_path)) {
+ exec('rm -rf '.$fastcgi_starter_path);
+ }
+ } else {
+ $fcgi_starter_script = $fastcgi_starter_path.$web_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
+ if (file_exists($fcgi_starter_script)) {
+ exec('rm -f '.$fcgi_starter_script);
+ }
+ }
+ }
+
+ // remove PHP-FPM pool
+ if ($data['old']['php'] == 'php-fpm') {
+ $this->php_fpm_pool_delete($data, $web_config);
+ }
+
+ //remove the php cgi starter script if available
+ if ($data['old']['php'] == 'cgi') {
+ // TODO: fetch the date from the server-settings
+ $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+
+ $cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']);
+ if($data['old']['type'] == 'vhost') {
+ if (is_dir($cgi_starter_path)) {
+ exec('rm -rf '.$cgi_starter_path);
+ }
+ } else {
+ $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
+ if (file_exists($cgi_starter_script)) {
+ exec('rm -f '.$cgi_starter_script);
+ }
+ }
+ }
+
+ $app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG);
+
+ // Delete the symlinks for the sites
+ $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+ $client_id = intval($client['client_id']);
+ unset($client);
+ $tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+ if(is_array($tmp_symlinks_array)) {
+ foreach($tmp_symlinks_array as $tmp_symlink) {
+ $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+ $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+ // Remove trailing slash
+ if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+ // create the symlinks, if not exist
+ if(is_link($tmp_symlink)) {
+ $app->system->unlink($tmp_symlink);
+ $app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+ // end removing symlinks
+ } else {
+ // vhost subdomain
+ }
+
+ // Delete the log file directory
+ $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
+ if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+ $app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
+
+ if($data['old']['type'] == 'vhost') {
+ //delete the web user
+ $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
+ $command .= ' '.escapeshellcmd($data['old']['system_user']);
+ exec($command);
+ if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+ }
+
+ //* Remove the awstats configuration file
+ if($data['old']['stats_type'] == 'awstats') {
+ $this->awstats_delete($data, $web_config);
+ }
+
+ $app->services->restartServiceDelayed('httpd', 'reload');
+
+ }
+
+
+ if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
+ }
+
+ //* This function is called when a IP on the server is inserted, updated or deleted
+ function server_ip($event_name, $data) {
+ return;
+ }
+
+ //* Create or update the .htaccess folder protection
+ function web_folder_user($event_name, $data) {
+ global $app, $conf;
+
+ $app->uses('system');
+
+ if($event_name == 'web_folder_user_delete') {
+ $folder_id = $data['old']['web_folder_id'];
+ } else {
+ $folder_id = $data['new']['web_folder_id'];
+ }
+
+ $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".intval($folder_id));
+ $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
+
+ if(!is_array($folder) or !is_array($website)) {
+ $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ $web_folder = 'web';
+ if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
+ //* Get the folder path.
+ if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+ if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
+ $folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
+ if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
+ //* Check if the resulting path is inside the docroot
+ if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) {
+ $app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Create the folder path, if it does not exist
+ if(!is_dir($folder_path)) {
+ $app->system->mkdirpath($folder_path);
+ $app->system->chown($folder_path, $website['system_user']);
+ $app->system->chgrp($folder_path, $website['system_group']);
+ }
+
+ //* Create empty .htpasswd file, if it does not exist
+ if(!is_file($folder_path.'.htpasswd')) {
+ touch($folder_path.'.htpasswd');
+ $app->system->chmod($folder_path.'.htpasswd', 0755);
+ $app->system->chown($folder_path.'.htpasswd', $website['system_user']);
+ $app->system->chgrp($folder_path.'.htpasswd', $website['system_group']);
+ $app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+
+ /*
+ $auth_users = $app->db->queryAllRecords("SELECT * FROM web_folder_user WHERE active = 'y' AND web_folder_id = ".intval($folder_id));
+ $htpasswd_content = '';
+ if(is_array($auth_users) && !empty($auth_users)){
+ foreach($auth_users as $auth_user){
+ $htpasswd_content .= $auth_user['username'].':'.$auth_user['password']."\n";
+ }
+ }
+ $htpasswd_content = trim($htpasswd_content);
+ @file_put_contents($folder_path.'.htpasswd', $htpasswd_content);
+ $app->log('Changed .htpasswd file: '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+ */
+
+ if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') {
+ $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+ $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
+ }
+
+ //* Add or remove the user from .htpasswd file
+ if($event_name == 'web_folder_user_delete') {
+ $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+ $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
+ } else {
+ if($data['new']['active'] == 'y') {
+ $app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1);
+ $app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG);
+ }
+ }
+
+ // write basic auth configuration to vhost file because nginx does not support .htaccess
+ $webdata['new'] = $webdata['old'] = $website;
+ $this->update('web_domain_update', $webdata);
+ }
+
+ //* Remove .htpasswd file, when folder protection is removed
+ function web_folder_delete($event_name, $data) {
+ global $app, $conf;
+
+ $folder_id = $data['old']['web_folder_id'];
+
+ $folder = $data['old'];
+ $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
+
+ if(!is_array($folder) or !is_array($website)) {
+ $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ $web_folder = 'web';
+ if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
+ //* Get the folder path.
+ if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+ if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
+ $folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
+ if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
+ //* Check if the resulting path is inside the docroot
+ if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+ $app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Remove .htpasswd file
+ if(is_file($folder_path.'.htpasswd')) {
+ $app->system->unlink($folder_path.'.htpasswd');
+ $app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+
+ // write basic auth configuration to vhost file because nginx does not support .htaccess
+ $webdata['new'] = $webdata['old'] = $website;
+ $this->update('web_domain_update', $webdata);
+ }
+
+ //* Update folder protection, when path has been changed
+ function web_folder_update($event_name, $data) {
+ global $app, $conf;
+
+ $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
+
+ if(!is_array($website)) {
+ $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ $web_folder = 'web';
+ if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
+ //* Get the folder path.
+ if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1);
+ if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1);
+ $old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']);
+ if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/';
+
+ if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1);
+ if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1);
+ $new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']);
+ if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/';
+
+ //* Check if the resulting path is inside the docroot
+ if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) {
+ $app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
+ return false;
+ }
+ if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) {
+ $app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Check if the resulting path is inside the docroot
+ if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+ $app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
+ return false;
+ }
+ if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+ $app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
+ return false;
+ }
+
+ //* Create the folder path, if it does not exist
+ if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path);
+
+ if($data['old']['path'] != $data['new']['path']) {
+
+
+ //* move .htpasswd file
+ if(is_file($old_folder_path.'.htpasswd')) {
+ $app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd');
+ $app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
+ }
+
+ }
+
+ // write basic auth configuration to vhost file because nginx does not support .htaccess
+ $webdata['new'] = $webdata['old'] = $website;
+ $this->update('web_domain_update', $webdata);
+ }
+
+ function _create_web_folder_auth_configuration($website){
+ global $app, $conf;
+ //* Create the domain.auth file which is included in the vhost configuration file
+ $app->uses('getconf');
+ $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+ $basic_auth_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$website['domain'].'.auth');
+ //$app->load('tpl');
+ //$tpl = new tpl();
+ //$tpl->newTemplate('nginx_http_authentication.auth.master');
+ $website_auth_locations = $app->db->queryAllRecords("SELECT * FROM web_folder WHERE active = 'y' AND parent_domain_id = ".intval($website['domain_id']));
+ $basic_auth_locations = array();
+ if(is_array($website_auth_locations) && !empty($website_auth_locations)){
+ foreach($website_auth_locations as $website_auth_location){
+ if(substr($website_auth_location['path'], 0, 1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 1);
+ if(substr($website_auth_location['path'], -1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 0, -1);
+ if($website_auth_location['path'] != ''){
+ $website_auth_location['path'] .= '/';
+ }
+ $basic_auth_locations[] = array('htpasswd_location' => '/'.$website_auth_location['path'],
+ 'htpasswd_path' => $website['document_root'].'/' . ($website['type'] == 'vhostsubdomain' ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']);
+ }
+ }
+ return $basic_auth_locations;
+ //$tpl->setLoop('basic_auth_locations', $basic_auth_locations);
+ //file_put_contents($basic_auth_file,$tpl->grab());
+ //$app->log('Writing the http basic authentication file: '.$basic_auth_file,LOGLEVEL_DEBUG);
+ //unset($tpl);
+ //$app->services->restartServiceDelayed('httpd','reload');
+ }
+
+ //* Update the awstats configuration file
+ private function awstats_update ($data, $web_config) {
+ global $app;
+
+ $web_folder = $data['new']['web_folder'];
+ if($data['new']['type'] == 'vhost') $web_folder = 'web';
+ $awstats_conf_dir = $web_config['awstats_conf_dir'];
+
+ if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats");
+ if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
+ if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
+ $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
+ }
+
+ $content = '';
+ $content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
+ $content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
+ $content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
+ $content .= "HostAliases=\"www.".$data['new']['domain']." localhost 127.0.0.1\"\n";
+
+ $app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content);
+ $app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG);
+ }
+
+ if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
+ if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
+ $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ } else {
+ $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+ }
+ }
+
+ //* Delete the awstats configuration file
+ private function awstats_delete ($data, $web_config) {
+ global $app;
+
+ $awstats_conf_dir = $web_config['awstats_conf_dir'];
+
+ if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
+ $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
+ $app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG);
+ }
+ }
+
+ //* Update the PHP-FPM pool configuration file
+ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) {
+ global $app, $conf;
+ /*
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ */
+ if($data['new']['php'] != 'no'){
+ if(trim($data['new']['fastcgi_php_version']) != ''){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ } else {
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+ }
+
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
+
+ if($data['new']['php'] == 'no'){
+ if(@is_file($pool_dir.$pool_name.'.conf')){
+ $app->system->unlink($pool_dir.$pool_name.'.conf');
+ //$reload = true;
+ }
+ if($data['old']['php'] != 'no'){
+ if(!$default_php_fpm){
+ $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
+ } else {
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+ return;
+ }
+
+ $app->load('tpl');
+ $tpl = new tpl();
+ $tpl->newTemplate('php_fpm_pool.conf.master');
+
+ if($data['new']['php_fpm_use_socket'] == 'y'){
+ $use_tcp = 0;
+ $use_socket = 1;
+ if(!is_dir($socket_dir)) $app->system->mkdirpath($socket_dir);
+ } else {
+ $use_tcp = 1;
+ $use_socket = 0;
+ }
+ $tpl->setVar('use_tcp', $use_tcp);
+ $tpl->setVar('use_socket', $use_socket);
+
+ $fpm_socket = $socket_dir.$pool_name.'.sock';
+ $tpl->setVar('fpm_socket', $fpm_socket);
+ $tpl->setVar('fpm_listen_mode', '0660');
+
+ $tpl->setVar('fpm_pool', $pool_name);
+ $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
+ $tpl->setVar('fpm_user', $data['new']['system_user']);
+ $tpl->setVar('fpm_group', $data['new']['system_group']);
+ $tpl->setVar('pm', $data['new']['pm']);
+ $tpl->setVar('pm_max_children', $data['new']['pm_max_children']);
+ $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']);
+ $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']);
+ $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']);
+ $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']);
+ $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']);
+ $tpl->setVar('document_root', $data['new']['document_root']);
+ $tpl->setVar('security_level', $web_config['security_level']);
+ $tpl->setVar('domain', $data['new']['domain']);
+ $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
+ $tpl->setVar('php_open_basedir', $php_open_basedir);
+ if($php_open_basedir != ''){
+ $tpl->setVar('enable_php_open_basedir', '');
+ } else {
+ $tpl->setVar('enable_php_open_basedir', ';');
+ }
+
+ // Custom php.ini settings
+ $final_php_ini_settings = array();
+ $custom_php_ini_settings = trim($data['new']['custom_php_ini']);
+ if($custom_php_ini_settings != ''){
+ // Make sure we only have Unix linebreaks
+ $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings);
+ $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings);
+ $ini_settings = explode("\n", $custom_php_ini_settings);
+ if(is_array($ini_settings) && !empty($ini_settings)){
+ foreach($ini_settings as $ini_setting){
+ $ini_setting = trim($ini_setting);
+ if(substr($ini_setting, 0, 1) == ';') continue;
+ if(substr($ini_setting, 0, 1) == '#') continue;
+ if(substr($ini_setting, 0, 2) == '//') continue;
+ list($key, $value) = explode('=', $ini_setting, 2);
+ $value = trim($value);
+ if($value != ''){
+ $key = trim($key);
+ switch (strtolower($value)) {
+ case '0':
+ // PHP-FPM might complain about invalid boolean value if you use 0
+ $value = 'off';
+ case '1':
+ case 'on':
+ case 'off':
+ case 'true':
+ case 'false':
+ case 'yes':
+ case 'no':
+ $final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
+ break;
+ default:
+ $final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
+ }
+ }
+ }
+ }
+ }
+
+ $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
+
+ $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());
+ $app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ unset($tpl);
+
+ // delete pool in all other PHP versions
+ $default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
+ if($default_pool_dir != $pool_dir){
+ if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
+ $app->system->unlink($default_pool_dir.$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+ $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$conf["server_id"]);
+ if(is_array($php_versions) && !empty($php_versions)){
+ foreach($php_versions as $php_version){
+ if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+ if($php_version['php_fpm_pool_dir'] != $pool_dir){
+ if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
+ $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
+ }
+ }
+ }
+ }
+ // Reload current PHP-FPM after all others
+ sleep(1);
+ if(!$default_php_fpm){
+ $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
+ } else {
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+
+ //* Delete the PHP-FPM pool configuration file
+ private function php_fpm_pool_delete ($data, $web_config) {
+ global $app, $conf;
+
+ if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
+ $default_php_fpm = false;
+ list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
+ if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
+ } else {
+ $default_php_fpm = true;
+ }
+
+ if($default_php_fpm){
+ $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ } else {
+ $pool_dir = $custom_php_fpm_pool_dir;
+ }
+
+ if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
+ $pool_name = 'web'.$data['old']['domain_id'];
+
+ if ( @is_file($pool_dir.$pool_name.'.conf') ) {
+ $app->system->unlink($pool_dir.$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ }
+
+ // delete pool in all other PHP versions
+ $default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
+ if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
+ if($default_pool_dir != $pool_dir){
+ if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
+ $app->system->unlink($default_pool_dir.$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+ $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$data['old']['server_id']);
+ if(is_array($php_versions) && !empty($php_versions)){
+ foreach($php_versions as $php_version){
+ if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+ if($php_version['php_fpm_pool_dir'] != $pool_dir){
+ if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
+ $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
+ $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+ $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
+ }
+ }
+ }
+ }
+
+ // Reload current PHP-FPM after all others
+ sleep(1);
+ if(!$default_php_fpm){
+ $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
+ } else {
+ $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+ }
+ }
+
+ private function nginx_replace($matches){
+ $location = 'location'.($matches[1] != '' ? ' '.$matches[1] : '').' '.$matches[2].' '.$matches[3];
+ if($matches[4] == '##merge##' || $matches[7] == '##merge##') $location .= ' ##merge##';
+ if($matches[4] == '##delete##' || $matches[7] == '##delete##') $location .= ' ##delete##';
+ $location .= "\n";
+ $location .= $matches[5]."\n";
+ $location .= $matches[6];
+ return $location;
+ }
+
+ private function nginx_merge_locations($vhost_conf){
+
+ $lines = explode("\n", $vhost_conf);
+
+ // if whole location block is in one line, split it up into multiple lines
+ if(is_array($lines) && !empty($lines)){
+ $linecount = sizeof($lines);
+ for($h=0;$h<$linecount;$h++){
+ // remove comments
+ if(substr(trim($lines[$h]), 0, 1) == '#'){
+ unset($lines[$h]);
+ continue;
+ }
+
+ $lines[$h] = rtrim($lines[$h]);
+ /*
+ if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], ';') !== false){
+ $lines[$h] = str_replace("{", "{\n", $lines[$h]);
+ $lines[$h] = str_replace(";", ";\n", $lines[$h]);
+ if(strpos($lines[$h], '##merge##') !== false){
+ $lines[$h] = str_replace('##merge##', '', $lines[$h]);
+ $lines[$h] = substr($lines[$h],0,strpos($lines[$h], '{')).' ##merge##'.substr($lines[$h],strpos($lines[$h], '{')+1);
+ }
+ }
+ if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], '}') !== false && strpos($lines[$h], ';') === false){
+ $lines[$h] = str_replace("{", "{\n", $lines[$h]);
+ if(strpos($lines[$h], '##merge##') !== false){
+ $lines[$h] = str_replace('##merge##', '', $lines[$h]);
+ $lines[$h] = substr($lines[$h],0,strpos($lines[$h], '{')).' ##merge##'.substr($lines[$h],strpos($lines[$h], '{')+1);
+ }
+ }
+ */
+ $pattern = '/^[^\S\n]*location[^\S\n]+(?:(.+)[^\S\n]+)?(.+)[^\S\n]*(\{)[^\S\n]*(##merge##|##delete##)?[^\S\n]*(.+)[^\S\n]*(\})[^\S\n]*(##merge##|##delete##)?[^\S\n]*$/';
+ $lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') , $lines[$h]);
+ }
+ }
+ $vhost_conf = implode("\n", $lines);
+ unset($lines);
+ unset($linecount);
+
+ $lines = explode("\n", $vhost_conf);
+
+ if(is_array($lines) && !empty($lines)){
+ $locations = array();
+ $locations_to_delete = array();
+ $islocation = false;
+ $linecount = sizeof($lines);
+ $server_count = 0;
+
+ for($i=0;$i<$linecount;$i++){
+ $l = trim($lines[$i]);
+ if(substr($l, 0, 8) == 'server {') $server_count += 1;
+ if($server_count > 1) break;
+ if(substr($l, 0, 8) == 'location' && !$islocation){
+
+ $islocation = true;
+ $level = 0;
+
+ // Remove unnecessary whitespace
+ $l = preg_replace('/\s\s+/', ' ', $l);
+
+ $loc_parts = explode(' ', $l);
+ // see http://wiki.nginx.org/HttpCoreModule#location
+ if($loc_parts[1] == '=' || $loc_parts[1] == '~' || $loc_parts[1] == '~*' || $loc_parts[1] == '^~'){
+ $location = $loc_parts[1].' '.$loc_parts[2];
+ } else {
+ $location = $loc_parts[1];
+ }
+ unset($loc_parts);
+
+ if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace';
+ if(substr($l, -9) == '##merge##') $locations[$location]['action'] = 'merge';
+ if(substr($l, -10) == '##delete##') $locations[$location]['action'] = 'delete';
+
+ if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = ' location '.$location.' {';
+ if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = '';
+ if($locations[$location]['action'] == 'delete') $locations_to_delete[] = $location;
+ if(!isset($locations[$location]['end_tag'])) $locations[$location]['end_tag'] = ' }';
+ if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i;
+
+ unset($lines[$i]);
+
+ } else {
+
+ if($islocation){
+ if(strpos($l, '{') !== false){
+ $level += 1;
+ }
+ if(strpos($l, '}') !== false && $level > 0){
+ $level -= 1;
+ $locations[$location]['location'] .= $lines[$i]."\n";
+ } elseif(strpos($l, '}') !== false && $level == 0){
+ $islocation = false;
+ } else {
+ $locations[$location]['location'] .= $lines[$i]."\n";
+ }
+ unset($lines[$i]);
+ }
+
+ }
+ }
+
+ if(is_array($locations) && !empty($locations)){
+ if(is_array($locations_to_delete) && !empty($locations_to_delete)){
+ foreach($locations_to_delete as $location_to_delete){
+ if(isset($locations[$location_to_delete])) unset($locations[$location_to_delete]);
+ }
+ }
+
+ foreach($locations as $key => $val){
+ $new_location = $val['open_tag']."\n".$val['location'].$val['end_tag'];
+ $lines[$val['start_line']] = $new_location;
+ }
+ }
+ ksort($lines);
+ $vhost_conf = implode("\n", $lines);
+ }
+
+ return trim($vhost_conf);
+ }
+
+ function client_delete($event_name, $data) {
+ global $app, $conf;
+
+ $app->uses("getconf");
+ $web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
+
+ $client_id = intval($data['old']['client_id']);
+ if($client_id > 0) {
+
+ $client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
+ if(is_dir($client_dir) && !stristr($client_dir, '..')) {
+ // remove symlinks from $client_dir
+ $files = array_diff(scandir($client_dir), array('.', '..'));
+ if(is_array($files) && !empty($files)){
+ foreach($files as $file){
+ if(is_link($client_dir.'/'.$file)){
+ unlink($client_dir.'/'.$file);
+ $app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
+ @rmdir($client_dir);
+ $app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG);
+ }
+
+ if($app->system->is_group('client'.$client_id)){
+ $this->_exec('groupdel client'.$client_id);
+ $app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG);
+ }
+ }
+
+ }
+
+ //* Wrapper for exec function for easier debugging
+ private function _exec($command) {
+ global $app;
+ $app->log('exec: '.$command, LOGLEVEL_DEBUG);
+ exec($command);
+ }
+
+ private function _checkTcp ($host, $port) {
+
+ $fp = @fsockopen($host, $port, $errno, $errstr, 2);
+
+ if ($fp) {
+ fclose($fp);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function create_relative_link($f, $t) {
+ global $app;
+ // $from already exists
+ $from = realpath($f);
+
+ // realpath requires the traced file to exist - so, lets touch it first, then remove
+ @$app->system->unlink($t); touch($t);
+ $to = realpath($t);
+ @$app->system->unlink($t);
+
+ // Remove from the left side matching path elements from $from and $to
+ // and get path elements counts
+ $a1 = explode('/', $from); $a2 = explode('/', $to);
+ for ($c = 0; $a1[$c] == $a2[$c]; $c++) {
+ unset($a1[$c]); unset($a2[$c]);
+ }
+ $cfrom = implode('/', $a1);
+
+ // Check if a path is fully a subpath of another - no way to create symlink in the case
+ if (count($a1) == 0 || count($a2) == 0) return false;
+
+ // Add ($cnt_to-1) number of "../" elements to left side of $cfrom
+ for ($c = 0; $c < (count($a2)-1); $c++) { $cfrom = '../'.$cfrom; }
+
+ return symlink($cfrom, $to);
+ }
+
+ private function _rewrite_quote($string) {
+ return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
+ }
+
+ private function url_is_local($hostname, $domain_id){
+ global $app;
+
+ // ORDER BY clause makes sure wildcard subdomains (*) are listed last in the result array so that we can find direct matches first
+ $webs = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' ORDER BY subdomain ASC");
+ if(is_array($webs) && !empty($webs)){
+ foreach($webs as $web){
+ // web domain doesn't match hostname
+ if(substr($hostname, -strlen($web['domain'])) != $web['domain']) continue;
+ // own vhost and therefore server {} container of its own
+ //if($web['type'] == 'vhostsubdomain') continue;
+ // alias domains/subdomains using rewrites and therefore a server {} container of their own
+ //if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') continue;
+
+ if($web['subdomain'] == '*'){
+ $pattern = '/\.?'.str_replace('.', '\.', $web['domain']).'$/i';
+ }
+ if($web['subdomain'] == 'none'){
+ if($web['domain'] == $hostname){
+ if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){
+ // own vhost and therefore server {} container of its own
+ if($web['type'] == 'vhostsubdomain') return false;
+ // alias domains/subdomains using rewrites and therefore a server {} container of their own
+ if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ $pattern = '/^'.str_replace('.', '\.', $web['domain']).'$/i';
+ }
+ if($web['subdomain'] == 'www'){
+ if($web['domain'] == $hostname || $web['subdomain'].'.'.$web['domain'] == $hostname){
+ if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){
+ // own vhost and therefore server {} container of its own
+ if($web['type'] == 'vhostsubdomain') return false;
+ // alias domains/subdomains using rewrites and therefore a server {} container of their own
+ if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ $pattern = '/^(www\.)?'.str_replace('.', '\.', $web['domain']).'$/i';
+ }
+ if(preg_match($pattern, $hostname)){
+ if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){
+ // own vhost and therefore server {} container of its own
+ if($web['type'] == 'vhostsubdomain') return false;
+ // alias domains/subdomains using rewrites and therefore a server {} container of their own
+ if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private function get_seo_redirects($web, $prefix = '', $force_subdomain = false){
+ // $force_subdomain = 'none|www'
+ $seo_redirects = array();
+
+ if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*';
+
+ if(($web['subdomain'] == 'www' || $web['subdomain'] == '*') && $force_subdomain != 'www'){
+ if($web['seo_redirect'] == 'non_www_to_www'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '=';
+ }
+ if($web['seo_redirect'] == '*_domain_tld_to_www_domain_tld'){
+ // ^(example\.com|(?!\bwww\b)\.example\.com)$
+ // ^(example\.com|((?:\w+(?:-\w+)*\.)*)((?!www\.)\w+(?:-\w+)*)(\.example\.com))$
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = '^('.str_replace('.', '\.', $web['domain']).'|((?:\w+(?:-\w+)*\.)*)((?!www\.)\w+(?:-\w+)*)(\.'.str_replace('.', '\.', $web['domain']).'))$';
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '~*';
+ }
+ if($web['seo_redirect'] == '*_to_www_domain_tld'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '!=';
+ }
+ }
+ if($force_subdomain != 'none'){
+ if($web['seo_redirect'] == 'www_to_non_www'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = 'www.'.$web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '=';
+ }
+ if($web['seo_redirect'] == '*_domain_tld_to_domain_tld'){
+ // ^(.+)\.example\.com$
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = '^(.+)\.'.str_replace('.', '\.', $web['domain']).'$';
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '~*';
+ }
+ if($web['seo_redirect'] == '*_to_domain_tld'){
+ $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain'];
+ $seo_redirects[$prefix.'seo_redirect_operator'] = '!=';
+ }
+ }
+ return $seo_redirects;
+ }
+
+} // end class
+
+?>