tbrehm
2005-11-23 8fab6e9cfa7f96b6994e0fea436ff59e048dbffd
Added Domain relay and exim4 config
12 files modified
13 files added
1039 ■■■■■ changed files
config/exim4/exim4.conf.template 434 ●●●●● patch | view | raw | blame | history
interface/lib/classes/listform_actions.inc.php 8 ●●●● patch | view | raw | blame | history
interface/lib/classes/tform.inc.php 7 ●●●● patch | view | raw | blame | history
interface/web/sites/form/mail_box.tform.php 104 ●●●●● patch | view | raw | blame | history
interface/web/sites/form/mail_domain.tform.php 2 ●●● patch | view | raw | blame | history
interface/web/sites/form/mail_domain_alias.tform.php 4 ●●● patch | view | raw | blame | history
interface/web/sites/form/mail_domain_relay.tform.php 104 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_mail_domain.lng 4 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_mail_domain_alias.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_mail_domain_alias_list.lng 9 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_mail_domain_list.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_mail_domain_relay.lng 10 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_mail_domain_relay_list.lng 12 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/module.conf.php 20 ●●●● patch | view | raw | blame | history
interface/web/sites/list/mail_domain_relay.list.php 68 ●●●●● patch | view | raw | blame | history
interface/web/sites/mail_domain_alias_list.php 5 ●●●●● patch | view | raw | blame | history
interface/web/sites/mail_domain_list.php 4 ●●●● patch | view | raw | blame | history
interface/web/sites/mail_domain_relay_del.php 54 ●●●●● patch | view | raw | blame | history
interface/web/sites/mail_domain_relay_edit.php 56 ●●●●● patch | view | raw | blame | history
interface/web/sites/mail_domain_relay_list.php 30 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/mail_domain_alias_edit.htm 33 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/mail_domain_alias_list.htm 1 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/mail_domain_list.htm 2 ●●● patch | view | raw | blame | history
interface/web/sites/templates/mail_domain_relay_edit.htm 29 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/mail_domain_relay_list.htm 27 ●●●●● patch | view | raw | blame | history
config/exim4/exim4.conf.template
New file
@@ -0,0 +1,434 @@
######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################
# MySQL defines
MYSQL_SERVER=localhost
MYSQL_USER=root
MYSQL_PASSWORD=matze
MYSQL_DB=mailserver
MYSQL_EMAILTABLE=mail_email
MYSQL_DOMAINTABLE=mail_domain
MYSQL_WHITETABLE=mail_whitelist
MYSQL_BLACKTABLE=mail_blacklist
# Server ID for Multiserver Setups
MAILSERVER_ID=1
MAILSERVER_HOSTNAME=mail.
MAILSERVER_EXIM_BINARY=/usr/sbin/exim4
MAILSERVER_SPAMC_BINARY=/usr/bin/spamc
# Mailman vars
MAILMAN_HOME=/var/lib/mailman
MAILMAN_WRAP=MAILMAN_HOME/mail/wrapper
MAILMAN_UID=list
MAILMAN_GID=list
# MySQL queries
# MYSQL_Q_LDOMAIN=SELECT DISTINCT domain FROM MYSQL_DOMAINTABLE WHERE domain='${quote_mysql:$domain}' AND type = 'local'
# MYSQL_Q_RDOMAIN=SELECT DISTINCT domain FROM MYSQL_DOMAINTABLE WHERE domain='${quote_mysql:$domain}' AND type = 'relay'
MYSQL_Q_VSCAN=SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND opt_virscan='yes'
MM_HOME=${lookup mysql{SELECT mm_home FROM mail_mailman_domain WHERE domain='${quote_mysql:domain}'}}
MM_LISTCHK=MM_HOME/lists/${lc::$local_part}/config.pck
MM_WRAP=${lookup mysql{SELECT mm_wrap FROM mail_mailman_domain WHERE domain='${quote_mysql:domain}'}}
# MySQL connection
hide mysql_servers = "MYSQL_SERVER/MYSQL_DB/MYSQL_USER/MYSQL_PASSWORD"
# starting 'normal' config
primary_hostname = MAILSERVER_HOSTNAME
domainlist local_domains = mysql;SELECT DISTINCT domain FROM MYSQL_DOMAINTABLE WHERE domain='${quote_mysql:$domain}' AND (type = 'local' OR type = 'alias')
domainlist relay_to_domains = mysql;SELECT DISTINCT domain FROM MYSQL_DOMAINTABLE WHERE domain='${quote_mysql:$domain}' AND type = 'relay'
hostlist   relay_from_hosts = 127.0.0.1
domainlist mmdomains = ${lookup mysql {SELECT domain FROM mail_mailman_domain}}
acl_smtp_rcpt = acl_check_rcpt
qualify_domain =
# qualify_recipient =
# allow_domain_literals
never_users = root
trusted_users = mail
host_lookup = *
rfc1413_hosts = *
rfc1413_query_timeout = 15s
check_spool_space = 50M
check_log_space = 20M
return_size_limit = 20k
message_size_limit = 20M
# sender_unqualified_hosts =
# recipient_unqualified_hosts =
# percent_hack_domains =
ignore_bounce_errors_after = 2d
timeout_frozen_after = 7d
deliver_queue_load_max = 8
queue_only_load = 10
remote_max_parallel = 15
#tls_certificate =
#tls_privatekey =
#tls_advertise_hosts = *
# SSL/TLS cert and key
tls_certificate = /etc/exim4/smtpd.cert
tls_privatekey = /etc/exim4/smtpd.key
# Advertise TLS to anyone
tls_advertise_hosts = *
# Require auth over SSL only.
# auth_over_tls_hosts = *
spamd_address = 127.0.0.1 783
######################################################################
#                       ACL CONFIGURATION                            #
#         Specifies access control lists for incoming SMTP mail      #
######################################################################
begin acl
acl_check_rcpt:
  accept  hosts = :
  deny    domains       = +local_domains
          local_parts   = ^[.] : ^.*[@%!/|]
  deny    domains       = !+local_domains
          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
  accept  local_parts   = postmaster
          domains       = +local_domains
  require verify        = sender
  accept  domains       = +local_domains
          endpass
          verify        = recipient
  accept  domains       = +relay_to_domains
          endpass
          verify        = recipient
  accept  hosts         = +relay_from_hosts
  accept  authenticated = *
  deny    message       = relay not permitted
