horfic
2011-01-06 07405653f111c4eb8fd1c83d45e66287807036d7
*) Added Mailman integration
28 files modified
14 files added
1443 ■■■■■ changed files
install/autoupdate.php 5 ●●●●● patch | view | raw | blame | history
install/dist/conf/debian40.conf.php 5 ●●●●● patch | view | raw | blame | history
install/dist/conf/debian60.conf.php 5 ●●●●● patch | view | raw | blame | history
install/install.php 9 ●●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 54 ●●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0007.sql 19 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 24 ●●●●● patch | view | raw | blame | history
install/tpl/mm_cfg.py.master 106 ●●●●● patch | view | raw | blame | history
install/update.php 5 ●●●●● patch | view | raw | blame | history
interface/lib/classes/remoting.inc.php 47 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/remote_user.tform.php 1 ●●●● patch | view | raw | blame | history
interface/web/admin/form/system_config.tform.php 18 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_remote_user.lng 1 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_system_config.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/admin/templates/system_config_mail_edit.htm 10 ●●●●● patch | view | raw | blame | history
interface/web/client/form/client.tform.php 14 ●●●●● patch | view | raw | blame | history
interface/web/client/form/client_template.tform.php 14 ●●●●● patch | view | raw | blame | history
interface/web/client/form/reseller.tform.php 14 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client_template.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_reseller.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/client/templates/client_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/client/templates/client_template_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/client/templates/reseller_edit_limits.htm 4 ●●●● patch | view | raw | blame | history
interface/web/dashboard/dashlets/limits.php 4 ●●●● patch | view | raw | blame | history
interface/web/dashboard/lib/lang/en_dashlet_limits.lng 1 ●●●● patch | view | raw | blame | history
interface/web/mail/form/mail_mailinglist.tform.php 122 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_mailinglist.lng 15 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_mailinglist_list.lng 5 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/module.conf.php 18 ●●●●● patch | view | raw | blame | history
interface/web/mail/list/mail_mailinglist.list.php 67 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_domain_del.php 6 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_domain_edit.php 3 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_mailinglist_del.php 58 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_mailinglist_edit.php 256 ●●●●● patch | view | raw | blame | history
interface/web/mail/mail_mailinglist_list.php 44 ●●●●● patch | view | raw | blame | history
interface/web/mail/mailinglist.php 68 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/mail_mailinglist_edit.htm 80 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/mail_mailinglist_list.htm 53 ●●●●● patch | view | raw | blame | history
server/conf/mm_cfg.py.master 106 ●●●●● patch | view | raw | blame | history
server/mods-available/mail_module.inc.php 11 ●●●●● patch | view | raw | blame | history
server/plugins-available/mailman_plugin.inc.php 155 ●●●●● patch | view | raw | blame | history
install/autoupdate.php
@@ -185,6 +185,10 @@
    swriteln('Configuring Postfix');
    $inst->configure_postfix('dont-create-certs');
    //** Configure mailman
    swriteln('Configuring Mailman');
    $inst->configure_mailman('update');
    //* Configure Jailkit
    swriteln('Configuring Jailkit');
    $inst->configure_jailkit();
@@ -293,6 +297,7 @@
    if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop']))                 system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart');
    if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl']))         system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart');
    if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script']))         system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart');
    if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script']))         system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart');
}
if($conf['services']['web']) {
    if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script']))                 system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
install/dist/conf/debian40.conf.php
@@ -112,6 +112,11 @@
$conf['postfix']['vmail_groupname'] = 'vmail';
$conf['postfix']['vmail_mailbox_base'] = '/var/vmail';
//* Mailman
$conf['mailman']['installed'] = false; // will be detected automatically during installation
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
install/dist/conf/debian60.conf.php
@@ -112,6 +112,11 @@
$conf['postfix']['vmail_groupname'] = 'vmail';
$conf['postfix']['vmail_mailbox_base'] = '/var/vmail';
//* Mailman
$conf['mailman']['installed'] = false; // will be detected automatically during installation
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
install/install.php
@@ -163,6 +163,9 @@
    //* Configure Postfix
    $inst->configure_postfix();
    
    //* Configure Mailman
    $inst->configure_mailman('install');
    //* Configure jailkit
    swriteln('Configuring Jailkit');
    $inst->configure_jailkit();
@@ -258,6 +261,7 @@
    if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop']))                 system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart');
    if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl']))         system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart');
    if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script']))         system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart');
    if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script']))         system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart');
    if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script']))                 system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
    if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script']))                system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart');
    if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script']))                    system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null');
@@ -331,6 +335,10 @@
        swriteln('Configuring Postfix');
        $inst->configure_postfix();
        //* Configure Mailman
        swriteln('Configuring Mailman');
        $inst->configure_mailman();
        if($conf['dovecot']['installed'] == true) {
            //* Configure dovecot
            swriteln('Configuring Dovecot');
@@ -372,6 +380,7 @@
        if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop']))                 system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart');
        if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl']))         system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart');
        if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script']))         system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart');
        if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script']))         system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart');
    }
    
    //** Configure Jailkit
install/lib/installer_base.lib.php
@@ -113,6 +113,7 @@
        if(is_installed('mysql') || is_installed('mysqld')) $conf['mysql']['installed'] = true;
        if(is_installed('postfix')) $conf['postfix']['installed'] = true;
        if(is_installed('mailman')) $conf['mailman']['installed'] = true;
        if(is_installed('apache') || is_installed('apache2') || is_installed('httpd')) $conf['apache']['installed'] = true;
        if(is_installed('getmail')) $conf['getmail']['installed'] = true;
        if(is_installed('courierlogger')) $conf['courier']['installed'] = true;
@@ -448,6 +449,59 @@
    }
    public function configure_mailman($status = 'insert') {
        global $conf;
        $config_dir = $conf['mailman']['config_dir'].'/';
        $full_file_name = $config_dir.'mm_cfg.py';
        //* Backup exiting file
        if(is_file($full_file_name)) {
            copy($full_file_name, $config_dir.'mm_cfg.py~');
        }
        // load files
        $content = rf('tpl/mm_cfg.py.master');
        $old_file = rf($full_file_name);
        $old_options = array();
        $lines = explode("\n", $old_file);
        foreach ($lines as $line)
        {
            if (strlen($line) && substr($line, 0, 1) != '#')
            {
                list($key, $value) = explode("=", $line);
                if (!empty($value))
                {
                    $key = rtrim($key);
                    $old_options[$key] = trim($value);
                }
            }
        }
        $virtual_domains = '';
        if($status == 'update')
        {
            // create virtual_domains list
            $domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
            foreach($domainAll as $domain)
            {
                if ($domainAll[0]['domain'] == $domain['domain'])
                    $virtual_domains .= "'".$domain['domain']."'";
                else
                    $virtual_domains .= ", '".$domain['domain']."'";
            }
        }
        else
            $virtual_domains = "' '";
        $content = str_replace('{hostname}', $conf['hostname'], $content);
        $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
        $content = str_replace('{virtual_domains}', $virtual_domains, $content);
        wf($full_file_name, $content);
    }
    public function configure_postfix($options = '') {
        global $conf;
        $cf = $conf['postfix'];
install/sql/incremental/upd_0007.sql
New file
@@ -0,0 +1,19 @@
ALTER TABLE client ADD COLUMN limit_mailmailinglist int(11) NOT NULL default '-1';
ALTER TABLE client_template ADD COLUMN limit_mailmailinglist int(11) NOT NULL default '-1';
CREATE TABLE IF NOT EXISTS `mail_mailinglist` (
  `mailinglist_id` int(11) unsigned NOT NULL auto_increment,
  `sys_userid` int(11) unsigned NOT NULL default '0',
  `sys_groupid` int(11) unsigned NOT NULL default '0',
  `sys_perm_user` varchar(5) NOT NULL,
  `sys_perm_group` varchar(5) character set ucs2 NOT NULL,
  `sys_perm_other` varchar(5) NOT NULL,
  `server_id` int(11) unsigned NOT NULL default '0',
  `domain` varchar(255) NOT NULL,
  `listname` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  PRIMARY KEY  (`mailinglist_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
DROP TABLE `mail_mailman_domain`;
install/sql/ispconfig3.sql
@@ -103,6 +103,7 @@
  `limit_cron_frequency` int(11) NOT NULL default '5',
  `limit_traffic_quota` int(11) NOT NULL default '-1',
  `limit_client` int(11) NOT NULL default '0',
  `limit_mailmailinglist` int(11) NOT NULL default '-1',
  `parent_client_id` int(11) unsigned NOT NULL default '0',
  `username` varchar(64) default NULL,
  `password` varchar(64) default NULL,
@@ -159,6 +160,7 @@
  `limit_cron_frequency` int(11) NOT NULL default '5',
  `limit_traffic_quota` int(11) NOT NULL default '-1',
  `limit_client` int(11) NOT NULL default '0',
  `limit_mailmailinglist` int(11) NOT NULL default '-1',
  PRIMARY KEY  (`template_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
@@ -493,18 +495,22 @@
-- --------------------------------------------------------
-- 
-- Table structure for table  `mail_mailman_domain`
-- Tabellenstruktur für Tabelle `mail_mailinglist`
-- 
CREATE TABLE `mail_mailman_domain` (
  `mailman_id` int(11) unsigned NOT NULL auto_increment,
CREATE TABLE `mail_mailinglist` (
  `mailinglist_id` int(11) unsigned NOT NULL auto_increment,
  `sys_userid` int(11) unsigned NOT NULL default '0',
  `sys_groupid` int(11) unsigned NOT NULL default '0',
  `sys_perm_user` varchar(5) NOT NULL,
  `sys_perm_group` varchar(5) NOT NULL,
  `sys_perm_other` varchar(5) NOT NULL,
  `server_id` int(11) unsigned NOT NULL default '0',
  `domain` varchar(255) NOT NULL default '',
  `mm_home` varchar(255) NOT NULL default '',
  `mm_wrap` varchar(255) NOT NULL default '',
  `mm_user` varchar(50) NOT NULL default '',
  `mm_group` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`mailman_id`,`server_id`,`domain`)
  `domain` varchar(255) NOT NULL,
  `listname` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  PRIMARY KEY  (`mailinglist_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
install/tpl/mm_cfg.py.master
New file
@@ -0,0 +1,106 @@
# -*- python -*-
# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
"""This is the module which takes your site-specific settings.
From a raw distribution it should be copied to mm_cfg.py.  If you
already have an mm_cfg.py, be careful to add in only the new settings
you want.  The complete set of distributed defaults, with annotation,
are in ./Defaults.  In mm_cfg, override only those you want to
change, after the
  from Defaults import *
line (see below).
Note that these are just default settings - many can be overridden via the
admin and user interfaces on a per-list or per-user basis.
Note also that some of the settings are resolved against the active list
setting by using the value as a format string against the
list-instance-object's dictionary - see the distributed value of
DEFAULT_MSG_FOOTER for an example."""
#######################################################
#    Here's where we get the distributed defaults.    #
from Defaults import *
##############################################################
# Put YOUR site-specific configuration below, in mm_cfg.py . #
# See Defaults.py for explanations of the values.            #
#-------------------------------------------------------------
# The name of the list Mailman uses to send password reminders
# and similar. Don't change if you want mailman-owner to be
# a valid local part.
MAILMAN_SITE_LIST = 'mailman'
#-------------------------------------------------------------
# If you change these, you have to configure your http server
# accordingly (Alias and ScriptAlias directives in most httpds)
DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/'
PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
IMAGE_LOGOS         = '/images/mailman/'
#-------------------------------------------------------------
# Default domain for email addresses of newly created MLs
DEFAULT_EMAIL_HOST = '{hostname}'
#-------------------------------------------------------------
# Default host for web interface of newly created MLs
DEFAULT_URL_HOST   = '{hostname}'
#-------------------------------------------------------------
# Required when setting any of its arguments.
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
#-------------------------------------------------------------
# The default language for this server.
DEFAULT_SERVER_LANGUAGE = {default_language}
#-------------------------------------------------------------
# Iirc this was used in pre 2.1, leave it for now
USE_ENVELOPE_SENDER    = 0              # Still used?
#-------------------------------------------------------------
# Unset send_reminders on newly created lists
DEFAULT_SEND_REMINDERS = 0
#-------------------------------------------------------------
# Uncomment this if you configured your MTA such that it
# automatically recognizes newly created lists.
# (see /usr/share/doc/mailman/README.Exim4.Debian or
# /usr/share/mailman/postfix-to-mailman.py)
# MTA=None   # Misnomer, suppresses alias output on newlist
#-------------------------------------------------------------
# Uncomment if you use Postfix virtual domains (but not
# postfix-to-mailman.py), but be sure to see
# /usr/share/doc/mailman/README.Debian first.
MTA='Postfix'
POSTFIX_STYLE_VIRTUAL_DOMAINS = [{virtual_domains}]
#-------------------------------------------------------------
# Uncomment if you want to filter mail with SpamAssassin. For
# more information please visit this website:
# http://www.jamesh.id.au/articles/mailman-spamassassin/
# GLOBAL_PIPELINE.insert(1, 'SpamAssassin')
# Note - if you're looking for something that is imported from mm_cfg, but you
# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py.
install/update.php
@@ -217,6 +217,10 @@
        swriteln('Configuring Postfix');
        $inst->configure_postfix('dont-create-certs');
    
        //** Configure mailman
        swriteln('Configuring Mailman');
        $inst->configure_mailman('update');
        //* Configure Jailkit
        swriteln('Configuring Jailkit');
        $inst->configure_jailkit();
@@ -336,6 +340,7 @@
        if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop']))                 system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart');
        if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl']))         system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart');
        if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script']))         system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart');
        if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script']))         system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart');
    }
    if($conf['services']['web']) {
        if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script']))                 system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
interface/lib/classes/remoting.inc.php
@@ -192,6 +192,53 @@
        return $affected_rows;
    }
    
    //* Get mail mailinglist details
    public function mail_mailinglist_get($session_id, $primary_id)
    {
        global $app;
        if(!$this->checkPerm($session_id, 'mail_mailinglist_get')) {
            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
            return false;
        }
        $app->uses('remoting_lib');
        $app->remoting_lib->loadFormDef('../mail/form/mail_mailinglist.tform.php');
        return $app->remoting_lib->getDataRecord($primary_id);
    }
    //* Add a mail mailinglist
    public function mail_mailinglist_add($session_id, $client_id, $params)
    {
        if(!$this->checkPerm($session_id, 'mail_mailinglist_add')) {
            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
            return false;
        }
        $primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php',$client_id,$params);
        return $primary_id;
    }
    //* Update a mail mailinglist
    public function mail_mailinglist_update($session_id, $client_id, $primary_id, $params)
    {
        if(!$this->checkPerm($session_id, 'mail_mailinglist_update')) {
            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
            return false;
        }
        $affected_rows = $this->updateQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $primary_id, $params);
        return $affected_rows;
    }
    //* Delete a mail mailinglist
    public function mail_mailinglist_delete($session_id, $primary_id)
    {
        if(!$this->checkPerm($session_id, 'mail_mailinglist_delete')) {
            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
            return false;
        }
        $affected_rows = $this->deleteQuery('../mail/form/mail_mailinglist.tform.php', $primary_id);
        return $affected_rows;
    }
    //* Get mail user details
    public function mail_user_get($session_id, $primary_id)
    {
interface/web/admin/form/remote_user.tform.php
@@ -35,6 +35,7 @@
$function_list = array();
$function_list['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete,mail_domain_set_status,mail_domain_get_by_domain'] = 'Mail domain functions';
$function_list['mail_mailinglist_get,mail_mailinglist_add,mail_mailinglist_update,mail_mailinglist_delete'] = 'Mail mailinglist functions';
$function_list['mail_user_get,mail_user_add,mail_user_update,mail_user_delete'] = 'Mail user functions';
$function_list['mail_alias_get,mail_alias_add,mail_alias_update,mail_alias_delete'] = 'Mail alias functions';
$function_list['mail_forward_get,mail_forward_add,mail_forward_update,mail_forward_delete'] = 'Mail forward functions';
interface/web/admin/form/system_config.tform.php
@@ -180,6 +180,24 @@
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'mailmailinglist_link' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'CHECKBOX',
            'default'    => 'n',
            'value'        => array(0 => 'n',1 => 'y')
        ),
        'mailmailinglist_url' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'REGEX',
                                                        'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
                                                        'errmsg'=> 'mailinglist_url_error_regex'),
                                        ),
            'default'    => '',
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'admin_mail' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
interface/web/admin/lib/lang/en_remote_user.lng
@@ -7,6 +7,7 @@
$wb['password_error_empty'] = 'Password cannot be empty';
$wb['password_strength_txt'] = 'Password Strength:';
$wb['Mail domain functions'] = 'Mail domain functions';
$wb['Mail mailing list functions'] = 'Mail mailinglist functions';
$wb['Mail user functions'] = 'Mail user functions';
$wb['Mail alias functions'] = 'Mail alias functions';
$wb['Mail forward functions'] = 'Mail forward functions';
interface/web/admin/lib/lang/en_system_config.lng
@@ -14,6 +14,8 @@
$wb["dblist_phpmyadmin_link_txt"] = 'Link to phpmyadmin in DB list';
$wb["mailboxlist_webmail_link_txt"] = 'Link to webmail in Mailbox list';
$wb["webmail_url_txt"] = 'Webmail URL';
$wb["mailmailinglist_link_txt"] = 'Link to mailing list in Mailing list list';
$wb["mailmailinglist_url_txt"] = 'Mailing list URL';
$wb["phpmyadmin_url_txt"] = 'PHPMyAdmin URL';
$wb["use_domain_module_txt"] = 'Use the domain-module to add new domains';
$wb["use_domain_module_hint"] = 'If you use this module, your customers can only select one of the domains the admin creates for them. They cannot free edit the domain-field.You have to re-login after changing this value, to make the changes visible.';
interface/web/admin/templates/system_config_mail_edit.htm
@@ -15,6 +15,16 @@
          <label for="webmail_url">{tmpl_var name='webmail_url_txt'}</label>
        <input name="webmail_url" id="webmail_url" value="{tmpl_var name='webmail_url'}" size="30" maxlength="255" type="text" class="textInput" />
      </div>
    <div class="ctrlHolder">
                <p class="label">{tmpl_var name='mailmailinglist_link_txt'}</p>
                    <div class="multiField">
                        {tmpl_var name='mailmailinglist_link'}
                    </div>
            </div>
    <div class="ctrlHolder">
          <label for="mailmailinglist_url">{tmpl_var name='mailmailinglist_url_txt'}</label>
        <input name="mailmailinglist_url" id="mailmailinglist_url" value="{tmpl_var name='mailmailinglist_url'}" size="30" maxlength="255" type="text" class="textInput" />
      </div>
    <div class="ctrlHolder">
          <label for="admin_mail">{tmpl_var name='admin_mail_txt'}</label>
        <input name="admin_mail" id="admin_mail" value="{tmpl_var name='admin_mail'}" size="30" maxlength="255" type="text" class="textInput" />
interface/web/client/form/client.tform.php
@@ -422,6 +422,20 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_mailmailinglist' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_mailmailinglist_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_mailforward' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
interface/web/client/form/client_template.tform.php
@@ -157,6 +157,20 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_mailmailinglist' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_mailmailinglist_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_mailforward' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
interface/web/client/form/reseller.tform.php
@@ -358,6 +358,20 @@
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_mailmailinglist' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'ISINT',
                                                        'errmsg'=> 'limit_mailmailinglist_error_notint'),
                                    ),
            'default'    => '-1',
            'value'        => '',
            'separator'    => '',
            'width'        => '10',
            'maxlength'    => '10',
            'rows'        => '',
            'cols'        => ''
        ),
        'limit_mailbox' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'TEXT',
interface/web/client/lib/lang/en_client.lng
@@ -1,5 +1,6 @@
<?php
$wb["limit_maildomain_txt"] = 'Max. number of email domains';
$wb["limit_mailmailinglist_txt"] = 'Max. number of mailing lists';
$wb["limit_mailbox_txt"] = 'Max. number of mailboxes';
$wb["limit_mailalias_txt"] = 'Max. number of email aliases';
$wb["limit_mailaliasdomain_txt"] = 'Max. number of domain aliases';
@@ -62,6 +63,7 @@
$wb["username_error_empty"] = 'Username is empty.';
$wb["username_error_unique"] = 'The username must be unique.';
$wb["limit_maildomain_error_notint"] = 'The email domain limit must be a number.';
$wb["limit_mailmailinglist_error_notint"] = 'The mailing list record limit must be a number.';
$wb["limit_mailbox_error_notint"] = 'The mailbox limit must be a number.';
$wb["limit_mailalias_error_notint"] = 'The email alias limit must be a number.';
$wb["limit_mailaliasdomain_error_notint"] = 'The email domain alias limit must be a number.';
interface/web/client/lib/lang/en_client_template.lng
@@ -5,6 +5,7 @@
$wb["limit_mailbox_txt"] = 'Max. number of mailboxes';
$wb["limit_mailalias_txt"] = 'Max. number of email aliases';
$wb["limit_mailaliasdomain_txt"] = 'Max. number of domain aliases';
$wb["limit_mailmailinglist_txt"] = 'Max. number of mailing lists';
$wb["limit_mailforward_txt"] = 'Max. number of email forwarders';
$wb["limit_mailcatchall_txt"] = 'Max. number of email catchall accounts';
$wb["limit_mailrouting_txt"] = 'Max. number of email routes';
@@ -32,6 +33,7 @@
$wb["limit_webdav_user_txt"] = 'Max. number of Webdav users';
$wb["limit_client_txt"] = 'Max. number of Clients';
$wb["limit_maildomain_error_notint"] = 'The email domain limit must be a number.';
$wb["limit_mailmailinglist_error_notint"] = 'The mailing list record limit must be a number.';
$wb["limit_mailbox_error_notint"] = 'The mailbox limit must be a number.';
$wb["limit_mailalias_error_notint"] = 'The email alias limit must be a number.';
$wb["limit_mailaliasdomain_error_notint"] = 'The email domain alias limit must be a number.';
interface/web/client/lib/lang/en_reseller.lng
@@ -1,5 +1,6 @@
<?php
$wb["limit_maildomain_txt"] = 'Max. number of email domains';
$wb["limit_mailmailinglist_txt"] = 'Max. number of mailing lists';
$wb["limit_mailbox_txt"] = 'Max. number of mailboxes';
$wb["limit_mailalias_txt"] = 'Max. number of email aliases';
$wb["limit_mailforward_txt"] = 'Max. number of email forwarders';
@@ -60,6 +61,7 @@
$wb["username_error_empty"] = 'Username is empty.';
$wb["username_error_unique"] = 'The username must be unique.';
$wb["limit_maildomain_error_notint"] = 'The email domain limit must be a number.';
$wb["limit_mailmailinglist_error_notint"] = 'The mailing list record limit must be a number.';
$wb["limit_mailbox_error_notint"] = 'The mailbox limit must be a number.';
$wb["limit_mailalias_error_notint"] = 'The email alias limit must be a number.';
$wb["limit_mailforward_error_notint"] = 'The email forward limit must be a number.';
interface/web/client/templates/client_edit_limits.htm
@@ -58,6 +58,10 @@
                <input name="limit_mailaliasdomain" id="limit_mailaliasdomain" value="{tmpl_var name='limit_mailaliasdomain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
            <div class="ctrlHolder">
                <label for="limit_mailmailinglist">{tmpl_var name='limit_mailmailinglist_txt'}</label>
                <input name="limit_mailmailinglist" id="limit_mailmailinglist" value="{tmpl_var name='limit_mailmailinglist'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
            <div class="ctrlHolder">
                <label for="limit_mailforward">{tmpl_var name='limit_mailforward_txt'}</label>
                <input name="limit_mailforward" id="limit_mailforward" value="{tmpl_var name='limit_mailforward'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
interface/web/client/templates/client_template_edit_limits.htm
@@ -22,6 +22,10 @@
                <input name="limit_mailaliasdomain" id="limit_mailaliasdomain" value="{tmpl_var name='limit_mailaliasdomain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
            <div class="ctrlHolder">
                <label for="limit_mailmailinglist">{tmpl_var name='limit_mailmailinglist_txt'}</label>
                <input name="limit_mailmailinglist" id="limit_mailmailinglist" value="{tmpl_var name='limit_mailmailinglist'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
            <div class="ctrlHolder">
                <label for="limit_mailforward">{tmpl_var name='limit_mailforward_txt'}</label>
                <input name="limit_mailforward" id="limit_mailforward" value="{tmpl_var name='limit_mailforward'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
interface/web/client/templates/reseller_edit_limits.htm
@@ -35,6 +35,10 @@
        <input name="limit_maildomain" id="limit_maildomain" value="{tmpl_var name='limit_maildomain'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
      <div class="ctrlHolder">
                <label for="limit_mailmailinglist">{tmpl_var name='limit_mailmailinglist_txt'}</label>
                <input name="limit_mailmailinglist" id="limit_mailmailinglist" value="{tmpl_var name='limit_mailmailinglist'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
      <div class="ctrlHolder">
          <label for="limit_mailbox">{tmpl_var name='limit_mailbox_txt'}</label>
        <input name="limit_mailbox" id="limit_mailbox" value="{tmpl_var name='limit_mailbox'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
            </div>
interface/web/dashboard/dashlets/limits.php
@@ -13,6 +13,10 @@
                          'db_table' => 'mail_domain',
                          'db_where' => '');
        
        $limits[] = array('field' => 'limit_mailmailinglist',
                          'db_table' => 'mail_mailinglist',
                          'db_where' => '');
        $limits[] = array('field' => 'limit_mailbox',
                          'db_table' => 'mail_user',
                          'db_where' => '');
interface/web/dashboard/lib/lang/en_dashlet_limits.lng
@@ -3,6 +3,7 @@
$wb['of_txt'] = "of";
$wb['unlimited_txt'] = "Unlimited";
$wb['limit_maildomain_txt'] = "Number of email domains";
$wb['limit_mailmailinglist_txt'] = "Number of mailing lists";
$wb['limit_mailbox_txt'] = "Number of mailboxes";
$wb["limit_mailalias_txt"] = 'Number of email aliases';
$wb["limit_mailaliasdomain_txt"] = 'Number of domain aliases';
interface/web/mail/form/mail_mailinglist.tform.php
New file
@@ -0,0 +1,122 @@
<?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"]             = "Mailing List";
$form["description"]     = "";
$form["name"]             = "mail_mailinglist";
$form["action"]            = "mail_mailinglist_edit.php";
$form["db_table"]        = "mail_mailinglist";
$form["db_table_idx"]    = "mailinglist_id";
$form["db_history"]        = "yes";
$form["tab_default"]    = "mailinglist";
$form["list_default"]    = "mail_mailinglist_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"]['mailinglist'] = array (
    'title'     => "Mailing List",
    'width'     => 100,
    'template'     => "templates/mail_mailinglist_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 mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} 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'    => 'REGEX',
                                                        'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
                                                        'errmsg'=> 'domain_error_regex'),
                                    ),
            'default'    => '',
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'listname' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'listname_error_empty'),
                                    ),
            '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'
        ),
        'password' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'PASSWORD',
            'encryption'=> 'CLEARTEXT',
            'default'    => '',
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
    ##################################
    # ENDE Datatable fields
    ##################################
    )
);
?>
interface/web/mail/lib/lang/en_mail_mailinglist.lng
New file
@@ -0,0 +1,15 @@
<?php
$wb["limit_mailmailinglist_txt"] = 'Limit reached';
$wb["domain_error_empty"] = 'Domain is empty.';
$wb["listname_error_empty"] = 'Listname is empty.';
$wb["domain_error_regex"] = 'Invalid domain name.';
$wb["email_in_use_txt"] = 'Email is in use';
$wb["no_domain_perm"] = 'You have no permission for this domain.';
$wb["password_strength_txt"] = 'Password strength';
$wb["server_id_txt"] = 'Server';
$wb["domain_txt"] = 'Domain';
$wb["listname_txt"] = 'Listname';
$wb["client_txt"] = 'Client';
$wb["email_txt"] = 'Email';
$wb["password_txt"] = 'Password';
?>
interface/web/mail/lib/lang/en_mail_mailinglist_list.lng
New file
@@ -0,0 +1,5 @@
<?php
$wb["list_head_txt"] = 'Mailing List';
$wb["domain_txt"] = 'Domain';
$wb["listname_txt"] = 'Listname';
?>
interface/web/mail/lib/module.conf.php
@@ -75,6 +75,24 @@
                                'items'    => $items);
}
//**** Mailinglist menu
$items = array();
if($app->auth->get_client_limit($userid,'mailmailinglist') != 0)
{
    $items[] = array( 'title'     => 'Mailing List',
                      'target'     => 'content',
                      'link'    => 'mail/mail_mailinglist_list.php',
                      'html_id' => 'mail_mailinglist_list');
}
if(count($items))
{
    $module['nav'][] = array(    'title'    => 'Mailing List',
                                'open'     => 1,
                                'items'    => $items);
}
//**** Spamfilter menu
$items = array();
interface/web/mail/list/mail_mailinglist.list.php
New file
@@ -0,0 +1,67 @@
<?php
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]                 = "mail_mailinglist";
// Database table
$liste["table"]             = "mail_mailinglist";
// Index index field of the database table
$liste["table_idx"]            = "mailinglist_id";
// Search Field Prefix
$liste["search_prefix"]     = "search_";
// Records per page
$liste["records_per_page"]     = 15;
// Script File of the list
$liste["file"]                = "mail_mailinglist_list.php";
// Script file of the edit form
$liste["edit_file"]            = "mail_mailinglist_edit.php";
// Script File of the delete script
$liste["delete_file"]        = "mail_mailinglist_del.php";
// Paging Template
$liste["paging_tpl"]        = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"]                = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array(    'field'        => "listname",
                            '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/mail/mail_domain_del.php
@@ -83,6 +83,12 @@
            $app->db->datalogDelete('spamfilter_users','id',$rec['id']);
        }
        
        // Delete all mailinglists that belong to this domain
        $records = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = '".$app->db->quote($domain)."'");
        foreach($records as $rec) {
            $app->db->datalogDelete('mail_mailinglist','mailinglist_id',$rec['id']);
        }
    }
}
interface/web/mail/mail_domain_edit.php
@@ -350,6 +350,9 @@
                }
            }
            //* Update the mailinglist
            $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $sys_groupid WHERE domain = '".mysql_real_escape_string($this->oldDataRecord['domain'])."'");
            //* Delete the old spamfilter record
            $tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".mysql_real_escape_string($this->oldDataRecord["domain"])."'");
            $app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]);
interface/web/mail/mail_mailinglist_del.php
New file
@@ -0,0 +1,58 @@
<?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_mailinglist.list.php";
$tform_def_file = "form/mail_mailinglist.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 {
}
$page = new page_action;
$page->onDelete();
?>
interface/web/mail/mail_mailinglist_edit.php
New file
@@ -0,0 +1,256 @@
<?php
/*
Copyright (c) 2005 - 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_mailinglist.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 {
    function onShowNew() {
        global $app, $conf;
        // we will check only users, not admins
        if($_SESSION["s"]["user"]["typ"] == 'user') {
            if(!$app->tform->checkClientLimit('limit_mailmailinglist')) {
                $app->error($app->tform->wordbook["limit_mailmailinglist_txt"]);
            }
            if(!$app->tform->checkResellerLimit('limit_mailmailinglist')) {
                $app->error('Reseller: '.$app->tform->wordbook["limit_mailmailinglist_txt"]);
            }
        }
        parent::onShowNew();
    }
    function onShowEnd() {
        global $app, $conf;
        if($_SESSION["s"]["user"]["typ"] == 'admin') {
            // Getting Clients of the user
            if($_SESSION["s"]["user"]["typ"] == 'admin') {
                $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
            } else {
                $client_group_id = $_SESSION["s"]["user"]["default_group"];
                $sql = "SELECT client.client_id, limit_web_domain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
            }
            $clients = $app->db->queryAllRecords($sql);
            $client_select = '';
            if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
            $tmp_data_record = $app->tform->getDataRecord($this->id);
            if(is_array($clients)) {
                foreach( $clients as $client) {
                    $selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
                    $client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
                }
            }
            $app->tpl->setVar("client_group_id",$client_select);
        } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name");
            // Fill the client select field
            $sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
            $clients = $app->db->queryAllRecords($sql);
            $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
            $client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
            $tmp_data_record = $app->tform->getDataRecord($this->id);
            if(is_array($clients)) {
                foreach( $clients as $client) {
                    $selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
                    $client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
                }
            }
            $app->tpl->setVar("client_group_id",$client_select);
        }
        // Getting Domains of the user
        $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
        $domains = $app->db->queryAllRecords($sql);
        $domain_select = '';
        if(is_array($domains)) {
            foreach( $domains as $domain) {
                $selected = ($domain["domain"] == $this->dataRecord["domain"])?'SELECTED':'';
                $domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
            }
        }
        $app->tpl->setVar("domain_option",$domain_select);
        if($this->id > 0) {
            //* we are editing a existing record
            $app->tpl->setVar("edit_disabled", 1);
            $app->tpl->setVar("listname_value", $this->dataRecord["listname"]);
            $app->tpl->setVar("domain_value", $this->dataRecord["domain"]);
            $app->tpl->setVar("email_value", $this->dataRecord["email"]);
        } else {
            $app->tpl->setVar("edit_disabled", 0);
        }
        parent::onShowEnd();
    }
    function onSubmit() {
        global $app, $conf;
        if($_SESSION["s"]["user"]["typ"] != 'admin') {
            // Get the limits of the client
            $client_group_id = $_SESSION["s"]["user"]["default_group"];
            $client = $app->db->queryOneRecord("SELECT limit_mailmailinglist, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
            //* Check if Domain belongs to user
            if(isset($_POST["domain"])) {
                $domain = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."' AND ".$app->tform->getAuthSQL('r'));
                if($domain["domain"] != $this->dataRecord["domain"]) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
            }
            // When the record is updated
            if($this->id == 0) {
                //Check if email is in use
                $check = $app->db->queryOneRecord("SELECT count(source) as number FROM mail_forwarding WHERE source = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'");
                if($check['number'] != 0) {
                        $app->error($app->tform->wordbook["email_in_use_txt"]);
                }
                $check = $app->db->queryOneRecord("SELECT count(email) as number FROM mail_user WHERE email = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'");
                if($check['number'] != 0) {
                        $app->error($app->tform->wordbook["email_in_use_txt"]);
                }
                $check = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE listname = '".$this->dataRecord["listname"]."' AND domain = '".$this->dataRecord["domain"]."'");
                if($check['number'] != 0) {
                        $app->error($app->tform->wordbook["email_in_use_txt"]);
                }
                // Check if the user may add another mail_domain
                if($client["limit_mailmailinglist"] >= 0) {
                    $tmp = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE sys_groupid = $client_group_id");
                    if($tmp["number"] >= $client["limit_mailmailinglist"]) {
                        $app->error($app->tform->wordbook["limit_mailmailinglist_txt"]);
                    }
                }
            }
            // Clients may not set the client_group_id, so we unset them if user is not a admin
            if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
        }
        //* make sure that the email domain is lowercase
        if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
        parent::onSubmit();
    }
    function onBeforeInsert() {
        global $app, $conf;
        // Set the server id of the mailinglist = server ID of mail domain.
        $domain = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."'");
        $this->dataRecord["server_id"] = $domain['server_id'];
    }
    function onAfterInsert() {
        global $app, $conf;
        // make sure that the record belongs to the client group and not the admin group when a dmin inserts it
        // also make sure that the user can not delete domain created by a admin
        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
            $client_group_id = intval($this->dataRecord["client_group_id"]);
            $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE mailinglist_id = ".$this->id);
        }
        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
            $client_group_id = intval($this->dataRecord["client_group_id"]);
            $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id);
        }
    }
    function onBeforeUpdate() {
        global $app, $conf;
        //* Check if the server has been changed
        // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
        if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
            $rec = $app->db->queryOneRecord("SELECT server_id, domain from mail_mailinglist WHERE mailinglist_id = ".$this->id);
            $this->dataRecord["server_id"] = $rec['server_id'];
            unset($rec);
            //* If the user is neither admin nor reseller
        } else {
            //* We do not allow users to change a domain which has been created by the admin
            $rec = $app->db->queryOneRecord("SELECT domain from mail_mailinglist WHERE mailinglist_id = ".$this->id);
            if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
                //* Add a error message and switch back to old server
                $app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
                $this->dataRecord["domain"] = $rec['domain'];
            }
            unset($rec);
        }
    }
    function onAfterUpdate() {
        global $app, $conf;
        // make sure that the record belongs to the clinet group and not the admin group when admin inserts it
        // also make sure that the user can not delete domain created by a admin
        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
            $client_group_id = intval($this->dataRecord["client_group_id"]);
            $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE mailinglist_id = ".$this->id);
        }
        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
            $client_group_id = intval($this->dataRecord["client_group_id"]);
            $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id);
        }
    }
}
$app->tform_actions = new page_action;
$app->tform_actions->onLoad();
?>
interface/web/mail/mail_mailinglist_list.php
New file
@@ -0,0 +1,44 @@
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_mailinglist.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('mail');
$app->load('listform_actions');
class list_action extends listform_actions {
    function onShow() {
        global $app,$conf;
        $app->uses('getconf');
        $global_config = $app->getconf->get_global_config('mail');
        if($global_config['mailmailinglist_link'] == 'y') {
            $app->tpl->setVar('mailmailinglist_link',1);
        } else {
            $app->tpl->setVar('mailmailinglist_link',0);
        }
        parent::onShow();
    }
}
$list = new list_action;
$list->onLoad();
?>
interface/web/mail/mailinglist.php
New file
@@ -0,0 +1,68 @@
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('mail');
/* get the id of the mail (must be int!) */
if (!isset($_GET['id'])){
    die ("No List selected!");
}
$listId = intval($_GET['id']);
/*
 * Get the data to connect to the database
 */
$dbData = $app->db->queryAllRecords("SELECT server_id, listname FROM mail_mailinglist WHERE mailinglist_id = " . $listId);
$serverId = intval($dbData[0]['server_id']);
if ($serverId == 0){
    die ("No List - Server found!");
}
$serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$serverId);
$app->uses('getconf');
$global_config = $app->getconf->get_global_config('mail');
if($global_config['mailmailinglist_url'] != '') {
    header('Location:' . $global_config['mailmailinglist_url']);
} else {
/*
 * We only redirect to the login-form, so there is no need, to check any rights
 */
    isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
    header('Location:' . $http . '://' . $serverData['server_name'] . '/cgi-bin/mailman/admin/' . $dbData[0]['listname']);
}
exit;
?>
interface/web/mail/templates/mail_mailinglist_edit.htm
New file
@@ -0,0 +1,80 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_mail_mailinglist">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels"><legend>Mailing List</legend>
        <tmpl_if name="is_admin">
            <div class="ctrlHolder">
                <label for="client_group_id">{tmpl_var name='client_txt'}</label>
                <select name="client_group_id" id="client_group_id" class="selectInput">
                    {tmpl_var name='client_group_id'}
                </select>
            </div>
        </tmpl_if>
        <tmpl_if name="is_reseller">
              <div class="ctrlHolder">
                  <label for="client_group_id">{tmpl_var name='client_txt'}</label>
                <select name="client_group_id" id="client_group_id" class="selectInput">
                    {tmpl_var name='client_group_id'}
                </select>
              </div>
          </tmpl_if>
        <tmpl_if name="edit_disabled">
            <div class="ctrlHolder">
                <label for="domain_disabled">{tmpl_var name='domain_txt'}</label>
                <select name="domain_disabled" id="domain_disabled" class="selectInput" disabled="disabled">
                        {tmpl_var name='domain_option'}
                </select>
                <input type="hidden" name="domain" value="{tmpl_var name='domain_value'}" />
            </div>
            <div class="ctrlHolder">
                <label for="listname_disabled">{tmpl_var name='listname_txt'}</label>
                <input name="listname_disabled" id="listname_disabled" value="{tmpl_var name='listname'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" />
                <input type="hidden" name="listname" value="{tmpl_var name='listname_value'}" />
            </div>
            <div class="ctrlHolder">
                <label for="email_disabled">{tmpl_var name='email_txt'}</label>
                <input name="email_disabled" id="email_disabled" value="{tmpl_var name='email'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" />
                <input type="hidden" name="email" value="{tmpl_var name='email_value'}" />
            </div>
        <tmpl_else>
            <div class="ctrlHolder">
                <label for="domain">{tmpl_var name='domain_txt'}</label>
                <select name="domain" id="domain" class="selectInput">
                        {tmpl_var name='domain_option'}
                </select>
            </div>
            <div class="ctrlHolder">
                <label for="listname">{tmpl_var name='listname_txt'}</label>
                <input name="listname" id="listname" value="{tmpl_var name='listname'}" size="30" maxlength="255" type="text" class="textInput" />
            </div>
            <div class="ctrlHolder">
                <label for="email">{tmpl_var name='email_txt'}</label>
                <input name="email" id="email" value="{tmpl_var name='email'}" size="30" maxlength="255" type="text" class="textInput" />
            </div>
        </tmpl_if>
        <div class="ctrlHolder">
            <label for="password">{tmpl_var name='password_txt'}</label>
            <input name="password" id="password" value="{tmpl_var name='password'}" size="30" maxlength="255" type="password" class="textInput" onkeyup="pass_check(this.value)" />
        </div>
        <div class="ctrlHolder">
                <p class="label">{tmpl_var name='password_strength_txt'}</p>
                <div id="passBar"></div>
                <p class="formHint"><span id="passText">&nbsp;</span></p>
            </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mail/mail_mailinglist_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_mailinglist_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/mail/templates/mail_mailinglist_list.htm
New file
@@ -0,0 +1,53 @@
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_list_mail_mailinglist">
  <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_mailinglist_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_listname" scope="col"><tmpl_var name="listname_txt"></th>
            <th class="tbl_col_domain" scope="col"><tmpl_var name="domain_txt"></th>
            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
          </tr>
          <tr>
            <td class="tbl_col_listname"><input type="text" name="search_listname" value="{tmpl_var name='search_listname'}" /></td>
            <td class="tbl_col_domain"><input type="text" name="search_domain" value="{tmpl_var name='search_domain'}" /></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_mailinglist_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_listname"><a href="#" onClick="loadContent('mail/mail_mailinglist_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="listname"}</a></td>
            <td class="tbl_col_domain"><a href="#" onClick="loadContent('mail/mail_mailinglist_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="domain"}</a></td>
            <td class="tbl_col_buttons">
              <div class="buttons icons16">
                  <tmpl_if name="mailmailinglist_link"><a class="icons16 icoWebmailer" href="mail/mailinglist.php?id={tmpl_var name='id'}" target="mailmailinglist"><span>{tmpl_var name='delete_txt'}</span></a></tmpl_if>
                <a class="icons16 icoDelete" href="javascript: del_record('mail/mail_mailinglist_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="3"><tmpl_var name="paging"></td>
          </tr>
        </tfoot>
      </table>
    </fieldset>
  </div>
</div>
server/conf/mm_cfg.py.master
New file
@@ -0,0 +1,106 @@
# -*- python -*-
# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
"""This is the module which takes your site-specific settings.
From a raw distribution it should be copied to mm_cfg.py.  If you
already have an mm_cfg.py, be careful to add in only the new settings
you want.  The complete set of distributed defaults, with annotation,
are in ./Defaults.  In mm_cfg, override only those you want to
change, after the
  from Defaults import *
line (see below).
Note that these are just default settings - many can be overridden via the
admin and user interfaces on a per-list or per-user basis.
Note also that some of the settings are resolved against the active list
setting by using the value as a format string against the
list-instance-object's dictionary - see the distributed value of
DEFAULT_MSG_FOOTER for an example."""
#######################################################
#    Here's where we get the distributed defaults.    #
from Defaults import *
##############################################################
# Put YOUR site-specific configuration below, in mm_cfg.py . #
# See Defaults.py for explanations of the values.            #
#-------------------------------------------------------------
# The name of the list Mailman uses to send password reminders
# and similar. Don't change if you want mailman-owner to be
# a valid local part.
MAILMAN_SITE_LIST = 'mailman'
#-------------------------------------------------------------
# If you change these, you have to configure your http server
# accordingly (Alias and ScriptAlias directives in most httpds)
DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/'
PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
IMAGE_LOGOS         = '/images/mailman/'
#-------------------------------------------------------------
# Default domain for email addresses of newly created MLs
DEFAULT_EMAIL_HOST = '{hostname}'
#-------------------------------------------------------------
# Default host for web interface of newly created MLs
DEFAULT_URL_HOST   = '{hostname}'
#-------------------------------------------------------------
# Required when setting any of its arguments.
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
#-------------------------------------------------------------
# The default language for this server.
DEFAULT_SERVER_LANGUAGE = {default_language}
#-------------------------------------------------------------
# Iirc this was used in pre 2.1, leave it for now
USE_ENVELOPE_SENDER    = 0              # Still used?
#-------------------------------------------------------------
# Unset send_reminders on newly created lists
DEFAULT_SEND_REMINDERS = 0
#-------------------------------------------------------------
# Uncomment this if you configured your MTA such that it
# automatically recognizes newly created lists.
# (see /usr/share/doc/mailman/README.Exim4.Debian or
# /usr/share/mailman/postfix-to-mailman.py)
# MTA=None   # Misnomer, suppresses alias output on newlist
#-------------------------------------------------------------
# Uncomment if you use Postfix virtual domains (but not
# postfix-to-mailman.py), but be sure to see
# /usr/share/doc/mailman/README.Debian first.
MTA='Postfix'
POSTFIX_STYLE_VIRTUAL_DOMAINS = [{virtual_domains}]
#-------------------------------------------------------------
# Uncomment if you want to filter mail with SpamAssassin. For
# more information please visit this website:
# http://www.jamesh.id.au/articles/mailman-spamassassin/
# GLOBAL_PIPELINE.insert(1, 'SpamAssassin')
# Note - if you're looking for something that is imported from mm_cfg, but you
# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py.
server/mods-available/mail_module.inc.php
@@ -52,7 +52,10 @@
                                    'mail_get_delete',
                                    'mail_content_filter_insert',
                                    'mail_content_filter_update',
                                    'mail_content_filter_delete');
                                    'mail_content_filter_delete',
                                    'mail_mailinglist_insert',
                                    'mail_mailinglist_update',
                                    'mail_mailinglist_delete');
    
    //* This function is called during ispconfig installation to determine
    //  if a symlink shall be created for this plugin.
@@ -98,6 +101,7 @@
        $app->modules->registerTableHook('mail_user','mail_module','process');
        $app->modules->registerTableHook('mail_get','mail_module','process');
        $app->modules->registerTableHook('mail_content_filter','mail_module','process');
        $app->modules->registerTableHook('mail_mailinglist','mail_module','process');
        
    }
    
@@ -145,6 +149,11 @@
                if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update',$data);
                if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete',$data);
            break;
            case 'mail_mailinglist':
                if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert',$data);
                if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update',$data);
                if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete',$data);
            break;
        } // end switch
    } // end function
server/plugins-available/mailman_plugin.inc.php
New file
@@ -0,0 +1,155 @@
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class mailman_plugin {
    var $plugin_name = 'mailman_plugin';
    var $class_name = 'mailman_plugin';
    var $mailman_config_dir = '/etc/mailman/';
    //* This function is called during ispconfig installation to determine
    //  if a symlink shall be created for this plugin.
    function onInstall() {
        global $conf;
        if($conf['services']['mail'] == true) {
            return true;
        } else {
            return false;
        }
    }
    /*
         This function is called when the plugin is loaded
    */
    function onLoad() {
        global $app;
        /*
        Register for the events
        */
        $app->plugins->registerEvent('mail_mailinglist_insert','mailman_plugin','insert');
        $app->plugins->registerEvent('mail_mailinglist_update','mailman_plugin','update');
        $app->plugins->registerEvent('mail_mailinglist_delete','mailman_plugin','delete');
    }
    function insert($event_name,$data) {
        global $app, $conf;
        $this->update_config();
        exec("/usr/lib/mailman/bin/newlist -u ".$data["new"]["domain"]." -e ".$data["new"]["domain"]." ".$data["new"]["listname"]." ".$data["new"]["email"]." ".$data["new"]["password"]."");
        exec($conf['init_scripts'] . '/' . 'mailman reload &> /dev/null');
        $app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$data["new"]['mailinglist_id']);
    }
    // The purpose of this plugin is to rewrite the main.cf file
    function update($event_name,$data) {
        global $app, $conf;
        exec("/usr/lib/mailman/bin/change_pw -l ".$data["new"]["listname"]." -p ".$data["new"]["password"]."");
        exec($conf['init_scripts'] . '/' . 'mailman reload &> /dev/null');
        $app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$data["new"]['mailinglist_id']);
    }
    function delete($event_name,$data) {
        global $app, $conf;
        $this->update_config();
        exec("/usr/lib/mailman/bin/rmlist -a ".$data["old"]["listname"]);
        exec($conf['init_scripts'] . '/' . 'mailman reload &> /dev/null');
    }
    function update_config() {
        global $app, $conf;
        copy($this->mailman_config_dir.'mm_cfg.py',$this->mailman_config_dir.'mm_cfg.py');
        // load the server configuration options
        $app->uses('getconf');
        $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
        // load files
        $content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master");
        $old_file = file_get_contents($this->mailman_config_dir."/mm_cfg.py");
        $old_options = array();
        $lines = explode("\n", $old_file);
        foreach ($lines as $line)
        {
            if (strlen($line) && substr($line, 0, 1) != '#')
            {
                list($key, $value) = explode("=", $line);
                if (!empty($value))
                {
                    $key = rtrim($key);
                    $old_options[$key] = trim($value);
                }
            }
        }
        // create virtual_domains list
        $domainAll = $app->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
        $virtual_domains = '';
        foreach($domainAll as $domain)
        {
            if ($domainAll[0]['domain'] == $domain['domain'])
                $virtual_domains .= "'".$domain['domain']."'";
            else
                $virtual_domains .= ", '".$domain['domain']."'";
        }
        $content = str_replace('{hostname}', $server_config['hostname'], $content);
        $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
        $content = str_replace('{virtual_domains}', $virtual_domains, $content);
        file_put_contents($this->mailman_config_dir."/mm_cfg.py", $content);
    }
} // end class
?>