From 83b0d0f038461786c6e62b381c6e0c05997d7ff6 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 9 Nov 2005 22:22:49 +0000
Subject: [PATCH] Added mail domains

---
 .../lib/classes/listform_actions.inc.php      |   5 +
 interface/lib/classes/tform.inc.php           |   9 ++
 interface/lib/classes/tform_actions.inc.php   |   2 +
 interface/sql/auth_sql_snippet.sql            |   5 +
 interface/sql/ispconfig3db.sql                |  14 +-
 .../web/admin/lib/lang/en_server_list.lng     |  17 +++
 interface/web/admin/lib/module.conf.php       |   2 +-
 interface/web/admin/list/server.list.php      | 123 ++++++++++++++++++
 interface/web/admin/server_del.php            |  54 ++++++++
 interface/web/admin/server_list.php           |  54 ++++++++
 interface/web/admin/templates/server_list.htm |  44 +++++++
 .../web/sites/form/mail_domain.tform.php      | 104 +++++++++++++++
 .../web/sites/lib/lang/en_mail_domain.lng     |   8 ++
 .../sites/lib/lang/en_mail_domain_list.lng    |  11 ++
 interface/web/sites/lib/module.conf.php       |  62 ++++++++-
 interface/web/sites/list/mail_domain.list.php |  69 ++++++++++
 interface/web/sites/mail_domain_del.php       |  54 ++++++++
 interface/web/sites/mail_domain_edit.php      |  56 ++++++++
 interface/web/sites/mail_domain_list.php      |  25 ++++
 .../web/sites/templates/mail_domain_edit.htm  |  30 +++++
 .../web/sites/templates/mail_domain_list.htm  |  26 ++++
 21 files changed, 769 insertions(+), 5 deletions(-)
 create mode 100644 interface/sql/auth_sql_snippet.sql
 create mode 100644 interface/web/admin/lib/lang/en_server_list.lng
 create mode 100644 interface/web/admin/list/server.list.php
 create mode 100644 interface/web/admin/server_del.php
 create mode 100644 interface/web/admin/server_list.php
 create mode 100644 interface/web/admin/templates/server_list.htm
 create mode 100644 interface/web/sites/form/mail_domain.tform.php
 create mode 100644 interface/web/sites/lib/lang/en_mail_domain.lng
 create mode 100644 interface/web/sites/lib/lang/en_mail_domain_list.lng
 create mode 100644 interface/web/sites/list/mail_domain.list.php
 create mode 100644 interface/web/sites/mail_domain_del.php
 create mode 100644 interface/web/sites/mail_domain_edit.php
 create mode 100644 interface/web/sites/mail_domain_list.php
 create mode 100644 interface/web/sites/templates/mail_domain_edit.htm
 create mode 100644 interface/web/sites/templates/mail_domain_list.htm

diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index 363401aa7..4b1369264 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -50,6 +50,11 @@ class listform_actions {
 		// Load list definition
 		$app->listform->loadListDef($list_def_file);
 		
+		if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) {
+			$app->uses('listform_tpl_generator');
+			$app->listform_tpl_generator->buildHTML($app->listform->listDef);
+		}
+		
 		$app->tpl->newTemplate("form.tpl.htm");
 		$app->tpl->setInclude('content_tpl','templates/'.$app->listform->listDef["name"].'_list.htm');
 
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 542dc4a4f..2c54f37ff 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -218,6 +218,7 @@ class tform {
 			
 			// Getting the records
 			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
 			if(is_array($tmp_records)) {
 				$key_field = $field["datasource"]["keyfield"];
 				$value_field = $field["datasource"]["valuefield"];
@@ -240,6 +241,8 @@ class tform {
 			}
 		}
 		
+		return $values;
+		
 	}
 	
 	
