diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index ef4ee71675f9eb7fc91a417315d119464b804a46..84ee2637544bed89aebe39f95d9f9e6b9e28631e 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -69,6 +69,7 @@ CREATE TABLE `client` (
`limit_maildomain` int(11) NOT NULL default '-1',
`limit_mailbox` int(11) NOT NULL default '-1',
`limit_mailalias` int(11) NOT NULL default '-1',
+ `limit_mailaliasdomain` int(11) NOT NULL default '-1',
`limit_mailforward` int(11) NOT NULL default '-1',
`limit_mailcatchall` int(11) NOT NULL default '-1',
`limit_mailrouting` int(11) NOT NULL default '0',
@@ -125,6 +126,7 @@ CREATE TABLE `client_template` (
`limit_maildomain` int(11) NOT NULL default '-1',
`limit_mailbox` int(11) NOT NULL default '-1',
`limit_mailalias` int(11) NOT NULL default '-1',
+ `limit_mailaliasdomain` int(11) NOT NULL default '-1',
`limit_mailforward` int(11) NOT NULL default '-1',
`limit_mailcatchall` int(11) NOT NULL default '-1',
`limit_mailrouting` int(11) NOT NULL default '0',
@@ -389,7 +391,7 @@ CREATE TABLE `mail_forwarding` (
`server_id` int(11) unsigned NOT NULL default '0',
`source` varchar(255) NOT NULL,
`destination` text NOT NULL default '',
- `type` enum('alias','forward','catchall') NOT NULL default 'alias',
+ `type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias',
`active` enum('n','y') NOT NULL,
PRIMARY KEY (`forwarding_id`),
KEY `server_id` (`server_id`,`source`)
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index 4d369cef9f747a52c5234ecc6c6749bec38ad381..9a7b6e0884d2e8072e4888337792a1acd3ff2569 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -364,6 +364,20 @@ $form["tabs"]['limits'] = array (
'rows' => '',
'cols' => ''
),
+ 'limit_mailaliasdomain' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'ISINT',
+ 'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+ ),
+ 'default' => '-1',
+ 'value' => '',
+ 'separator' => '',
+ 'width' => '10',
+ 'maxlength' => '10',
+ 'rows' => '',
+ 'cols' => ''
+ ),
'limit_mailforward' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php
index 5f34c58ffef746302703e24fee8186dadbd931ba..e26f037e30085c8b75db3535e7303dea227a0ea3 100644
--- a/interface/web/client/form/client_template.tform.php
+++ b/interface/web/client/form/client_template.tform.php
@@ -143,6 +143,20 @@ $form["tabs"]['limits'] = array (
'rows' => '',
'cols' => ''
),
+ 'limit_mailaliasdomain' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'ISINT',
+ 'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+ ),
+ 'default' => '-1',
+ 'value' => '',
+ 'separator' => '',
+ 'width' => '10',
+ 'maxlength' => '10',
+ 'rows' => '',
+ 'cols' => ''
+ ),
'limit_mailforward' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng
index 03cec3feee03717564d2248c7fc6fe0b10941427..4be403341d84a8410b602d3d32b4a38fcbcd4dc6 100644
--- a/interface/web/client/lib/lang/en_client.lng
+++ b/interface/web/client/lib/lang/en_client.lng
@@ -2,6 +2,7 @@
$wb["limit_maildomain_txt"] = 'Max. number of email domains';
$wb["limit_mailbox_txt"] = 'Max. number of mailboxes';
$wb["limit_mailalias_txt"] = 'Max. number of email aliases';
+$wb["limit_mailaliasdomain_txt"] = 'Max. number of domain aliases';
$wb["limit_mailforward_txt"] = 'Max. number of email forwarders';
$wb["limit_mailcatchall_txt"] = 'Max. number of email catchall accounts';
$wb["limit_mailrouting_txt"] = 'Max. number of email routes';
@@ -61,6 +62,7 @@ $wb["username_error_unique"] = 'The username must be unique.';
$wb["limit_maildomain_error_notint"] = 'The email domain limit must be a number.';
$wb["limit_mailbox_error_notint"] = 'The mailbox limit must be a number.';
$wb["limit_mailalias_error_notint"] = 'The email alias limit must be a number.';
+$wb["limit_mailaliasdomain_error_notint"] = 'The email domain alias limit must be a number.';
$wb["limit_mailforward_error_notint"] = 'The email forward limit must be a number.';
$wb["limit_mailcatchall_error_notint"] = 'The email catchall limit must be a number.';
$wb["limit_mailrouting_error_notint"] = 'The email routing limit must be a number.';
diff --git a/interface/web/client/lib/lang/en_client_template.lng b/interface/web/client/lib/lang/en_client_template.lng
index 6d9ee1115435c6a816f7bb36c373c04e14ac9261..d403dfda503eccd5dd1f73dabaf28739f60048c7 100644
--- a/interface/web/client/lib/lang/en_client_template.lng
+++ b/interface/web/client/lib/lang/en_client_template.lng
@@ -1,55 +1,57 @@
-
\ No newline at end of file
diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm
index 839627e8f7b6f3d3406277f8aa66391a1b4d31ef..2927ca4d087acc9dfa842ad3aa57338ddd212a89 100644
--- a/interface/web/client/templates/client_edit_limits.htm
+++ b/interface/web/client/templates/client_edit_limits.htm
@@ -53,6 +53,10 @@
+
+
+
+
diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm
index 1ee1a1e487420cdb0149a33906e81ae952569bf4..81f2595425117d1136a27bf4b9eb9841c1623b65 100644
--- a/interface/web/client/templates/client_template_edit_limits.htm
+++ b/interface/web/client/templates/client_template_edit_limits.htm
@@ -18,6 +18,10 @@
+
+
+
+
diff --git a/interface/web/mail/form/mail_aliasdomain.tform.php b/interface/web/mail/form/mail_aliasdomain.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..ae06013d97ddd39b16b0cb4068bde9bf8742cc4d
--- /dev/null
+++ b/interface/web/mail/form/mail_aliasdomain.tform.php
@@ -0,0 +1,113 @@
+ 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
+
+$form["tabs"]['alias'] = array (
+ 'title' => "Domain Alias",
+ 'width' => 100,
+ 'template' => "templates/mail_aliasdomain_edit.htm",
+ 'fields' => array (
+ ##################################
+ # Begin Datatable fields
+ ##################################
+ 'server_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'source' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'source_error_empty'),
+ 1 => array ( 'type' => 'UNIQUE',
+ 'errmsg'=> 'source_error_unique'),
+ 2 => array ( 'type' => 'REGEX',
+ 'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
+ 'errmsg'=> 'source_error_regex'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'destination' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('alias' => 'Alias','forward'=>'Forward')
+ ),
+ 'active' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_aliasdomain.lng b/interface/web/mail/lib/lang/en_mail_aliasdomain.lng
new file mode 100644
index 0000000000000000000000000000000000000000..241eb64ce5e77bea645b35b2876794fbe78671f2
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_mail_aliasdomain.lng
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_aliasdomain_list.lng b/interface/web/mail/lib/lang/en_mail_aliasdomain_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..8ebfa7decb87a9fdfd8443c35ad8f1e8d5e52882
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_mail_aliasdomain_list.lng
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php
index 54d0e05f15a8e22df2435bfd708d91bd358ad8ff..82e7a39b97c9c61426019164b7ac0eeb44465b99 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -14,6 +14,10 @@ $items[] = array( 'title' => 'Domain',
'target' => 'content',
'link' => 'mail/mail_domain_list.php');
+$items[] = array( 'title' => 'Domain Alias',
+ 'target' => 'content',
+ 'link' => 'mail/mail_aliasdomain_list.php');
+
$items[] = array( 'title' => 'Email Mailbox',
'target' => 'content',
'link' => 'mail/mail_user_list.php');
diff --git a/interface/web/mail/list/mail_aliasdomain.list.php b/interface/web/mail/list/mail_aliasdomain.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..690b6f3da25cbdaa9d47f0cfc480e589c57f3b5c
--- /dev/null
+++ b/interface/web/mail/list/mail_aliasdomain.list.php
@@ -0,0 +1,79 @@
+ "active",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "",
+ 'value' => array('y' => "Yes
", 'n' => "No
"));
+
+
+$liste["item"][] = array( 'field' => "source",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+$liste["item"][] = array( 'field' => "destination",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_aliasdomain_del.php b/interface/web/mail/mail_aliasdomain_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..fba0aea366b0e289f24b01ef2a2aedba896dcaea
--- /dev/null
+++ b/interface/web/mail/mail_aliasdomain_del.php
@@ -0,0 +1,51 @@
+auth->check_module_permissions('mail');
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_aliasdomain_edit.php b/interface/web/mail/mail_aliasdomain_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..e993c4db894e9e0369299fa181e41929ad7e0a31
--- /dev/null
+++ b/interface/web/mail/mail_aliasdomain_edit.php
@@ -0,0 +1,141 @@
+auth->check_module_permissions('mail');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowNew() {
+ global $app, $conf;
+
+ // we will check only users, not admins
+ if($_SESSION["s"]["user"]["typ"] == 'user') {
+ if(!$app->tform->checkClientLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+ $app->error($app->tform->wordbook["limit_mailaliasdomain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailaliasdomain_txt"]);
+ }
+ }
+
+ parent::onShowNew();
+ }
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $source_domain = substr($this->dataRecord["source"],1);
+ $destination_domain = substr($this->dataRecord["destination"],1);
+
+ // Getting Domains of the user
+ $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
+ $domains = $app->db->queryAllRecords($sql);
+
+ $source_select = '';
+ $destination_select = '';
+ if(is_array($domains)) {
+ foreach( $domains as $domain) {
+ $selected = ($domain["domain"] == @$source_domain)?'SELECTED':'';
+ $source_select .= "\r\n";
+ $selected = ($domain["domain"] == @$destination_domain)?'SELECTED':'';
+ $destination_select .= "\r\n";
+ }
+ }
+ $app->tpl->setVar("source_domain",$source_select);
+ $app->tpl->setVar("destination_domain",$destination_select);
+
+ parent::onShowEnd();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check if source Domain belongs to user
+ $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["source"])."' AND ".$app->tform->getAuthSQL('r'));
+ if($domain["domain"] != $_POST["source"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // Check if the destination domain belongs to the user
+ $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["destination"])."' AND ".$app->tform->getAuthSQL('r'));
+ if($domain["domain"] != $_POST["destination"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // Check the client limits, if user is not the admin
+ if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
+ if(!$app->tform->checkClientLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+ $app->error($app->tform->wordbook["limit_mailaliasdomain_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_mailaliasdomain_txt"]);
+ }
+ } // end if user is not admin
+
+ if($this->dataRecord["source"] == $this->dataRecord["destination"]) $app->tform->errorMessage .= $app->tform->wordbook["source_destination_identical_txt"];
+
+ // compose the source and destination field
+ $this->dataRecord["source"] = "@".$app->db->quote($this->dataRecord["source"]);
+ $this->dataRecord["destination"] = "@".$app->db->quote($this->dataRecord["destination"]);
+ // Set the server id of the mailbox = server ID of mail domain.
+ $this->dataRecord["server_id"] = $domain["server_id"];
+
+ parent::onSubmit();
+ }
+
+ function onAfterInsert() {
+ global $app;
+
+ $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($_POST["destination"])."' AND ".$app->tform->getAuthSQL('r'));
+ $app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
+
+ }
+
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_aliasdomain_list.php b/interface/web/mail/mail_aliasdomain_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..8998afad0c14d60108bac8f40ca2afc16c21dda3
--- /dev/null
+++ b/interface/web/mail/mail_aliasdomain_list.php
@@ -0,0 +1,26 @@
+auth->check_module_permissions('mail');
+
+$app->uses('listform_actions');
+
+// Limit the results to alias domains
+$app->listform_actions->SQLExtWhere = "type = 'aliasdomain'";
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_aliasdomain_edit.htm b/interface/web/mail/templates/mail_aliasdomain_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..4f6a6b053fe3d08d2d9c793fcbe1258b6094983b
--- /dev/null
+++ b/interface/web/mail/templates/mail_aliasdomain_edit.htm
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/interface/web/mail/templates/mail_aliasdomain_list.htm b/interface/web/mail/templates/mail_aliasdomain_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..2bf29dbb10943161d0ec44a34915cea0d551c6b1
--- /dev/null
+++ b/interface/web/mail/templates/mail_aliasdomain_list.htm
@@ -0,0 +1,57 @@
+
+
+
+