acl_check_data:
  warn  message = X-Spam-Score: $spam_score ($spam_bar)
        spam = nobody:true
  warn  message = X-Spam-Report: $spam_report
        spam = nobody:true
  warn  message = Subject: *SPAM* $h_Subject
        spam = nobody
  # reject spam at high scores (> 12)
  deny   message = This message scored $spam_score spam points.
         spam = nobody:true
         condition = ${if >{$spam_score_int}{120}{1}{0}}
######################################################################
#                      ROUTERS CONFIGURATION                         #
#               Specifies how addresses are handled                  #
######################################################################
#     THE ORDER IN WHICH THE ROUTERS ARE DEFINED IS IMPORTANT!       #
# An address is passed to each router in turn until it is accepted.  #
######################################################################
begin routers
fail_router:
  driver = redirect
  domains = ${lookup mysql {SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND enabled='no'}{$value}}
  data = ":fail:"
  allow_fail
mailman_router:
   driver = accept
   domains = +mmdomains
   require_files = MM_LISTCHK
   local_part_suffix_optional
   local_part_suffix =  -admin     : \
            -bounces   : -bounces+* : \
            -confirm   : -confirm+* : \
            -join      : -leave     : \
            -owner      : -request   : \
            -subscribe : -unsubscribe
   transport = mailman_transport
dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  no_more
domain_aliases:
   driver=redirect
   domains=${lookup mysql{SELECT domain FROM mail_domain WHERE type = 'alias'}}
   data=$local_part@${lookup mysql{SELECT destination FROM mail_domain WHERE domain='${domain}'}}
blacklist_router:
  driver = manualroute
  senders = ${lookup mysql {SELECT DISTINCT MYSQL_BLACKTABLE.address FROM MYSQL_BLACKTABLE WHERE '${quote_mysql:$sender_address}' LIKE MYSQL_BLACKTABLE.address}{$value}}
  condition = "${if !def:h_X-Spam-Flag: {1}{0}}"
  headers_add = X-Spam-Flag: YES
  route_list = * localhost
  self = pass
#system_aliases:
#  driver = redirect
#  allow_fail
#  allow_defer
#  data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
#  file_transport = address_file
#  pipe_transport = address_pipe
#mysql_systemalias:
#   driver = redirect
#   allow_fail
#   allow_defer
#   data = ${lookup mysql{SELECT dest FROM mail_systemalias WHERE local_part='${quote_mysql:$local_part}'}}
mysql_email_alias:
   driver = redirect
   allow_fail
   allow_defer
   data = ${lookup mysql{ SELECT destination FROM mail_redirect WHERE email='${local_part}@${domain}' AND type = 'alias'}}
#spamcheck_router:
#  driver = manualroute
#  domains = ${lookup mysql {SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND spamscan='yes'}{$value}}
#  senders = ! ${lookup mysql {SELECT DISTINCT MYSQL_WHITETABLE.address FROM MYSQL_WHITETABLE WHERE '${quote_mysql:$sender_address}' LIKE MYSQL_WHITETABLE.address}{$value}}
#  condition = ${if and { \
#    {!eq {$received_protocol}{spam-scanned}} \
#    {!eq {$received_protocol}{local}} \
#    } {1}{0}}
#  headers_remove = X-Spam-Flag
#  route_list = "* localhost byname"
#  transport = spamcheck
#  verify = false
#spampurge_router:
#  driver = manualroute
#  domains = ${lookup mysql {SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND spampurge='yes'}{$value}}
#  condition = "${if eq{$h_X-Spam-Flag:}{YES} {1}{0}}"
#  route_list = "* localhost byname"
#  transport = devnull_transport
#  verify = false
autoresponder_router:
  driver = accept
  domains = ${lookup mysql {SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND autoresponder='yes'}{$value}}
  transport = autoresponder_transport
  unseen
cc_router:
  driver = redirect
  data = ${lookup mysql {SELECT cc FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}')}{$value}}
  unseen
forward_router:
  driver = redirect
  data = ${lookup mysql {SELECT forward FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND forward != ''}{$value}}
local_mailbox_router:
  driver = accept
  domains = ${lookup mysql {SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}') AND maildir != ''}{$value}}
  transport = local_delivery
mysql_default_router:
   driver=redirect
   data=${lookup mysql{ SELECT dest FROM mail_virtual_default WHERE domain='${domain}'}}
   allow_fail
   allow_defer
#domain_catchall_director:
#  driver = redirect
#  domains = ${lookup mysql {SELECT SUBSTRING_INDEX(email,'@',-1) FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@') AND forward != ''}{$value}}
#  data = ${lookup mysql {SELECT forward FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@') AND forward != ''}{$value}}
######################################################################
#                      TRANSPORTS CONFIGURATION                      #
######################################################################
#                       ORDER DOES NOT MATTER                        #
#     Only one appropriate transport is called for each delivery.    #
######################################################################
begin transports
remote_smtp:
  driver = smtp
devnull_delivery:
  driver = appendfile
  file = /dev/null
  group = mail
address_pipe:
  driver = pipe
  return_output
address_file:
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add
address_reply:
  driver = autoreply
mailman_transport:
   driver = pipe
   command = /var/mailman/lists.mas-services.co.uk/mail/mailman \
            '${if def:local_part_suffix \
            {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
            {post}}' \
            $local_part
   current_directory = ${lookup mysql{SELECT mm_home FROM mail_mailman_domain WHERE domain='${domain}'}}
   home_directory = ${lookup mysql{SELECT mm_home FROM mail_mailman_domain WHERE domain='${domain}'}}
   user = ${lookup mysql{SELECT mm_user FROM mail_mailman_domain WHERE domain='${domain}'}}
   group = ${lookup mysql{SELECT mm_group FROM mail_mailman_domain WHERE domain='${domain}'}}
spamcheck:
  driver = pipe
  command = MAILSERVER_EXIM_BINARY -oMr spam-scanned -bS
  use_bsmtp = true
  transport_filter = MAILSERVER_SPAMC_BINARY
  home_directory = "/tmp"
  current_directory = "/tmp"
  user = mail
  group = mail
  log_output = true
  return_fail_output = true
  return_path_add = false
  message_prefix =
  message_suffix =
local_delivery:
  driver = appendfile
  directory = ${lookup mysql {SELECT concat(maildir,'/Maildir') FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}')}{$value}}
  maildir_format
  user = mail
  group = mail
  quota = ${lookup mysql{select quota from MYSQL_EMAILTABLE where email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}')}{${value}M}}
  quota_is_inclusive = false
  #quota_size_regex = ,S=(\d+):
  quota_warn_threshold = 75%
  maildir_use_size_file = false
  quota_warn_message = "To: $local_part@$domain\n\
              Subject: Mailbox quota warning\n\n\
            This message was automatically generated by the mail delivery software.\n\n\
            You are now using over 75% of your allocated mail storage quota.\n\n\
            If your mailbox fills completely, further incoming messages will be automatically\n\
            returned to their senders.\n\n\
            Please take note of this and remove unwanted mail from your mailbox.\n"
  mode = 0660
  directory_mode = 0770
#mysql_delivery:
#   driver = appendfile
#   maildir_format
#   directory = \
#      ${lookup mysql{SELECT maildir FROM passwd \
#      WHERE email='${local_part}@${domain}'}}
#   user = \
#      ${lookup mysql{SELECT uid FROM passwd \
#      WHERE email='${local_part}@${domain}'}}
#   group = \
#      ${lookup mysql{SELECT gid FROM passwd \
#      WHERE email='${local_part}@${domain}'}}
autoresponder_transport:
  driver = autoreply
  to = ${sender_address}
  from = "vacation@${domain}"
  subject = "Autoresponder: ${local_part}@${domain}"
  text = ${lookup mysql {SELECT autoresponder_text FROM MYSQL_EMAILTABLE WHERE email=CONCAT('${quote_mysql:$local_part}','@','${quote_mysql:$domain}')}{$value}}
devnull_transport:
  driver = appendfile
  file = /dev/null
  user = mail
######################################################################
#                      RETRY CONFIGURATION                           #
######################################################################
begin retry
# This single retry rule applies to all domains and all errors. It specifies
# retries every 15 minutes for 2 hours, then increasing retry intervals,
# starting at 1 hour and increasing each time by a factor of 1.5, up to 16
# hours, then retries every 6 hours until 4 days have passed since the first
# failed delivery.
# Domain               Error       Retries
# ------               -----       -------
*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,6h
######################################################################
#                      REWRITE CONFIGURATION                         #
######################################################################
# There are no rewriting specifications in this default configuration file.
begin rewrite
######################################################################
#                   AUTHENTICATION CONFIGURATION                     #
######################################################################
# There are no authenticator specifications in this default configuration file.
begin authenticators
fixed_plain:
  driver = plaintext
  public_name = PLAIN
  server_condition = ${lookup mysql{SELECT email FROM MYSQL_EMAILTABLE WHERE email='${quote_mysql:$2}' AND cryptpwd=encrypt('${quote_mysql:$3}', cryptpwd)}{1}fail}
  server_set_id = $2
fixed_login:
  driver = plaintext
  public_name = LOGIN
  server_prompts = "Username:: : Password::"
  server_condition = ${lookup mysql{SELECT email FROM MYSQL_EMAILTABLE WHERE email='${quote_mysql:$1}' AND cryptpwd=encrypt('${quote_mysql:$2}', cryptpwd)}{1}fail}
  server_set_id = $1
cram:
  driver = cram_md5
  public_name = CRAM-MD5
  server_secret = "${lookup mysql {SELECT clearpwd FROM mail_box WHERE email = '${sg {$1}{'}{}}' AND is_enabled = 'yes'} {$value} fail}"
  server_set_id = $1
######################################################################
#                   CONFIGURATION FOR local_scan()                   #
######################################################################
# If you have built Exim to include a local_scan() function that contains
# tables for private options, you can define those options here. Remember to
# uncomment the "begin" line. It is commented by default because it provokes
# an error with Exim binaries that are not built with LOCAL_SCAN_HAS_OPTIONS
# set in the Local/Makefile.
# begin local_scan
# End of Exim configuration file
interface/lib/classes/listform_actions.inc.php
@@ -99,12 +99,16 @@
        // Generate the search sql
        if($app->listform->listDef["auth"] != 'no') {
            if($_SESSION["s"]["user"]["typ"] == "admin") {
                $sql_where = $this->SQLExtWhere;
                $sql_where = "";
            } else {
                $sql_where = $this->SQLExtWhere ." ". $app->tform->getAuthSQL('r')." and";
                $sql_where = $app->tform->getAuthSQL('r')." and";
            }
        }
        if($this->SQLExtWhere != '') {
            $sql_where .= " ".$this->SQLExtWhere." and";
        }
        $sql_where = $app->listform->getSearchSQL($sql_where);
        $app->tpl->setVar($app->listform->searchValues);
interface/lib/classes/tform.inc.php
@@ -107,6 +107,7 @@
    var $formDef;
    var $wordbook;
    var $module;
    var $primary_id;
    
    /**
    * Laden der Tabellendefinition
@@ -535,14 +536,15 @@
                    }
                break;
                case 'UNIQUE':
                    $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($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'];
                            $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                        }
                    } else {
                        if($num_rec["number"] > 1) {
                        $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'];
                            $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                        }
@@ -610,6 +612,7 @@
        }
        
        $this->action = $action;
        $this->primary_id = $primary_id;
        
        $record = $this->encode($record,$tab);
        $sql_insert_key = '';
interface/web/sites/form/mail_box.tform.php
New file
@@ -0,0 +1,104 @@
<?php
/*
    Form Definition
    Tabledefinition
    Datatypes:
    - INTEGER (Forces the input to Int)
    - DOUBLE
    - CURRENCY (Formats the values to currency notation)
    - VARCHAR (no format check, maxlength: 255)
    - TEXT (no format check)
    - DATE (Dateformat, automatic conversion to timestamps)
    Formtype:
    - TEXT (Textfield)
    - TEXTAREA (Textarea)
    - PASSWORD (Password textfield, input is not shown when edited)
    - SELECT (Select option field)
    - RADIO
    - CHECKBOX
    - CHECKBOXARRAY
    - FILE
    VALUE:
    - Wert oder Array
    Hint:
    The ID field of the database table is not part of the datafield definition.
    The ID field must be always auto incement (int or bigint).
*/
$form["title"]             = "Mail Domain";
$form["description"]     = "";
$form["name"]             = "mail_domain";
$form["action"]            = "mail_domain_edit.php";
$form["db_table"]        = "mail_domain";
$form["db_table_idx"]    = "domain_id";
$form["db_history"]        = "yes";
$form["tab_default"]    = "domain";
$form["list_default"]    = "mail_domain_list.php";
$form["auth"]            = '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"]['domain'] = array (
    'title'     => "Domain",
    'width'     => 100,
    'template'     => "templates/mail_domain_edit.htm",
    'fields'     => array (
    ##################################
    # Begin Datatable fields
    ##################################
        'server_id' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE 1 ORDER BY server_name',
                                        'keyfield'=> 'server_id',
                                        'valuefield'=> 'server_name'
                                     ),
            'value'        => ''
        ),
        'domain' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'domain_error_empty'),
                                        1 => array (    'type'    => 'UNIQUE',
                                                        'errmsg'=> 'domain_error_unique'),
                                    ),
            'default'    => '',
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'type' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'SELECT',
            'default'    => '',
            'value'        => array('local' => 'local','relay'=>'relay','manual_relay'=>'manual Relay')
        ),
        'active' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'CHECKBOX',
            'default'    => '1',
            'value'        => '1'
        ),
    ##################################
    # ENDE Datatable fields
    ##################################
    )
);
?>
interface/web/sites/form/mail_domain.tform.php
@@ -42,7 +42,7 @@
$form["db_history"]        = "yes";
$form["tab_default"]    = "domain";
$form["list_default"]    = "mail_domain_list.php";
$form["auth"]            = 'no';
$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
interface/web/sites/form/mail_domain_alias.tform.php
@@ -42,7 +42,7 @@
$form["db_history"]        = "yes";
$form["tab_default"]    = "domain";
$form["list_default"]    = "mail_domain_alias_list.php";
$form["auth"]            = 'no';
$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
@@ -87,8 +87,6 @@
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'destination_error_empty'),
                                        1 => array (    'type'    => 'UNIQUE',
                                                        'errmsg'=> 'destination_error_unique'),
                                    ),
            'default'    => '',
            'value'        => '',
interface/web/sites/form/mail_domain_relay.tform.php
New file
@@ -0,0 +1,104 @@
<?php
/*
    Form Definition
    Tabledefinition
    Datatypes:
    - INTEGER (Forces the input to Int)
    - DOUBLE
    - CURRENCY (Formats the values to currency notation)
    - VARCHAR (no format check, maxlength: 255)
    - TEXT (no format check)
    - DATE (Dateformat, automatic conversion to timestamps)
    Formtype:
    - TEXT (Textfield)
    - TEXTAREA (Textarea)
    - PASSWORD (Password textfield, input is not shown when edited)
    - SELECT (Select option field)
    - RADIO
    - CHECKBOX
    - CHECKBOXARRAY
    - FILE
    VALUE:
    - Wert oder Array
    Hint:
    The ID field of the database table is not part of the datafield definition.
    The ID field must be always auto incement (int or bigint).
*/
$form["title"]             = "Domain Relay";
$form["description"]     = "";
$form["name"]             = "mail_domain_relay";
$form["action"]            = "mail_domain_relay_edit.php";
$form["db_table"]        = "mail_domain";
$form["db_table_idx"]    = "domain_id";
$form["db_history"]        = "yes";
$form["tab_default"]    = "domain";
$form["list_default"]    = "mail_domain_relay_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"]['domain'] = array (
    'title'     => "Domain",
    'width'     => 100,
    'template'     => "templates/mail_domain_relay_edit.htm",
    'fields'     => array (
    ##################################
    # Begin Datatable fields
    ##################################
        'server_id' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE 1 ORDER BY server_name',
                                        'keyfield'=> 'server_id',
                                        'valuefield'=> 'server_name'
                                     ),
            'value'        => ''
        ),
        'domain' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'domain_error_empty'),
                                        1 => array (    'type'    => 'UNIQUE',
                                                        'errmsg'=> 'domain_error_unique'),
                                    ),
            'default'    => '',
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'type' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'SELECT',
            'default'    => '',
            'value'        => array('relay'=>'relay','local' => 'local','manual_relay'=>'manual Relay')
        ),
        'active' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'CHECKBOX',
            'default'    => '1',
            'value'        => '1'
        ),
    ##################################
    # ENDE Datatable fields
    ##################################
    )
);
?>
interface/web/sites/lib/lang/en_mail_domain.lng
@@ -5,4 +5,8 @@
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["domain_error_empty"] = 'Domain is empty.';
$wb["domain_error_unique"] = 'Duplicate Domain.';
$wb["destination_error_empty"] = 'Destination is empty.';
?>
interface/web/sites/lib/lang/en_mail_domain_alias.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$wb["destination_txt"] = 'Destination';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["domain_error_empty"] = 'Domain is empty.';
$wb["domain_error_unique"] = 'Duplicate Domain.';
$wb["destination_error_empty"] = 'Destination is empty.';
?>
interface/web/sites/lib/lang/en_mail_domain_alias_list.lng
@@ -1,12 +1,13 @@
<?php
$wb["list_head_txt"] = 'mail_domain_alias';
$wb["server_id_txt"] = 'server_id';
$wb["domain_txt"] = 'domain';
$wb["destination_txt"] = 'destination';
$wb["list_head_txt"] = 'Domain Alias';
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$wb["destination_txt"] = 'Destination';
$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 Alias Domain';
?>
interface/web/sites/lib/lang/en_mail_domain_list.lng
@@ -8,4 +8,5 @@
$wb["page_back_txt"] = 'Back';
$wb["delete_txt"] = 'Delete';
$wb["filter_txt"] = 'Filter';
$wb["add_new_record_txt"] = 'Add new Domain';
?>
interface/web/sites/lib/lang/en_mail_domain_relay.lng
New file
@@ -0,0 +1,10 @@
<?php
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$wb["active_txt"] = 'active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["domain_error_empty"] = 'Domain is empty.';
$wb["domain_error_unique"] = 'Duplicate Domain.';
$wb["destination_error_empty"] = 'Destination is empty.';
?>
interface/web/sites/lib/lang/en_mail_domain_relay_list.lng
New file
@@ -0,0 +1,12 @@
<?php
$wb["list_head_txt"] = 'Relay Domain';
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$wb["page_txt"] = 'Page';
$wb["page_of_txt"] = 'of';
$wb["page_next_txt"] = 'Next';
$wb["page_back_txt"] = 'Back';
$wb["delete_txt"] = 'Delete';
$wb["filter_txt"] = 'Filter';
$wb["add_new_record_txt"] = 'Add new Relay Domain';
?>
interface/web/sites/lib/module.conf.php
@@ -28,19 +28,31 @@
        ),
        2 => 
        array (
          'title' => 'Email Mailbox',
          'title' => 'Domain Relay',
          'target' => 'content',
          'link' => '',
          'link' => 'sites/mail_domain_relay_list.php',
        ),
        3 => 
        array (
          'title' => 'Email Forward',
          'title' => 'Email Mailbox',
          'target' => 'content',
          'link' => '',
        ),
        4 => 
        array (
          'title' => 'Domain Catchall',
          'title' => 'Email Alias',
          'target' => 'content',
          'link' => '',
        ),
        5 =>
        array (
          'title' => 'Email Forward',
          'target' => 'content',
          'link' => '',
        ),
        6 =>
        array (
          'title' => 'Email Catchall',
          'target' => 'content',
          'link' => '',
        ),
interface/web/sites/list/mail_domain_relay.list.php
New file
@@ -0,0 +1,68 @@
<?php
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]                 = "mail_domain_relay";
// Database table
$liste["table"]             = "mail_domain";
// Index index field of the database table
$liste["table_idx"]            = "domain_id";
// Search Field Prefix
$liste["search_prefix"]     = "search_";
// Records per page
$liste["records_per_page"]     = 15;
// Script File of the list
$liste["file"]                = "mail_domain_relay_list.php";
// Script file of the edit form
$liste["edit_file"]            = "mail_domain_relay_edit.php";
// Script File of the delete script
$liste["delete_file"]        = "mail_domain_relay_del.php";
// Paging Template
$liste["paging_tpl"]        = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"]                = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array(    'field'        => "server_id",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "TEXT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'width'        => "",
                            'value'        => "");
$liste["item"][] = array(    'field'        => "domain",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "TEXT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'width'        => "",
                            'value'        => "");
?>
interface/web/sites/mail_domain_alias_list.php
@@ -19,6 +19,11 @@
}
$app->uses('listform_actions');
// Limit the results to alias domains
$app->listform_actions->SQLExtWhere = "type = 'alias'";
// Generate the page
$app->listform_actions->onLoad();
interface/web/sites/mail_domain_list.php
@@ -19,6 +19,10 @@
}
$app->uses('listform_actions');
// Limit the results to alias domains
$app->listform_actions->SQLExtWhere = "type = 'local'";
$app->listform_actions->onLoad();
interface/web/sites/mail_domain_relay_del.php
New file
@@ -0,0 +1,54 @@
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_domain_relay.list.php";
$tform_def_file = "form/mail_domain_relay.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();
?>
interface/web/sites/mail_domain_relay_edit.php
New file
@@ -0,0 +1,56 @@
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_domain_relay.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();
?>
interface/web/sites/mail_domain_relay_list.php
New file
@@ -0,0 +1,30 @@
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_domain_relay.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 = 'relay'";
// Generate the page
$app->listform_actions->onLoad();
?>
interface/web/sites/templates/mail_domain_alias_edit.htm
New file
@@ -0,0 +1,33 @@
<table width="500" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="126" class="frmText11">{tmpl_var name='server_id_txt'}:</td>
    <td width="366" class="frmText11">
        <select name="server_id" class="text">
            {tmpl_var name='server_id'}
        </select>
    </td>
  </tr>
  <tr>
    <td width="126" class="frmText11">{tmpl_var name='domain_txt'}:</td>
    <td width="366" class="frmText11"><input name="domain" type="text" class="text" value="{tmpl_var name='domain'}" size="30" maxlength="255"></td>
  </tr>
  <tr>
    <td 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_alias_list.php';">
    </td>
  </tr>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="type" value="alias">
interface/web/sites/templates/mail_domain_alias_list.htm
@@ -1,5 +1,6 @@
<form name="myform" action="mail_domain_alias_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_domain_alias_edit.php'" /><br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
interface/web/sites/templates/mail_domain_list.htm
@@ -1,6 +1,6 @@
<form name="myform" action="mail_domain_list.php" method="POST">
<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
<input type="button" value="Add new Domain" onClick="location.href='mail_domain_edit.php'" /><br /><br />
<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='mail_domain_edit.php'" /><br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
interface/web/sites/templates/mail_domain_relay_edit.htm
New file
@@ -0,0 +1,29 @@
<table width="500" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="126" class="frmText11">{tmpl_var name='server_id_txt'}:</td>
    <td width="366" class="frmText11">
        <select name="server_id" class="text">
            {tmpl_var name='server_id'}
        </select>
    </td>
  </tr>
  <tr>
    <td width="126" class="frmText11">{tmpl_var name='domain_txt'}:</td>
    <td width="366" class="frmText11"><input name="domain" type="text" class="text" value="{tmpl_var name='domain'}" size="30" maxlength="255"></td>
  </tr>
  <tr>
    <td 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_relay_list.php';">
    </td>
  </tr>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="type" value="relay">
interface/web/sites/templates/mail_domain_relay_list.htm
New file
@@ -0,0 +1,27 @@
<form name="myform" action="mail_domain_relay_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_domain_relay_edit.php'" /><br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
    <td class="tblHead"><tmpl_var name="domain_txt"></td>
    <td class="tblHead">&nbsp;</td>
  </tr>
  <tr>
    <td class="frmText11"><input type="text" name="search_server_id" value="{tmpl_var name='search_server_id'}" class="text" /></td>
    <td class="frmText11"><input type="text" name="search_domain" value="{tmpl_var name='search_domain'}" class="text" /></td>
    <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td>
  </tr>
  <tmpl_loop name="records">
  <tr bgcolor="{tmpl_var name="bgcolor"}">
    <td class="frmText11"><a href="mail_domain_relay_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
    <td class="frmText11"><a href="mail_domain_relay_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="domain"}</a></td>
    <td class="frmText11" align="right">[<a href="javascript: del_record('mail_domain_relay_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
  </tr>
  </tmpl_loop>
  <tr>
      <td colspan="3" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
  </tr>
</table>
</form>