From 92bc670e3f96622013d0255468fd37be405ee9d1 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 6 Sep 2007 14:42:16 +0000
Subject: [PATCH] - Added a mailserver configuration form. - Fixed several
 bugs.

---
 interface/lib/classes/db_mysql.inc.php        |   6 +-
 interface/lib/classes/ini_parser.inc.php      |  19 +-
 .../lib/classes/listform_actions.inc.php      |   2 +-
 interface/lib/classes/tform_actions.inc.php   |  39 +++-
 interface/web/admin/form/groups.tform.php     |   1 +
 interface/web/admin/form/users.tform.php      |   1 +
 .../web/mail/form/spamfilter_config.tform.php | 180 ++++++++++++++++++
 .../mail/lib/lang/en_mail_spamfilter_list.lng |  25 +--
 .../mail/lib/lang/en_spamfilter_config.lng    |  16 ++
 .../lib/lang/en_spamfilter_config_list.lng    |  11 ++
 interface/web/mail/lib/module.conf.php        |   4 +
 .../web/mail/list/mail_spamfilter.list.php    |   8 +-
 .../web/mail/list/spamfilter_config.list.php  |  60 ++++++
 interface/web/mail/spamfilter_config_del.php  |  54 ++++++
 interface/web/mail/spamfilter_config_edit.php |  99 ++++++++++
 interface/web/mail/spamfilter_config_list.php |  27 +++
 .../mail/templates/spamfilter_config_list.htm |  21 ++
 .../templates/spamfilter_config_mail_edit.htm |  64 +++++++
 18 files changed, 603 insertions(+), 34 deletions(-)
 create mode 100644 interface/web/mail/form/spamfilter_config.tform.php
 create mode 100644 interface/web/mail/lib/lang/en_spamfilter_config.lng
 create mode 100644 interface/web/mail/lib/lang/en_spamfilter_config_list.lng
 create mode 100644 interface/web/mail/list/spamfilter_config.list.php
 create mode 100644 interface/web/mail/spamfilter_config_del.php
 create mode 100644 interface/web/mail/spamfilter_config_edit.php
 create mode 100644 interface/web/mail/spamfilter_config_list.php
 create mode 100644 interface/web/mail/templates/spamfilter_config_list.htm
 create mode 100644 interface/web/mail/templates/spamfilter_config_mail_edit.htm

diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index ccfaa63bd5..2a2d640cd1 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -341,10 +341,10 @@ class db
 		if($database_name == ''){
             $database_name = $this->dbName;
         }
-        $result = mysql_list_tables($database_name);
+        $result = @mysql_list_tables($database_name);
         $tb_names = array();
-        for ($i = 0; $i < mysql_num_rows($result); $i++) {
-            $tb_names[$i] = mysql_tablename($result, $i);
+        for ($i = 0; $i < @mysql_num_rows($result); $i++) {
+            $tb_names[$i] = @mysql_tablename($result, $i);
         }
         return $tb_names;       
     }
