From 45f11e2be23676e9efc084b7c447993e58f5b670 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 07 Mar 2007 16:20:39 -0500
Subject: [PATCH] Update of the mail and dns module.

---
 interface/web/mail/lib/lang/en_mail_whitelist.lng           |    5 
 interface/web/mail/mail_domain_catchall_list.php            |   53 
 interface/web/mail/templates/mail_blacklist_edit.htm        |   23 
 interface/web/mail/form/mail_transport.tform.php            |  111 
 interface/web/mail/templates/mail_forward_list.htm          |   58 
 interface/web/mail/templates/mail_transport_edit.htm        |   40 
 interface/web/mail/mail_forward_edit.php                    |  196 
 interface/web/dns/list/rr.list.php                          |  260 +-
 interface/web/dns/rr_edit.php                               |  370 +-
 interface/web/mail/form/_old_mail_domain_catchall.tform.php |  107 
 interface/web/mail/lib/lang/en_mail_whitelist_list.lng      |    4 
 interface/web/mail/list/mail_blacklist.list.php             |   21 
 interface/web/dns/form/soa.tform.php                        |  514 ++--
 interface/web/mail/form/mail_alias.tform.php                |    6 
 interface/web/dns/soa_edit.php                              |  460 ++--
 interface/web/mail/list/mail_whitelist.list.php             |   21 
 interface/web/mail/lib/lang/en_mail_blacklist_list.lng      |    4 
 interface/web/mail/list/mail_forward.list.php               |  154 
 interface/web/mail/mail_transport_del.php                   |  106 
 interface/web/mail/form/mail_domain_catchall.tform.php      |   58 
 interface/web/mail/lib/lang/en_mail_transport.lng           |    9 
 interface/web/mail/templates/mail_whitelist_edit.htm        |   23 
 interface/web/mail/mail_blacklist_edit.php                  |   44 
 interface/web/mail/mail_transport_edit.php                  |  110 
 interface/web/mail/lib/lang/en_mail_transport_list.lng      |   15 
 interface/web/mail/list/mail_transport.list.php             |  104 
 interface/web/mail/form/mail_user.tform.php                 |   10 
 interface/web/mail/form/mail_forward.tform.php              |  214 
 interface/web/mail/list/mail_domain_catchall.list.php       |   19 
 interface/web/dns/form/rr.tform.php                         |  338 +-
 interface/web/mail/templates/mail_domain_catchall_edit.htm  |   57 
 interface/web/mail/form/mail_whitelist.tform.php            |   30 
 interface/web/mail/mail_transport_list.php                  |   57 
 interface/web/mail/lib/lang/en_mail_blacklist.lng           |    7 
 interface/web/mail/form/mail_domain.tform.php               |   12 
 interface/web/mail/list/mail_alias.list.php                 |    2 
 interface/web/mail/list/mail_spamfilter.list.php            |    2 
 interface/web/mail/form/mail_spamfilter.tform.php           |    6 
 interface/web/dns/list/soa.list.php                         |  354 +-
 interface/web/dns/rr_del.php                                |  276 +-
 interface/web/dns/soa_del.php                               |  242 +-
 interface/web/mail/lib/module.conf.php                      |   12 
 interface/web/mail/mail_whitelist_edit.php                  |   44 
 interface/web/mail/templates/mail_blacklist_list.htm        |   19 
 interface/web/mail/mail_blacklist_list.php                  |   51 
 interface/web/mail/list/mail_domain.list.php                |    2 
 interface/lib/classes/tform.inc.php                         | 1873 ++++++++--------
 interface/web/mail/templates/mail_domain_catchall_list.htm  |   11 
 interface/web/mail/form/mail_blacklist.tform.php            |   30 
 interface/web/mail/mail_whitelist_list.php                  |   51 
 interface/web/mail/templates/mail_whitelist_list.htm        |   19 
 interface/web/mail/mail_domain_catchall_edit.php            |  174 
 interface/web/mail/templates/mail_transport_list.htm        |   36 
 53 files changed, 3,618 insertions(+), 3,206 deletions(-)

diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 9b32e27..a7f821a 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -1,931 +1,944 @@
-<?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.
-*/
-
-/**
-* Formularbehandlung
-*
-* Funktionen zur Umwandlung von Formulardaten
-* sowie zum vorbereiten von HTML und SQL
-* Ausgaben
-*
-*        Tabellendefinition
-*
-*        Datentypen:
-*        - INTEGER (Wandelt Ausdr�cke in Int um)
-*        - DOUBLE
-*        - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
-*        - VARCHAR (kein weiterer Format Check)
-*        - DATE (Datumsformat, Timestamp Umwandlung)
-*
-*        Formtype:
-*        - TEXT (normales Textfeld)
-*        - PASSWORD (Feldinhalt wird nicht angezeigt)
-*        - SELECT (Gibt Werte als option Feld aus)
-*        - MULTIPLE (Select-Feld mit nehreren Werten)
-*
-*        VALUE:
-*        - Wert oder Array
-*
-*        SEPARATOR
-*        - Trennzeichen f�r multiple Felder
-*
-*        Hinweis:
-*        Das ID-Feld ist nicht bei den Table Values einzuf�gen.
-*
-* @package form
-* @author Till Brehm
-* @version 1.1
-*/
-
-class tform {
-
-        /**
-        * Definition der Tabelle (array)
-        * @var tableDef
-        */
-        var $tableDef;
-
-        /**
-        * Private
-        * @var action
-        */
-        var $action;
-
-        /**
-        * Tabellenname (String)
-        * @var table_name
-        */
-        var $table_name;
-
-        /**
-        * Debug Variable
-        * @var debug
-        */
-        var $debug = 0;
-
-        /**
-        * name des primary Field der Tabelle (string)
-        * @var table_index
-        */
-        var $table_index;
-
-        /**
-        * enth�lt die Fehlermeldung bei �berpr�fung
-        * der Variablen mit Regex
-        * @var errorMessage
-        */
-        var $errorMessage = '';
-
-        var $dateformat = "d.m.Y";
-    var $formDef;
-        var $wordbook;
-        var $module;
-        var $primary_id;
-
-        /**
-        * Laden der Tabellendefinition
-        *
-        * @param file: Pfad zur Tabellendefinition
-        * @return true
-        */
-        /*
-        function loadTableDef($file) {
-                global $app,$conf;
-
-                include_once($file);
-                $this->tableDef = $table;
-                $this->table_name = $table_name;
-                $this->table_index = $table_index;
-                return true;
-        }
-        */
-
-    function loadFormDef($file,$module = '') {
-                global $app,$conf;
-
-                include_once($file);
-                $this->formDef = $form;
-
-                $this->module = $module;
-                if($module == '') {
-                        include_once("lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
-                } else {
-                        include_once("../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
-                }
-                $this->wordbook = $wb;
-
-                return true;
-        }
-
-
-        /**
-        * Konvertiert die Daten des �bergebenen assoziativen
-        * Arrays in "menschenlesbare" Form.
-        * Datentyp Konvertierung, z.B. f�r Ausgabe in Listen.
-        *
-        * @param record
-        * @return record
-        */
-        function decode($record,$tab) {
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
-                if(is_array($record)) {
-                        foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-                                switch ($field['datatype']) {
-                                case 'VARCHAR':
-                                        $new_record[$key] = stripslashes($record[$key]);
-                                break;
-
-                                case 'TEXT':
-                                        $new_record[$key] = stripslashes($record[$key]);
-                                break;
-
-                                case 'DATE':
-                                        if($record[$key] > 0) {
-                                                $new_record[$key] = date($this->dateformat,$record[$key]);
-                                        }
-                                break;
-
-                                case 'INTEGER':
-                                        $new_record[$key] = intval($record[$key]);
-                                break;
-
-                                case 'DOUBLE':
-                                        $new_record[$key] = $record[$key];
-                                break;
-
-                                case 'CURRENCY':
-                                        $new_record[$key] = number_format($record[$key], 2, ',', '');
-                                break;
-
-                                default:
-                                        $new_record[$key] = stripslashes($record[$key]);
-                                }
-                        }
-
-                }
-        return $new_record;
-        }
-
-        /**
-        * Get the key => value array of a form filed from a datasource definitiom
-        *
-        * @param field = array with field definition
-        * @param record = Dataset as array
-        * @return key => value array for the value field of a form
-        */
-
-        function getDatasourceData($field, $record) {
-                global $app;
-
-                $values = array();
-
-                if($field["datasource"]["type"] == 'SQL') {
-
-                        // Preparing SQL string. We will replace some
-                        // common placeholders
-                        $querystring = $field["datasource"]["querystring"];
-                        $querystring = str_replace("{USERID}",$_SESSION["s"]["user"]["userid"],$querystring);
-                        $querystring = str_replace("{GROUPID}",$_SESSION["s"]["user"]["default_group"],$querystring);
-                        $querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
-                        $table_idx = $this->formDef['db_table_idx'];
-                        $querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
-                        $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
-
-                        // 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"];
-                                foreach($tmp_records as $tmp_rec) {
-                                        $tmp_id = $tmp_rec[$key_field];
-                                        $values[$tmp_id] = $tmp_rec[$value_field];
-                                }
-                        }
-                }
-
-                if($field["datasource"]["type"] == 'CUSTOM') {
-                        // Calls a custom class to validate this record
-                        if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
-                                $datasource_class = $field["datasource"]['class'];
-                                $datasource_function = $field["datasource"]['function'];
-                                $app->uses($datasource_class);
-                                $values = $app->$datasource_class->$datasource_function($field, $record);
-                        } else {
-                                $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
-                        }
-                }
-
-                return $values;
-
-        }
-
-
-        /**
-        * Record f�r Ausgabe in Formularen vorbereiten.
-        *
-        * @param record = Datensatz als Array
-        * @param action = NEW oder EDIT
-        * @return record
-        */
-        function getHTML($record, $tab, $action = 'NEW') {
-
-                global $app;
-
-                $this->action = $action;
-
-                if(!is_array($this->formDef)) $app->error("Keine Formdefinition vorhanden.");
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
-
-                $new_record = array();
-                if($action == 'EDIT') {
-                        $record = $this->decode($record,$tab);
-                        if(is_array($record)) {
-                                foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-                                        $val = $record[$key];
-
-                                        // 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'])) {
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
-                                                                $selected = ($k == $val)?' SELECTED':'';
-                                                                $out .= "<option value='$k'$selected>$v</option>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-                                        case 'MULTIPLE':
-                                                if(is_array($field['value'])) {
-
-                                                        // aufsplitten ergebnisse
-                                                        $vals = explode($field['separator'],$val);
-
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
-
-                                                                $selected = '';
-                                                                foreach($vals as $tvl) {
-                                                                        if(trim($tvl) == trim($k)) $selected = ' SELECTED';
-                                                                }
-
-                                                                $out .= "<option value='$k'$selected>$v</option>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-
-                                        case 'PASSWORD':
-                                                $new_record[$key] = '';
-                                        break;
-
-                                        case 'CHECKBOX':
-                                                $checked = (empty($val))?'':' CHECKED';
-                                                $new_record[$key] = "<input name=\"".$key."\" type=\"checkbox\" value=\"".$field['value']."\" $checked>\r\n";
-                                        break;
-
-                                        case 'CHECKBOXARRAY':
-                                                if(is_array($field['value'])) {
-
-                                                        // aufsplitten ergebnisse
-                                                        $vals = explode($field['separator'],$val);
-
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
-
-                                                                $checked = '';
-                                                                foreach($vals as $tvl) {
-                                                                        if(trim($tvl) == trim($k)) $checked = ' CHECKED';
-                                                                }
-
-                                                                $out .= "<input name=\"".$key."[]\" type=\"checkbox\" value=\"$k\" $checked>$v <br />\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-
-                                        case 'RADIO':
-                                                if(is_array($field['value'])) {
-
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
-                                                                $checked = ($k == $val)?' CHECKED':'';
-                                                                $out .= "<input name='".$key."[]' type='radio' value='$k'$checked> $v<br>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-
-                                        default:
-                                                $new_record[$key] = htmlspecialchars($record[$key]);
-                                        }
-                                }
-                        }
-                } 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'])) {
-                                                $out = '';
-                                                foreach($field['value'] as $k => $v) {
-                                                        $selected = ($k == $val)?' SELECTED':'';
-                                                        $out .= "<option value='$k'$selected>$v</option>\r\n";
-                                                }
-                                        }
-                                        $new_record[$key] = $out;
-                                break;
-                                case 'MULTIPLE':
-                                                if(is_array($field['value'])) {
-
-                                                        // aufsplitten ergebnisse
-                                                        $vals = explode($field['separator'],$val);
-
-                                                        // HTML schreiben
-                                                        $out = '';
-                                                        foreach($field['value'] as $k => $v) {
-
-                                                                $out .= "<option value='$k'>$v</option>\r\n";
-                                                        }
-                                                }
-                                                $new_record[$key] = $out;
-                                        break;
-
-                                case 'PASSWORD':
-                                        $new_record[$key] = '';
-                                break;
-
-                                case 'CHECKBOX':
-                                        $checked = (empty($field["default"]))?'':' CHECKED';
-                                        $new_record[$key] = "<input name=\"".$key."\" type=\"checkbox\" value=\"".$field['value']."\" $checked>\r\n";
-                                break;
-
-                                case 'CHECKBOXARRAY':
-                                        if(is_array($field['value'])) {
-
-                                                // aufsplitten ergebnisse
-                                                $vals = explode($field['separator'],$field["default"]);
-
-                                                // HTML schreiben
-                                                $out = '';
-                                                foreach($field['value'] as $k => $v) {
-
-                                                        $checked = '';
-                                                        foreach($vals as $tvl) {
-                                                                if(trim($tvl) == trim($k)) $checked = ' CHECKED';
-                                                        }
-
-                                                        $out .= "<input name=\"".$key."[]\" type=\"checkbox\" value=\"$k\" $checked> $v<br />\r\n";
-                                                }
-                                        }
-                                        $new_record[$key] = $out;
-                                break;
-
-                                case 'RADIO':
-                                        if(is_array($field['value'])) {
-
-                                                // HTML schreiben
-                                                $out = '';
-                                                foreach($field['value'] as $k => $v) {
-                                                        $checked = ($k == $field["default"])?' CHECKED':'';
-                                                        $out .= "<input name='".$key."[]' type='radio' value='$k'$checked> $v<br>\r\n";
-                                                }
-                                        }
-                                        $new_record[$key] = $out;
-                                break;
-
-                                default:
-                                        $new_record[$key] = htmlspecialchars($field['default']);
-                                }
-                        }
-
-                }
-
-                if($this->debug == 1) $this->dbg($new_record);
-
-                return $new_record;
-        }
-
-        /**
-        * Record in "maschinen lesbares" Format �berf�hren
-        * und Werte gegen regul�re Ausdr�cke pr�fen.
-        *
-        * @param record = Datensatz als Array
-        * @return record
-        */
-        function encode($record,$tab) {
-
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
-                //$this->errorMessage = '';
-
-                if(is_array($record)) {
-                        foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-
-                                if(is_array($field['validators'])) $this->validateField($key, $record[$key], $field['validators']);
-
-                                switch ($field['datatype']) {
-                                case 'VARCHAR':
-                                        if(!is_array($record[$key])) {
-                                                $new_record[$key] = addslashes($record[$key]);
-                                        } else {
-                                                $new_record[$key] = implode($field['separator'],$record[$key]);
-                                        }
-                                break;
-                                case 'TEXT':
-                                        if(!is_array($record[$key])) {
-                                                $new_record[$key] = addslashes($record[$key]);
-                                        } else {
-                                                $new_record[$key] = implode($field['separator'],$record[$key]);
-                                        }
-                                break;
-                                case 'DATE':
-                                        if($record[$key] > 0) {
-                                                list($tag,$monat,$jahr) = explode('.',$record[$key]);
-                                                $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
-                                        } else {
-											$new_record[$key] = 0;
-										}
-                                break;
-                                case 'INTEGER':
-                                        $new_record[$key] = intval($record[$key]);
-                                        //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
-                                        //if($key == 'refresh') die($record[$key]);
-                                break;
-                                case 'DOUBLE':
-                                        $new_record[$key] = addslashes($record[$key]);
-                                break;
-                                case 'CURRENCY':
-                                        $new_record[$key] = str_replace(",",".",$record[$key]);
-                                break;
-                                }
-
-                                // The use of the field value is deprecated, use validators instead
-                                if($field['regex'] != '') {
-                                        // Enable that "." matches also newlines
-                                        $field['regex'] .= 's';
-                                        if(!preg_match($field['regex'], $record[$key])) {
-                                                $errmsg = $field['errmsg'];
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-                                        }
-                                }
-
-
-                        }
-                }
-                return $new_record;
-        }
-
-        /**
-        * process the validators for a given field.
-        *
-        * @param field_name = Name of the field
-        * @param field_value = value of the field
-        * @param validatoors = Array of validators
-        * @return record
-        */
-
-        function validateField($field_name, $field_value, $validators) {
-
-                global $app;
-				
-                // loop trough the validators
-                foreach($validators as $validator) {
-
-                        switch ($validator['type']) {
-                                case 'REGEX':
-                                        $validator['regex'] .= 's';
-                                        if(!preg_match($validator['regex'], $field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-                                        }
-                                break;
-                                case 'UNIQUE':
-                                        if($this->action == 'NEW') {
-                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
-                                                if($num_rec["number"] > 0) {
-                                                        $errmsg = $validator['errmsg'];
-														if(isset($this->wordbook[$errmsg])) {
-                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br>\r\n";
-														}
-                                                }
-                                        } else {
-                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
-                                                if($num_rec["number"] > 0) {
-                                                        $errmsg = $validator['errmsg'];
-                                                        if(isset($this->wordbook[$errmsg])) {
-                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br>\r\n";
-														}
-                                                }
-                                        }
-                                break;
-                                case 'NOTEMPTY':
-                                        if(empty($field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br>\r\n";
-												}
-                                        }
-                                break;
-                                case 'ISEMAIL':
-                                        if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br>\r\n";
-												}
-                                        }
-                                break;
-                                case 'ISINT':
-                                        $tmpval = intval($field_value);
-                                        if($tmpval === 0 and !empty($field_value)) {
-                                                $errmsg = $validator['errmsg'];
-                                                if(isset($this->wordbook[$errmsg])) {
-                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br>\r\n";
-												}
-                                        }
-                                break;
-                                case 'ISPOSITIVE':
-                                        if(!is_numeric($field_value) || $field_value <= 0){
-                                          $errmsg = $validator['errmsg'];
-                                          if(isset($this->wordbook[$errmsg])) {
-                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br>\r\n";
-										  }
-                                        }
-                                break;
-                                case 'CUSTOM':
-                                        // Calls a custom class to validate this record
-                                        if($validator['class'] != '' and $validator['function'] != '') {
-                                                $validator_class = $validator['class'];
-                                                $validator_function = $validator['function'];
-                                                $app->uses($validator_class);
-                                                $this->errorMessage .= $app->$validator_class->$validator_function($validator);
-                                        } else {
-                                                $this->errorMessage .= "Custom validator class or function is empty<br>\r\n";
-                                        }
-                                break;
-								default:
-									$this->errorMessage .= "Unknown Validator: ".$validator['type'];
-								break;
-                        }
-
-
-                }
-
-                return true;
-        }
-
-        /**
-        * SQL Statement f�r Record erzeugen.
-        *
-        * @param record = Datensatz als Array
-        * @param action = INSERT oder UPDATE
-        * @param primary_id
-        * @return record
-        */
-        function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-
-                global $app;
-
-                // If there are no data records on the tab, return empty sql string
-                if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
-
-                // checking permissions
-                if($this->formDef['auth'] == 'yes') {
-                        if($action == "INSERT") {
-                                if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied.<br>\r\n";
-                        } else {
-                                if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Insert denied.<br>\r\n";
-                        }
-                }
-
-                $this->action = $action;
-                $this->primary_id = $primary_id;
-
-                $record = $this->encode($record,$tab);
-                $sql_insert_key = '';
-                $sql_insert_val = '';
-                $sql_update = '';
-
-                if(!is_array($this->formDef)) $app->error("Keine Formulardefinition vorhanden.");
-                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
-
-                // gehe durch alle Felder des Tabs
-                if(is_array($record)) {
-                foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-                                // Wenn es kein leeres Passwortfeld ist
-                                if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
-                                        // Erzeuge Insert oder Update Quelltext
-                                        if($action == "INSERT") {
-                                                if($field['formtype'] == 'PASSWORD') {
-                                                        $sql_insert_key .= "`$key`, ";
-                                                        if($field['encryption'] == 'CRYPT') {
-                                                                $sql_insert_val .= "'".crypt($record[$key])."', ";
-                                                        } else {
-                                                                $sql_insert_val .= "md5('".$record[$key]."'), ";
-                                                        }
-                                                } else {
-                                                        $sql_insert_key .= "`$key`, ";
-                                                        $sql_insert_val .= "'".$record[$key]."', ";
-                                                }
-                                        } else {
-                                                if($field['formtype'] == 'PASSWORD') {
-                                                        if($field['encryption'] == 'CRYPT') {
-                                                                $sql_update .= "`$key` = '".crypt($record[$key])."', ";
-                                                        } else {
-                                                                $sql_update .= "`$key` = md5('".$record[$key]."'), ";
-                                                        }
-                                                } else {
-                                                        $sql_update .= "`$key` = '".$record[$key]."', ";
-                                                }
-                                        }
-                                }
-                        }
-        }
-
-
-                // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein
-                if(stristr($this->formDef['db_table'],'.')) {
-                        $escape = '';
-                } else {
-                        $escape = '`';
-                }
-
-
-                if($action == "INSERT") {
-                        if($this->formDef['auth'] == 'yes') {
-                                // Setze User und Gruppe
-                                $sql_insert_key .= "`sys_userid`, ";
-                                $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
-                                $sql_insert_key .= "`sys_groupid`, ";
-                                $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
-                                $sql_insert_key .= "`sys_perm_user`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
-                                $sql_insert_key .= "`sys_perm_group`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
-                                $sql_insert_key .= "`sys_perm_other`, ";
-                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
-                        }
-                        $sql_insert_key = substr($sql_insert_key,0,-2);
-                        $sql_insert_val = substr($sql_insert_val,0,-2);
-                        $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
-                } else {
-                        if($primary_id != 0) {
-                                $sql_update = substr($sql_update,0,-2);
-                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
-                        } else {
-                                $app->error("Primary ID fehlt!");
-                        }
-                }
-
-                // Daten in History tabelle speichern
-                if($this->errorMessage == '' and $this->formDef['db_history'] == 'yes') $this->datalogSave($action,$primary_id,$record);
-				// die($sql);
-                return $sql;
-        }
-
-        /**
-        * Debugging arrays.
-        *
-        * @param array_data
-        */
-        function dbg($array_data) {
-
-                echo "<pre>";
-                print_r($array_data);
-                echo "</pre>";
-
-        }
-
-
-    function showForm() {
-            global $app,$conf;
-
-        if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
-
-                $active_tab = $this->getNextTab();
-
-        // definiere Tabs
-        foreach( $this->formDef["tabs"] as $key => $tab) {
-
-                        $tab['name'] = $key;
-            if($tab['name'] == $active_tab) {
-
-                                // Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
-                                if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
-
-                                // �berpr�fe, ob das Template existiert, wenn nicht
-                                // dann generiere das Template
-                                if(!is_file($tab["template"])) {
-                                        $app->uses('tform_tpl_generator');
-                                        $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
-                                }
-
-                    $app->tpl->setInclude('content_tpl',$tab["template"]);
-                $tab["active"] = 1;
-                $_SESSION["s"]["form"]["tab"] = $tab['name'];
-            } else {
-                    $tab["active"] = 0;
-            }
-
-                        // Die Datenfelder werden f�r die Tabs nicht ben�tigt
-                        unset($tab["fields"]);
-                        unset($tab["plugins"]);
-
-            $frmTab[] = $tab;
-        }
-
-        // setting form tabs
-        $app->tpl->setLoop("formTab", $frmTab);
-
-                // Set form action
-                $app->tpl->setVar('form_action',$this->formDef["action"]);
-                $app->tpl->setVar('form_active_tab',$active_tab);
-
-                // Set form title
-                $form_hint = '<b>'.$this->formDef["title"].'</b>';
-                if($this->formDef["description"] != '') $form_hint .= '<br><br>'.$this->formDef["description"];
-                $app->tpl->setVar('form_hint',$form_hint);
-
-                // Set Wordbook for this form
-
-                $app->tpl->setVar($this->wordbook);
-    }
-
-
-
-        function datalogSave($action,$primary_id,$record_new) {
-                global $app,$conf;
-
-                // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein
-                if(stristr($this->formDef['db_table'],'.')) {
-                        $escape = '';
-                } else {
-                        $escape = '`';
-                }
-
-                if($action == "UPDATE") {
-                        $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-                        $record_old = $app->db->queryOneRecord($sql);
-                } else {
-                        $record_old = array();
-                }
-
-                $diffrec = array();
-
-                if(is_array($record_new)) {
-                        foreach($record_new as $key => $val) {
-                                if($record_old[$key] != $val) {
-                                        // Datensatz hat sich ge�ndert
-                                        $diffrec[$key] = array('old' => $record_old[$key],
-                                                                           'new' => $val);
-                                }
-                        }
-                }
-				
-				// Insert the server_id, if the record has a server_id
-				$server_id = ($record_old["server_id"] > 0)?$record_old["server_id"]:0;
-
-                if(count($diffrec) > 0) {
-                        
-						// We need the full records in ISPConfig, not only the diffs
-						$diffrec = array(	'old' => $record_old,
-											'new' => $record_new);
-						
-						$diffstr = $app->db->quote(serialize($diffrec));
-                        $username = $app->db->quote($_SESSION["s"]["user"]["username"]);
-                        $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
-                        $action = ($action == 'INSERT')?'i':'u';
-                        $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$this->formDef['db_table']."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
-						$app->db->query($sql);
-                }
-
-                return true;
-
-        }
-
-        function getAuthSQL($perm) {
-
-                $sql = '(';
-                $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR  ";
-                $sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
-                $sql .= "sys_perm_other like '%$perm%'";
-                $sql .= ')';
-
-                return $sql;
-        }
-
-        /*
-        Diese funktion �berpr�ft, ob ein User die Berechtigung $perm f�r den Datensatz mit der ID $record_id
-        hat. It record_id = 0, dann wird gegen die user Defaults des Formulares getestet.
-        */
-        function checkPerm($record_id,$perm) {
-                global $app;
-
-                if($record_id > 0) {
-                        // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein
-                        if(stristr($this->formDef['db_table'],'.')) {
-                                $escape = '';
-                        } else {
-                                $escape = '`';
-                        }
-
-                        $sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
-                        if($record = $app->db->queryOneRecord($sql)) {
-                                return true;
-                        } else {
-                                return false;
-                        }
-                } else {
-                        $result = false;
-                        if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
-                        if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
-                        if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
-
-                        // if preset == 0, everyone can insert a record of this type
-                        if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
-
-                        return $result;
-
-                }
-
-        }
-
-        function getNextTab() {
-                // Welcher Tab wird angezeigt
-                if($this->errorMessage == '') {
-                    // wenn kein Fehler vorliegt
-                        if($_REQUEST["next_tab"] != '') {
-                                // wenn n�chster Tab bekannt
-                                $active_tab = $_REQUEST["next_tab"];
-                    } else {
-                        // ansonsten ersten tab nehmen
-                        $active_tab = $this->formDef['tab_default'];
-                    }
-                } else {
-                    // bei Fehlern den gleichen Tab nochmal anzeigen
-                    $active_tab = $_SESSION["s"]["form"]["tab"];
-                }
-
-                return $active_tab;
-        }
-
-        function getCurrentTab() {
-                return $_SESSION["s"]["form"]["tab"];
-        }
-
-}
-
+<?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.
+*/
+
+/**
+* Formularbehandlung
+*
+* Funktionen zur Umwandlung von Formulardaten
+* sowie zum vorbereiten von HTML und SQL
+* Ausgaben
+*
+*        Tabellendefinition
+*
+*        Datentypen:
+*        - INTEGER (Wandelt Ausdr�cke in Int um)
+*        - DOUBLE
+*        - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
+*        - VARCHAR (kein weiterer Format Check)
+*        - DATE (Datumsformat, Timestamp Umwandlung)
+*
+*        Formtype:
+*        - TEXT (normales Textfeld)
+*        - PASSWORD (Feldinhalt wird nicht angezeigt)
+*        - SELECT (Gibt Werte als option Feld aus)
+*        - MULTIPLE (Select-Feld mit nehreren Werten)
+*
+*        VALUE:
+*        - Wert oder Array
+*
+*        SEPARATOR
+*        - Trennzeichen f�r multiple Felder
+*
+*        Hinweis:
+*        Das ID-Feld ist nicht bei den Table Values einzuf�gen.
+*
+* @package form
+* @author Till Brehm
+* @version 1.1
+*/
+
+class tform {
+
+        /**
+        * Definition der Tabelle (array)
+        * @var tableDef
+        */
+        var $tableDef;
+
+        /**
+        * Private
+        * @var action
+        */
+        var $action;
+
+        /**
+        * Tabellenname (String)
+        * @var table_name
+        */
+        var $table_name;
+
+        /**
+        * Debug Variable
+        * @var debug
+        */
+        var $debug = 0;
+
+        /**
+        * name des primary Field der Tabelle (string)
+        * @var table_index
+        */
+        var $table_index;
+
+        /**
+        * enth�lt die Fehlermeldung bei �berpr�fung
+        * der Variablen mit Regex
+        * @var errorMessage
+        */
+        var $errorMessage = '';
+
+        var $dateformat = "d.m.Y";
+    var $formDef;
+        var $wordbook;
+        var $module;
+        var $primary_id;
+
+        /**
+        * Laden der Tabellendefinition
+        *
+        * @param file: Pfad zur Tabellendefinition
+        * @return true
+        */
+        /*
+        function loadTableDef($file) {
+                global $app,$conf;
+
+                include_once($file);
+                $this->tableDef = $table;
+                $this->table_name = $table_name;
+                $this->table_index = $table_index;
+                return true;
+        }
+        */
+
+    function loadFormDef($file,$module = '') {
+                global $app,$conf;
+
+                include_once($file);
+                $this->formDef = $form;
+
+                $this->module = $module;
+                if($module == '') {
+                        include_once("lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
+                } else {
+                        include_once("../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
+                }
+                $this->wordbook = $wb;
+
+                return true;
+        }
+
+
+        /**
+        * Konvertiert die Daten des �bergebenen assoziativen
+        * Arrays in "menschenlesbare" Form.
+        * Datentyp Konvertierung, z.B. f�r Ausgabe in Listen.
+        *
+        * @param record
+        * @return record
+        */
+        function decode($record,$tab) {
+                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+                if(is_array($record)) {
+                        foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+                                switch ($field['datatype']) {
+                                case 'VARCHAR':
+                                        $new_record[$key] = stripslashes($record[$key]);
+                                break;
+
+                                case 'TEXT':
+                                        $new_record[$key] = stripslashes($record[$key]);
+                                break;
+
+                                case 'DATE':
+                                        if($record[$key] > 0) {
+                                                $new_record[$key] = date($this->dateformat,$record[$key]);
+                                        }
+                                break;
+
+                                case 'INTEGER':
+                                        $new_record[$key] = intval($record[$key]);
+                                break;
+
+                                case 'DOUBLE':
+                                        $new_record[$key] = $record[$key];
+                                break;
+
+                                case 'CURRENCY':
+                                        $new_record[$key] = number_format($record[$key], 2, ',', '');
+                                break;
+
+                                default:
+                                        $new_record[$key] = stripslashes($record[$key]);
+                                }
+                        }
+
+                }
+        return $new_record;
+        }
+
+        /**
+        * Get the key => value array of a form filed from a datasource definitiom
+        *
+        * @param field = array with field definition
+        * @param record = Dataset as array
+        * @return key => value array for the value field of a form
+        */
+
+        function getDatasourceData($field, $record) {
+                global $app;
+
+                $values = array();
+
+                if($field["datasource"]["type"] == 'SQL') {
+
+                        // Preparing SQL string. We will replace some
+                        // common placeholders
+                        $querystring = $field["datasource"]["querystring"];
+                        $querystring = str_replace("{USERID}",$_SESSION["s"]["user"]["userid"],$querystring);
+                        $querystring = str_replace("{GROUPID}",$_SESSION["s"]["user"]["default_group"],$querystring);
+                        $querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
+                        $table_idx = $this->formDef['db_table_idx'];
+                        $querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
+                        $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
+
+                        // 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"];
+                                foreach($tmp_records as $tmp_rec) {
+                                        $tmp_id = $tmp_rec[$key_field];
+                                        $values[$tmp_id] = $tmp_rec[$value_field];
+                                }
+                        }
+                }
+
+                if($field["datasource"]["type"] == 'CUSTOM') {
+                        // Calls a custom class to validate this record
+                        if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
+                                $datasource_class = $field["datasource"]['class'];
+                                $datasource_function = $field["datasource"]['function'];
+                                $app->uses($datasource_class);
+                                $values = $app->$datasource_class->$datasource_function($field, $record);
+                        } else {
+                                $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
+                        }
+                }
+
+                return $values;
+
+        }
+
+
+        /**
+        * Record f�r Ausgabe in Formularen vorbereiten.
+        *
+        * @param record = Datensatz als Array
+        * @param action = NEW oder EDIT
+        * @return record
+        */
+        function getHTML($record, $tab, $action = 'NEW') {
+
+                global $app;
+
+                $this->action = $action;
+
+                if(!is_array($this->formDef)) $app->error("Keine Formdefinition vorhanden.");
+                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+
+                $new_record = array();
+                if($action == 'EDIT') {
+                        $record = $this->decode($record,$tab);
+                        if(is_array($record)) {
+                                foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+                                        $val = $record[$key];
+
+                                        // 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'])) {
+                                                        $out = '';
+                                                        foreach($field['value'] as $k => $v) {
+                                                                $selected = ($k == $val)?' SELECTED':'';
+                                                                $out .= "<option value='$k'$selected>$v</option>\r\n";
+                                                        }
+                                                }
+                                                $new_record[$key] = $out;
+                                        break;
+                                        case 'MULTIPLE':
+                                                if(is_array($field['value'])) {
+
+                                                        // aufsplitten ergebnisse
+                                                        $vals = explode($field['separator'],$val);
+
+                                                        // HTML schreiben
+                                                        $out = '';
+                                                        foreach($field['value'] as $k => $v) {
+
+                                                                $selected = '';
+                                                                foreach($vals as $tvl) {
+                                                                        if(trim($tvl) == trim($k)) $selected = ' SELECTED';
+                                                                }
+
+                                                                $out .= "<option value='$k'$selected>$v</option>\r\n";
+                                                        }
+                                                }
+                                                $new_record[$key] = $out;
+                                        break;
+
+                                        case 'PASSWORD':
+                                                $new_record[$key] = '';
+                                        break;
+
+                                        case 'CHECKBOX':
+                                                $checked = ($val == $field['value'][1])?' CHECKED':'';
+                                                $new_record[$key] = "<input name=\"".$key."\" type=\"checkbox\" value=\"".$field['value'][1]."\" $checked>\r\n";
+                                        break;
+
+                                        case 'CHECKBOXARRAY':
+                                                if(is_array($field['value'])) {
+
+                                                        // aufsplitten ergebnisse
+                                                        $vals = explode($field['separator'],$val);
+
+                                                        // HTML schreiben
+                                                        $out = '';
+                                                        foreach($field['value'] as $k => $v) {
+
+                                                                $checked = '';
+                                                                foreach($vals as $tvl) {
+                                                                        if(trim($tvl) == trim($k)) $checked = ' CHECKED';
+                                                                }
+
+                                                                $out .= "<input name=\"".$key."[]\" type=\"checkbox\" value=\"$k\" $checked>$v <br />\r\n";
+                                                        }
+                                                }
+                                                $new_record[$key] = $out;
+                                        break;
+
+                                        case 'RADIO':
+                                                if(is_array($field['value'])) {
+
+                                                        // HTML schreiben
+                                                        $out = '';
+                                                        foreach($field['value'] as $k => $v) {
+                                                                $checked = ($k == $val)?' CHECKED':'';
+                                                                $out .= "<input name='".$key."[]' type='radio' value='$k'$checked> $v<br>\r\n";
+                                                        }
+                                                }
+                                                $new_record[$key] = $out;
+                                        break;
+
+                                        default:
+                                                $new_record[$key] = htmlspecialchars($record[$key]);
+                                        }
+                                }
+                        }
+                } 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'])) {
+                                                $out = '';
+                                                foreach($field['value'] as $k => $v) {
+                                                        $selected = ($k == $val)?' SELECTED':'';
+                                                        $out .= "<option value='$k'$selected>$v</option>\r\n";
+                                                }
+                                        }
+                                        $new_record[$key] = $out;
+                                break;
+                                case 'MULTIPLE':
+                                                if(is_array($field['value'])) {
+
+                                                        // aufsplitten ergebnisse
+                                                        $vals = explode($field['separator'],$val);
+
+                                                        // HTML schreiben
+                                                        $out = '';
+                                                        foreach($field['value'] as $k => $v) {
+
+                                                                $out .= "<option value='$k'>$v</option>\r\n";
+                                                        }
+                                                }
+                                                $new_record[$key] = $out;
+                                        break;
+
+                                case 'PASSWORD':
+                                        $new_record[$key] = '';
+                                break;
+
+                                case 'CHECKBOX':
+                                        // $checked = (empty($field["default"]))?'':' CHECKED';
+										$checked = ($field["default"] == $field['value'][1])?' CHECKED':'';
+                                        $new_record[$key] = "<input name=\"".$key."\" type=\"checkbox\" value=\"".$field['value'][1]."\" $checked>\r\n";
+                                break;
+
+                                case 'CHECKBOXARRAY':
+                                        if(is_array($field['value'])) {
+
+                                                // aufsplitten ergebnisse
+                                                $vals = explode($field['separator'],$field["default"]);
+
+                                                // HTML schreiben
+                                                $out = '';
+                                                foreach($field['value'] as $k => $v) {
+
+                                                        $checked = '';
+                                                        foreach($vals as $tvl) {
+                                                                if(trim($tvl) == trim($k)) $checked = ' CHECKED';
+                                                        }
+
+                                                        $out .= "<input name=\"".$key."[]\" type=\"checkbox\" value=\"$k\" $checked> $v<br />\r\n";
+                                                }
+                                        }
+                                        $new_record[$key] = $out;
+                                break;
+
+                                case 'RADIO':
+                                        if(is_array($field['value'])) {
+
+                                                // HTML schreiben
+                                                $out = '';
+                                                foreach($field['value'] as $k => $v) {
+                                                        $checked = ($k == $field["default"])?' CHECKED':'';
+                                                        $out .= "<input name='".$key."[]' type='radio' value='$k'$checked> $v<br>\r\n";
+                                                }
+                                        }
+                                        $new_record[$key] = $out;
+                                break;
+
+                                default:
+                                        $new_record[$key] = htmlspecialchars($field['default']);
+                                }
+                        }
+
+                }
+
+                if($this->debug == 1) $this->dbg($new_record);
+
+                return $new_record;
+        }
+
+        /**
+        * Record in "maschinen lesbares" Format �berf�hren
+        * und Werte gegen regul�re Ausdr�cke pr�fen.
+        *
+        * @param record = Datensatz als Array
+        * @return record
+        */
+        function encode($record,$tab) {
+
+                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+                //$this->errorMessage = '';
+
+                if(is_array($record)) {
+                        foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+                                if(is_array($field['validators'])) $this->validateField($key, $record[$key], $field['validators']);
+
+                                switch ($field['datatype']) {
+                                case 'VARCHAR':
+                                        if(!is_array($record[$key])) {
+                                                $new_record[$key] = addslashes($record[$key]);
+                                        } else {
+                                                $new_record[$key] = implode($field['separator'],$record[$key]);
+                                        }
+                                break;
+                                case 'TEXT':
+                                        if(!is_array($record[$key])) {
+                                                $new_record[$key] = addslashes($record[$key]);
+                                        } else {
+                                                $new_record[$key] = implode($field['separator'],$record[$key]);
+                                        }
+                                break;
+                                case 'DATE':
+                                        if($record[$key] > 0) {
+                                                list($tag,$monat,$jahr) = explode('.',$record[$key]);
+                                                $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+                                        } else {
+											$new_record[$key] = 0;
+										}
+                                break;
+                                case 'INTEGER':
+                                        $new_record[$key] = intval($record[$key]);
+                                        //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
+                                        //if($key == 'refresh') die($record[$key]);
+                                break;
+                                case 'DOUBLE':
+                                        $new_record[$key] = addslashes($record[$key]);
+                                break;
+                                case 'CURRENCY':
+                                        $new_record[$key] = str_replace(",",".",$record[$key]);
+                                break;
+                                }
+
+                                // The use of the field value is deprecated, use validators instead
+                                if($field['regex'] != '') {
+                                        // Enable that "." matches also newlines
+                                        $field['regex'] .= 's';
+                                        if(!preg_match($field['regex'], $record[$key])) {
+                                                $errmsg = $field['errmsg'];
+                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+                                        }
+                                }
+
+
+                        }
+                }
+                return $new_record;
+        }
+
+        /**
+        * process the validators for a given field.
+        *
+        * @param field_name = Name of the field
+        * @param field_value = value of the field
+        * @param validatoors = Array of validators
+        * @return record
+        */
+
+        function validateField($field_name, $field_value, $validators) {
+
+                global $app;
+				
+                // loop trough the validators
+                foreach($validators as $validator) {
+
+                        switch ($validator['type']) {
+                                case 'REGEX':
+                                        $validator['regex'] .= 's';
+                                        if(!preg_match($validator['regex'], $field_value)) {
+                                                $errmsg = $validator['errmsg'];
+                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+                                        }
+                                break;
+                                case 'UNIQUE':
+                                        if($this->action == 'NEW') {
+                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
+                                                if($num_rec["number"] > 0) {
+                                                        $errmsg = $validator['errmsg'];
+														if(isset($this->wordbook[$errmsg])) {
+                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+														} else {
+															$this->errorMessage .= $errmsg."<br>\r\n";
+														}
+                                                }
+                                        } else {
+                                                $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
+                                                if($num_rec["number"] > 0) {
+                                                        $errmsg = $validator['errmsg'];
+                                                        if(isset($this->wordbook[$errmsg])) {
+                                                        	$this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+														} else {
+															$this->errorMessage .= $errmsg."<br>\r\n";
+														}
+                                                }
+                                        }
+                                break;
+                                case 'NOTEMPTY':
+                                        if(empty($field_value)) {
+                                                $errmsg = $validator['errmsg'];
+                                                if(isset($this->wordbook[$errmsg])) {
+                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+												} else {
+													$this->errorMessage .= $errmsg."<br>\r\n";
+												}
+                                        }
+                                break;
+                                case 'ISEMAIL':
+                                        if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
+                                                $errmsg = $validator['errmsg'];
+                                                if(isset($this->wordbook[$errmsg])) {
+                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+												} else {
+													$this->errorMessage .= $errmsg."<br>\r\n";
+												}
+                                        }
+                                break;
+                                case 'ISINT':
+                                        $tmpval = intval($field_value);
+                                        if($tmpval === 0 and !empty($field_value)) {
+                                                $errmsg = $validator['errmsg'];
+                                                if(isset($this->wordbook[$errmsg])) {
+                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+												} else {
+													$this->errorMessage .= $errmsg."<br>\r\n";
+												}
+                                        }
+                                break;
+                                case 'ISPOSITIVE':
+                                        if(!is_numeric($field_value) || $field_value <= 0){
+                                          $errmsg = $validator['errmsg'];
+                                          if(isset($this->wordbook[$errmsg])) {
+                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+										  } else {
+											 $this->errorMessage .= $errmsg."<br>\r\n";
+										  }
+                                        }
+                                break;
+                                case 'CUSTOM':
+                                        // Calls a custom class to validate this record
+                                        if($validator['class'] != '' and $validator['function'] != '') {
+                                                $validator_class = $validator['class'];
+                                                $validator_function = $validator['function'];
+                                                $app->uses($validator_class);
+                                                $this->errorMessage .= $app->$validator_class->$validator_function($validator);
+                                        } else {
+                                                $this->errorMessage .= "Custom validator class or function is empty<br>\r\n";
+                                        }
+                                break;
+								default:
+									$this->errorMessage .= "Unknown Validator: ".$validator['type'];
+								break;
+                        }
+
+
+                }
+
+                return true;
+        }
+
+        /**
+        * SQL Statement f�r Record erzeugen.
+        *
+        * @param record = Datensatz als Array
+        * @param action = INSERT oder UPDATE
+        * @param primary_id
+        * @return record
+        */
+        function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
+
+                global $app;
+
+                // If there are no data records on the tab, return empty sql string
+                if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
+
+                // checking permissions
+                if($this->formDef['auth'] == 'yes') {
+                        if($action == "INSERT") {
+                                if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied.<br>\r\n";
+                        } else {
+                                if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Insert denied.<br>\r\n";
+                        }
+                }
+
+                $this->action = $action;
+                $this->primary_id = $primary_id;
+
+                $record = $this->encode($record,$tab);
+                $sql_insert_key = '';
+                $sql_insert_val = '';
+                $sql_update = '';
+
+                if(!is_array($this->formDef)) $app->error("Keine Formulardefinition vorhanden.");
+                if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+
+                // gehe durch alle Felder des Tabs
+                if(is_array($record)) {
+                foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+                                // Wenn es kein leeres Passwortfeld ist
+                                if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
+                                        // Erzeuge Insert oder Update Quelltext
+                                        if($action == "INSERT") {
+                                                if($field['formtype'] == 'PASSWORD') {
+                                                        $sql_insert_key .= "`$key`, ";
+                                                        if($field['encryption'] == 'CRYPT') {
+                                                                $sql_insert_val .= "'".crypt($record[$key])."', ";
+                                                        } else {
+                                                                $sql_insert_val .= "md5('".$record[$key]."'), ";
+                                                        }
+                                                } elseif ($field['formtype'] == 'CHECKBOX') {
+                                                        $sql_insert_key .= "`$key`, ";
+														if($record[$key] == '') {
+															$sql_insert_val .= "'".$field['value'][0]."', ";
+														} else {
+															$sql_insert_val .= "'".$record[$key]."', ";
+														}
+                                                } else {
+                                                        $sql_insert_key .= "`$key`, ";
+                                                        $sql_insert_val .= "'".$record[$key]."', ";
+                                                }
+                                        } else {
+                                                if($field['formtype'] == 'PASSWORD') {
+                                                        if($field['encryption'] == 'CRYPT') {
+                                                                $sql_update .= "`$key` = '".crypt($record[$key])."', ";
+                                                        } else {
+                                                                $sql_update .= "`$key` = md5('".$record[$key]."'), ";
+                                                        }
+                                                } elseif ($field['formtype'] == 'CHECKBOX') {
+														if($record[$key] == '') {
+															$sql_update .= "`$key` = '".$field['value'][0]."', ";
+														} else {
+															$sql_update .= "`$key` = '".$record[$key]."', ";
+														}
+                                                } else {
+                                                        $sql_update .= "`$key` = '".$record[$key]."', ";
+                                                }
+                                        }
+                                }
+                        }
+        }
+
+
+                // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein
+                if(stristr($this->formDef['db_table'],'.')) {
+                        $escape = '';
+                } else {
+                        $escape = '`';
+                }
+
+
+                if($action == "INSERT") {
+                        if($this->formDef['auth'] == 'yes') {
+                                // Setze User und Gruppe
+                                $sql_insert_key .= "`sys_userid`, ";
+                                $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
+                                $sql_insert_key .= "`sys_groupid`, ";
+                                $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
+                                $sql_insert_key .= "`sys_perm_user`, ";
+                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
+                                $sql_insert_key .= "`sys_perm_group`, ";
+                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
+                                $sql_insert_key .= "`sys_perm_other`, ";
+                                $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
+                        }
+                        $sql_insert_key = substr($sql_insert_key,0,-2);
+                        $sql_insert_val = substr($sql_insert_val,0,-2);
+                        $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
+                } else {
+                        if($primary_id != 0) {
+                                $sql_update = substr($sql_update,0,-2);
+                                $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+                                if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+                        } else {
+                                $app->error("Primary ID fehlt!");
+                        }
+                }
+
+                // Daten in History tabelle speichern
+                if($this->errorMessage == '' and $this->formDef['db_history'] == 'yes') $this->datalogSave($action,$primary_id,$record);
+                return $sql;
+        }
+
+        /**
+        * Debugging arrays.
+        *
+        * @param array_data
+        */
+        function dbg($array_data) {
+
+                echo "<pre>";
+                print_r($array_data);
+                echo "</pre>";
+
+        }
+
+
+    function showForm() {
+            global $app,$conf;
+
+        if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
+
+                $active_tab = $this->getNextTab();
+
+        // definiere Tabs
+        foreach( $this->formDef["tabs"] as $key => $tab) {
+
+                        $tab['name'] = $key;
+            if($tab['name'] == $active_tab) {
+
+                                // Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
+                                if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
+
+                                // �berpr�fe, ob das Template existiert, wenn nicht
+                                // dann generiere das Template
+                                if(!is_file($tab["template"])) {
+                                        $app->uses('tform_tpl_generator');
+                                        $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
+                                }
+
+                    $app->tpl->setInclude('content_tpl',$tab["template"]);
+                $tab["active"] = 1;
+                $_SESSION["s"]["form"]["tab"] = $tab['name'];
+            } else {
+                    $tab["active"] = 0;
+            }
+
+                        // Die Datenfelder werden f�r die Tabs nicht ben�tigt
+                        unset($tab["fields"]);
+                        unset($tab["plugins"]);
+
+            $frmTab[] = $tab;
+        }
+
+        // setting form tabs
+        $app->tpl->setLoop("formTab", $frmTab);
+
+                // Set form action
+                $app->tpl->setVar('form_action',$this->formDef["action"]);
+                $app->tpl->setVar('form_active_tab',$active_tab);
+
+                // Set form title
+                $form_hint = '<b>'.$this->formDef["title"].'</b>';
+                if($this->formDef["description"] != '') $form_hint .= '<br><br>'.$this->formDef["description"];
+                $app->tpl->setVar('form_hint',$form_hint);
+
+                // Set Wordbook for this form
+
+                $app->tpl->setVar($this->wordbook);
+    }
+
+
+
+        function datalogSave($action,$primary_id,$record_new) {
+                global $app,$conf;
+
+                // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein
+                if(stristr($this->formDef['db_table'],'.')) {
+                        $escape = '';
+                } else {
+                        $escape = '`';
+                }
+
+                if($action == "UPDATE") {
+                        $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+                        $record_old = $app->db->queryOneRecord($sql);
+                } else {
+                        $record_old = array();
+                }
+
+                $diffrec = array();
+
+                if(is_array($record_new)) {
+                        foreach($record_new as $key => $val) {
+                                if($record_old[$key] != $val) {
+                                        // Datensatz hat sich ge�ndert
+                                        $diffrec[$key] = array('old' => $record_old[$key],
+                                                                           'new' => $val);
+                                }
+                        }
+                }
+				
+				// Insert the server_id, if the record has a server_id
+				$server_id = ($record_old["server_id"] > 0)?$record_old["server_id"]:0;
+
+                if(count($diffrec) > 0) {
+                        
+						// We need the full records in ISPConfig, not only the diffs
+						$diffrec = array(	'old' => $record_old,
+											'new' => $record_new);
+						
+						$diffstr = $app->db->quote(serialize($diffrec));
+                        $username = $app->db->quote($_SESSION["s"]["user"]["username"]);
+                        $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
+                        $action = ($action == 'INSERT')?'i':'u';
+                        $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$this->formDef['db_table']."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+						$app->db->query($sql);
+                }
+
+                return true;
+
+        }
+
+        function getAuthSQL($perm) {
+
+                $sql = '(';
+                $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR  ";
+                $sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
+                $sql .= "sys_perm_other like '%$perm%'";
+                $sql .= ')';
+
+                return $sql;
+        }
+
+        /*
+        Diese funktion �berpr�ft, ob ein User die Berechtigung $perm f�r den Datensatz mit der ID $record_id
+        hat. It record_id = 0, dann wird gegen die user Defaults des Formulares getestet.
+        */
+        function checkPerm($record_id,$perm) {
+                global $app;
+
+                if($record_id > 0) {
+                        // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein
+                        if(stristr($this->formDef['db_table'],'.')) {
+                                $escape = '';
+                        } else {
+                                $escape = '`';
+                        }
+
+                        $sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
+                        if($record = $app->db->queryOneRecord($sql)) {
+                                return true;
+                        } else {
+                                return false;
+                        }
+                } else {
+                        $result = false;
+                        if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
+                        if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
+                        if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
+
+                        // if preset == 0, everyone can insert a record of this type
+                        if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
+
+                        return $result;
+
+                }
+
+        }
+
+        function getNextTab() {
+                // Welcher Tab wird angezeigt
+                if($this->errorMessage == '') {
+                    // wenn kein Fehler vorliegt
+                        if($_REQUEST["next_tab"] != '') {
+                                // wenn n�chster Tab bekannt
+                                $active_tab = $_REQUEST["next_tab"];
+                    } else {
+                        // ansonsten ersten tab nehmen
+                        $active_tab = $this->formDef['tab_default'];
+                    }
+                } else {
+                    // bei Fehlern den gleichen Tab nochmal anzeigen
+                    $active_tab = $_SESSION["s"]["form"]["tab"];
+                }
+
+                return $active_tab;
+        }
+
+        function getCurrentTab() {
+                return $_SESSION["s"]["form"]["tab"];
+        }
+
+}
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/form/rr.tform.php b/interface/web/dns/form/rr.tform.php
index 0ce5037..0b3352a 100644
--- a/interface/web/dns/form/rr.tform.php
+++ b/interface/web/dns/form/rr.tform.php
@@ -1,170 +1,170 @@
-<?php
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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.
-*/
-
-/*
-        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"]                         = "Record";
-$form["description"]         = "";
-$form["name"]                         = "rr";
-$form["action"]                        = "rr_edit.php";
-$form["db_table"]                = "rr";
-$form["db_table_idx"]        = "id";
-$form["db_history"]                = "yes";
-$form["tab_default"]        = "rr";
-$form["list_default"]        = "rr_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"]['rr'] = array (
-        'title'         => "Record",
-        'width'         => 100,
-        'template'         => "templates/rr_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'                => ''
-                ),
-*/
-                'zone' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        'validators'      => array (0 => array ('type' => 'NOTEMPTY',
-                                                                'errmsg'=> 'rr_zone_error_empty'),
-                                                   ),
-                        'default'        => '',
-                        'value'                => '',
-                        'width'                => '30',
-                        'maxlength'        => '255'
-                ),
-                'name' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'TEXT',
-                        'default'        => '',
-                        'value'                => '',
-                        'width'                => '30',
-                        'maxlength'        => '255'
-                ),
-                'type' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'SELECT',
-                        'default'        => '',
-                        'value'                => array('A' => 'A', 'AAAA' => 'AAAA', 'ALIAS' => 'ALIAS', 'CNAME' => 'CNAME', 'HINFO' => 'HINFO', 'MX' => 'MX', 'NS' => 'NS', 'PTR' => 'PTR', 'RP' => 'RP', 'SRV' => 'SRV', 'TXT' => 'TXT')
-                ),
-                'data' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'TEXT',
-                        'validators'      => array (0 => array ('type' => 'NOTEMPTY',
-                                                                'errmsg'=> 'rr_data_error_empty'),
-                                                   ),
-                        'default'        => '',
-                        'value'                => '',
-                        'width'                => '30',
-                        'maxlength'        => '255'
-                ),
-                'aux' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ('type' => 'ISINT',
-                                                                'errmsg'=> 'rr_aux_error_noint'),
-                                                   ),
-                        */
-                        'default'        => '',
-                        'value'                => '',
-                        'width'                => '30',
-                        'maxlength'        => '255'
-                ),
-                'ttl' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ('type' => 'ISPOSITIVE',
-                                                                'errmsg'=> 'rr_ttl_error_notpositive'),
-                                                   ),
-                        */
-                        'default'        => '86400',
-                        'value'                => '86400',
-                        'width'                => '30',
-                        'maxlength'        => '255'
-                ),
-        ##################################
-        # ENDE Datatable fields
-        ##################################
-        )
-);
-
-
+<?php
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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.
+*/
+
+/*
+        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"]          = "Record";
+$form["description"]    = "";
+$form["name"]           = "rr";
+$form["action"]         = "rr_edit.php";
+$form["db_table"]       = "dns_rr";
+$form["db_table_idx"]   = "id";
+$form["db_history"]     = "yes";
+$form["tab_default"]    = "rr";
+$form["list_default"]   = "rr_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"]['rr'] = array (
+        'title'         => "Record",
+        'width'         => 100,
+        'template'         => "templates/rr_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'                => ''
+                ),
+*/
+                'zone' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        'validators'      => array (0 => array ('type' => 'NOTEMPTY',
+                                                                'errmsg'=> 'rr_zone_error_empty'),
+                                                   ),
+                        'default'        => '',
+                        'value'                => '',
+                        'width'                => '30',
+                        'maxlength'        => '255'
+                ),
+                'name' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'TEXT',
+                        'default'        => '',
+                        'value'                => '',
+                        'width'                => '30',
+                        'maxlength'        => '255'
+                ),
+                'type' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'SELECT',
+                        'default'        => '',
+                        'value'                => array('A' => 'A', 'AAAA' => 'AAAA', 'ALIAS' => 'ALIAS', 'CNAME' => 'CNAME', 'HINFO' => 'HINFO', 'MX' => 'MX', 'NS' => 'NS', 'PTR' => 'PTR', 'RP' => 'RP', 'SRV' => 'SRV', 'TXT' => 'TXT')
+                ),
+                'data' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'TEXT',
+                        'validators'      => array (0 => array ('type' => 'NOTEMPTY',
+                                                                'errmsg'=> 'rr_data_error_empty'),
+                                                   ),
+                        'default'        => '',
+                        'value'                => '',
+                        'width'                => '30',
+                        'maxlength'        => '255'
+                ),
+                'aux' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ('type' => 'ISINT',
+                                                                'errmsg'=> 'rr_aux_error_noint'),
+                                                   ),
+                        */
+                        'default'        => '',
+                        'value'                => '',
+                        'width'                => '30',
+                        'maxlength'        => '255'
+                ),
+                'ttl' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ('type' => 'ISPOSITIVE',
+                                                                'errmsg'=> 'rr_ttl_error_notpositive'),
+                                                   ),
+                        */
+                        'default'        => '86400',
+                        'value'                => '86400',
+                        'width'                => '30',
+                        'maxlength'        => '255'
+                ),
+        ##################################
+        # ENDE Datatable fields
+        ##################################
+        )
+);
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/form/soa.tform.php b/interface/web/dns/form/soa.tform.php
index b456a79..e5f961e 100644
--- a/interface/web/dns/form/soa.tform.php
+++ b/interface/web/dns/form/soa.tform.php
@@ -1,258 +1,258 @@
-<?php
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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.
-*/
-
-/*
-        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"]                         = "SOA";
-$form["description"]         = "";
-$form["name"]                         = "soa";
-$form["action"]                        = "soa_edit.php";
-$form["db_table"]                = "soa";
-$form["db_table_idx"]        = "id";
-$form["db_history"]                = "yes";
-$form["tab_default"]        = "soa";
-$form["list_default"]        = "soa_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"]['soa'] = array (
-        'title'         => "SOA",
-        'width'         => 100,
-        'template'         => "templates/soa_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'                => ''
-                ),
-*/
-                'origin' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'TEXT',
-                        'validators'      => array (0 => array ( 'type'        => 'UNIQUE',
-                                                                   'errmsg'=> 'soa_error_unique'),
-                                                   ),
-                        'default'         => '',
-                        'value'           => '',
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'ns' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'NOTEMPTY',
-                                                                   'errmsg'=> 'ns_error_empty'),
-                                                    ),
-                        */
-                        'default'         => $conf['default_ns'],
-                        'value'           => $conf['default_ns'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'mbox' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'NOTEMPTY',
-                                                                   'errmsg'=> 'mbox_error_empty'),
-                                                    ),
-                        */
-                        'default'         => $conf['default_mbox'],
-                        'value'           => $conf['default_mbox'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'serial' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
-                                                                   'errmsg'=> 'serial_error_notpositive'),
-                                                    ),
-                        */
-                        'default'         => date("Ymd").'01',
-                        'value'           => date("Ymd").'01',
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'refresh' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
-                                                                   'errmsg'=> 'refresh_error_notpositive'),
-                                                    ),
-                        */
-                        'default'         => $conf['default_refresh'],
-                        'value'           => $conf['default_refresh'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'retry' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
-                                                                   'errmsg'=> 'retry_error_notpositive'),
-                                                   ),
-                        */
-                        'default'         => $conf['default_retry'],
-                        'value'           => $conf['default_retry'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'expire' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
-                                                                   'errmsg'=> 'expire_error_notpositive'),
-                                                   ),
-                        */
-                        'default'         => $conf['default_expire'],
-                        'value'           => $conf['default_expire'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'minimum' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
-                                                                   'errmsg'=> 'minimum_error_notpositive'),
-                                                   ),
-                        */
-                        'default'         => $conf['default_minimum_ttl'],
-                        'value'           => $conf['default_minimum_ttl'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'ttl' => array (
-                        'datatype'        => 'INTEGER',
-                        'formtype'        => 'TEXT',
-                        /*
-                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
-                                                                   'errmsg'=> 'ttl_error_notpositive'),
-                                                   ),
-                        */
-                        'default'         => $conf['default_ttl'],
-                        'value'           => $conf['default_ttl'],
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-                'active' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'RADIO',
-                        'default'         => 'Y',
-                        'value'           => array('Y' => 'Yes','N'=>'No')
-                ),
-                'xfer' => array (
-                        'datatype'        => 'VARCHAR',
-                        'formtype'        => 'TEXT',
-                        'default'         => '',
-                        'value'           => '',
-                        'width'           => '30',
-                        'maxlength'       => '255'
-                ),
-        ##################################
-        # ENDE Datatable fields
-        ##################################
-        )
-);
-
-$form["tabs"]['rr'] = array (
-        'title'         => "Records",
-        'width'         => 100,
-        'template'         => "templates/soa_edit_rr.htm",
-        'fields'         => array (
-        ##################################
-        # Beginn Datatable fields
-        ##################################
-
-        ##################################
-        # ENDE Datatable fields
-        ##################################
-        ),
-        'plugins' => array (
-                'rr_list' => array (
-                        'class'                 => 'plugin_listview',
-                        'options'                => array('listdef' => 'list/rr.list.php', 'sqlextwhere' => "zone = ".intval($_REQUEST['id']))
-                )
-        )
-);
-
-
+<?php
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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.
+*/
+
+/*
+        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"]            = "SOA";
+$form["description"]      = "";
+$form["name"]             = "soa";
+$form["action"]           = "soa_edit.php";
+$form["db_table"]         = "dns_soa";
+$form["db_table_idx"]     = "id";
+$form["db_history"]       = "yes";
+$form["tab_default"]      = "soa";
+$form["list_default"]     = "soa_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"]['soa'] = array (
+        'title'         => "SOA",
+        'width'         => 100,
+        'template'         => "templates/soa_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'                => ''
+                ),
+*/
+                'origin' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'TEXT',
+                        'validators'      => array (0 => array ( 'type'        => 'UNIQUE',
+                                                                   'errmsg'=> 'soa_error_unique'),
+                                                   ),
+                        'default'         => '',
+                        'value'           => '',
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'ns' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'NOTEMPTY',
+                                                                   'errmsg'=> 'ns_error_empty'),
+                                                    ),
+                        */
+                        'default'         => $conf['default_ns'],
+                        'value'           => $conf['default_ns'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'mbox' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'NOTEMPTY',
+                                                                   'errmsg'=> 'mbox_error_empty'),
+                                                    ),
+                        */
+                        'default'         => $conf['default_mbox'],
+                        'value'           => $conf['default_mbox'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'serial' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
+                                                                   'errmsg'=> 'serial_error_notpositive'),
+                                                    ),
+                        */
+                        'default'         => date("Ymd").'01',
+                        'value'           => date("Ymd").'01',
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'refresh' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
+                                                                   'errmsg'=> 'refresh_error_notpositive'),
+                                                    ),
+                        */
+                        'default'         => $conf['default_refresh'],
+                        'value'           => $conf['default_refresh'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'retry' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
+                                                                   'errmsg'=> 'retry_error_notpositive'),
+                                                   ),
+                        */
+                        'default'         => $conf['default_retry'],
+                        'value'           => $conf['default_retry'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'expire' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
+                                                                   'errmsg'=> 'expire_error_notpositive'),
+                                                   ),
+                        */
+                        'default'         => $conf['default_expire'],
+                        'value'           => $conf['default_expire'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'minimum' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
+                                                                   'errmsg'=> 'minimum_error_notpositive'),
+                                                   ),
+                        */
+                        'default'         => $conf['default_minimum_ttl'],
+                        'value'           => $conf['default_minimum_ttl'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'ttl' => array (
+                        'datatype'        => 'INTEGER',
+                        'formtype'        => 'TEXT',
+                        /*
+                        'validators'      => array (0 => array ( 'type'        => 'ISPOSITIVE',
+                                                                   'errmsg'=> 'ttl_error_notpositive'),
+                                                   ),
+                        */
+                        'default'         => $conf['default_ttl'],
+                        'value'           => $conf['default_ttl'],
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+                'active' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'RADIO',
+                        'default'         => 'Y',
+                        'value'           => array('Y' => 'Yes','N'=>'No')
+                ),
+                'xfer' => array (
+                        'datatype'        => 'VARCHAR',
+                        'formtype'        => 'TEXT',
+                        'default'         => '',
+                        'value'           => '',
+                        'width'           => '30',
+                        'maxlength'       => '255'
+                ),
+        ##################################
+        # ENDE Datatable fields
+        ##################################
+        )
+);
+
+$form["tabs"]['rr'] = array (
+        'title'         => "Records",
+        'width'         => 100,
+        'template'         => "templates/soa_edit_rr.htm",
+        'fields'         => array (
+        ##################################
+        # Beginn Datatable fields
+        ##################################
+
+        ##################################
+        # ENDE Datatable fields
+        ##################################
+        ),
+        'plugins' => array (
+                'rr_list' => array (
+                        'class'                 => 'plugin_listview',
+                        'options'                => array('listdef' => 'list/rr.list.php', 'sqlextwhere' => "zone = ".intval($_REQUEST['id']))
+                )
+        )
+);
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/list/rr.list.php b/interface/web/dns/list/rr.list.php
index 127ffa6..852c515 100644
--- a/interface/web/dns/list/rr.list.php
+++ b/interface/web/dns/list/rr.list.php
@@ -1,131 +1,131 @@
-<?php
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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.
-*/
-
-/*
-        Datatypes:
-        - INTEGER
-        - DOUBLE
-        - CURRENCY
-        - VARCHAR
-        - TEXT
-        - DATE
-*/
-
-
-
-// Name of the list
-$liste["name"]                                 = "rr";
-
-// Database table
-$liste["table"]                         = "rr";
-
-// Index index field of the database table
-$liste["table_idx"]                        = "id";
-
-// Search Field Prefix
-$liste["search_prefix"]         = "search_";
-
-// Records per page
-$liste["records_per_page"]         = 15;
-
-// Script File of the list
-$liste["file"]                                = "rr_list.php";
-
-// Script file of the edit form
-$liste["edit_file"]                        = "rr_edit.php";
-
-// Script File of the delete script
-$liste["delete_file"]                = "rr_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'                => "name",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "like",
-                                                        'prefix'        => "%",
-                                                        'suffix'        => "%",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "type",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "SELECT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => array('A' => 'A', 'AAAA' => 'AAAA', 'ALIAS' => 'ALIAS', 'CNAME' => 'CNAME', 'HINFO' => 'HINFO', 'MX' => 'MX', 'NS' => 'NS', 'PTR' => 'PTR', 'RP' => 'RP', 'SRV' => 'SRV', 'TXT' => 'TXT'));
-
-$liste["item"][] = array(        'field'                => "data",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "like",
-                                                        'prefix'        => "%",
-                                                        'suffix'        => "%",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "aux",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "ttl",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
+<?php
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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.
+*/
+
+/*
+        Datatypes:
+        - INTEGER
+        - DOUBLE
+        - CURRENCY
+        - VARCHAR
+        - TEXT
+        - DATE
+*/
+
+
+
+// Name of the list
+$liste["name"]                                 = "rr";
+
+// Database table
+$liste["table"]                         = "dns_rr";
+
+// Index index field of the database table
+$liste["table_idx"]                        = "id";
+
+// Search Field Prefix
+$liste["search_prefix"]         = "search_";
+
+// Records per page
+$liste["records_per_page"]         = 15;
+
+// Script File of the list
+$liste["file"]                                = "rr_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]                        = "rr_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]                = "rr_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'                => "name",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "like",
+                                                        'prefix'        => "%",
+                                                        'suffix'        => "%",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "type",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "SELECT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => array('A' => 'A', 'AAAA' => 'AAAA', 'ALIAS' => 'ALIAS', 'CNAME' => 'CNAME', 'HINFO' => 'HINFO', 'MX' => 'MX', 'NS' => 'NS', 'PTR' => 'PTR', 'RP' => 'RP', 'SRV' => 'SRV', 'TXT' => 'TXT'));
+
+$liste["item"][] = array(        'field'                => "data",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "like",
+                                                        'prefix'        => "%",
+                                                        'suffix'        => "%",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "aux",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "ttl",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/list/soa.list.php b/interface/web/dns/list/soa.list.php
index c41e88e..fe4bcf5 100644
--- a/interface/web/dns/list/soa.list.php
+++ b/interface/web/dns/list/soa.list.php
@@ -1,178 +1,178 @@
-<?php
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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.
-*/
-
-/*
-        Datatypes:
-        - INTEGER
-        - DOUBLE
-        - CURRENCY
-        - VARCHAR
-        - TEXT
-        - DATE
-*/
-
-
-
-// Name of the list
-$liste["name"]                                 = "soa";
-
-// Database table
-$liste["table"]                         = "soa";
-
-// Index index field of the database table
-$liste["table_idx"]                        = "id";
-
-// Search Field Prefix
-$liste["search_prefix"]         = "search_";
-
-// Records per page
-$liste["records_per_page"]         = 15;
-
-// Script File of the list
-$liste["file"]                                = "soa_list.php";
-
-// Script file of the edit form
-$liste["edit_file"]                        = "soa_edit.php";
-
-// Script File of the delete script
-$liste["delete_file"]                = "soa_del.php";
-
-// Paging Template
-$liste["paging_tpl"]                = "templates/paging.tpl.htm";
-
-// Enable auth
-$liste["auth"]                                = "yes";
-
-/*****************************************************
-* Suchfelder
-*****************************************************/
-
-$liste["item"][] = array(        'field'                => "origin",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "like",
-                                                        'prefix'        => "%",
-                                                        'suffix'        => "%",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "ns",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "like",
-                                                        'prefix'        => "%",
-                                                        'suffix'        => "%",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-/*
-$liste["item"][] = array(        'field'                => "mbox",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "like",
-                                                        'prefix'        => "%",
-                                                        'suffix'        => "%",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "serial",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "refresh",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "retry",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "expire",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "minimum",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-*/
-
-$liste["item"][] = array(        'field'                => "ttl",
-                                                        'datatype'        => "INTEGER",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => "");
-
-$liste["item"][] = array(        'field'                => "active",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "SELECT",
-                                                        'op'                => "=",
-                                                        'prefix'        => "",
-                                                        'suffix'        => "",
-                                                        'width'                => "",
-                                                        'value'                => array('Y' => $app->lng('Yes'), 'N' => $app->lng('No')));
-
-/*
-$liste["item"][] = array(        'field'                => "xfer",
-                                                        'datatype'        => "VARCHAR",
-                                                        'formtype'        => "TEXT",
-                                                        'op'                => "LIKE",
-                                                        'prefix'        => "%",
-                                                        'suffix'        => "%",
-                                                        'width'                => "",
-                                                        'value'                => "");
-*/
+<?php
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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.
+*/
+
+/*
+        Datatypes:
+        - INTEGER
+        - DOUBLE
+        - CURRENCY
+        - VARCHAR
+        - TEXT
+        - DATE
+*/
+
+
+
+// Name of the list
+$liste["name"]                                 = "soa";
+
+// Database table
+$liste["table"]                         = "dns_soa";
+
+// Index index field of the database table
+$liste["table_idx"]                        = "id";
+
+// Search Field Prefix
+$liste["search_prefix"]         = "search_";
+
+// Records per page
+$liste["records_per_page"]         = 15;
+
+// Script File of the list
+$liste["file"]                                = "soa_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]                        = "soa_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]                = "soa_del.php";
+
+// Paging Template
+$liste["paging_tpl"]                = "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"]                                = "yes";
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(        'field'                => "origin",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "like",
+                                                        'prefix'        => "%",
+                                                        'suffix'        => "%",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "ns",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "like",
+                                                        'prefix'        => "%",
+                                                        'suffix'        => "%",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+/*
+$liste["item"][] = array(        'field'                => "mbox",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "like",
+                                                        'prefix'        => "%",
+                                                        'suffix'        => "%",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "serial",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "refresh",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "retry",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "expire",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "minimum",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+*/
+
+$liste["item"][] = array(        'field'                => "ttl",
+                                                        'datatype'        => "INTEGER",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => "");
+
+$liste["item"][] = array(        'field'                => "active",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "SELECT",
+                                                        'op'                => "=",
+                                                        'prefix'        => "",
+                                                        'suffix'        => "",
+                                                        'width'                => "",
+                                                        'value'                => array('Y' => $app->lng('Yes'), 'N' => $app->lng('No')));
+
+/*
+$liste["item"][] = array(        'field'                => "xfer",
+                                                        'datatype'        => "VARCHAR",
+                                                        'formtype'        => "TEXT",
+                                                        'op'                => "LIKE",
+                                                        'prefix'        => "%",
+                                                        'suffix'        => "%",
+                                                        'width'                => "",
+                                                        'value'                => "");
+*/
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/rr_del.php b/interface/web/dns/rr_del.php
index e181221..af379b0 100644
--- a/interface/web/dns/rr_del.php
+++ b/interface/web/dns/rr_del.php
@@ -1,139 +1,139 @@
-<?php
-
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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/rr.list.php";
-$tform_def_file = "form/rr.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;
-}
-
-// Loading classes
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
-        function onDelete() {
-                global $app, $conf;
-
-                $app->uses('tform');
-                if(!$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->lng('error_no_permission'));
-
-                //$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']);
-                $zone_id = $rr['zone'];
-
-                // update serial
-                $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$zone_id);
-                $serial = $soa['serial'];
-                $update = 1;
-
-                if($update > 0){
-                  $serial_date = substr($serial, 0, 8);
-                  $count = intval(substr($serial, 8, 2));
-                  $current_date = date("Ymd");
-                  if($serial_date == $current_date){
-                    $count += 1;
-                    $count = str_pad($count, 2, "0", STR_PAD_LEFT);
-                    $new_serial = $current_date.$count;
-                  } else {
-                    $new_serial = $current_date.'01';
-                  }
-                  $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$zone_id);
-                }
-
-                // PTR
-                if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-                  if($rr['type'] == 'A' || $rr['type'] == 'AAAA'){
-                    list($a, $b, $c, $d) = explode('.', $rr['data']);
-                    $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
-                    if(substr($rr['name'], -1) == '.'){
-                      $ptr_soa_rr_data = $rr['name'];
-                    } else {
-                      $ptr_soa_rr_data = $rr['name'].(trim($rr['name']) == '' ? '' : '.').$soa['origin'];
-                    }
-                    if($ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){
-                      if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){
-                        $app->db->query("DELETE FROM rr WHERE id = ".$ptr_soa_rr_exist['id']);
-                        // is there another A/AAAA record with that IP address?
-                        if($other_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id'])){
-                          $other_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$other_rr['zone']);
-                          if(substr($other_rr['name'], -1) == '.'){
-                            $other_ptr_soa_rr_data = $other_rr['name'];
-                          } else {
-                            $other_ptr_soa_rr_data = $other_rr['name'].(trim($other_rr['name']) == '' ? '' : '.').$other_soa['origin'];
-                          }
-                          $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                        }
-
-                        // if no more records exist for the ptr_soa, delete it
-                        if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."'")){
-                          $app->db->query("DELETE FROM soa WHERE id = ".$ptr_soa_exist['id']);
-                        } else { // increment serial
-                          $serial_date = substr($ptr_soa_exist['serial'], 0, 8);
-                          $count = intval(substr($ptr_soa_exist['serial'], 8, 2));
-                          $current_date = date("Ymd");
-                          if($serial_date == $current_date){
-                            $count += 1;
-                            $count = str_pad($count, 2, "0", STR_PAD_LEFT);
-                            $new_serial = $current_date.$count;
-                          } else {
-                            $new_serial = $current_date.'01';
-                          }
-                          $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']);
-                        }
-                      }
-                    }
-                  }
-                }
-
-
-                parent::onDelete();
-        }
-
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onDelete();
-
-
+<?php
+
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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/rr.list.php";
+$tform_def_file = "form/rr.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;
+}
+
+// Loading classes
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+        function onDelete() {
+                global $app, $conf;
+
+                $app->uses('tform');
+                if(!$rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->lng('error_no_permission'));
+
+                //$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']);
+                $zone_id = $rr['zone'];
+
+                // update serial
+                $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$zone_id);
+                $serial = $soa['serial'];
+                $update = 1;
+
+                if($update > 0){
+                  $serial_date = substr($serial, 0, 8);
+                  $count = intval(substr($serial, 8, 2));
+                  $current_date = date("Ymd");
+                  if($serial_date == $current_date){
+                    $count += 1;
+                    $count = str_pad($count, 2, "0", STR_PAD_LEFT);
+                    $new_serial = $current_date.$count;
+                  } else {
+                    $new_serial = $current_date.'01';
+                  }
+                  $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$zone_id);
+                }
+
+                // PTR
+                if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+                  if($rr['type'] == 'A' || $rr['type'] == 'AAAA'){
+                    list($a, $b, $c, $d) = explode('.', $rr['data']);
+                    $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+                    if(substr($rr['name'], -1) == '.'){
+                      $ptr_soa_rr_data = $rr['name'];
+                    } else {
+                      $ptr_soa_rr_data = $rr['name'].(trim($rr['name']) == '' ? '' : '.').$soa['origin'];
+                    }
+                    if($ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$ptr_soa."'")){
+                      if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){
+                        $app->db->query("DELETE FROM rr WHERE id = ".$ptr_soa_rr_exist['id']);
+                        // is there another A/AAAA record with that IP address?
+                        if($other_rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id'])){
+                          $other_soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$other_rr['zone']);
+                          if(substr($other_rr['name'], -1) == '.'){
+                            $other_ptr_soa_rr_data = $other_rr['name'];
+                          } else {
+                            $other_ptr_soa_rr_data = $other_rr['name'].(trim($other_rr['name']) == '' ? '' : '.').$other_soa['origin'];
+                          }
+                          $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                        }
+
+                        // if no more records exist for the ptr_soa, delete it
+                        if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."'")){
+                          $app->db->query("DELETE FROM dns_soa WHERE id = ".$ptr_soa_exist['id']);
+                        } else { // increment serial
+                          $serial_date = substr($ptr_soa_exist['serial'], 0, 8);
+                          $count = intval(substr($ptr_soa_exist['serial'], 8, 2));
+                          $current_date = date("Ymd");
+                          if($serial_date == $current_date){
+                            $count += 1;
+                            $count = str_pad($count, 2, "0", STR_PAD_LEFT);
+                            $new_serial = $current_date.$count;
+                          } else {
+                            $new_serial = $current_date.'01';
+                          }
+                          $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']);
+                        }
+                      }
+                    }
+                  }
+                }
+
+
+                parent::onDelete();
+        }
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onDelete();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/rr_edit.php b/interface/web/dns/rr_edit.php
index 2686b2a..369183c 100644
--- a/interface/web/dns/rr_edit.php
+++ b/interface/web/dns/rr_edit.php
@@ -1,186 +1,186 @@
-<?php
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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/rr.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');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
-
-        function onSubmit() {
-                global $app, $conf;
-
-                if($this->dataRecord['id'] > 0){
-                  if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
-                } else {
-                  if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
-                }
-
-                $this->dataRecord["zone"] = $_SESSION['s']['list']['rr']['parent_id'];
-
-                $app->uses('validate_dns');
-                $app->tform->errorMessage .= $app->validate_dns->validate_rr($this->dataRecord);
-
-                $increased_serials[] = -1;
-                if($app->tform->errorMessage == ''){
-                  // update serial
-                  $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$this->dataRecord["zone"]);
-                  $serial = $soa['serial'];
-                  $update = 0;
-                  if($old_record = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$this->dataRecord["id"])){
-                    foreach($old_record as $key => $val){
-                      if($this->dataRecord[$key] != $val && isset($this->dataRecord[$key])) $update += 1;
-                    }
-                  } else { // new record
-                    $update = 1;
-                  }
-
-                  if($update > 0 && !in_array($soa['id'], $increased_serials)){
-                    $new_serial = $app->validate_dns->increase_serial($serial);
-                    $increased_serials[] = $soa['id'];
-                    $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$this->dataRecord["zone"]);
-                  }
-
-                  // PTR
-                  if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-                    if($this->dataRecord['type'] == 'A' || $this->dataRecord['type'] == 'AAAA'){
-                      list($a, $b, $c, $d) = explode('.', $this->dataRecord['data']);
-                      $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
-                      if(substr($this->dataRecord['name'], -1) == '.'){
-                        $ptr_soa_rr_data = $this->dataRecord['name'];
-                      } else {
-                        $ptr_soa_rr_data = $this->dataRecord['name'].(trim($this->dataRecord['name']) == '' ? '' : '.').$soa['origin'];
-                      }
-
-                      if(!$ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){
-                        $app->db->query("INSERT INTO soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa."', '".trim($conf['default_ns'])."', '".trim($conf['default_mbox'])."', '".date("Ymd").'01'."', '".$conf['default_refresh']."', '".$conf['default_retry']."', '".$conf['default_expire']."', '".$conf['default_minimum_ttl']."', '".$conf['default_ttl']."', 'Y', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                        $ptr_soa_id = $app->db->insertID();
-                        $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                      } else {
-                        if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']);
-                        if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){
-                          $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                          // increase serial of PTR SOA
-                          if(!in_array($ptr_soa_exist['id'], $increased_serials)){
-                            $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
-                            $increased_serials[] = $ptr_soa_exist['id'];
-                            $app->db->query("UPDATE soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']);
-                          }
-                        }
-                      }
-
-                      // if IP address changes, delete/change old PTR record
-                      if(!empty($old_record)){
-
-
-
-
-                        list($oa, $ob, $oc, $od) = explode('.', $old_record['data']);
-                        $old_ptr_soa = $oc.'.'.$ob.'.'.$oa.'.in-addr.arpa.';
-                        $old_ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$old_ptr_soa."'");
-                        if(substr($old_record['name'], -1) == '.'){
-                          $old_ptr_soa_rr_data = $old_record['name'];
-                        } else {
-                          $old_ptr_soa_rr_data = $old_record['name'].(trim($old_record['name']) == '' ? '' : '.').$soa['origin'];
-                        }
-                        if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR' AND data = '".$old_ptr_soa_rr_data."'")){
-                          parent::onSubmit();
-                          return true;
-                        }
-
-                        if($old_record['data'] == $this->dataRecord['data']){
-                          $a_rr_with_same_ip = $this->dataRecord;
-                          $a_rr_with_same_ip['origin'] = $soa['origin'];
-                        } else {
-                          $a_rr_with_same_ip = $app->db->queryOneRecord("SELECT rr.*, soa.origin FROM rr, soa WHERE rr.type = 'A' AND rr.data = '".$old_record['data']."' AND rr.zone = soa.id AND soa.active = 'Y' AND rr.id != ".$this->dataRecord["id"]);
-                        }
-
-                        if($a_rr_with_same_ip){
-                          if(substr($a_rr_with_same_ip['name'], -1) == '.'){
-                            $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
-                          } else {
-                            $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
-                          }
-                          $app->db->query("UPDATE rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
-                          // increase serial
-                          if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
-                            $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
-                            $increased_serials[] = $old_ptr_soa_exist['id'];
-                            $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
-                          }
-                        } else {
-                          $app->db->query("DELETE FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
-                          if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."'")){
-                            $app->db->query("DELETE FROM soa WHERE id = ".$old_ptr_soa_exist['id']);
-                          } else {
-                            // increase serial
-                            if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
-                              $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
-                              $increased_serials[] = $old_ptr_soa_exist['id'];
-                              $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
-                            }
-                          }
-                        }
-                      }
-
-                    }
-                  }
-                }
-
-
-                parent::onSubmit();
-        }
-
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onLoad();
-
+<?php
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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/rr.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');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+
+        function onSubmit() {
+                global $app, $conf;
+
+                if($this->dataRecord['id'] > 0){
+                  if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
+                } else {
+                  if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
+                }
+
+                $this->dataRecord["zone"] = $_SESSION['s']['list']['rr']['parent_id'];
+
+                $app->uses('validate_dns');
+                $app->tform->errorMessage .= $app->validate_dns->validate_rr($this->dataRecord);
+
+                $increased_serials[] = -1;
+                if($app->tform->errorMessage == ''){
+                  // update serial
+                  $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$this->dataRecord["zone"]);
+                  $serial = $soa['serial'];
+                  $update = 0;
+                  if($old_record = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE id = ".$this->dataRecord["id"])){
+                    foreach($old_record as $key => $val){
+                      if($this->dataRecord[$key] != $val && isset($this->dataRecord[$key])) $update += 1;
+                    }
+                  } else { // new record
+                    $update = 1;
+                  }
+
+                  if($update > 0 && !in_array($soa['id'], $increased_serials)){
+                    $new_serial = $app->validate_dns->increase_serial($serial);
+                    $increased_serials[] = $soa['id'];
+                    $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$this->dataRecord["zone"]);
+                  }
+
+                  // PTR
+                  if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+                    if($this->dataRecord['type'] == 'A' || $this->dataRecord['type'] == 'AAAA'){
+                      list($a, $b, $c, $d) = explode('.', $this->dataRecord['data']);
+                      $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+                      if(substr($this->dataRecord['name'], -1) == '.'){
+                        $ptr_soa_rr_data = $this->dataRecord['name'];
+                      } else {
+                        $ptr_soa_rr_data = $this->dataRecord['name'].(trim($this->dataRecord['name']) == '' ? '' : '.').$soa['origin'];
+                      }
+
+                      if(!$ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$ptr_soa."'")){
+                        $app->db->query("INSERT INTO dns_soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa."', '".trim($conf['default_ns'])."', '".trim($conf['default_mbox'])."', '".date("Ymd").'01'."', '".$conf['default_refresh']."', '".$conf['default_retry']."', '".$conf['default_expire']."', '".$conf['default_minimum_ttl']."', '".$conf['default_ttl']."', 'Y', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                        $ptr_soa_id = $app->db->insertID();
+                        $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                      } else {
+                        if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE dns_soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']);
+                        if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){
+                          $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                          // increase serial of PTR SOA
+                          if(!in_array($ptr_soa_exist['id'], $increased_serials)){
+                            $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
+                            $increased_serials[] = $ptr_soa_exist['id'];
+                            $app->db->query("UPDATE dns_soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']);
+                          }
+                        }
+                      }
+
+                      // if IP address changes, delete/change old PTR record
+                      if(!empty($old_record)){
+
+
+
+
+                        list($oa, $ob, $oc, $od) = explode('.', $old_record['data']);
+                        $old_ptr_soa = $oc.'.'.$ob.'.'.$oa.'.in-addr.arpa.';
+                        $old_ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$old_ptr_soa."'");
+                        if(substr($old_record['name'], -1) == '.'){
+                          $old_ptr_soa_rr_data = $old_record['name'];
+                        } else {
+                          $old_ptr_soa_rr_data = $old_record['name'].(trim($old_record['name']) == '' ? '' : '.').$soa['origin'];
+                        }
+                        if(!$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR' AND data = '".$old_ptr_soa_rr_data."'")){
+                          parent::onSubmit();
+                          return true;
+                        }
+
+                        if($old_record['data'] == $this->dataRecord['data']){
+                          $a_rr_with_same_ip = $this->dataRecord;
+                          $a_rr_with_same_ip['origin'] = $soa['origin'];
+                        } else {
+                          $a_rr_with_same_ip = $app->db->queryOneRecord("SELECT dns_rr.*, dns_soa.origin FROM dns_rr, dns_soa WHERE dns_rr.type = 'A' AND dns_rr.data = '".$old_record['data']."' AND dns_rr.zone = dns_soa.id AND dns_soa.active = 'Y' AND dns_rr.id != ".$this->dataRecord["id"]);
+                        }
+
+                        if($a_rr_with_same_ip){
+                          if(substr($a_rr_with_same_ip['name'], -1) == '.'){
+                            $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
+                          } else {
+                            $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
+                          }
+                          $app->db->query("UPDATE dns_rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
+                          // increase serial
+                          if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
+                            $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
+                            $increased_serials[] = $old_ptr_soa_exist['id'];
+                            $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
+                          }
+                        } else {
+                          $app->db->query("DELETE FROM dns_rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
+                          if(!$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$old_ptr_soa_exist['id']."'")){
+                            $app->db->query("DELETE FROM dns_soa WHERE id = ".$old_ptr_soa_exist['id']);
+                          } else {
+                            // increase serial
+                            if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
+                              $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
+                              $increased_serials[] = $old_ptr_soa_exist['id'];
+                              $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
+                            }
+                          }
+                        }
+                      }
+
+                    }
+                  }
+                }
+
+
+                parent::onSubmit();
+        }
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/soa_del.php b/interface/web/dns/soa_del.php
index 20aed64..049bbef 100644
--- a/interface/web/dns/soa_del.php
+++ b/interface/web/dns/soa_del.php
@@ -1,122 +1,122 @@
-<?php
-
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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/soa.list.php";
-$tform_def_file = "form/soa.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;
-}
-
-// Loading classes
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
-        function onDelete() {
-                global $app, $conf;
-
-                $app->uses('tform');
-                if(!$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->tform->wordbook['error_no_permission']);
-
-                // PTR
-                if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-                  //$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']);
-                  $rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = '".$_REQUEST['id']."' AND (type = 'A' OR type = 'AAAA')");
-                  if(!empty($rrs)){
-                    foreach($rrs as $rr){
-                      list($a, $b, $c, $d) = explode('.', $rr['data']);
-                      $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
-                      if(substr($rr['name'], -1) == '.'){
-                        $ptr_soa_rr_data = $rr['name'];
-                      } else {
-                        $ptr_soa_rr_data = $rr['name'].(trim($rr['name']) == '' ? '' : '.').$soa['origin'];
-                      }
-                      if($ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){
-                        if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){
-                          $app->db->query("DELETE FROM rr WHERE id = ".$ptr_soa_rr_exist['id']);
-                          // is there another A/AAAA record with that IP address?
-                          if($other_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id']." AND zone != ".$rr['zone'])){
-                            $other_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$other_rr['zone']);
-                            if(substr($other_rr['name'], -1) == '.'){
-                              $other_ptr_soa_rr_data = $other_rr['name'];
-                            } else {
-                              $other_ptr_soa_rr_data = $other_rr['name'].(trim($other_rr['name']) == '' ? '' : '.').$other_soa['origin'];
-                            }
-                            $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                          }
-
-                          // if no more records exist for the ptr_soa, delete it
-                          if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."'")){
-                            $app->db->query("DELETE FROM soa WHERE id = ".$ptr_soa_exist['id']);
-                          } else { // increment serial
-                            $serial_date = substr($ptr_soa_exist['serial'], 0, 8);
-                            $count = intval(substr($ptr_soa_exist['serial'], 8, 2));
-                            $current_date = date("Ymd");
-                            if($serial_date == $current_date){
-                              $count += 1;
-                              $count = str_pad($count, 2, "0", STR_PAD_LEFT);
-                              $new_serial = $current_date.$count;
-                            } else {
-                              $new_serial = $current_date.'01';
-                            }
-                            $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']);
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-
-                // delete associated records
-                $app->db->query("DELETE FROM rr WHERE zone = ".$_REQUEST['id']);
-
-                parent::onDelete();
-        }
-
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onDelete();
-
+<?php
+
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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/soa.list.php";
+$tform_def_file = "form/soa.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;
+}
+
+// Loading classes
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+        function onDelete() {
+                global $app, $conf;
+
+                $app->uses('tform');
+                if(!$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->tform->wordbook['error_no_permission']);
+
+                // PTR
+                if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+                  //$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']);
+                  $rrs = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = '".$_REQUEST['id']."' AND (type = 'A' OR type = 'AAAA')");
+                  if(!empty($rrs)){
+                    foreach($rrs as $rr){
+                      list($a, $b, $c, $d) = explode('.', $rr['data']);
+                      $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+                      if(substr($rr['name'], -1) == '.'){
+                        $ptr_soa_rr_data = $rr['name'];
+                      } else {
+                        $ptr_soa_rr_data = $rr['name'].(trim($rr['name']) == '' ? '' : '.').$soa['origin'];
+                      }
+                      if($ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$ptr_soa."'")){
+                        if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){
+                          $app->db->query("DELETE FROM dns_rr WHERE id = ".$ptr_soa_rr_exist['id']);
+                          // is there another A/AAAA record with that IP address?
+                          if($other_rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id']." AND zone != ".$rr['zone'])){
+                            $other_soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$other_rr['zone']);
+                            if(substr($other_rr['name'], -1) == '.'){
+                              $other_ptr_soa_rr_data = $other_rr['name'];
+                            } else {
+                              $other_ptr_soa_rr_data = $other_rr['name'].(trim($other_rr['name']) == '' ? '' : '.').$other_soa['origin'];
+                            }
+                            $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                          }
+
+                          // if no more records exist for the ptr_soa, delete it
+                          if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."'")){
+                            $app->db->query("DELETE FROM dns_soa WHERE id = ".$ptr_soa_exist['id']);
+                          } else { // increment serial
+                            $serial_date = substr($ptr_soa_exist['serial'], 0, 8);
+                            $count = intval(substr($ptr_soa_exist['serial'], 8, 2));
+                            $current_date = date("Ymd");
+                            if($serial_date == $current_date){
+                              $count += 1;
+                              $count = str_pad($count, 2, "0", STR_PAD_LEFT);
+                              $new_serial = $current_date.$count;
+                            } else {
+                              $new_serial = $current_date.'01';
+                            }
+                            $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']);
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+
+                // delete associated records
+                $app->db->query("DELETE FROM dns_rr WHERE zone = ".$_REQUEST['id']);
+
+                parent::onDelete();
+        }
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onDelete();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/dns/soa_edit.php b/interface/web/dns/soa_edit.php
index 413062d..d7dfd38 100644
--- a/interface/web/dns/soa_edit.php
+++ b/interface/web/dns/soa_edit.php
@@ -1,231 +1,231 @@
-<?php
-/*
-Copyright (c) 2005, Till Brehm, Falko Timme, 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/soa.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');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
-        function onSubmit() {
-                global $app, $conf;
-
-                if($app->tform->getCurrentTab() == 'rr'){
-                  parent::onSubmit();
-                  return true;
-                }
-
-                if($this->dataRecord['id'] > 0){
-                  if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
-                } else {
-                  if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
-                }
-
-                $app->uses('validate_dns');
-                $app->tform->errorMessage .= $app->validate_dns->validate_soa($this->dataRecord);
-
-                $increased_serials[] = -1;
-                // update serial
-                $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$this->dataRecord["id"]);
-                $serial = $soa['serial'];
-                $update = 0;
-                if($soa){
-                  foreach($soa as $key => $val){
-                    if($this->dataRecord[$key] != $val && $key != 'active' && isset($this->dataRecord[$key])) $update += 1;
-                  }
-                } else { // new record
-                  $update = 1;
-                }
-                if(strlen($this->dataRecord["serial"]) == 10 && intval($this->dataRecord["serial"]) == $this->dataRecord["serial"] && $this->dataRecord["serial"] != $serial){
-                  $update = 0;
-                  $increased_serials[] = $soa['id'];
-                }
-                if($update > 0){
-                  $new_serial = $app->validate_dns->increase_serial($serial);
-                  $increased_serials[] = $soa['id'];
-                  $this->dataRecord["serial"] = $new_serial;
-                }
-
-                if($soa){
-                  // update rr if origin has changed
-                  if($soa['origin'] != $this->dataRecord['origin']){
-
-                    if($rrs = $app->db->queryAllRecords("SELECT * FROM rr")){
-                      $update_soas = array();
-                      foreach($rrs as $rr){
-                        if($soa['origin'] == substr($rr['name'], -(strlen($soa['origin']))) || $soa['origin'] == substr($rr['data'], -(strlen($soa['origin'])))) $update_soas[] = $rr['zone'];
-                        //$update_soas[] = $app->db->queryAllRecords("SELECT DISTINCT zone FROM rr WHERE name LIKE '%".$soa['origin']."' OR data LIKE '%".$soa['origin']."'");
-
-                        $app->db->query("UPDATE rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type != 'PTR' AND id = ".$rr['id']);
-
-                        $app->db->query("UPDATE rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type != 'PTR' AND id = ".$rr['id']);
-
-                        if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-                          $app->db->query("UPDATE rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type = 'PTR' AND id = ".$rr['id']);
-
-                          $app->db->query("UPDATE rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type = 'PTR' AND id = ".$rr['id']);
-
-                        }
-                      }
-
-                      // increase serial
-                      if(!empty($update_soas)){
-                        $update_soas = array_unique($update_soas);
-                        foreach($update_soas as $update_soa){
-                          $u_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$update_soa);
-                          if(!in_array($u_soa['id'], $increased_serials)){
-                            $new_serial = $app->validate_dns->increase_serial($u_soa['serial']);
-                            if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-                              $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$update_soa);
-                            } else {
-                              $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$update_soa." AND origin NOT LIKE '%.in-addr.arpa.'");
-                            }
-                            $increased_serials[] = $u_soa['id'];
-                          }
-                        }
-                      }
-                    }
-                  }
-
-
-                  // PTR
-                  if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-
-                    if($soa['active'] = 'Y' && $this->dataRecord['active'][0] == 'N'){
-
-                      if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
-                        foreach($soa_rrs as $soa_rr){
-                          if(substr($soa_rr['name'], -1) == '.'){
-                            $fqdn = $soa_rr['name'];
-                          } else {
-                            $fqdn = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
-                          }
-                          list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
-                          $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
-                          if($ptr = $app->db->queryOneRecord("SELECT soa.id, soa.serial FROM soa, rr WHERE rr.type = 'PTR' AND rr.data = '".$fqdn."' AND rr.zone = soa.id AND soa.origin = '".$ptr_soa."'")){
-                            ############
-                            if($a_rr_with_same_ip = $app->db->queryOneRecord("SELECT rr.*, soa.origin FROM rr, soa WHERE rr.type = 'A' AND rr.data = '".$soa_rr['data']."' AND rr.zone = soa.id AND soa.active = 'Y' AND rr.id != ".$soa_rr["id"]." AND rr.zone != '".$this->dataRecord['zone']."'")){
-                              if(substr($a_rr_with_same_ip['name'], -1) == '.'){
-                                $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
-                              } else {
-                                $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
-                              }
-                              $app->db->query("UPDATE rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
-                            } else {
-                              $app->db->query("DELETE FROM rr WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
-
-                              if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr['id']."'")){
-                                $app->db->query("DELETE FROM soa WHERE id = ".$ptr['id']);
-                              } else {
-                                // increase serial
-                                if(!in_array($ptr['id'], $increased_serials)){
-                                  $new_serial = $app->validate_dns->increase_serial($ptr['serial']);
-                                  $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$ptr['id']);
-                                  $increased_serials[] = $ptr['id'];
-                                }
-                              }
-                            }
-                            ############
-                          }
-                        }
-                      }
-
-                     /* */
-
-
-                    }
-
-                    if($soa['active'] = 'N' && $this->dataRecord['active'][0] == 'Y'){
-
-                      if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
-                        foreach($soa_rrs as $soa_rr){
-                          #################
-                          list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
-                          $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
-                          if(substr($soa_rr['name'], -1) == '.'){
-                            $ptr_soa_rr_data = $soa_rr['name'];
-                          } else {
-                            $ptr_soa_rr_data = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
-                          }
-
-                          if(!$ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){
-                            $app->db->query("INSERT INTO soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa."', '".trim($conf['default_ns'])."', '".trim($conf['default_mbox'])."', '".date("Ymd").'01'."', '".$conf['default_refresh']."', '".$conf['default_retry']."', '".$conf['default_expire']."', '".$conf['default_minimum_ttl']."', '".$conf['default_ttl']."', 'Y', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                            $ptr_soa_id = $app->db->insertID();
-                            $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                          } else {
-                            if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']);
-                            if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){
-                              $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
-                              // increase serial of PTR SOA
-                              if(!in_array($ptr_soa_exist['id'], $increased_serials)){
-                                $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
-                                $increased_serials[] = $ptr_soa_exist['id'];
-                                $app->db->query("UPDATE soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']);
-                              }
-                            }
-                          }
-                          ################
-                        }
-                      }
-
-
-                    }
-                  }
-                }
-
-
-                parent::onSubmit();
-        }
-
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onLoad();
-
+<?php
+/*
+Copyright (c) 2005, Till Brehm, Falko Timme, 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/soa.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');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+        function onSubmit() {
+                global $app, $conf;
+
+                if($app->tform->getCurrentTab() == 'rr'){
+                  parent::onSubmit();
+                  return true;
+                }
+
+                if($this->dataRecord['id'] > 0){
+                  if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
+                } else {
+                  if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
+                }
+
+                $app->uses('validate_dns');
+                $app->tform->errorMessage .= $app->validate_dns->validate_soa($this->dataRecord);
+
+                $increased_serials[] = -1;
+                // update serial
+                $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$this->dataRecord["id"]);
+                $serial = $soa['serial'];
+                $update = 0;
+                if($soa){
+                  foreach($soa as $key => $val){
+                    if($this->dataRecord[$key] != $val && $key != 'active' && isset($this->dataRecord[$key])) $update += 1;
+                  }
+                } else { // new record
+                  $update = 1;
+                }
+                if(strlen($this->dataRecord["serial"]) == 10 && intval($this->dataRecord["serial"]) == $this->dataRecord["serial"] && $this->dataRecord["serial"] != $serial){
+                  $update = 0;
+                  $increased_serials[] = $soa['id'];
+                }
+                if($update > 0){
+                  $new_serial = $app->validate_dns->increase_serial($serial);
+                  $increased_serials[] = $soa['id'];
+                  $this->dataRecord["serial"] = $new_serial;
+                }
+
+                if($soa){
+                  // update rr if origin has changed
+                  if($soa['origin'] != $this->dataRecord['origin']){
+
+                    if($rrs = $app->db->queryAllRecords("SELECT * FROM dns_rr")){
+                      $update_soas = array();
+                      foreach($rrs as $rr){
+                        if($soa['origin'] == substr($rr['name'], -(strlen($soa['origin']))) || $soa['origin'] == substr($rr['data'], -(strlen($soa['origin'])))) $update_soas[] = $rr['zone'];
+                        //$update_soas[] = $app->db->queryAllRecords("SELECT DISTINCT zone FROM rr WHERE name LIKE '%".$soa['origin']."' OR data LIKE '%".$soa['origin']."'");
+
+                        $app->db->query("UPDATE dns_rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type != 'PTR' AND id = ".$rr['id']);
+
+                        $app->db->query("UPDATE dns_rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type != 'PTR' AND id = ".$rr['id']);
+
+                        if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+                          $app->db->query("UPDATE dns_rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type = 'PTR' AND id = ".$rr['id']);
+
+                          $app->db->query("UPDATE dns_rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type = 'PTR' AND id = ".$rr['id']);
+
+                        }
+                      }
+
+                      // increase serial
+                      if(!empty($update_soas)){
+                        $update_soas = array_unique($update_soas);
+                        foreach($update_soas as $update_soa){
+                          $u_soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$update_soa);
+                          if(!in_array($u_soa['id'], $increased_serials)){
+                            $new_serial = $app->validate_dns->increase_serial($u_soa['serial']);
+                            if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+                              $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$update_soa);
+                            } else {
+                              $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$update_soa." AND origin NOT LIKE '%.in-addr.arpa.'");
+                            }
+                            $increased_serials[] = $u_soa['id'];
+                          }
+                        }
+                      }
+                    }
+                  }
+
+
+                  // PTR
+                  if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+
+                    if($soa['active'] = 'Y' && $this->dataRecord['active'][0] == 'N'){
+
+                      if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
+                        foreach($soa_rrs as $soa_rr){
+                          if(substr($soa_rr['name'], -1) == '.'){
+                            $fqdn = $soa_rr['name'];
+                          } else {
+                            $fqdn = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
+                          }
+                          list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
+                          $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+                          if($ptr = $app->db->queryOneRecord("SELECT dns_soa.id, dns_soa.serial FROM dns_soa, dns_rr WHERE dns_rr.type = 'PTR' AND dns_rr.data = '".$fqdn."' AND dns_rr.zone = dns_soa.id AND dns_soa.origin = '".$ptr_soa."'")){
+                            ############
+                            if($a_rr_with_same_ip = $app->db->queryOneRecord("SELECT dns_rr.*, dns_soa.origin FROM dns_rr, dns_soa WHERE dns_rr.type = 'A' AND dns_rr.data = '".$soa_rr['data']."' AND dns_rr.zone = dns_soa.id AND dns_soa.active = 'Y' AND dns_rr.id != ".$soa_rr["id"]." AND dns_rr.zone != '".$this->dataRecord['zone']."'")){
+                              if(substr($a_rr_with_same_ip['name'], -1) == '.'){
+                                $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
+                              } else {
+                                $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
+                              }
+                              $app->db->query("UPDATE dns_rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
+                            } else {
+                              $app->db->query("DELETE FROM dns_rr WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
+
+                              if(!$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr['id']."'")){
+                                $app->db->query("DELETE FROM dns_soa WHERE id = ".$ptr['id']);
+                              } else {
+                                // increase serial
+                                if(!in_array($ptr['id'], $increased_serials)){
+                                  $new_serial = $app->validate_dns->increase_serial($ptr['serial']);
+                                  $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$ptr['id']);
+                                  $increased_serials[] = $ptr['id'];
+                                }
+                              }
+                            }
+                            ############
+                          }
+                        }
+                      }
+
+                     /* */
+
+
+                    }
+
+                    if($soa['active'] = 'N' && $this->dataRecord['active'][0] == 'Y'){
+
+                      if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
+                        foreach($soa_rrs as $soa_rr){
+                          #################
+                          list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
+                          $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+                          if(substr($soa_rr['name'], -1) == '.'){
+                            $ptr_soa_rr_data = $soa_rr['name'];
+                          } else {
+                            $ptr_soa_rr_data = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
+                          }
+
+                          if(!$ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$ptr_soa."'")){
+                            $app->db->query("INSERT INTO dns_soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa."', '".trim($conf['default_ns'])."', '".trim($conf['default_mbox'])."', '".date("Ymd").'01'."', '".$conf['default_refresh']."', '".$conf['default_retry']."', '".$conf['default_expire']."', '".$conf['default_minimum_ttl']."', '".$conf['default_ttl']."', 'Y', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                            $ptr_soa_id = $app->db->insertID();
+                            $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                          } else {
+                            if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE dns_soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']);
+                            if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){
+                              $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+                              // increase serial of PTR SOA
+                              if(!in_array($ptr_soa_exist['id'], $increased_serials)){
+                                $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
+                                $increased_serials[] = $ptr_soa_exist['id'];
+                                $app->db->query("UPDATE dns_soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']);
+                              }
+                            }
+                          }
+                          ################
+                        }
+                      }
+
+
+                    }
+                  }
+                }
+
+
+                parent::onSubmit();
+        }
+
+}
+
+$app->tform_actions = new page_action;
+$app->tform_actions->onLoad();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/form/_old_mail_domain_catchall.tform.php b/interface/web/mail/form/_old_mail_domain_catchall.tform.php
new file mode 100644
index 0000000..262bac1
--- /dev/null
+++ b/interface/web/mail/form/_old_mail_domain_catchall.tform.php
@@ -0,0 +1,107 @@
+<?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"] 			= "Email Catchall";
+$form["description"] 	= "";
+$form["name"] 			= "mail_domain_catchall";
+$form["action"]			= "mail_domain_catchall_edit.php";
+$form["db_table"]		= "mail_domain_catchall";
+$form["db_table_idx"]	= "domain_catchall_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "catchall";
+$form["list_default"]	= "mail_domain_catchall_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"]['catchall'] = array (
+	'title' 	=> "Domain Catchall",
+	'width' 	=> 150,
+	'template' 	=> "templates/mail_domain_catchall_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Begin Datatable fields
+	##################################
+		'server_id' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'VARCHAR',
+			'default'	=> '',
+			'value'		=> ''
+		),
+		'domain' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
+														'errmsg'=> 'domain_error_unique'),
+										1 => array (	'type'	=> 'REGEX',
+														'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
+														'errmsg'=> 'domain_error_regex'),
+									),
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => "SELECT domain FROM mail_domain WHERE type = 'local' AND {AUTHSQL} ORDER BY domain",
+										'keyfield'=> 'domain',
+										'valuefield'=> 'domain'
+									 ),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'destination' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'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/form/mail_alias.tform.php b/interface/web/mail/form/mail_alias.tform.php
index 4c64d85..7ff4228 100644
--- a/interface/web/mail/form/mail_alias.tform.php
+++ b/interface/web/mail/form/mail_alias.tform.php
@@ -98,10 +98,10 @@
 			'value'		=> array('alias' => 'Alias','forward'=>'Forward')
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_blacklist.tform.php b/interface/web/mail/form/mail_blacklist.tform.php
index 6b91c3a..a349680 100644
--- a/interface/web/mail/form/mail_blacklist.tform.php
+++ b/interface/web/mail/form/mail_blacklist.tform.php
@@ -37,8 +37,8 @@
 $form["description"] 	= "";
 $form["name"] 			= "mail_blacklist";
 $form["action"]			= "mail_blacklist_edit.php";
