aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Alouit <alexandre.alouit@gmail.com>2016-02-02 08:06:08 +0100
committerAlexandre Alouit <alexandre.alouit@gmail.com>2016-02-02 08:06:08 +0100
commit73b52f7d2bbe5ef267384afe79115d19ec98ca7e (patch)
treeb2fa077a32dd3cba270e61d439b0ce619f5b2dff
parentbc90352dd0e8429fb608f3ec4e2927c39990a79f (diff)
improvements
alias domain support
-rw-r--r--_todo1
-rwxr-xr-xsrc/server/plugins-available/apache2_plugin.inc.php10
-rwxr-xr-xsrc/server/plugins-available/nginx_plugin.inc.php10
3 files changed, 20 insertions, 1 deletions
diff --git a/_todo b/_todo
index 1da1187..9a7fdd9 100644
--- a/_todo
+++ b/_todo
@@ -3,7 +3,6 @@ check dns MX entry is correct before request to Let's Encrypt (apache and nginx
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)
-support aliasdomain
improve email policy
check if is a symlink and is correct (if target is same)
disable ssl & letsencrypt fields in database if we have error (and show notification?)
diff --git a/src/server/plugins-available/apache2_plugin.inc.php b/src/server/plugins-available/apache2_plugin.inc.php
index 6dbf04e..755d0e1 100755
--- a/src/server/plugins-available/apache2_plugin.inc.php
+++ b/src/server/plugins-available/apache2_plugin.inc.php
@@ -956,6 +956,7 @@ class apache2_plugin {
OR ($data['old']['domain'] != $data['new']['domain']) // we have domain update
OR ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
OR ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
+ OR ($data['old']['type'] == 'alias' OR $data['new']['type'] == 'alias') // we have new or update on alias domain
)) {
$data['new']['ssl_domain'] = $domain;
$vhost_data['ssl_domain'] = $domain;
@@ -964,6 +965,7 @@ class apache2_plugin {
$temp_domains = array();
$lddomain = $domain;
$subdomains = null;
+ $aliasdomains = null;
//* be sure to have good domain
if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
@@ -978,6 +980,14 @@ class apache2_plugin {
}
}
+ //* then, add alias domain if we have
+ $aliasdomains = $app->db->queryAllRecords('SELECT domain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'alias'");
+ if(is_array($aliasdomains)) {
+ foreach($aliasdomains as $aliasdomain) {
+ $temp_domains[] = $aliasdomain['domain'];
+ }
+ }
+
// prevent duplicate
$temp_domains = array_unique($temp_domains);
diff --git a/src/server/plugins-available/nginx_plugin.inc.php b/src/server/plugins-available/nginx_plugin.inc.php
index b3eecfa..69416b9 100755
--- a/src/server/plugins-available/nginx_plugin.inc.php
+++ b/src/server/plugins-available/nginx_plugin.inc.php
@@ -1119,12 +1119,14 @@ class nginx_plugin {
OR ($data['old']['domain'] != $data['new']['domain']) // we have domain update
OR ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
OR ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
+ OR ($data['old']['type'] == 'alias' OR $data['new']['type'] == 'alias') // we have new or update on alias domain
)) {
// default values
$temp_domains = array();
$lddomain = $domain;
$subdomains = null;
+ $aliasdomains = null;
//* be sure to have good domain
if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
@@ -1139,6 +1141,14 @@ class nginx_plugin {
}
}
+ //* then, add alias domain if we have
+ $aliasdomains = $app->db->queryAllRecords('SELECT domain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'alias'");
+ if(is_array($aliasdomains)) {
+ foreach($aliasdomains as $aliasdomain) {
+ $temp_domains[] = $aliasdomain['domain'];
+ }
+ }
+
// prevent duplicate
$temp_domains = array_unique($temp_domains);