diff --git a/interface/lib/classes/ini_parser.inc.php b/interface/lib/classes/ini_parser.inc.php
index 4cb2e4f609..67e6542bf3 100644
--- a/interface/lib/classes/ini_parser.inc.php
+++ b/interface/lib/classes/ini_parser.inc.php
@@ -39,7 +39,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 class ini_parser{
 
 	private $config;
-
+	
+	//* Converts a ini string to array
 	public function parse_ini_string($ini) {
 		$ini = str_replace("\r\n", "\n", $ini);
 		$lines = explode("\n", $ini);
@@ -56,19 +57,27 @@ class ini_parser{
 		}
 		return $this->config;
 	}
-
-	public function get_ini_string($file) {
+	
+	
+	//* Converts a config array to a string
+	public function get_ini_string($config_array = '') {
+		if($config_array == '') $config_array = $this->config;
 		$content = '';
-		foreach($this->config as $section => $data) {
+		foreach($config_array as $section => $data) {
 			$content .= "[$section]\n";
 			foreach($data as $item => $value) {
-				if($value != ''){
+				if($item != ''){
                     $content .= "$item=$value\n";
                 }
 			}
+			$content .= "\n";
 		}
 		return $content;
 	}
+	
+	
+	
+	
 }
 
 ?>
\ No newline at end of file
diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index e49943db29..c67c7fac3a 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -97,7 +97,7 @@ class listform_actions {
 		foreach($app->listform->listDef['item'] as $field) {
 			$key = $field['field'];
 			if(isset($field['formtype']) && $field['formtype'] == 'SELECT') {
-				$rec[$key] = $field['value'][$rec[$key]];
+				$rec[$key] = @$field['value'][$rec[$key]];
 			}
 		}
 		
diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index 0ef8ec0b43..7fb553fb62 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -98,7 +98,7 @@ class tform_actions {
                 global $app, $conf;
 				
 				$this->onBeforeUpdate();
-
+				
                 $ext_where = '';
                 $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
                 if($app->tform->errorMessage == '') {
@@ -106,11 +106,9 @@ class tform_actions {
 						if($app->tform->formDef['db_history'] == 'yes') {
 							$old_data_record = $app->tform->getDataRecord($this->id);
 						}
-
-                        if(!empty($sql)) {
-                            $app->db->query($sql);
-                            if($app->db->errorMessage != '') die($app->db->errorMessage);
-                        }
+						
+						// Save record in database
+						$this->onUpdateSave($sql);
 						
 						// loading plugins
 						$next_tab = $app->tform->getCurrentTab();
@@ -160,6 +158,19 @@ class tform_actions {
                         $this->onError();
                 }
         }
+		
+		/*
+		 Save record in database
+		*/
+		
+		function onUpdateSave($sql) {
+			global $app;
+			if(!empty($sql)) {
+				$app->db->query($sql);
+				if($app->db->errorMessage != '') die($app->db->errorMessage);
+			}
+		}
+		
 
         /**
         * Function called on data insert
@@ -173,9 +184,8 @@ class tform_actions {
                 $ext_where = '';
                 $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();
+						
+						$this->id = $this->onInsertSave($sql);
 						
 						// loading plugins
 						$next_tab = $app->tform->getCurrentTab();
@@ -221,6 +231,17 @@ class tform_actions {
                         $this->onError();
                 }
         }
+		
+		/*
+		 Save record in database
+		*/
+		
+		function onInsertSave($sql) {
+			global $app, $conf;
+			$app->db->query($sql);
+            if($app->db->errorMessage != '') die($app->db->errorMessage);
+            return $app->db->insertID();
+		}
 
         function onBeforeUpdate() {
             global $app, $conf;
diff --git a/interface/web/admin/form/groups.tform.php b/interface/web/admin/form/groups.tform.php
index 11cb1c9827..8b70fe4483 100644
--- a/interface/web/admin/form/groups.tform.php
+++ b/interface/web/admin/form/groups.tform.php
@@ -65,6 +65,7 @@ $form["name"] 			= "groups";
 $form["action"]			= "groups_edit.php";
 $form["db_table"]		= "sys_group";
 $form["db_table_idx"]	= "groupid";
+$form["db_history"]		= "no";
 $form["tab_default"]	= "groups";
 $form["list_default"]	= "groups_list.php";
 $form["auth"]			= 'no';
diff --git a/interface/web/admin/form/users.tform.php b/interface/web/admin/form/users.tform.php
index 576c551a7d..244892ae0c 100644
--- a/interface/web/admin/form/users.tform.php
+++ b/interface/web/admin/form/users.tform.php
@@ -66,6 +66,7 @@ $form['name'] 			= 'users';
 $form['action']			= 'users_edit.php';
 $form['db_table']		= 'sys_user';
 $form['db_table_idx']	= 'userid';
+$form["db_history"]		= "no";
 $form['tab_default']	= 'users';
 $form['list_default']	= 'users_list.php';
 $form['auth']			= 'yes';
diff --git a/interface/web/mail/form/spamfilter_config.tform.php b/interface/web/mail/form/spamfilter_config.tform.php
new file mode 100644
index 0000000000..0dece2192d
--- /dev/null
+++ b/interface/web/mail/form/spamfilter_config.tform.php
@@ -0,0 +1,180 @@
+<?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"] 			= "Spamfilter Config";
+$form["description"] 	= "";
+$form["name"] 			= "spamfilter_config";
+$form["action"]			= "spamfilter_config_edit.php";
+$form["db_table"]		= "server";
+$form["db_table_idx"]	= "server_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "mail";
+$form["list_default"]	= "spamfilter_config_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
+
+$form["tabs"]['mail'] = array (
+	'title' 	=> "Mailserver",
+	'width' 	=> 100,
+	'template' 	=> "templates/spamfilter_config_mail_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'module' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'value'		=> array('postfix_mysql' => 'postfix_mysql')
+		),
+		'maildir_path' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '/home/vmail/[domain]/[localpart]/',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'maildir_path_error_empty'),
+									),
+			'value'		=> '',
+			'width'		=> '40',
+			'maxlength'	=> '255'
+		),
+		'homedir_path' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '/home/vmail/',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'homedir_path_error_empty'),
+									),
+			'value'		=> '',
+			'width'		=> '40',
+			'maxlength'	=> '255'
+		),
+		'mailuser_uid' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'default'	=> '5000',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'mailuser_uid_error_empty'),
+									),
+			'value'		=> '',
+			'width'		=> '10',
+			'maxlength'	=> '255'
+		),
+		'mailuser_gid' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'default'	=> '5000',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'mailuser_gid_error_empty'),
+									),
+			'value'		=> '',
+			'width'		=> '10',
+			'maxlength'	=> '255'
+		),
+		'mailuser_name' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> 'vmail',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'mailuser_name_error_empty'),
+									),
+			'value'		=> '',
+			'width'		=> '10',
+			'maxlength'	=> '255'
+		),
+		'mailuser_group' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> 'vmail',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'mailuser_group_error_empty'),
+									),
+			'value'		=> '',
+			'width'		=> '10',
+			'maxlength'	=> '255'
+		),
+		'relayhost' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '40',
+			'maxlength'	=> '255'
+		),
+		'relayhost_user' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '40',
+			'maxlength'	=> '255'
+		),
+		'relayhost_password' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '40',
+			'maxlength'	=> '255'
+		),
+		'mailbox_size_limit' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'default'	=> '0',
+			'value'		=> '',
+			'width'		=> '10',
+			'maxlength'	=> '15'
+		),
+		'message_size_limit' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'TEXT',
+			'default'	=> '0',
+			'value'		=> '',
+			'width'		=> '10',
+			'maxlength'	=> '15'
+		),
+	##################################
+	# ENDE Datatable fields
+	##################################
+	)
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_spamfilter_list.lng b/interface/web/mail/lib/lang/en_mail_spamfilter_list.lng
index 69aafffec2..6921b13b45 100644
--- a/interface/web/mail/lib/lang/en_mail_spamfilter_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_spamfilter_list.lng
@@ -1,13 +1,14 @@
-<?php
-$wb["list_head_txt"] = 'Spamfilter';
-$wb["active_txt"] = 'Active';
-$wb["server_id_txt"] = 'Server';
-$wb["email_txt"] = 'Email';
-$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';
-$wb["add_new_record_txt"] = 'Add new Spamfilter record';
+<?php
+$wb["list_head_txt"] = 'Spamfilter';
+$wb["active_txt"] = 'Active';
+$wb["server_id_txt"] = 'Server';
+$wb["server_name_txt"] = 'server_name';
+$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';
+$wb["email_txt"] = 'Email';
+$wb["add_new_record_txt"] = 'Add new Spamfilter record';
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_spamfilter_config.lng b/interface/web/mail/lib/lang/en_spamfilter_config.lng
new file mode 100644
index 0000000000..0303c4d1d5
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_spamfilter_config.lng
@@ -0,0 +1,16 @@
+<?php
+$wb["module_txt"] = 'Server Module';
+$wb["maildir_path_txt"] = 'Maildir Path';
+$wb["homedir_path_txt"] = 'Homedir Path';
+$wb["mailuser_uid_txt"] = 'Mailuser UID';
+$wb["mailuser_gid_txt"] = 'Mailuser GID';
+$wb["mailuser_name_txt"] = 'Mailuser Name';
+$wb["mailuser_group_txt"] = 'Mailuser Group';
+$wb["relayhost_txt"] = 'Relayhost';
+$wb["relayhost_user_txt"] = 'Relayhost User';
+$wb["relayhost_password_txt"] = 'Relayhost Password';
+$wb["mailbox_size_limit_txt"] = 'Mailbox Size Limit';
+$wb["message_size_limit_txt"] = 'Message Size Limit';
+$wb["btn_save_txt"] = 'Save';
+$wb["btn_cancel_txt"] = 'Cancel';
+?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_spamfilter_config_list.lng b/interface/web/mail/lib/lang/en_spamfilter_config_list.lng
new file mode 100644
index 0000000000..14ae71e10c
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_spamfilter_config_list.lng
@@ -0,0 +1,11 @@
+<?php
+$wb["list_head_txt"] = 'Server Configuration';
+$wb["server_name_txt"] = 'Server';
+$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';
+$wb["server_id_txt"] = 'server_id';
+?>
\ 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 efd5036efa..6e57cbd7e5 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -58,6 +58,10 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 	$items[] = array( 	'title' 	=> 'Policy',
 				  		'target' 	=> 'content',
 				  		'link'	    => 'mail/spamfilter_policy_list.php');