-$form["db_table"]		= "mail_blacklist";
-$form["db_table_idx"]	= "blacklist_id";
+$form["db_table"]		= "mail_access";
+$form["db_table_idx"]	= "access_id";
 $form["db_history"]		= "yes";
 $form["tab_default"]	= "blacklist";
 $form["list_default"]	= "mail_blacklist_list.php";
@@ -69,30 +69,36 @@
 									 ),
 			'value'		=> ''
 		),
-		'address' => array (
+		'source' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'address_error_notempty'),
-									),
 			'default'	=> '',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'source_error_notempty'),
+									),
 			'value'		=> '',
 			'width'		=> '30',
 			'maxlength'	=> '255'
 		),
-		'recipient' => array (
+		'access' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
+			'default'	=> 'REJECT',
+			'value'		=> 'REJECT',
 			'width'		=> '30',
 			'maxlength'	=> '255'
+		),
+		'type' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'default'	=> 'y',
+			'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_domain.tform.php b/interface/web/mail/form/mail_domain.tform.php
index ecdb76f..b6ba910 100644
--- a/interface/web/mail/form/mail_domain.tform.php
+++ b/interface/web/mail/form/mail_domain.tform.php
@@ -85,17 +85,11 @@
 			'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',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_domain_catchall.tform.php b/interface/web/mail/form/mail_domain_catchall.tform.php
