tbrehm
2009-11-02 429dcfd472ae80dcb8643712d74bdc0684488124
Implemented: FS#278 - Add a configuration option for relay_recipient_maps in mail module. 
5 files modified
10 files added
475 ■■■■■ changed files
install/dist/lib/fedora.lib.php 4 ●●●● patch | view | raw | blame | history
install/dist/lib/opensuse.lib.php 4 ●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 4 ●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 20 ●●●●● patch | view | raw | blame | history
install/tpl/mysql-virtual_relayrecipientmaps.cf.master 8 ●●●●● patch | view | raw | blame | history
interface/web/mail/form/mail_relay_recipient.tform.php 104 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_relay_recipient.lng 9 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_relay_recipient_list.lng 9 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/module.conf.php 4 ●●●● patch | view | raw | blame | history
interface/web/mail/list/mail_relay_recipient.list.php 85 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_relay_recipient_del.php 51 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_relay_recipient_edit.php 59 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_relay_recipient_list.php 24 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/mail_relay_recipient_edit.htm 35 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/mail_relay_recipient_list.htm 55 ●●●●● patch | view | raw | blame | history
install/dist/lib/fedora.lib.php
@@ -66,6 +66,9 @@
        
        //* mysql-virtual_relaydomains.cf
        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
        //* mysql-virtual_relayrecipientmaps.cf
        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
        //* Changing mode and group of the new created config files.
        caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -101,6 +104,7 @@
            'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
            'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
            'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
            'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
            'virtual_create_maildirsize = yes',
            'virtual_maildir_extended = yes',
            'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
install/dist/lib/opensuse.lib.php
@@ -66,6 +66,9 @@
        
        //* mysql-virtual_relaydomains.cf
        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
        //* mysql-virtual_relayrecipientmaps.cf
        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
        //* Changing mode and group of the new created config files.
        caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -101,6 +104,7 @@
            'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
            'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
            'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
            'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
            'virtual_create_maildirsize = yes',
            'virtual_maildir_extended = yes',
            'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
install/lib/installer_base.lib.php
@@ -425,6 +425,9 @@
        
        //* mysql-virtual_relaydomains.cf
        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
        //* mysql-virtual_relayrecipientmaps.cf
        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
        //* Changing mode and group of the new created config files.
        caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -460,6 +463,7 @@
            'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
            'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
            'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
            'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
            'virtual_create_maildirsize = yes',
            'virtual_maildir_extended = yes',
            'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',
install/sql/ispconfig3.sql
@@ -459,6 +459,26 @@
  PRIMARY KEY  (`mailman_id`,`server_id`,`domain`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for Table `mail_relay_recipient`
--
CREATE TABLE IF NOT EXISTS `mail_relay_recipient` (
  `relay_recipient_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `sys_userid` int(11) NOT NULL DEFAULT '0',
  `sys_groupid` int(11) NOT NULL DEFAULT '0',
  `sys_perm_user` varchar(5) DEFAULT NULL,
  `sys_perm_group` varchar(5) DEFAULT NULL,
  `sys_perm_other` varchar(5) DEFAULT NULL,
  `server_id` int(11) NOT NULL DEFAULT '0',
  `source` varchar(255) DEFAULT NULL,
  `access` varchar(255) NOT NULL DEFAULT 'OK',
  `active` varchar(255) NOT NULL DEFAULT 'y',
  PRIMARY KEY (`relay_recipient_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
install/tpl/mysql-virtual_relayrecipientmaps.cf.master
New file
@@ -0,0 +1,8 @@
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_relay_recipients
select_field = access
where_field = source
additional_conditions = and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
interface/web/mail/form/mail_relay_recipient.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"]             = "Email relay recipient";
$form["description"]     = "";
$form["name"]             = "mail_relay_recipient";
$form["action"]            = "mail_relay_recipient_edit.php";
$form["db_table"]        = "mail_relay_recipient";
$form["db_table_idx"]    = "relay_recipient_id";
$form["db_history"]        = "yes";
$form["tab_default"]    = "relay_recipient";
$form["list_default"]    = "mail_relay_recipient_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"]['relay_recipient'] = array (
    'title'     => "Relay recipient",
    'width'     => 100,
    'template'     => "templates/mail_relay_recipient_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'        => ''
        ),
        'source' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'default'    => '',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'source_error_notempty'),
                                    ),
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'access' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'default'    => 'OK',
            'value'        => 'OK',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'active' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'CHECKBOX',
            'default'    => 'y',
            'value'        => array(0 => 'n',1 => 'y')
        ),
    ##################################
    # ENDE Datatable fields
    ##################################
    )
);
?>
interface/web/mail/lib/lang/en_mail_relay_recipient.lng
New file
@@ -0,0 +1,9 @@
<?php
$wb["server_id_txt"] = 'Server';
$wb["source_txt"] = 'Relay recipient';
$wb["recipient_txt"] = 'Recipient';
$wb["active_txt"] = 'Active';
$wb["source_error_notempty"] = 'Address is empty.';
$wb["type_txt"] = 'Type';
$wb["limit_mailfilter_txt"] = 'The max. number of email filters for your account is reached.';
?>
interface/web/mail/lib/lang/en_mail_relay_recipient_list.lng
New file
@@ -0,0 +1,9 @@
<?php
$wb["list_head_txt"] = 'Relay recipients';
$wb["active_txt"] = 'Active';
$wb["server_id_txt"] = 'Server';
$wb["source_txt"] = 'Recipient address';
$wb["recipient_txt"] = 'Recipient';
$wb["add_new_record_txt"] = 'Add new relay recipient';
$wb["access_txt"] = 'access';
?>
interface/web/mail/lib/module.conf.php
@@ -112,6 +112,10 @@
    $items[] = array(   'title'     => 'Content Filter',
                         'target'     => 'content',
                          'link'        => 'mail/mail_content_filter_list.php');
    $items[] = array(   'title'     => 'Relay Recipients',
                         'target'     => 'content',
                          'link'        => 'mail/mail_relay_recipient_list.php');
    $module['nav'][] = array(    'title'    => 'Global Filters',
                                'open'     => 1,
interface/web/mail/list/mail_relay_recipient.list.php
New file
@@ -0,0 +1,85 @@
<?php
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]                 = "mail_relay_recipient";
// Database table
$liste["table"]             = "mail_relay_recipient";
// Index index field of the database table
$liste["table_idx"]            = "relay_recipient_id";
// Search Field Prefix
$liste["search_prefix"]     = "search_";
// Records per page
$liste["records_per_page"]     = 15;
// Script File of the list
$liste["file"]                = "mail_relay_recipient_list.php";
// Script file of the edit form
$liste["edit_file"]            = "mail_relay_recipient_edit.php";
// Script File of the delete script
$liste["delete_file"]        = "mail_relay_recipient_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' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
$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'        => "source",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "TEXT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'width'        => "",
                            'value'        => "");
?>
interface/web/mail/mail_relay_recipient_del.php
New file
@@ -0,0 +1,51 @@
<?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_relay_recipient.list.php";
$tform_def_file = "form/mail_relay_recipient.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('mail');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
?>
interface/web/mail/mail_relay_recipient_edit.php
New file
@@ -0,0 +1,59 @@
<?php
/*
Copyright (c) 2009, 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_relay_recipient.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('mail');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
}
$app->tform_actions = new page_action;
$app->tform_actions->onLoad();
?>
interface/web/mail/mail_relay_recipient_list.php
New file
@@ -0,0 +1,24 @@
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_relay_recipient.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('mail');
$app->uses('listform_actions');
# $app->listform_actions->SQLExtWhere = "access = 'OK'";
$app->listform_actions->onLoad();
?>
interface/web/mail/templates/mail_relay_recipient_edit.htm
New file
@@ -0,0 +1,35 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_relay_recipient">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels"><legend>Relay recipient</legend>
      <div class="ctrlHolder">
          <label for="server_id">{tmpl_var name='server_id_txt'}</label>
        <select name="server_id" id="server_id" class="selectInput">
                    {tmpl_var name='server_id'}
                </select>
      </div>
      <div class="ctrlHolder">
          <label for="source">{tmpl_var name='source_txt'}</label>
        <input name="source" id="source" value="{tmpl_var name='source'}" size="30" maxlength="255" type="text" class="textInput" />
            </div>
      <div class="ctrlHolder">
                <p class="label">{tmpl_var name='active_txt'}</p>
                    <div class="multiField">
                        {tmpl_var name='active'}
                    </div>
            </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <input type="hidden" name="access" value="OK">
    <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mail/mail_relay_recipient_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mail/mail_relay_recipient_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/mail/templates/mail_relay_recipient_list.htm
New file
@@ -0,0 +1,55 @@
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_list_mail_relay_recipient">
  <div class="pnl_toolsarea">
    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
      <div class="buttons">
        <button class="iconstxt icoAdd" type="button" onClick="loadContent('mail/mail_relay_recipient_edit.php');">
          <span>{tmpl_var name="add_new_record_txt"}</span>
        </button>
      </div>
    </fieldset>
  </div>
  <div class="pnl_listarea">
    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
      <table class="list">
        <thead>
          <tr>
            <th class="tbl_col_active" scope="col"><tmpl_var name="active_txt"></th>
            <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th>
            <th class="tbl_col_source" scope="col"><tmpl_var name="source_txt"></th>
            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
          </tr>
          <tr>
            <td class="tbl_col_active"><select name="search_active" onChange="submitForm('pageForm','mail/mail_relay_recipient_list.php');">{tmpl_var name='search_active'}</select></td>
            <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','mail/mail_relay_recipient_list.php');">{tmpl_var name='search_server_id'}</select></td>
            <td class="tbl_col_source"><input type="text" name="search_source" value="{tmpl_var name='search_source'}" /></td>
            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','mail/mail_relay_recipient_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
          </tr>
        </thead>
        <tbody>
          <tmpl_loop name="records">
          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
            <td class="tbl_col_active"><a href="#" onClick="loadContent('mail/mail_relay_recipient_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a></td>
            <td class="tbl_col_server_id"><a href="#" onClick="loadContent('mail/mail_relay_recipient_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td>
            <td class="tbl_col_source"><a href="#" onClick="loadContent('mail/mail_relay_recipient_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="source"}</a></td>
            <td class="tbl_col_buttons">
              <div class="buttons icons16">
                <a class="icons16 icoDelete" href="javascript: del_record('mail/mail_relay_recipient_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
              </div>
            </td>
          </tr>
          </tmpl_loop>
        </tbody>
        <tfoot>
          <tr>
            <td class="tbl_footer tbl_paging" colspan="4"><tmpl_var name="paging"></td>
          </tr>
        </tfoot>
      </table>
    </fieldset>
  </div>
</div>