@@ -354,6 +357,12 @@ class tform {
 		} else {
 			// Action: NEW
 			foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+				
+				// If Datasource is set, get the data from there
+				if(is_array($field['datasource'])) {
+					$field["value"] = $this->getDatasourceData($field, $record);
+				}
+				
 				switch ($field['formtype']) {
 				case 'SELECT':
 					if(is_array($field['value'])) {
diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index 56deb43c4..a13a8fe6f 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -105,6 +105,7 @@ class tform_actions {
 		$sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
 		if($app->tform->errorMessage == '') {
 			$app->db->query($sql);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
 			
 			// Call plugin
 			foreach($this->plugins as $plugin) {
@@ -133,6 +134,7 @@ class tform_actions {
 		$sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'INSERT',$this->id,$ext_where);
 		if($app->tform->errorMessage == '') {
 			$app->db->query($sql);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
 			$this->id = $app->db->insertID();
 			
 			// Call plugin
diff --git a/interface/sql/auth_sql_snippet.sql b/interface/sql/auth_sql_snippet.sql
new file mode 100644
index 000000000..2a1fb8cc1
--- /dev/null
+++ b/interface/sql/auth_sql_snippet.sql
@@ -0,0 +1,5 @@
+ALTER TABLE `mail_domain` ADD `sys_userid` INT NOT NULL AFTER `domain_id` ,
+ADD `sys_groupid` INT NOT NULL AFTER `sys_userid` ,
+ADD `sys_perm_user` VARCHAR( 5 ) NOT NULL AFTER `sys_groupid` ,
+ADD `sys_perm_group` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_user` ,
+ADD `sys_perm_other` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_group` ;
\ No newline at end of file
diff --git a/interface/sql/ispconfig3db.sql b/interface/sql/ispconfig3db.sql
index 887ce2ea4..c37bd4338 100644
--- a/interface/sql/ispconfig3db.sql
+++ b/interface/sql/ispconfig3db.sql
@@ -3,7 +3,7 @@
 # http://www.phpmyadmin.net/ (download page)
 #
 # Host: localhost
-# Erstellungszeit: 01. November 2005 um 23:57
+# Erstellungszeit: 09. November 2005 um 23:22
 # Server Version: 4.0.23
 # PHP-Version: 5.0.3
 # Datenbank: `ispconfig3`
@@ -35,10 +35,17 @@ CREATE TABLE mail_blacklist (
 DROP TABLE IF EXISTS mail_domain;
 CREATE TABLE mail_domain (
   domain_id int(11) NOT NULL auto_increment,
+  sys_userid int(11) NOT NULL default '0',
+  sys_groupid int(11) NOT NULL default '0',
+  sys_perm_user varchar(5) NOT NULL default '',
+  sys_perm_group varchar(5) NOT NULL default '',
+  sys_perm_other varchar(5) NOT NULL default '',
   server_id int(11) NOT NULL default '0',
   domain varchar(255) NOT NULL default '',
-  type enum('local','relay','manual_relay') NOT NULL default 'local',
+  type enum('local','relay','manual_relay','alias') NOT NULL default 'local',
   relay_host varchar(255) NOT NULL default '',
+  destination varchar(255) NOT NULL default '',
+  active tinyint(4) NOT NULL default '1',
   PRIMARY KEY  (domain_id),
   KEY server_id (server_id,domain,type)
 ) TYPE=MyISAM;
@@ -47,6 +54,7 @@ CREATE TABLE mail_domain (
 # Daten für Tabelle `mail_domain`
 #
 
+INSERT INTO mail_domain VALUES (1, 1, 0, 'riud', 'riud', '', 1, 'test.de', 'local', '', '', 1);
 # --------------------------------------------------------
 
 #
@@ -399,5 +407,5 @@ CREATE TABLE sys_user (
 # Daten für Tabelle `sys_user`
 #
 
-INSERT INTO sys_user VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin,clients,designer,resellers,sites', 'admin', 'default', 'admin', 1, '', 'Administrator', '', '', '', '', '', '', '', '', '', 'en', '1,2', 0);
+INSERT INTO sys_user VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin,designer,sites', 'admin', 'default', 'admin', 1, '', 'Administrator', '', '', '', '', '', '', '', '', '', 'en', '1,2', 0);
 
diff --git a/interface/web/admin/lib/lang/en_server_list.lng b/interface/web/admin/lib/lang/en_server_list.lng
new file mode 100644
index 000000000..889d8025f
--- /dev/null
+++ b/interface/web/admin/lib/lang/en_server_list.lng
@@ -0,0 +1,17 @@
+<?php
+$wb["list_head_txt"] = 'Server';
+$wb["server_name_txt"] = 'Name';
+$wb["mail_server_txt"] = 'Mail';
+$wb["web_server_txt"] = 'Web';
+$wb["dns_server_txt"] = 'DNS';
+$wb["file_server_txt"] = 'File';
+$wb["mysql_server_txt"] = 'MySQL';
+$wb["postgresql_server_txt"] = 'PostgreSQL';
+$wb["firebird_server_txt"] = 'Firebird';
+$wb["page_txt"] = 'Page';
+$wb["page_of_txt"] = 'of';
+$wb["page_next_txt"] = 'Next';
+$wb["page_back_txt"] = 'Back';
+$wb["delete_txt"] = 'Delete';
+$wb["filter_txt"] = 'Filter';
+?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index d1261e489..f5c49fd8d 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -16,7 +16,7 @@ $items[] = array( 'title' 	=> "Edit user",
 				  'link'	=> 'admin/users_list.php');
 
 				  
-$module["nav"][] = array(	'title'	=> 'Users',
+$module["nav"][] = array(	'title'	=> 'CP Users',
 							'open' 	=> 1,
 							'items'	=> $items);
 
diff --git a/interface/web/admin/list/server.list.php b/interface/web/admin/list/server.list.php
new file mode 100644
index 000000000..b5cb00750
--- /dev/null
+++ b/interface/web/admin/list/server.list.php
@@ -0,0 +1,123 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "server";
+
+// Database table
+$liste["table"] 			= "server";
+
+// Index index field of the database table
+$liste["table_idx"]			= "server_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "server_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "server_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "server_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable authe
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "server_name",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "mail_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "web_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");  
+
+$liste["item"][] = array(	'field'		=> "dns_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "file_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "mysql_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+$liste["item"][] = array(	'field'		=> "postgresql_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+$liste["item"][] = array(	'field'		=> "firebird_server",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+?>
\ No newline at end of file
diff --git a/interface/web/admin/server_del.php b/interface/web/admin/server_del.php
new file mode 100644
index 000000000..b0ae30d45
--- /dev/null
+++ b/interface/web/admin/server_del.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005, 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.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/server.list.php";
+$tform_def_file = "form/server.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checke Berechtigungen für Modul
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/server_list.php b/interface/web/admin/server_list.php
new file mode 100644
index 000000000..bfae8779f
--- /dev/null
+++ b/interface/web/admin/server_list.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005, 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.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/server.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses('listform_actions');
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/templates/server_list.htm b/interface/web/admin/templates/server_list.htm
new file mode 100644
index 000000000..e730c00bb
--- /dev/null
+++ b/interface/web/admin/templates/server_list.htm
@@ -0,0 +1,44 @@
+<form name="myform" action="server_list.php" method="POST">
+<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
+<table width="100%" border="0" cellspacing="0" cellpadding="4">
+  <tr>
+    <td class="tblHead"><tmpl_var name="server_name_txt"></td>
+    <td class="tblHead"><tmpl_var name="mail_server_txt"></td>
+    <td class="tblHead"><tmpl_var name="web_server_txt"></td>
+    <td class="tblHead"><tmpl_var name="dns_server_txt"></td>
+    <td class="tblHead"><tmpl_var name="file_server_txt"></td>
+    <td class="tblHead"><tmpl_var name="mysql_server_txt"></td>
+    <td class="tblHead"><tmpl_var name="postgresql_server_txt"></td>
+    <td class="tblHead"><tmpl_var name="firebird_server_txt"></td>
+    <td class="tblHead">&nbsp;</td>
+  </tr>
+  <tr>
+    <td class="frmText11"><input type="text" name="search_server_name" value="{tmpl_var name='search_server_name'}" class="text" /></td>
+    <td class="frmText11"><input type="text" name="search_mail_server" value="{tmpl_var name='search_mail_server'}" class="text" size="2" /></td>
+    <td class="frmText11"><input type="text" name="search_web_server" value="{tmpl_var name='search_web_server'}" class="text" size="2" /></td>
+    <td class="frmText11"><input type="text" name="search_dns_server" value="{tmpl_var name='search_dns_server'}" class="text" size="2" /></td>
+    <td class="frmText11"><input type="text" name="search_file_server" value="{tmpl_var name='search_file_server'}" class="text" size="2" /></td>
+    <td class="frmText11"><input type="text" name="search_mysql_server" value="{tmpl_var name='search_mysql_server'}" class="text" size="2" /></td>
+    <td class="frmText11"><input type="text" name="search_postgresql_server" value="{tmpl_var name='search_postgresql_server'}" class="text" size="2" /></td>
+    <td class="frmText11"><input type="text" name="search_firebird_server" value="{tmpl_var name='search_firebird_server'}" class="text" size="2" /></td>
+    <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td>
+  </tr>
+  <tmpl_loop name="records">
+  <tr bgcolor="{tmpl_var name="bgcolor"}">
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_name"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="mail_server"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="web_server"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="dns_server"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="file_server"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="mysql_server"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="postgresql_server"}</a></td>
+    <td class="frmText11"><a href="server_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="firebird_server"}</a></td>
+    <td class="frmText11" align="right">[<a href="javascript: del_record('server_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
+  </tr>
+  </tmpl_loop>
+
+  <tr>
+  	<td colspan="9" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
+  </tr>
+</table>
+</form>
\ No newline at end of file
diff --git a/interface/web/sites/form/mail_domain.tform.php b/interface/web/sites/form/mail_domain.tform.php
new file mode 100644
index 000000000..cdf6b9461
--- /dev/null
+++ b/interface/web/sites/form/mail_domain.tform.php
@@ -0,0 +1,104 @@
+<?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).
+
+
+*/
+
+$form["title"] 			= "Mail Domain";
+$form["description"] 	= "";
+$form["name"] 			= "mail_domain";
+$form["action"]			= "mail_domain_edit.php";
+$form["db_table"]		= "mail_domain";
+$form["db_table_idx"]	= "domain_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "domain";
+$form["list_default"]	= "mail_domain_list.php";
+$form["auth"]			= '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
+
+$form["tabs"]['domain'] = array (
+	'title' 	=> "Domain",
+	'width' 	=> 100,
+	'template' 	=> "templates/mail_domain_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'server_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT server_id,server_name FROM server WHERE 1 ORDER BY server_name',
+										'keyfield'=> 'server_id',
+										'valuefield'=> 'server_name'
+									 ),
+			'value'		=> ''
+		),
+		'domain' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'domain_error_empty'),
+										1 => array (	'type'	=> 'UNIQUE',
+														'errmsg'=> 'domain_error_unique'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'type' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'value'		=> array('local' => 'local','relay'=>'relay','manual_relay'=>'manual Relay')
+		),
+		'active' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> '1',
+			'value'		=> '1'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/en_mail_domain.lng b/interface/web/sites/lib/lang/en_mail_domain.lng
new file mode 100644
index 000000000..9645078df
--- /dev/null
+++ b/interface/web/sites/lib/lang/en_mail_domain.lng
@@ -0,0 +1,8 @@
+<?php
+$wb["server_id_txt"] = 'Server';
+$wb["domain_txt"] = 'Domain';
+$wb["type_txt"] = 'Type';
+$wb["active_txt"] = 'Active';
+$wb["btn_save_txt"] = 'Save';
+$wb["btn_cancel_txt"] = 'Cancel';
+?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/lang/en_mail_domain_list.lng b/interface/web/sites/lib/lang/en_mail_domain_list.lng
new file mode 100644
index 000000000..efdf7fc71
--- /dev/null
+++ b/interface/web/sites/lib/lang/en_mail_domain_list.lng
@@ -0,0 +1,11 @@
+<?php
+$wb["list_head_txt"] = 'Email Domains';
+$wb["server_id_txt"] = 'Server';
+$wb["domain_txt"] = 'Domain';
+$wb["page_txt"] = 'Page';
+$wb["page_of_txt"] = 'of';
+$wb["page_next_txt"] = 'Next';
+$wb["page_back_txt"] = 'Back';
+$wb["delete_txt"] = 'Delete';
+$wb["filter_txt"] = 'Filter';
+?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php
index 9f2fb8dff..392881c4b 100644
--- a/interface/web/sites/lib/module.conf.php
+++ b/interface/web/sites/lib/module.conf.php
@@ -6,6 +6,66 @@ $module = array (
   'navframe_page' => '',
   'startpage' => 'sites/index.php',
   'tab_width' => '',
-  'nav' => NULL,
+  'nav' => 
+  array (
+    0 => 
+    array (
+      'title' => 'Email Accounts',
+      'open' => 1,
+      'items' => 
+      array (
+        0 => 
+        array (
+          'title' => 'Domain',
+          'target' => 'content',
+          'link' => 'sites/mail_domain_list.php',
+        ),
+        1 => 
+        array (
+          'title' => 'Domain Alias',
+          'target' => 'content',
+          'link' => '',
+        ),
+        2 => 
+        array (
+          'title' => 'Email Mailbox',
+          'target' => 'content',
+          'link' => '',
+        ),
+        3 => 
+        array (
+          'title' => 'Email Forward',
+          'target' => 'content',
+          'link' => '',
+        ),
+        4 => 
+        array (
+          'title' => 'Domain Catchall',
+          'target' => 'content',
+          'link' => '',
+        ),
+      ),
+    ),
+    1 => 
+    array (
+      'title' => 'Email Filter',
+      'open' => 1,
+      'items' => 
+      array (
+        0 => 
+        array (
+          'title' => 'Email Whitelist',
+          'target' => 'content',
+          'link' => '',
+        ),
+        1 => 
+        array (
+          'title' => 'Email Blacklist',
+          'target' => 'content',
+          'link' => '',
+        ),
+      ),
+    ),
+  ),
 )
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/list/mail_domain.list.php b/interface/web/sites/list/mail_domain.list.php
new file mode 100644
index 000000000..07c4681d8
--- /dev/null
+++ b/interface/web/sites/list/mail_domain.list.php
@@ -0,0 +1,69 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "mail_domain";
+
+// Database table
+$liste["table"] 			= "mail_domain";
+
+// Index index field of the database table
+$liste["table_idx"]			= "domain_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "mail_domain_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "mail_domain_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "mail_domain_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "server_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "domain",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_domain_del.php b/interface/web/sites/mail_domain_del.php
new file mode 100644
index 000000000..894c9c116
--- /dev/null
+++ b/interface/web/sites/mail_domain_del.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005, 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.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_domain.list.php";
+$tform_def_file = "form/mail_domain.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checke Berechtigungen für Modul
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_domain_edit.php b/interface/web/sites/mail_domain_edit.php
new file mode 100644
index 000000000..f1bf87f22
--- /dev/null
+++ b/interface/web/sites/mail_domain_edit.php
@@ -0,0 +1,56 @@
+<?php
+/*
+Copyright (c) 2005, 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.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/mail_domain.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+
+// let tform_actions handle the page
+$app->tform_actions->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_domain_list.php b/interface/web/sites/mail_domain_list.php
new file mode 100644
index 000000000..cc6d8f549
--- /dev/null
+++ b/interface/web/sites/mail_domain_list.php
@@ -0,0 +1,25 @@
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_domain.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses('listform_actions');
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/templates/mail_domain_edit.htm b/interface/web/sites/templates/mail_domain_edit.htm
new file mode 100644
index 000000000..1a7a3a9eb
--- /dev/null
+++ b/interface/web/sites/templates/mail_domain_edit.htm
@@ -0,0 +1,30 @@
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+  <tr>
+    <td width="126" class="frmText11">{tmpl_var name='server_id_txt'}:</td>
+    <td width="366" class="frmText11">
+		<select name="server_id" class="text">
+			{tmpl_var name='server_id'}
+		</select>
+	</td>
+  </tr>
+  <tr>
+    <td width="126" class="frmText11">{tmpl_var name='domain_txt'}:</td>
+    <td width="366" class="frmText11"><input name="domain" type="text" class="text" value="{tmpl_var name='domain'}" size="30" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">&nbsp;</td>
+    <td class="frmText11">{tmpl_var name='active'} &nbsp; {tmpl_var name='active_txt'}</td>
+  </tr>
+  <tr>
+    <td class="frmText11">&nbsp;</td>
+    <td class="frmText11">&nbsp;</td>
+  </tr>
+  <tr>
+    <td>&nbsp;</td>
+    <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}">
+      <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='mail_domain_list.php';">
+    </td>
+  </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
+<input type="hidden" name="type" value="local">
\ No newline at end of file
diff --git a/interface/web/sites/templates/mail_domain_list.htm b/interface/web/sites/templates/mail_domain_list.htm
new file mode 100644
index 000000000..e400ca393
--- /dev/null
+++ b/interface/web/sites/templates/mail_domain_list.htm
@@ -0,0 +1,26 @@
+<form name="myform" action="mail_domain_list.php" method="POST">
+<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
+<input type="button" value="Add new Domain" onClick="location.href='mail_domain_edit.php'" /><br /><br />
+<table width="100%" border="0" cellspacing="0" cellpadding="4">
+  <tr>
+    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
+    <td class="tblHead"><tmpl_var name="domain_txt"></td>
+    <td class="tblHead">&nbsp;</td>
+  </tr>
+  <tr>
+    <td class="frmText11"><input type="text" name="search_server_id" value="{tmpl_var name='search_server_id'}" class="text" size="5" /></td>
+    <td class="frmText11"><input type="text" name="search_domain" value="{tmpl_var name='search_domain'}" class="text" /></td>
+    <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td>
+  </tr>
+  <tmpl_loop name="records">
+  <tr bgcolor="{tmpl_var name="bgcolor"}">
+    <td class="frmText11"><a href="mail_domain_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
+    <td class="frmText11"><a href="mail_domain_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="domain"}</a></td>
+    <td class="frmText11" align="right">[<a href="javascript: del_record('mail_domain_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
+  </tr>
+  </tmpl_loop>
+  <tr>
+  	<td colspan="3" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
+  </tr>
+</table>
+</form>
\ No newline at end of file
-- 
GitLab