index 0f16d44..d3197e2 100644
--- a/interface/web/mail/form/mail_domain_catchall.tform.php
+++ b/interface/web/mail/form/mail_domain_catchall.tform.php
@@ -37,8 +37,8 @@
 $form["description"] 	= "";
 $form["name"] 			= "mail_domain_catchall";
 $form["action"]			= "mail_domain_catchall_edit.php";
-$form["db_table"]		= "mail_domain_catchall";
-$form["db_table_idx"]	= "domain_catchall_id";
+$form["db_table"]		= "mail_forwarding";
+$form["db_table_idx"]	= "forwarding_id";
 $form["db_history"]		= "yes";
 $form["tab_default"]	= "catchall";
 $form["list_default"]	= "mail_domain_catchall_list.php";
@@ -51,8 +51,8 @@
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['catchall'] = array (
-	'title' 	=> "Domain Catchall",
-	'width' 	=> 150,
+	'title' 	=> "Email catchall",
+	'width' 	=> 100,
 	'template' 	=> "templates/mail_domain_catchall_edit.htm",
 	'fields' 	=> array (
 	##################################
@@ -60,24 +60,23 @@
 	##################################
 		'server_id' => array (
 			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
 			'default'	=> '',
-			'value'		=> ''
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
 		),
-		'domain' => array (
+		'source' => array (
 			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'domain_error_empty'),
+										1 => array (	'type'	=> 'UNIQUE',
 														'errmsg'=> 'domain_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
+										2 => array (	'type'	=> 'REGEX',
+														'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
 														'errmsg'=> 'domain_error_regex'),
 									),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain FROM mail_domain WHERE type = 'local' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain',
-										'valuefield'=> 'domain'
-									 ),
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
@@ -85,17 +84,29 @@
 		),
 		'destination' => array (
 			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'formtype'	=> 'SELECT',
 			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datasource'	=> array ( 	'type'			=> 'SQL',
+										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
+										'keyfield'		=> 'email',
+										'valuefield'	=> 'email'
+									 ),
+			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
+														'errmsg'=> 'destination_error_isemail'),
+									),
+			'value'		=> ''
+		),
+		'type' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'default'	=> '',
+			'value'		=> array('alias' => 'Alias','forward'=>'Forward','catchall'=>'Catchall')
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
@@ -104,4 +115,5 @@
 );
 
 
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/form/mail_forward.tform.php b/interface/web/mail/form/mail_forward.tform.php
index 7d8fd2f..503faf1 100644
--- a/interface/web/mail/form/mail_forward.tform.php
+++ b/interface/web/mail/form/mail_forward.tform.php
@@ -1,108 +1,108 @@
-<?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"] 			= "Email Forward";
-$form["description"] 	= "";
-$form["name"] 			= "mail_forward";
-$form["action"]			= "mail_forward_edit.php";
-$form["db_table"]		= "mail_redirect";
-$form["db_table_idx"]	= "redirect_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "forward";
-$form["list_default"]	= "mail_forward_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"]['forward'] = array (
-	'title' 	=> "Email forward",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_forward_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'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('forward'=>'Forward','alias' => 'Alias')
-		),
-		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
-
-
-
+<?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"] 			= "Email Forward";
+$form["description"] 	= "";
+$form["name"] 			= "mail_forward";
+$form["action"]			= "mail_forward_edit.php";
+$form["db_table"]		= "mail_forwarding";
+$form["db_table_idx"]	= "forwarding_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "forward";
+$form["list_default"]	= "mail_forward_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"]['forward'] = array (
+	'title' 	=> "Email forward",
+	'width' 	=> 100,
+	'template' 	=> "templates/mail_forward_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'	=> 'ISEMAIL',
+														'errmsg'=> 'email_error_isemail'),
+									),
+			'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('forward'=>'Forward','alias' => 'Alias')
+		),
+		'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/form/mail_spamfilter.tform.php b/interface/web/mail/form/mail_spamfilter.tform.php
index 7495fd8..aee5d85 100644
--- a/interface/web/mail/form/mail_spamfilter.tform.php
+++ b/interface/web/mail/form/mail_spamfilter.tform.php
@@ -131,10 +131,10 @@
 			'maxlength'	=> '10'
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_transport.tform.php b/interface/web/mail/form/mail_transport.tform.php
new file mode 100644
index 0000000..12dbdac
--- /dev/null
+++ b/interface/web/mail/form/mail_transport.tform.php
@@ -0,0 +1,111 @@
+<?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"] 			= "Email Routing";
+$form["description"] 	= "";
+$form["name"] 			= "mail_transport";
+$form["action"]			= "mail_transport_edit.php";
+$form["db_table"]		= "mail_transport";
+$form["db_table_idx"]	= "transport_id";
+$form["db_history"]		= "yes";
+$form["tab_default"]	= "transport";
+$form["list_default"]	= "mail_transport_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"]['transport'] = array (
+	'title' 	=> "Email transport",
+	'width' 	=> 100,
+	'template' 	=> "templates/mail_transport_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 {AUTHSQL} ORDER BY server_name',
+										'keyfield'=> 'server_id',
+										'valuefield'=> 'server_name'
+									 ),
+			'value'		=> ''
+		),
+		'domain' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
+														'errmsg'=> 'domain_error_unique'),
+									),
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'transport' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
+		'sort_order' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> 5,
+			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+		),
+		'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/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php
index 60a25bb..f358ff8 100644
--- a/interface/web/mail/form/mail_user.tform.php
+++ b/interface/web/mail/form/mail_user.tform.php
@@ -132,16 +132,16 @@
 			'maxlength'	=> '10'
 		),
 		'postfix' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(1 => 'y',0 => 'n')
 		),
 		'access' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
 			'default'	=> '1',
