Commit 3501f913 authored by mcramer's avatar mcramer
Browse files

Implemented FS#2382 - automatically add alias domain when creating a domain

parent 8e0d3660
......@@ -390,6 +390,14 @@ $form["tabs"]['web'] = array(
'default' => 'n',
'value' => array(0 => 'n',1 => 'y')
),
'website_autoalias' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
),
'vhost_conf_dir' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
......
......@@ -35,6 +35,8 @@ $wb['hostname_txt'] = 'Hostname';
$wb['nameservers_txt'] = 'Nameserver';
$wb['auto_network_configuration_txt'] = 'Netzwerkkonfiguration';
$wb['website_basedir_txt'] = 'Website basedir';
$wb["website_autoalias_txt"] = 'Website Autoalias';
$wb["website_autoalias_note_txt"] = 'Platzhalter: [client_id], [client_username], [website_id], [website_domain]';
$wb['ip_address_error_wrong'] = 'Ungültiges IP-Adressen-Format.';
$wb['netmask_error_wrong'] = 'Ungültiges Netzmasken-Format.';
$wb['gateway_error_wrong'] = 'Ungültiges Gateway-Format.';
......
......@@ -15,6 +15,8 @@ $wb["website_path_txt"] = 'Website path';
$wb["website_symlinks_txt"] = 'Website symlinks';
$wb['website_symlinks_rel_txt'] = 'Make relative symlinks';
$wb["website_basedir_txt"] = 'Website basedir';
$wb["website_autoalias_txt"] = 'Website auto alias';
$wb["website_autoalias_note_txt"] = 'Placeholders: [client_id], [client_username], [website_id], [website_domain]';
$wb["vhost_conf_dir_txt"] = 'Vhost config dir';
$wb["vhost_conf_enabled_dir_txt"] = 'Vhost config enabled dir';
$wb["getmail_config_dir_txt"] = 'Getmail config dir';
......
......@@ -31,6 +31,10 @@
{tmpl_var name='website_symlinks_rel'}
</div>
</div>
<div class="ctrlHolder">
<label for="website_autoalias">{tmpl_var name='website_autoalias_txt'}</label>
<input name="website_autoalias" id="website_autoalias" value="{tmpl_var name='website_autoalias'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='website_autoalias_note_txt'}
</div>
<div class="ctrlHolder apache">
<label for="vhost_conf_dir">{tmpl_var name='vhost_conf_dir_txt'}</label>
<input name="vhost_conf_dir" id="vhost_conf_dir" value="{tmpl_var name='vhost_conf_dir'}" size="40" maxlength="255" type="text" class="textInput" />
......
......@@ -871,10 +871,25 @@ class apache2_plugin {
'rewrite_target_ssl' => $rewrite_target_ssl);
}
}
$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'");
$server_alias = array();
switch($data['new']['subdomain']) {
case 'www':
$server_alias[] .= 'www.'.$data['new']['domain'].' ';
......
......@@ -912,10 +912,25 @@ class nginx_plugin {
'rewrite_exclude' => $rewrite_exclude);
}
}
$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'");
$server_alias = array();
switch($data['new']['subdomain']) {
case 'www':
$server_alias[] = 'www.'.$data['new']['domain'].' ';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment