Commit 16b9461a authored by Marius Burkard's avatar Marius Burkard

- removed mlmmj mailinglist manager

parent 57bbd9f7
......@@ -118,10 +118,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -118,10 +118,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -120,10 +120,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -120,10 +120,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -120,10 +120,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -120,10 +120,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -118,10 +118,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -128,10 +128,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['user'] = 'getmail';
......
......@@ -118,10 +118,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -120,10 +120,6 @@ $conf['mailman']['installed'] = false; // will be detected automatically during
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* mlmmj
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
......
......@@ -346,13 +346,7 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Mail
$inst->configure_mailman();
}
//* Configure mlmmj
if($conf['mlmmj']['installed'] == true) {
swriteln('Configuring Mlmmj');
$inst->configure_mlmmj(/*install*/);
}
//* Check for Dovecot and Courier
//* Check for Dovecot
if(!$conf['dovecot']['installed']) {
$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', ($install_mode == 'expert'));
}
......
......@@ -157,7 +157,6 @@ class installer_base {
if(is_installed('postfix')) $conf['postfix']['installed'] = true;
if(is_installed('postgrey')) $conf['postgrey']['installed'] = true;
if(is_installed('mailman') || is_installed('mmsitepass')) $conf['mailman']['installed'] = true;
if(is_installed('mlmmj') || is_installed('mlmmj-make-ml')) $conf['mlmmj']['installed'] = true;
if(is_installed('apache') || is_installed('apache2') || is_installed('httpd') || is_installed('httpd2')) $conf['apache']['installed'] = true;
if(is_installed('getmail')) $conf['getmail']['installed'] = true;
if(is_installed('dovecot')) $conf['dovecot']['installed'] = true;
......@@ -319,7 +318,7 @@ class installer_base {
$tpl_ini_array['web']['group'] = $conf['apache']['group'];
$tpl_ini_array['web']['php_ini_path_apache'] = $conf['apache']['php_ini_path_apache'];
$tpl_ini_array['web']['php_ini_path_cgi'] = $conf['apache']['php_ini_path_cgi'];
$tpl_ini_array['mail']['mailinglist_manager'] = ($conf['mlmmj']['installed'] == true)?'mlmmj':'mailman';
$tpl_ini_array['mail']['mailinglist_manager'] = 'mailman';
$tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user'];
$tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group'];
$tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir'];
......@@ -831,90 +830,6 @@ class installer_base {
exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
}
public function configure_mlmmj() {
global $conf;
$configDir = $conf['mlmmj']['config_dir'];
@mkdir($configDir, 0755, true);
$configFile = 'mlmmj.conf';
//* Backup exiting file
if(is_file("$configDir/$configFile")) {
copy("$configDir/$configFile", "$configDir/$configFile~");
}
// load files
if(is_file($conf['ispconfig_install_dir']."/server/conf-custom/install/$configFile.master")) {
copy($conf['ispconfig_install_dir']."/server/conf-custom/install/$configFile.master", "$configDir/$configFile");
} else {
copy("tpl/$configFile.master", "$configDir/$configFile");
}
$mlConfig = @parse_ini_file("$configDir/$configFile");
// Force PHP7 to use # to mark comments
if(PHP_MAJOR_VERSION >= 7)
$mlConfig = array_filter($mlConfig, function($v){return(substr($v,0,1)!=='#');}, ARRAY_FILTER_USE_KEY);
$command = 'useradd --system mlmmj --home '.$mlConfig['spool_dir'].' --shell /usr/false';
if(!is_user('mlmmj')) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@mkdir($mlConfig['spool_dir'], 0755, true);
chown($mlConfig['spool_dir'], 'mlmmj');
chgrp($mlConfig['spool_dir'], 'mlmmj');
// Make a backup copy of master.cf and main.cf files
copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~mlmmj');
//* Update postfix main.cf
$content = rf($conf['postfix']['config_dir'].'/main.cf');
if(!preg_match("/^alias_maps = .*hash:\/etc\/mlmmj\/aliases.*/m", $content)) {
$content = preg_replace("/^alias_maps = (.*)/m", "$0, hash:$configDir/aliases", $content);
}
if(!preg_match("/^alias_database = .*hash:\/etc\/mlmmj\/aliases.*/m", $content)) {
$content = preg_replace("/^alias_database = (.*)/m", "$0, hash:$configDir/aliases", $content);
}
if(!preg_match("/^virtual_alias_maps = .*hash:\/etc\/mlmmj\/virtual.*/m", $content)) {
$content = preg_replace("/^virtual_alias_maps = (.*)/m", "$0, hash:$configDir/virtual", $content);
}
if(!preg_match("/^transport_maps = .*hash:\/etc\/mlmmj\/transport.*/m", $content)) {
$content = preg_replace("/transport_maps = (.*)/m", "$0, hash:$configDir/transport", $content);
}
if(!preg_match("/^mlmmj_destination_recipient_limit.*/m", $content)) {
$content .= "\n# Only deliver one message to Mlmmj at a time\nmlmmj_destination_recipient_limit = 1\n";
}
wf($conf['postfix']['config_dir'].'/main.cf', $content);
//* Update postfix master.cf
$content = rf($conf['postfix']['config_dir'].'/master.cf');
if(!preg_match('/^mlmmj\s+unix\s+-\s+n\s+n\s+-\s+-\s+pipe\s*$/m', $content)) {
copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~mlmmj');
$content .= "\n# mlmmj mailing lists\n";
$content .= "mlmmj unix - n n - - pipe\n";
$content .= " flags=ORhu user=mlmmj argv=/usr/bin/mlmmj-receive -F -L ";
$content .= $mlConfig['spool_dir']."/\$nexthop\n\n";
wf($conf['postfix']['config_dir'].'/master.cf', $content);
}
//* Create aliasaes
touch("$configDir/aliases");
exec("nohup /usr/sbin/postalias $configDir/aliases >/dev/null 2>&1");
touch("$configDir/virtual");
exec("nohup /usr/sbin/postmap $configDir/virtual >/dev/null 2>&1");
touch("$configDir/transport");
exec("nohup /usr/sbin/postmap $configDir/transport >/dev/null 2>&1");
//* Create/update cron entry
$cronEntry = '0 */2 * * * find /var'.$mlConfig['spool_dir'].'/ -mindepth 1 -maxdepth 1 -type d -exec /usr/bin/mlmmj-maintd -F -d {} \;';
file_put_contents('/etc/cron.d/mlmmj', $cronEntry);
}
public function get_postfix_service($service, $type) {
global $conf;
......
# Path of the skeleton for mailing lists
skel_dir = /usr/share/mlmmj/text.skel
# Where to store ML data and archive
spool_dir = /var/spool/mlmmj
\ No newline at end of file
......@@ -57,7 +57,7 @@ overquota_notify_client=y
overquota_notify_freq=7
overquota_notify_onok=n
sendmail_path=/usr/sbin/sendmail
mailinglist_manager=mlmmj
mailinglist_manager=mailman
[getmail]
getmail_config_dir=/etc/getmail
......
......@@ -375,12 +375,6 @@ if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'sel
$inst->configure_mailman('update');
}
//* Configure mlmmj
if($conf['mlmmj']['installed'] == true && $inst->reconfigure_app('Mlmmj', $reconfigure_services_answer)) {
swriteln('Configuring Mlmmj');
$inst->configure_mlmmj(/*update*/);
}
//** Configure Spamasassin
if($inst->reconfigure_app('Spamassassin', $reconfigure_services_answer)) {
swriteln('Configuring Spamassassin');
......
......@@ -757,7 +757,7 @@ $form["tabs"]['mail'] = array(
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '20',
'value' => array('mlmmj' => 'Mlmmj', 'mailman' => 'Mailman')
'value' => array('mailman' => 'Mailman')
),
//#################################
// ENDE Datatable fields
......
......@@ -161,135 +161,3 @@ $form["tabs"]['mailinglist'] = array (
)
);
if($mlManager == 'mlmmj') {
$form["tabs"]['options'] = array (
'title' => "Options",
'width' => 100,
'template' => "templates/mail_mailinglist_options.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'admins' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'validators' => array (
0 => array ( 'type' => 'ISEMAIL',
'allowempty' => 'y',
'separator' => "\n",
'errmsg'=> 'email_error_isemail'),
),
'cols' => '30',
'rows' => '5'
),
'subject_prefix' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255',
),
'mail_footer' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'cols' => '30',
'rows' => '5'
),
'archive' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
)
);
$form["tabs"]['privacy'] = array (
'title' => "Privacy",
'width' => 100,
'template' => "templates/mail_mailinglist_privacy.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'list_type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'RADIO',
'regex' => '',
'errmsg' => '',
'default' => 'user',
'value' => array ('open' => 'open_list_txt', 'closed' => 'closed_list_txt'),
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'subscribe_policy' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'confirm',
'value' => array(
'disabled' => 'sub_disabled_txt',
'confirm' => 'sub_confirm_txt',
'approval' => 'sub_approval_txt',
'both' => 'sub_both_txt',
'none' => 'sub_none_txt'),
),
'posting_policy' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'confirm',
'value' => array(
'closed' => 'post_closed_txt',
'moderated' => 'post_moderated_txt',
'free' => 'post_free_txt'),
),
)
);
$form["tabs"]['digest'] = array (
'title' => "Digest",
'width' => 100,
'template' => "templates/mail_mailinglist_digest.htm",
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'digesttext' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'digestsub' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'digestinterval' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '7',
'validators' => array(0 => array('type' => 'ISINT'),
array('type'=>'RANGE', 'range'=>'1:60')
),
'value' => '',
'width' => '15'
),
'digestmaxmails' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '50',
'validators' => array(0 => array('type' => 'ISINT'),
array('type'=>'RANGE', 'range'=>'10:100')
),
'value' => '',
'width' => '15'
),
)
);
}
?>
......@@ -87,11 +87,6 @@ if($app->auth->get_client_limit($userid, 'mailmailinglist') != 0)
'html_id' => 'mail_mailinglist_list');
$mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager'];
if($mlManager == 'mlmmj')
$items[] = array( 'title' => 'Membership',
'target' => 'content',
'link' => 'mail/mail_ml_membership_list.php',
'html_id' => 'mail_ml_membership_list');
}
if(count($items) && $app->system->has_service($userid, 'mail'))
......
<?php
/*
Datatypes:
- INTEGER
- DOUBLE
- CURRENCY
- VARCHAR
- TEXT
- DATE
*/
// Name of the list
$liste["name"] = "mail_ml_membership";
// Database table
$liste["table"] = "mail_ml_membership";
// Index index field of the database table
$liste["table_idx"] = "subscriber_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
// Records per page
$liste["records_per_page"] = "15";
// Script File of the list
$liste["file"] = "mail_ml_membership_list.php";
// Script file of the edit form
$liste["edit_file"] = "mail_ml_membership_edit.php";
// Script File of the delete script
$liste["delete_file"] = "mail_ml_membership_del.php";
// Paging Template
$liste["paging_tpl"] = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"] = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array( 'field' => "mailinglist_id",
'datatype' => "INTEGER",
'formtype' => "SELECT",
'op' => "like",
'prefix' => "",
'suffix' => "",
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT mailinglist_id, CONCAT_WS(\'@\', listname, domain) as listname FROM mail_mailinglist WHERE {AUTHSQL} ORDER BY listname',
'keyfield'=> 'mailinglist_id',
'valuefield'=> 'listname'
),
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "email",
'datatype' => "VARCHAR",
'filters' => array( 0 => array( 'event' => 'SHOW',
'type' => 'IDNTOUTF8')
),
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "name",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
$liste["item"][] = array( 'field' => "goodbye_msg",
'datatype' => "VARCHAR",
'formtype' => "SELECT",
'op' => "=",
'prefix' => "",
'suffix' => "",
'width' => "",
'value' => array('n' => "<div id=\"ir-No\" class=\"swap\"><span>".$app->lng('no_txt')."</span></div>", 'y' => "<div class=\"swap\" id=\"ir-Yes\"><span>".$app->lng('yes_txt')."</span></div>"));
......@@ -197,13 +197,6 @@ class page_action extends tform_actions {
function onAfterInsert() {
global $app, $conf;
$mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager'];
if($mlManager == 'mlmmj') {
// The following update is usefull to set the prefix of the new mailinglist as the list name
$sql = 'UPDATE mail_mailinglist SET subject_prefix = ? WHERE mailinglist_id = ?';
$app->db->query($sql, '['.$this->dataRecord['listname'].']', $this->id);
}
// 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"])) {
......
<?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_ml_membership.list.php";
$tform_def_file = "form/mail_ml_membership.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 onBeforeDelete() {
global $app; $conf;
}
}
$page = new page_action;
$page->onDelete();
?>
<?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_ml_membership.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;
//TODO: Add ml members limit
// we will check only users, not admins
// if($_SESSION["s"]["user"]["typ"] == 'user') {
// if(!$app->tform->checkClientLimit('limit_ml_membership')) {
// $app->error($app->tform->wordbook["limit_ml_membership_txt"]);
// }
// if(!$app->tform->checkResellerLimit('limit_ml_membership')) {
// $app->error('Reseller: '.$app->tform->wordbook["limit_ml_membership_txt"]);
// }
// }
parent::onShowNew();
}
function onShowEnd() {
global $app, $conf;
if($this->id > 0) {
//* we are editing a existing record
$app->tpl->setVar("edit_disabled", 1);
$sql = "SELECT mailinglist_id, email FROM mail_ml_membership WHERE subscriber_id = ?";
$mlID = $app->db->queryOneRecord($sql, $this->id);
if($mlID['mailinglist_id']) $app->tpl->setVar("mailinglist_id_value", $mlID["mailinglist_id"]);
if($mlID['email']) $app->tpl->setVar("email_value", $mlID["email"]);
} else {
$app->tpl->setVar("edit_disabled", 0);
}
parent::onShowEnd();
}
function onBeforeInsert() {
global $app, $conf;
// Set the server id of the mailinglist members = server ID of mail domain.
$domain = $app->db->queryOneRecord("SELECT server_id FROM mail_mailinglist WHERE mailinglist_id = ?", $this->dataRecord["mailinglist_id"]);
$this->dataRecord["server_id"] = $domain['server_id'];
}
}