-			'value'		=> '1'
+			'value'		=> array(1 => 'y',0 => 'n')
 		),
 	##################################
 	# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_whitelist.tform.php b/interface/web/mail/form/mail_whitelist.tform.php
index 69f68e6..8d98346 100644
--- a/interface/web/mail/form/mail_whitelist.tform.php
+++ b/interface/web/mail/form/mail_whitelist.tform.php
@@ -37,8 +37,8 @@
 $form["description"] 	= "";
 $form["name"] 			= "mail_whitelist";
 $form["action"]			= "mail_whitelist_edit.php";
-$form["db_table"]		= "mail_whitelist";
-$form["db_table_idx"]	= "whitelist_id";
+$form["db_table"]		= "mail_access";
+$form["db_table_idx"]	= "access_id";
 $form["db_history"]		= "yes";
 $form["tab_default"]	= "whitelist";
 $form["list_default"]	= "mail_whitelist_list.php";
@@ -69,30 +69,36 @@
 									 ),
 			'value'		=> ''
 		),
-		'address' => array (
+		'source' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'address_error_notempty'),
-									),
 			'default'	=> '',
+			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+														'errmsg'=> 'source_error_notempty'),
+									),
 			'value'		=> '',
 			'width'		=> '30',
 			'maxlength'	=> '255'
 		),
-		'recipient' => array (
+		'access' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
+			'default'	=> 'OK',
+			'value'		=> 'OK',
 			'width'		=> '30',
 			'maxlength'	=> '255'
+		),
+		'type' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
+			'default'	=> 'y',
+			'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
+			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'default'	=> 'y',
+			'value'		=> array(0 => 'n',1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
diff --git a/interface/web/mail/lib/lang/en_mail_blacklist.lng b/interface/web/mail/lib/lang/en_mail_blacklist.lng
index 1138100..b967c3e 100644
--- a/interface/web/mail/lib/lang/en_mail_blacklist.lng
+++ b/interface/web/mail/lib/lang/en_mail_blacklist.lng
@@ -1,9 +1,10 @@
 <?php
 $wb["server_id_txt"] = 'Server';
-$wb["address_txt"] = 'Block Address';
+$wb["source_txt"] = 'Blacklist Address';
+$wb["recipient_txt"] = 'Recipient';
 $wb["active_txt"] = 'Active';
 $wb["btn_save_txt"] = 'Save';
 $wb["btn_cancel_txt"] = 'Cancel';
-$wb["address_error_notempty"] = 'Address is empty.';
-$wb["recipient_txt"] = 'Recipient';
+$wb["source_error_notempty"] = 'Address is empty.';
+$wb["type_txt"] = 'Type';
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_blacklist_list.lng b/interface/web/mail/lib/lang/en_mail_blacklist_list.lng
index cc90ac8..833cf21 100644
--- a/interface/web/mail/lib/lang/en_mail_blacklist_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_blacklist_list.lng
@@ -1,7 +1,7 @@
 <?php
 $wb["list_head_txt"] = 'Email Blacklist';
 $wb["server_id_txt"] = 'Server';
-$wb["address_txt"] = 'Blacklisted address';
+$wb["source_txt"] = 'Blacklisted address';
 $wb["recipient_txt"] = 'Recipient';
 $wb["active_txt"] = 'Active';
 $wb["page_txt"] = 'Page';
@@ -11,4 +11,6 @@
 $wb["delete_txt"] = 'Delete';
 $wb["filter_txt"] = 'Filter';
 $wb["add_new_record_txt"] = 'Add new Blacklist record';
+$wb["access_txt"] = 'access';
+$wb["type_txt"] = 'Type';
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_transport.lng b/interface/web/mail/lib/lang/en_mail_transport.lng
new file mode 100644
index 0000000..e454c00
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_mail_transport.lng
@@ -0,0 +1,9 @@
+<?php
+$wb["server_id_txt"] = 'Server';
+$wb["domain_txt"] = 'Domain';
+$wb["transport_txt"] = 'Transport';
+$wb["sort_order_txt"] = 'Sort by';
+$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/mail/lib/lang/en_mail_transport_list.lng b/interface/web/mail/lib/lang/en_mail_transport_list.lng
new file mode 100644
index 0000000..562ee8e
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_mail_transport_list.lng
@@ -0,0 +1,15 @@
+<?php
+$wb["list_head_txt"] = 'Advanced Email Routing';
+$wb["active_txt"] = 'Active';
+$wb["server_id_txt"] = 'Server';
+$wb["domain_txt"] = 'Domain';
+$wb["transport_txt"] = 'Transport';
+$wb["sort_order_txt"] = 'Sort by';
+$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 transport';
+?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_whitelist.lng b/interface/web/mail/lib/lang/en_mail_whitelist.lng
index faf0619..4cf2fb5 100644
--- a/interface/web/mail/lib/lang/en_mail_whitelist.lng
+++ b/interface/web/mail/lib/lang/en_mail_whitelist.lng
@@ -1,9 +1,10 @@
 <?php
 $wb["server_id_txt"] = 'Server';
-$wb["address_txt"] = 'Witelist Address';
+$wb["source_txt"] = 'Witelist Address';
 $wb["recipient_txt"] = 'Recipient';
 $wb["active_txt"] = 'Active';
 $wb["btn_save_txt"] = 'Save';
 $wb["btn_cancel_txt"] = 'Cancel';
-$wb["address_error_notempty"] = 'Address is empty.';
+$wb["source_error_notempty"] = 'Address is empty.';
+$wb["type_txt"] = 'Type';
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_whitelist_list.lng b/interface/web/mail/lib/lang/en_mail_whitelist_list.lng
index 71f7639..e8c58b4 100644
--- a/interface/web/mail/lib/lang/en_mail_whitelist_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_whitelist_list.lng
@@ -1,7 +1,7 @@
 <?php
 $wb["list_head_txt"] = 'Email Whitelist';
 $wb["server_id_txt"] = 'Server';
-$wb["address_txt"] = 'Whitelisted address';
+$wb["source_txt"] = 'Whitelisted address';
 $wb["recipient_txt"] = 'Recipient';
 $wb["active_txt"] = 'Active';
 $wb["page_txt"] = 'Page';
@@ -11,4 +11,6 @@
 $wb["delete_txt"] = 'Delete';
 $wb["filter_txt"] = 'Filter';
 $wb["add_new_record_txt"] = 'Add new Whitelist record';
+$wb["access_txt"] = 'access';
+$wb["type_txt"] = 'Type';
 ?>
\ 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 d5f1c7a..d3d3ad9 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -48,7 +48,7 @@
         array (
           'title' => 'Email Routing',
           'target' => 'content',
-          'link' => '',
+          'link' => 'mail/mail_transport_list.php',
         ),
       ),
     ),