+						
+	$items[] = array( 	'title' 	=> 'Server Settings',
+				  		'target' 	=> 'content',
+				  		'link'	    => 'mail/spamfilter_config_list.php');
 }
 
 $module['nav'][] = array(	'title'	=> 'Spamfilter',
diff --git a/interface/web/mail/list/mail_spamfilter.list.php b/interface/web/mail/list/mail_spamfilter.list.php
index 3b0c4bc01f..3700094d9f 100644
--- a/interface/web/mail/list/mail_spamfilter.list.php
+++ b/interface/web/mail/list/mail_spamfilter.list.php
@@ -16,10 +16,10 @@
 $liste["name"] 				= "mail_spamfilter";
 
 // Database table
-$liste["table"] 			= "mail_spamfilter";
+$liste["table"] 			= "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "spamfilter_id";
+$liste["table_idx"]			= "server_id";
 
 // Search Field Prefix
 $liste["search_prefix"] 	= "search_";
@@ -54,7 +54,7 @@ $liste["item"][] = array(	'field'		=> "active",
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('y' => "Yes",'n' => "No"));
+							'value'		=> array('1' => "Yes",'0' => "No"));
 
 
 $liste["item"][] = array(	'field'		=> "server_id",
@@ -71,7 +71,7 @@ $liste["item"][] = array(	'field'		=> "server_id",
 							'width'		=> "",
 							'value'		=> "");
 
-$liste["item"][] = array(	'field'		=> "email",
+$liste["item"][] = array(	'field'		=> "server_name",
 							'datatype'	=> "VARCHAR",
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
diff --git a/interface/web/mail/list/spamfilter_config.list.php b/interface/web/mail/list/spamfilter_config.list.php
new file mode 100644
index 0000000000..28c36cd6b7
--- /dev/null
+++ b/interface/web/mail/list/spamfilter_config.list.php
@@ -0,0 +1,60 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "spamfilter_config";
+
+// 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"]				= "spamfilter_config_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "spamfilter_config_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "spamfilter_config_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "server_name",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/spamfilter_config_del.php b/interface/web/mail/spamfilter_config_del.php
new file mode 100644
index 0000000000..8ca69b1d3b
--- /dev/null
+++ b/interface/web/mail/spamfilter_config_del.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2007, 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/spamfilter_config.list.php";
+$tform_def_file = "form/spamfilter_config.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"],'mail')) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/spamfilter_config_edit.php b/interface/web/mail/spamfilter_config_edit.php
new file mode 100644
index 0000000000..480e24988f
--- /dev/null
+++ b/interface/web/mail/spamfilter_config_edit.php
@@ -0,0 +1,99 @@
+<?php
+/*
+Copyright (c) 2007, 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/spamfilter_config.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"],'mail')) {
+	header("Location: ../index.php");
+	exit;
+}
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+	function onShowEdit() {
+		global $app, $conf;
+		
+		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
+		
+		if($app->tform->errorMessage == '') {
+			$app->uses('ini_parser,getconf');
+		
+			$section = $this->active_tab;
+			$server_id = $this->id;
+		
+			$this->dataRecord = $app->getconf->get_server_config($server_id,$section);
+		}
+		
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
+		
+		$record['id'] = $this->id;
+		$app->tpl->setVar($record);
+	}
+	
+	function onUpdateSave($sql) {
+		global $app;
+		
+		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
+		$app->uses('ini_parser,getconf');
+		
+		$section = $app->tform->getCurrentTab();
+		$server_id = $this->id;
+		
+		$server_config_array = $app->getconf->get_server_config($server_id);
+		$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
+		$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
+		
+		$sql = "UPDATE server SET config = '".$app->db->quote($server_config_str)."' WHERE server_id = ".$server_id;
+		$app->db->query($sql);
+	}
+	
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/spamfilter_config_list.php b/interface/web/mail/spamfilter_config_list.php
new file mode 100644
index 0000000000..4457171b65
--- /dev/null
+++ b/interface/web/mail/spamfilter_config_list.php
@@ -0,0 +1,27 @@
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/spamfilter_config.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses('listform_actions');
+//$app->listform_actions->SQLExtWhere = "wb = 'W'";
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/templates/spamfilter_config_list.htm b/interface/web/mail/templates/spamfilter_config_list.htm
new file mode 100644
index 0000000000..08b5630bba
--- /dev/null
+++ b/interface/web/mail/templates/spamfilter_config_list.htm
@@ -0,0 +1,21 @@
+<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="listTable">
+  <tr>
+    <td class="tblHead"><tmpl_var name="server_name_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" align="right"><input name="Filter" type="button" id="Filter" value="{tmpl_var name="filter_txt"}" class="button" onClick="submitForm('pageForm','mail/spamfilter_config_list.php');"><div class="buttonEnding"></div></td>
+  </tr>
+  <tmpl_loop name="records">
+  <tr bgcolor="{tmpl_var name="bgcolor"}">
+    <td class="frmText11"><a href="#" onClick="loadContent('mail/spamfilter_config_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="server_name"}</a></td>
+    <td class="frmText11" align="right">[<a href="javascript: del_record('mail/spamfilter_config_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="2" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
+  </tr>
+</table>
\ No newline at end of file
diff --git a/interface/web/mail/templates/spamfilter_config_mail_edit.htm b/interface/web/mail/templates/spamfilter_config_mail_edit.htm
new file mode 100644
index 0000000000..9f8ac0ec88
--- /dev/null
+++ b/interface/web/mail/templates/spamfilter_config_mail_edit.htm
@@ -0,0 +1,64 @@
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+  <tr>
+    <td class="frmText11">{tmpl_var name='module_txt'}:</td>
+    <td class="frmText11">
+		<select name="module" class="text">
+			{tmpl_var name='module'}
+		</select>
+	</td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='maildir_path_txt'}:</td>
+    <td class="frmText11"><input name="maildir_path" type="text" class="text" value="{tmpl_var name='maildir_path'}" size="40" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='homedir_path_txt'}:</td>
+    <td class="frmText11"><input name="homedir_path" type="text" class="text" value="{tmpl_var name='homedir_path'}" size="40" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='mailuser_uid_txt'}:</td>
+    <td class="frmText11"><input name="mailuser_uid" type="text" class="text" value="{tmpl_var name='mailuser_uid'}" size="10" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='mailuser_gid_txt'}:</td>
+    <td class="frmText11"><input name="mailuser_gid" type="text" class="text" value="{tmpl_var name='mailuser_gid'}" size="10" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='mailuser_name_txt'}:</td>
+    <td class="frmText11"><input name="mailuser_name" type="text" class="text" value="{tmpl_var name='mailuser_name'}" size="10" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='mailuser_group_txt'}:</td>
+    <td class="frmText11"><input name="mailuser_group" type="text" class="text" value="{tmpl_var name='mailuser_group'}" size="10" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='relayhost_txt'}:</td>
+    <td class="frmText11"><input name="relayhost" type="text" class="text" value="{tmpl_var name='relayhost'}" size="40" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='relayhost_user_txt'}:</td>
+    <td class="frmText11"><input name="relayhost_user" type="text" class="text" value="{tmpl_var name='relayhost_user'}" size="40" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='relayhost_password_txt'}:</td>
+    <td class="frmText11"><input name="relayhost_password" type="text" class="text" value="{tmpl_var name='relayhost_password'}" size="40" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='mailbox_size_limit_txt'}:</td>
+    <td class="frmText11"><input name="mailbox_size_limit" type="text" class="text" value="{tmpl_var name='mailbox_size_limit'}" size="10" maxlength="15"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='message_size_limit_txt'}:</td>
+    <td class="frmText11"><input name="message_size_limit" type="text" class="text" value="{tmpl_var name='message_size_limit'}" size="10" maxlength="15"></td>
+  </tr>  <tr>
+    <td class="frmText11">&nbsp;</td>
+    <td class="frmText11">&nbsp;</td>
+  </tr>
+  <tr>
+    <td>&nbsp;</td>
+    <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mail/spamfilter_config_edit.php');"><div class="buttonEnding"></div>&nbsp;
+      <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mail/spamfilter_config_list.php');"><div class="buttonEnding"></div>
+    </td>
+  </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
-- 
GitLab