@@ -72,9 +72,15 @@
         ),
         2 => 
         array (
-          'title' => 'Spamfilter',
+          'title' => 'Users',
           'target' => 'content',
-          'link' => 'mail/mail_spamfilter_list.php',
+          'link' => 'mail/spamfilter_user_list.php',
+        ),
+        3 => 
+        array (
+          'title' => 'Policys',
+          'target' => 'content',
+          'link' => 'mail/spamfilter_policy_list.php',
         ),
       ),
     ),
diff --git a/interface/web/mail/list/mail_alias.list.php b/interface/web/mail/list/mail_alias.list.php
index 5ae8727..25c4d59 100644
--- a/interface/web/mail/list/mail_alias.list.php
+++ b/interface/web/mail/list/mail_alias.list.php
@@ -54,7 +54,7 @@
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
+							'value'		=> array('y' => "Yes",'n' => "No"));
 
 $liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
diff --git a/interface/web/mail/list/mail_blacklist.list.php b/interface/web/mail/list/mail_blacklist.list.php
index 12308e5..ca0677d 100644
--- a/interface/web/mail/list/mail_blacklist.list.php
+++ b/interface/web/mail/list/mail_blacklist.list.php
@@ -16,10 +16,10 @@
 $liste["name"] 				= "mail_blacklist";
 
 // Database table
-$liste["table"] 			= "mail_blacklist";
+$liste["table"] 			= "mail_access";
 
 // Index index field of the database table
-$liste["table_idx"]			= "blacklist_id";
+$liste["table_idx"]			= "access_id";
 
 // Search Field Prefix
 $liste["search_prefix"] 	= "search_";
@@ -54,7 +54,7 @@
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
+							'value'		=> array('y' => "Yes",'n' => "No"));
 
 
 $liste["item"][] = array(	'field'		=> "server_id",
@@ -71,7 +71,7 @@
 							'width'		=> "",
 							'value'		=> "");
 
-$liste["item"][] = array(	'field'		=> "address",
+$liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
@@ -81,13 +81,14 @@
 							'value'		=> "");
 
 
-$liste["item"][] = array(	'field'		=> "recipient",
+$liste["item"][] = array(	'field'		=> "type",
 							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> "");
+							'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
+
 
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index 359a6df..0d7796c 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -55,7 +55,7 @@
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
+							'value'		=> array('y' => "Yes",'n' => "No"));
 
 
 $liste["item"][] = array(	'field'		=> "server_id",
diff --git a/interface/web/mail/list/mail_domain_catchall.list.php b/interface/web/mail/list/mail_domain_catchall.list.php
index c6f9c30..b113a1f 100644
--- a/interface/web/mail/list/mail_domain_catchall.list.php
+++ b/interface/web/mail/list/mail_domain_catchall.list.php
@@ -16,10 +16,10 @@
 $liste["name"] 				= "mail_domain_catchall";
 
 // Database table
-$liste["table"] 			= "mail_domain_catchall";
+$liste["table"] 			= "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_catchall_id";
+$liste["table_idx"]			= "forwarding_id";
 
 // Search Field Prefix
 $liste["search_prefix"] 	= "search_";
@@ -54,18 +54,9 @@
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
+							'value'		=> array('y' => "Yes",'n' => "No"));
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
+$liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
@@ -82,4 +73,6 @@
 							'suffix'	=> "%",
 							'width'		=> "",
 							'value'		=> "");
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_forward.list.php b/interface/web/mail/list/mail_forward.list.php
index 2b1f027..f9df32a 100644
--- a/interface/web/mail/list/mail_forward.list.php
+++ b/interface/web/mail/list/mail_forward.list.php
@@ -1,78 +1,78 @@
-<?php
-
-/*
-	Datatypes:
-	- INTEGER
-	- DOUBLE
-	- CURRENCY
-	- VARCHAR
-	- TEXT
-	- DATE
-*/
-
-
-
-// Name of the list
-$liste["name"] 				= "mail_forward";
-
-// Database table
-$liste["table"] 			= "mail_redirect";
-
-// Index index field of the database table
-$liste["table_idx"]			= "redirect_id";
-
-// Search Field Prefix
-$liste["search_prefix"] 	= "search_";
-
-// Records per page
-$liste["records_per_page"] 	= 15;
-
-// Script File of the list
-$liste["file"]				= "mail_forward_list.php";
-
-// Script file of the edit form
-$liste["edit_file"]			= "mail_forward_edit.php";
-
-// Script File of the delete script
-$liste["delete_file"]		= "mail_forward_del.php";
-
-// Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
-
-// Enable auth
-$liste["auth"]				= "yes";
-
-
-/*****************************************************
-* Suchfelder
-*****************************************************/
-
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
-
-$liste["item"][] = array(	'field'		=> "email",
-							'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'		=> "");
-
-
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "mail_forward";
+
+// Database table
+$liste["table"] 			= "mail_forwarding";
+
+// Index index field of the database table
+$liste["table_idx"]			= "forwarding_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "mail_forward_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "mail_forward_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "mail_forward_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "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/list/mail_spamfilter.list.php b/interface/web/mail/list/mail_spamfilter.list.php
index d959918..3b0c4bc 100644
--- a/interface/web/mail/list/mail_spamfilter.list.php
+++ b/interface/web/mail/list/mail_spamfilter.list.php
@@ -54,7 +54,7 @@
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
+							'value'		=> array('y' => "Yes",'n' => "No"));
 
 
 $liste["item"][] = array(	'field'		=> "server_id",
diff --git a/interface/web/mail/list/mail_transport.list.php b/interface/web/mail/list/mail_transport.list.php
new file mode 100644
index 0000000..8391678
--- /dev/null
+++ b/interface/web/mail/list/mail_transport.list.php
@@ -0,0 +1,104 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "mail_transport";
+
+// Database table
+$liste["table"] 			= "mail_transport";
+
+// Index index field of the database table
+$liste["table_idx"]			= "transport_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "mail_transport_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "mail_transport_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "mail_transport_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+
+$liste["item"][] = array(	'field'		=> "active",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> array('y' => "Yes",'n' => "No"));
+
+
+$liste["item"][] = array(	'field'		=> "server_id",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "SELECT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'datasource'	=> array ( 	'type'	=> 'SQL',
+														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+														'keyfield'=> 'server_id',
+														'valuefield'=> 'server_name'
+									 				  ),
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "domain",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+$liste["item"][] = array(	'field'		=> "transport",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+$liste["item"][] = array(	'field'		=> "sort_order",
+							'datatype'	=> "INTEGER",
+							'formtype'	=> "TEXT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
+							'width'		=> "",
+							'value'		=> "");
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_whitelist.list.php b/interface/web/mail/list/mail_whitelist.list.php
index 79a582c..0caace8 100644
--- a/interface/web/mail/list/mail_whitelist.list.php
+++ b/interface/web/mail/list/mail_whitelist.list.php
@@ -16,10 +16,10 @@
 $liste["name"] 				= "mail_whitelist";
 
 // Database table
-$liste["table"] 			= "mail_whitelist";
+$liste["table"] 			= "mail_access";
 
 // Index index field of the database table
-$liste["table_idx"]			= "whitelist_id";
+$liste["table_idx"]			= "access_id";
 
 // Search Field Prefix
 $liste["search_prefix"] 	= "search_";
@@ -54,7 +54,7 @@
 							'prefix'	=> "",
 							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> array('1' => "Yes",'0' => "No"));
+							'value'		=> array('y' => "Yes",'n' => "No"));
 
 
 $liste["item"][] = array(	'field'		=> "server_id",
@@ -71,7 +71,8 @@
 							'width'		=> "",
 							'value'		=> "");
 
-$liste["item"][] = array(	'field'		=> "address",
+
+$liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
@@ -80,14 +81,14 @@
 							'width'		=> "",
 							'value'		=> "");
 
-$liste["item"][] = array(	'field'		=> "recipient",
+$liste["item"][] = array(	'field'		=> "type",
 							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
+							'formtype'	=> "SELECT",
+							'op'		=> "=",
+							'prefix'	=> "",
+							'suffix'	=> "",
 							'width'		=> "",
-							'value'		=> "");
+							'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
 
 
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php
index 4caf034..5c74198 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -53,50 +53,6 @@
 
 class page_action extends tform_actions {
 	
-	function onShowEnd() {
-		global $app, $conf;
-		
-		// Getting recipient from data record
-		$recipient = $this->dataRecord["recipient"];
-		$email_parts = explode("@",$recipient);
-		$app->tpl->setVar("recipient_local_part",$email_parts[0]);
-		
-		// Getting Domains of the user
-		$sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
-		$domains = $app->db->queryAllRecords($sql);
-		$domain_select = '';
-		if($_SESSION["s"]["user"]["typ"] == 'admin') $domain_select .= '<option value=""></option>';
-		foreach( $domains as $domain) {
-			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
-			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
-		}
-		$app->tpl->setVar("recipient_domain",$domain_select);
-		
-		parent::onShowEnd();
-	}
-	
-	function onSubmit() {
-		global $app, $conf;
-		
-		// Check if Domain belongs to user
-		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["recipient_domain"])."' AND ".$app->tform->getAuthSQL('r'));
-		if($domain["domain"] != $_POST["recipient_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
-		// compose the email field
-		if($_POST["recipient_local_part"] != '') {
-			$this->dataRecord["recipient"] = $_POST["recipient_local_part"]."@".$_POST["recipient_domain"];
-		} else {
-			$this->dataRecord["recipient"] = $_POST["recipient_domain"];
-		}
-		// Set the server id of the mailbox = server ID of mail domain.
-		//$this->dataRecord["server_id"] = $domain["server_id"];
-		
-		unset($this->dataRecord["recipient_local_part"]);
-		unset($this->dataRecord["recipient_domain"]);
-		
-		parent::onSubmit();
-	}
-	
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php
index 2679fdf..d6b2700 100644
--- a/interface/web/mail/mail_blacklist_list.php
+++ b/interface/web/mail/mail_blacklist_list.php
@@ -1,26 +1,27 @@
-<?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$list_def_file = "list/mail_blacklist.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();
-
-
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_blacklist.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->SQLExtWhere = "access = 'REJECT'";
+
+$app->listform_actions->onLoad();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_catchall_edit.php b/interface/web/mail/mail_domain_catchall_edit.php
index 4ea00b0..a40c5dc 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -1,75 +1,101 @@
-<?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_catchall.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');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-	
-	function onSubmit() {
-		global $app, $conf;
-		
-		// Check if Domain belongs to user
-		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["domain"])."' AND ".$app->tform->getAuthSQL('r'));
-		if($domain["domain"] != $_POST["domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
-		// Set the server id of the catchall = server ID of mail domain.
-		$this->dataRecord["server_id"] = $domain["server_id"];
-		
-		parent::onSubmit();
-	}
-	
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onLoad();
-
-
+<?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_catchall.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');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+	function onShowEnd() {
+		global $app, $conf;
+		
+		$email = $this->dataRecord["source"];
+		$email_parts = explode("@",$email);
+		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		
+		// Getting Domains of the user
+		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r');
+		$domains = $app->db->queryAllRecords($sql);
+		$domain_select = '';
+		if(is_array($domains)) {
+			foreach( $domains as $domain) {
+				$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
+				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
+			}
+		}
+		$app->tpl->setVar("email_domain",$domain_select);
+		
+		parent::onShowEnd();
+	}
+	
+	function onSubmit() {
+		global $app, $conf;
+		
+		// Check if Domain belongs to user
+		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
+		if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+		 		
+		// compose the email field
+		$this->dataRecord["source"] = "@".$_POST["email_domain"];
+		// Set the server id of the mailbox = server ID of mail domain.
+		$this->dataRecord["server_id"] = $domain["server_id"];
+		
+		//unset($this->dataRecord["email_local_part"]);
+		unset($this->dataRecord["email_domain"]);
+		
+		parent::onSubmit();
+	}
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_catchall_list.php b/interface/web/mail/mail_domain_catchall_list.php
index 7e5f452..412bb43 100644
--- a/interface/web/mail/mail_domain_catchall_list.php
+++ b/interface/web/mail/mail_domain_catchall_list.php
@@ -1,26 +1,29 @@
-<?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$list_def_file = "list/mail_domain_catchall.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();
-
-
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_domain_catchall.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');
+
+// Limit the results to alias domains
+$app->listform_actions->SQLExtWhere = "type = 'catchall'";
+
+$app->listform_actions->onLoad();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php
index 25e12f0..5d6b8a7 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -1,99 +1,99 @@
-<?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_forward.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');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-	
-	function onShowEnd() {
-		global $app, $conf;
-		
-		$email = $this->dataRecord["email"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
-		
-		// Getting Domains of the user
-		$sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
-		$domains = $app->db->queryAllRecords($sql);
-		$domain_select = '';
-		foreach( $domains as $domain) {
-			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
-			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
-		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
-		parent::onShowEnd();
-	}
-	
-	function onSubmit() {
-		global $app, $conf;
-		
-		// Check if Domain belongs to user
-		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
-		if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		 		
-		// compose the email field
-		$this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
-		// Set the server id of the mailbox = server ID of mail domain.
-		$this->dataRecord["server_id"] = $domain["server_id"];
-		
-		unset($this->dataRecord["email_local_part"]);
-		unset($this->dataRecord["email_domain"]);
-		
-		parent::onSubmit();
-	}
-	
-}
-
-$page = new page_action;
-$page->onLoad();
-
+<?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_forward.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');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+	function onShowEnd() {
+		global $app, $conf;
+		
+		$email = $this->dataRecord["source"];
+		$email_parts = explode("@",$email);
+		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		
+		// Getting Domains of the user
+		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r');
+		$domains = $app->db->queryAllRecords($sql);
+		$domain_select = '';
+		foreach( $domains as $domain) {
+			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
+			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
+		}
+		$app->tpl->setVar("email_domain",$domain_select);
+		
+		parent::onShowEnd();
+	}
+	
+	function onSubmit() {
+		global $app, $conf;
+		
+		// Check if Domain belongs to user
+		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
+		if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+		 		
+		// compose the email field
+		$this->dataRecord["source"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
+		// Set the server id of the mailbox = server ID of mail domain.
+		$this->dataRecord["server_id"] = $domain["server_id"];
+		
+		unset($this->dataRecord["email_local_part"]);
+		unset($this->dataRecord["email_domain"]);
+		
+		parent::onSubmit();
+	}
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_route_del.php b/interface/web/mail/mail_transport_del.php
similarity index 94%
rename from interface/web/mail/mail_domain_route_del.php
rename to interface/web/mail/mail_transport_del.php
index d69f9e2..fd0fcee 100644
--- a/interface/web/mail/mail_domain_route_del.php
+++ b/interface/web/mail/mail_transport_del.php
@@ -1,54 +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_route.list.php";
-$tform_def_file = "form/mail_domain_route.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();
-
+<?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_transport.list.php";
+$tform_def_file = "form/mail_transport.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/mail/mail_domain_route_edit.php b/interface/web/mail/mail_transport_edit.php
similarity index 97%
rename from interface/web/mail/mail_domain_route_edit.php
rename to interface/web/mail/mail_transport_edit.php
index a87a8ae..8bf03f3 100644
--- a/interface/web/mail/mail_domain_route_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -1,56 +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_route.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();
-
+<?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_transport.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/mail/mail_domain_route_list.php b/interface/web/mail/mail_transport_list.php
similarity index 83%
rename from interface/web/mail/mail_domain_route_list.php
rename to interface/web/mail/mail_transport_list.php
index c7f004f..aa43090 100644
--- a/interface/web/mail/mail_domain_route_list.php
+++ b/interface/web/mail/mail_transport_list.php
@@ -1,30 +1,29 @@
-<?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$list_def_file = "list/mail_domain_route.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');
-
-// Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "";
-
-// Generate the page
-$app->listform_actions->onLoad();
-
-
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_transport.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');
+
+// Limit the results to alias domains
+// $app->listform_actions->SQLExtWhere = "type = 'local'";
+
+$app->listform_actions->onLoad();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php
index ece39d5..97ec9d4 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -53,50 +53,6 @@
 
 class page_action extends tform_actions {
 	
-	function onShowEnd() {
-		global $app, $conf;
-		
-		// Getting recipient from data record
-		$recipient = $this->dataRecord["recipient"];
-		$email_parts = explode("@",$recipient);
-		$app->tpl->setVar("recipient_local_part",$email_parts[0]);
-		
-		// Getting Domains of the user
-		$sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
-		$domains = $app->db->queryAllRecords($sql);
-		$domain_select = '';
-		if($_SESSION["s"]["user"]["typ"] == 'admin') $domain_select .= '<option value=""></option>';
-		foreach( $domains as $domain) {
-			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
-			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
-		}
-		$app->tpl->setVar("recipient_domain",$domain_select);
-		
-		parent::onShowEnd();
-	}
-	
-	function onSubmit() {
-		global $app, $conf;
-		
-		// Check if Domain belongs to user
-		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["recipient_domain"])."' AND ".$app->tform->getAuthSQL('r'));
-		if($domain["domain"] != $_POST["recipient_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
-		// compose the email field
-		if($_POST["recipient_local_part"] != '') {
-			$this->dataRecord["recipient"] = $_POST["recipient_local_part"]."@".$_POST["recipient_domain"];
-		} else {
-			$this->dataRecord["recipient"] = $_POST["recipient_domain"];
-		}
-		// Set the server id of the mailbox = server ID of mail domain.
-		// $this->dataRecord["server_id"] = $domain["server_id"];
-		
-		unset($this->dataRecord["recipient_local_part"]);
-		unset($this->dataRecord["recipient_domain"]);
-		
-		parent::onSubmit();
-	}
-	
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php
index cc245ff..6844333 100644
--- a/interface/web/mail/mail_whitelist_list.php
+++ b/interface/web/mail/mail_whitelist_list.php
@@ -1,26 +1,27 @@
-<?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$list_def_file = "list/mail_whitelist.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();
-
-
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_whitelist.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->SQLExtWhere = "access = 'OK'";
+
+$app->listform_actions->onLoad();
+
+
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_blacklist_edit.htm b/interface/web/mail/templates/mail_blacklist_edit.htm
index dab389a..a707acf 100644
--- a/interface/web/mail/templates/mail_blacklist_edit.htm
+++ b/interface/web/mail/templates/mail_blacklist_edit.htm
@@ -1,23 +1,27 @@
 <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">
+    <td class="frmText11">{tmpl_var name='server_id_txt'}:</td>
+    <td 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='address_txt'}:</td>
-    <td width="366" class="frmText11"><input name="address" type="text" class="text" value="{tmpl_var name='address'}" size="30" maxlength="255"></td>
+    <td class="frmText11">{tmpl_var name='source_txt'}:</td>
+    <td class="frmText11"><input name="source" type="text" class="text" value="{tmpl_var name='source'}" size="30" maxlength="255"></td>
   </tr>
   <tr>
-    <td width="126" class="frmText11">{tmpl_var name='recipient_txt'}:</td>
-    <td width="366" class="frmText11"><input name="recipient_local_part" type="text" class="text" value="{tmpl_var name='recipient_local_part'}" size="10" maxlength="50"> @ <select name="recipient_domain">{tmpl_var name="recipient_domain"}</select></td>
+    <td class="frmText11">{tmpl_var name='type_txt'}:</td>
+    <td class="frmText11">
+		<select name="type" class="text">
+			{tmpl_var name='type'}
+		</select>
+	</td>
   </tr>
   <tr>
-    <td width="126" class="frmText11">{tmpl_var name='active_txt'}:</td>
-    <td width="366" class="frmText11">{tmpl_var name='active'}</td>
+    <td class="frmText11">{tmpl_var name='active_txt'}:</td>
+    <td class="frmText11">{tmpl_var name='active'}</td>
   </tr>  <tr>
     <td class="frmText11">&nbsp;</td>
     <td class="frmText11">&nbsp;</td>
@@ -29,4 +33,5 @@
     </td>
   </tr>
 </table>
-<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
+<input name="access" type="hidden" value="{tmpl_var name='access'}">
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_blacklist_list.htm b/interface/web/mail/templates/mail_blacklist_list.htm
index 1d2ec6c..f68245d 100644
--- a/interface/web/mail/templates/mail_blacklist_list.htm
+++ b/interface/web/mail/templates/mail_blacklist_list.htm
@@ -4,27 +4,28 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
     <td class="tblHead"><tmpl_var name="active_txt"></td>
-	<td class="tblHead"><tmpl_var name="server_id_txt"></td>
-    <td class="tblHead"><tmpl_var name="address_txt"></td>
-	<td class="tblHead"><tmpl_var name="recipient_txt"></td>
+    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
+	<td class="tblHead"><tmpl_var name="source_txt"></td>
+    <td class="tblHead"><tmpl_var name="type_txt"></td>
     <td class="tblHead">&nbsp;</td>
   </tr>
   <tr>
     <td class="frmText11"><select name="search_active" onChange="document.myform.submit();">{tmpl_var name='search_active'}</select></td>
-	<td class="frmText11"><select name="search_server_id" onChange="document.myform.submit();">{tmpl_var name='search_server_id'}</select></td>
-    <td class="frmText11"><input type="text" name="search_address" value="{tmpl_var name='search_address'}" class="text" /></td>
-	<td class="frmText11"><input type="text" name="search_recipient" value="{tmpl_var name='search_recipient'}" class="text" /></td>
+    <td class="frmText11"><select name="search_server_id" onChange="document.myform.submit();">{tmpl_var name='search_server_id'}</select></td>
+	<td class="frmText11"><input type="text" name="search_source" value="{tmpl_var name='search_source'}" class="text" /></td>
+    <td class="frmText11"><select name="search_type" onChange="document.myform.submit();">{tmpl_var name='search_type'}</select></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_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td>
-	<td class="frmText11"><a href="mail_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
-    <td class="frmText11"><a href="mail_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="address"}</a></td>
-	<td class="frmText11"><a href="mail_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="recipient"}</a></td>
+    <td class="frmText11"><a href="mail_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
+	<td class="frmText11"><a href="mail_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="source"}</a></td>
+    <td class="frmText11"><a href="mail_blacklist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="type"}</a></td>
     <td class="frmText11" align="right">[<a href="javascript: del_record('mail_blacklist_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="5" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
   </tr>
diff --git a/interface/web/mail/templates/mail_domain_catchall_edit.htm b/interface/web/mail/templates/mail_domain_catchall_edit.htm
index e6445f3..278f2b3 100644
--- a/interface/web/mail/templates/mail_domain_catchall_edit.htm
+++ b/interface/web/mail/templates/mail_domain_catchall_edit.htm
@@ -1,28 +1,29 @@
-<table width="500" border="0" cellspacing="0" cellpadding="2">
-  <tr>
-    <td width="126" class="frmText11">{tmpl_var name='domain_txt'}:</td>
-    <td width="366" class="frmText11">* @ 
-		<select name="domain" class="text">
-			{tmpl_var name='domain'}
-		</select>
-	</td>
-  </tr>
-  <tr>
-    <td width="126" class="frmText11">{tmpl_var name='destination_txt'}:</td>
-    <td width="366" class="frmText11"><input name="destination" type="text" class="text" value="{tmpl_var name='destination'}" size="30" maxlength="255"></td>
-  </tr>
-  <tr>
-    <td width="126" class="frmText11">{tmpl_var name='active_txt'}:</td>
-    <td width="366" class="frmText11">{tmpl_var name='active'}</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_catchall_list.php';">
-    </td>
-  </tr>
-</table>
-<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+  <tr>
+    <td width="126" class="frmText11">{tmpl_var name='domain_txt'}:</td>
+    <td width="366" class="frmText11">@ <select name="email_domain">{tmpl_var name="email_domain"}</select></td>
+  </tr>
+  <tr>
+    <td width="126" class="frmText11">{tmpl_var name='destination_txt'}:</td>
+    <td width="366" class="frmText11">
+		<select name="destination" class="text">
+			{tmpl_var name='destination'}
+		</select>
+	</td>
+  </tr>
+  <tr>
+    <td width="126" class="frmText11">{tmpl_var name='active_txt'}:</td>
+    <td width="366" class="frmText11">{tmpl_var name='active'}</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_alias_list.php';">
+    </td>
+  </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
+<input type="hidden" name="type" value="catchall">
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_domain_catchall_list.htm b/interface/web/mail/templates/mail_domain_catchall_list.htm
index 5ade0ad..f66dc6d 100644
--- a/interface/web/mail/templates/mail_domain_catchall_list.htm
+++ b/interface/web/mail/templates/mail_domain_catchall_list.htm
@@ -4,30 +4,27 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
     <td class="tblHead"><tmpl_var name="active_txt"></td>
-	<td class="tblHead"><tmpl_var name="server_id_txt"></td>
-    <td class="tblHead"><tmpl_var name="domain_txt"></td>
+    <td class="tblHead"><tmpl_var name="email_txt"></td>
     <td class="tblHead"><tmpl_var name="destination_txt"></td>
     <td class="tblHead">&nbsp;</td>
   </tr>
   <tr>
     <td class="frmText11"><select name="search_active" onChange="document.myform.submit();">{tmpl_var name='search_active'}</select></td>
-	<td class="frmText11"><input type="text" name="search_server_id" value="{tmpl_var name='search_server_id'}" class="text" /></td>
-    <td class="frmText11"><input type="text" name="search_domain" value="{tmpl_var name='search_domain'}" class="text" /></td>
+    <td class="frmText11"><input type="text" name="search_source" value="{tmpl_var name='search_source'}" class="text" /></td>
     <td class="frmText11"><input type="text" name="search_destination" value="{tmpl_var name='search_destination'}" 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_catchall_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td>
-	<td class="frmText11"><a href="mail_domain_catchall_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
-    <td class="frmText11"><a href="mail_domain_catchall_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="domain"}</a></td>
+    <td class="frmText11"><a href="mail_domain_catchall_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="source"}</a></td>
     <td class="frmText11"><a href="mail_domain_catchall_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="destination"}</a></td>
     <td class="frmText11" align="right">[<a href="javascript: del_record('mail_domain_catchall_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="5" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
+  	<td colspan="4" 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/mail/templates/mail_forward_list.htm b/interface/web/mail/templates/mail_forward_list.htm
index a92ea8f..b14c1be 100644
--- a/interface/web/mail/templates/mail_forward_list.htm
+++ b/interface/web/mail/templates/mail_forward_list.htm
@@ -1,30 +1,30 @@
-<form name="myform" action="mail_forward_list.php" method="POST">
-<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
-<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='mail_forward_edit.php'" /><br /><br />
-<table width="100%" border="0" cellspacing="0" cellpadding="4">
-  <tr>
-    <td class="tblHead"><tmpl_var name="active_txt"></td>
-    <td class="tblHead"><tmpl_var name="email_txt"></td>
-    <td class="tblHead"><tmpl_var name="destination_txt"></td>
-    <td class="tblHead">&nbsp;</td>
-  </tr>
-  <tr>
-    <td class="frmText11"><select name="search_active" onChange="document.myform.submit();">{tmpl_var name='search_active'}</select></td>
-    <td class="frmText11"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" class="text" /></td>
-    <td class="frmText11"><input type="text" name="search_destination" value="{tmpl_var name='search_destination'}" 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_forward_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td>
-    <td class="frmText11"><a href="mail_forward_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="email"}</a></td>
-    <td class="frmText11"><a href="mail_forward_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="destination"}</a></td>
-    <td class="frmText11" align="right">[<a href="javascript: del_record('mail_forward_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="4" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
-  </tr>
-</table>
+<form name="myform" action="mail_forward_list.php" method="POST">
+<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
+<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='mail_forward_edit.php'" /><br /><br />
+<table width="100%" border="0" cellspacing="0" cellpadding="4">
+  <tr>
+    <td class="tblHead"><tmpl_var name="active_txt"></td>
+    <td class="tblHead"><tmpl_var name="source_txt"></td>
+    <td class="tblHead"><tmpl_var name="destination_txt"></td>
+    <td class="tblHead">&nbsp;</td>
+  </tr>
+  <tr>
+    <td class="frmText11"><select name="search_active" onChange="document.myform.submit();">{tmpl_var name='search_active'}</select></td>
+    <td class="frmText11"><input type="text" name="search_source" value="{tmpl_var name='search_source'}" class="text" /></td>
+    <td class="frmText11"><input type="text" name="search_destination" value="{tmpl_var name='search_destination'}" 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_forward_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td>
+    <td class="frmText11"><a href="mail_forward_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="source"}</a></td>
+    <td class="frmText11"><a href="mail_forward_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="destination"}</a></td>
+    <td class="frmText11" align="right">[<a href="javascript: del_record('mail_forward_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="4" 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/mail/templates/mail_transport_edit.htm b/interface/web/mail/templates/mail_transport_edit.htm
new file mode 100644
index 0000000..2095e97
--- /dev/null
+++ b/interface/web/mail/templates/mail_transport_edit.htm
@@ -0,0 +1,40 @@
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+  <tr>
+    <td class="frmText11">{tmpl_var name='server_id_txt'}:</td>
+    <td class="frmText11">
+		<select name="server_id" class="text">
+			{tmpl_var name='server_id'}
+		</select>
+	</td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='domain_txt'}:</td>
+    <td class="frmText11"><input name="domain" type="text" class="text" value="{tmpl_var name='domain'}" size="30" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='transport_txt'}:</td>
+    <td class="frmText11"><input name="transport" type="text" class="text" value="{tmpl_var name='transport'}" size="30" maxlength="255"></td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='sort_order_txt'}:</td>
+    <td class="frmText11">
+		<select name="sort_order" class="text">
+			{tmpl_var name='sort_order'}
+		</select>
+	</td>
+  </tr>
+  <tr>
+    <td class="frmText11">{tmpl_var name='active_txt'}:</td>
+    <td class="frmText11">{tmpl_var name='active'}</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_transport_list.php';">
+    </td>
+  </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_transport_list.htm b/interface/web/mail/templates/mail_transport_list.htm
new file mode 100644
index 0000000..0e43f7e
--- /dev/null
+++ b/interface/web/mail/templates/mail_transport_list.htm
@@ -0,0 +1,36 @@
+<form name="myform" action="mail_transport_list.php" method="POST">
+<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
+<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='mail_transport_edit.php'" /><br /><br />
+<table width="100%" border="0" cellspacing="0" cellpadding="4">
+  <tr>
+    <td class="tblHead"><tmpl_var name="active_txt"></td>
+    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
+    <td class="tblHead"><tmpl_var name="domain_txt"></td>
+    <td class="tblHead"><tmpl_var name="transport_txt"></td>
+    <td class="tblHead"><tmpl_var name="sort_order_txt"></td>
+    <td class="tblHead">&nbsp;</td>
+  </tr>
+  <tr>
+    <td class="frmText11"><select name="search_active" onChange="document.myform.submit();">{tmpl_var name='search_active'}</select></td>
+    <td class="frmText11"><select name="search_server_id" onChange="document.myform.submit();">{tmpl_var name='search_server_id'}</select></td>
+    <td class="frmText11"><input type="text" name="search_domain" value="{tmpl_var name='search_domain'}" class="text" /></td>
+    <td class="frmText11"><input type="text" name="search_transport" value="{tmpl_var name='search_transport'}" class="text" /></td>
+    <td class="frmText11"><input type="text" name="search_sort_order" value="{tmpl_var name='search_sort_order'}" 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_transport_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td>
+    <td class="frmText11"><a href="mail_transport_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
+    <td class="frmText11"><a href="mail_transport_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="domain"}</a></td>
+    <td class="frmText11"><a href="mail_transport_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="transport"}</a></td>
+    <td class="frmText11"><a href="mail_transport_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="sort_order"}</a></td>
+    <td class="frmText11" align="right">[<a href="javascript: del_record('mail_transport_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="6" 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/mail/templates/mail_whitelist_edit.htm b/interface/web/mail/templates/mail_whitelist_edit.htm
index 96b2e95..1158bf2 100644
--- a/interface/web/mail/templates/mail_whitelist_edit.htm
+++ b/interface/web/mail/templates/mail_whitelist_edit.htm
@@ -1,23 +1,27 @@
 <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">
+    <td class="frmText11">{tmpl_var name='server_id_txt'}:</td>
+    <td 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='address_txt'}:</td>
-    <td width="366" class="frmText11"><input name="address" type="text" class="text" value="{tmpl_var name='address'}" size="30" maxlength="255"></td>
+    <td class="frmText11">{tmpl_var name='source_txt'}:</td>
+    <td class="frmText11"><input name="source" type="text" class="text" value="{tmpl_var name='source'}" size="30" maxlength="255"></td>
   </tr>
   <tr>
-    <td width="126" class="frmText11">{tmpl_var name='recipient_txt'}:</td>
-    <td width="366" class="frmText11"><input name="recipient_local_part" type="text" class="text" value="{tmpl_var name='recipient_local_part'}" size="10" maxlength="50"> @ <select name="recipient_domain">{tmpl_var name="recipient_domain"}</select></td>
+    <td class="frmText11">{tmpl_var name='type_txt'}:</td>
+    <td class="frmText11">
+		<select name="type" class="text">
+			{tmpl_var name='type'}
+		</select>
+	</td>
   </tr>
   <tr>
-    <td width="126" class="frmText11">{tmpl_var name='active_txt'}:</td>
-    <td width="366" class="frmText11">{tmpl_var name='active'}</td>
+    <td class="frmText11">{tmpl_var name='active_txt'}:</td>
+    <td class="frmText11">{tmpl_var name='active'}</td>
   </tr>  <tr>
     <td class="frmText11">&nbsp;</td>
     <td class="frmText11">&nbsp;</td>
@@ -29,4 +33,5 @@
     </td>
   </tr>
 </table>
-<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
+<input name="access" type="hidden" value="{tmpl_var name='access'}">
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_whitelist_list.htm b/interface/web/mail/templates/mail_whitelist_list.htm
index 6c46d1f..f8edee0 100644
--- a/interface/web/mail/templates/mail_whitelist_list.htm
+++ b/interface/web/mail/templates/mail_whitelist_list.htm
@@ -4,27 +4,28 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
     <td class="tblHead"><tmpl_var name="active_txt"></td>
-	<td class="tblHead"><tmpl_var name="server_id_txt"></td>
-    <td class="tblHead"><tmpl_var name="address_txt"></td>
-	<td class="tblHead"><tmpl_var name="recipient_txt"></td>
+    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
+	<td class="tblHead"><tmpl_var name="source_txt"></td>
+    <td class="tblHead"><tmpl_var name="type_txt"></td>
     <td class="tblHead">&nbsp;</td>
   </tr>
   <tr>
     <td class="frmText11"><select name="search_active" onChange="document.myform.submit();">{tmpl_var name='search_active'}</select></td>
-	<td class="frmText11"><select name="search_server_id" onChange="document.myform.submit();">{tmpl_var name='search_server_id'}</select></td>
-    <td class="frmText11"><input type="text" name="search_address" value="{tmpl_var name='search_address'}" class="text" /></td>
-	<td class="frmText11"><input type="text" name="search_recipient" value="{tmpl_var name='search_recipient'}" class="text" /></td>
+    <td class="frmText11"><select name="search_server_id" onChange="document.myform.submit();">{tmpl_var name='search_server_id'}</select></td>
+	<td class="frmText11"><input type="text" name="search_source" value="{tmpl_var name='search_source'}" class="text" /></td>
+    <td class="frmText11"><select name="search_type" onChange="document.myform.submit();">{tmpl_var name='search_type'}</select></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_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td>
-	<td class="frmText11"><a href="mail_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
-    <td class="frmText11"><a href="mail_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="address"}</a></td>
-	<td class="frmText11"><a href="mail_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="recipient"}</a></td>
+    <td class="frmText11"><a href="mail_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
+	<td class="frmText11"><a href="mail_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="source"}</a></td>
+    <td class="frmText11"><a href="mail_whitelist_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="type"}</a></td>
     <td class="frmText11" align="right">[<a href="javascript: del_record('mail_whitelist_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="5" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
   </tr>

--
Gitblit v1.9.1