(1) Please BACKUP your froxlor folder and your froxlor database before you continue with this HOWTO
(2) This HOWTO is an alpha state and not completely tested. Therefore you may change some lines to make it fit to work on your system.
(3) You will loose changes in your language file, when you update your froxlor installation. So you have to do STEP 3 more than one time (everytime after you've updated froxlor).
(4) It uses $froxpath to shorten the path to the directory froxlor is installed and to be machine indepentent. $froxpath may differ on each installtion. The next lines will give you some examples: - If you have installed the froxlor files under /var/www, $froxpath is /var/www - If you have installed the forxlor files under /var/www/localhost/htdocs/froxlor, $froxpath is /var/www/localhost/htdocs/froxlor
ASSUMPTION: You have all files from syscp mailman module (if not, you may get it here: http://www.syscp-for...hp?topic=3541.0 and note, that you have to be logged in to get the download link)
STEP 1: Changes in the database.
Run the following commands:
CREATE TABLE modules_mailman (
id int(11) unsigned NOT NULL auto_increment,
`type` enum('list','update','new','delete','system','del_archive') NOT NULL default 'list',
customerid int(11) unsigned NOT NULL default '0',
domainid int(11) unsigned NOT NULL default '0',
listid int(11) unsigned NOT NULL default '0',
list_name tinytext NOT NULL,
list_webhost tinytext NOT NULL,
list_owner tinytext NOT NULL,
list_mailhost tinytext NOT NULL,
transport tinytext NOT NULL,
list_password tinytext NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
upload modules_admin_mailman.php to $froxpath/modules_admin_mailman.php
upload modules_customer_mailman.php to $froxpath/modules_customer_mailman.php
upload all template files (after having done, your $froxpath/templates/admin directory and $froxpath/templates/customer directory will contain a new subdirectory called modules)
STEP 3: Adept language files.
open $froxpath/lng/german.lng.php
insert before ?>
/* BEGIN mailman module */
$lng['crondesc']['cron_mailman'] = 'Mailman cronjob';
$lng['admin']['mailman'] = 'Mailinglisten';
$lng['menue']['mailinglists']['mailinglists'] = 'Mailinglisten';
$lng['menue']['mailinglists']['lists'] = 'Listen';
$lng['module']['mailman']['admin']['newlist_path'] = 'Pfad von \'newlist\'';
$lng['module']['mailman']['admin']['genaliases_path'] = 'Pfad von \'genaliases\'';
$lng['module']['mailman']['admin']['list_lists'] = 'Pfad von \'list_lists\'';
$lng['module']['mailman']['admin']['rmlist_path'] = 'Pfad von \'rmlist\'';
$lng['module']['mailman']['admin']['newaliases_path'] = 'Pfad von \'newaliases\'';
$lng['module']['mailman']['admin']['config_list_path'] = 'Pfad von \'config_list\'';
$lng['module']['mailman']['admin']['change_pw_path'] = 'Pfad von \'change_pw\'';
$lng['module']['mailman']['admin']['withlist_path'] = 'Pfad von \'withlist\'';
$lng['module']['mailman']['admin']['list_lists_path'] = 'Pfad von \'list_lists\'';
$lng['module']['mailman']['admin']['existing_lists_syscp'] = 'In SysCP existierende Listen';
$lng['module']['mailman']['admin']['existing_lists_system'] = 'Auf dem System existierende Listen';
$lng['module']['mailman']['admin']['mailman_data_path'] = 'Pfad zu den Mailman Daten';
$lng['module']['mailman']['admin']['cgi-bin_path'] = 'Pfad zum cgi-bin Verzeichnis von Mailman';
$lng['module']['mailman']['admin']['images_path'] = 'Pfad zu den Mailman Bildern';
$lng['module']['mailman']['mailinglists'] = 'Mailinglisten';
$lng['module']['mailman']['description'] = 'Hier k?nnen Sie Mailinglisten hinzuf?gen, bearbeiten und entfernen.';
$lng['module']['mailman']['existing_lists'] = 'Ihre Mailinglisten';
$lng['module']['mailman']['list_name'] = 'Listname';
$lng['module']['mailman']['list_mailhost'] = 'Mail Hostname';
$lng['module']['mailman']['list_owner'] = 'Besitzer (Owner)';
$lng['module']['mailman']['list_webhost'] = 'Web Hostname';
$lng['module']['mailman']['list_password'] = 'Passwort';
$lng['module']['mailman']['list_add_submit'] = 'Liste hinzuf?gen';
$lng['module']['mailman']['list_edit_submit'] = 'Liste ?ndern';
$lng['module']['mailman']['list_add'] = 'Liste hinzuf?gen';
$lng['module']['mailman']['list_exists'] = 'Eine Liste solchen Names existiert bereits.';
$lng['module']['mailman']['using_mailhost'] = 'Mailhost verwenden';
$lng['module']['mailman']['list_del'] = 'Liste entfernen';
$lng['module']['mailman']['list_del_archive'] = 'Wollen Sie das zu der Liste geh?rige Archiv auch entfernen?';
$lng['module']['mailman']['list_del_archives_submit'] = 'Liste entfernen';
$lng['module']['mailman']['question']['reallydelete'] = 'Sind Sie sicher, dass Sie diese Liste entfernen wollen?';
/* END mailman module */
open $froxpath/lng/english.lng.php
insert before ?>
/* BEGIN mailman module */
$lng['crondesc']['cron_mailman'] = 'Mailman cronjob';
$lng['admin']['mailman'] = 'Mailinglists';
$lng['menue']['mailinglists']['mailinglists'] = 'Mailinglists';
$lng['menue']['mailinglists']['lists'] = 'Lists';
$lng['module']['mailman']['admin']['newlist_path'] = 'Path of \'newlist\'';
$lng['module']['mailman']['admin']['genaliases_path'] = 'Path of \'genaliases\'';
$lng['module']['mailman']['admin']['list_lists'] = 'Path of \'list_lists\'';
$lng['module']['mailman']['admin']['rmlist_path'] = 'Path of \'rmlist\'';
$lng['module']['mailman']['admin']['newaliases_path'] = 'Path of \'newaliases\'';
$lng['module']['mailman']['admin']['config_list_path'] = 'Path of \'config_list\'';
$lng['module']['mailman']['admin']['change_pw_path'] = 'Path of \'change_pw\'';
$lng['module']['mailman']['admin']['withlist_path'] = 'Path of \'withlist\'';
$lng['module']['mailman']['admin']['list_lists_path'] = 'Path of \'list_lists\'';
$lng['module']['mailman']['admin']['existing_lists_syscp'] = 'Lists existing in SysCP';
$lng['module']['mailman']['admin']['existing_lists_system'] = 'Lists existing on the system';
$lng['module']['mailman']['admin']['mailman_data_path'] = 'Path to the Mailman Data';
$lng['module']['mailman']['admin']['cgi-bin_path'] = 'Path to the cgi-bin of Mailman';
$lng['module']['mailman']['admin']['images_path'] = 'Path to the Mailman images';
$lng['module']['mailman']['mailinglists'] = 'Mailinglists';
$lng['module']['mailman']['description'] = 'Here you can add mailinglists. Feel free to create/delete/modifiy lists.';
$lng['module']['mailman']['existing_lists'] = 'Your Mailinglists';
$lng['module']['mailman']['list_name'] = 'Listname';
$lng['module']['mailman']['list_mailhost'] = 'Mail Hostname';
$lng['module']['mailman']['list_owner'] = 'Owner';
$lng['module']['mailman']['list_webhost'] = 'Web Hostname';
$lng['module']['mailman']['list_password'] = 'Password';
$lng['module']['mailman']['list_add_submit'] = 'Add list';
$lng['module']['mailman']['list_edit_submit'] = 'Change list';
$lng['module']['mailman']['list_add'] = 'Add new Mailinglist';
$lng['module']['mailman']['list_exists'] = 'A list with this name already exists';
$lng['module']['mailman']['using_mailhost'] = 'Using Your Mailhost';
$lng['module']['mailman']['list_del'] = 'Deleting a List';
$lng['module']['mailman']['list_del_archive'] = 'Do you want to delete the archives too?';
$lng['module']['mailman']['list_del_archives_submit'] = 'Delete List';
$lng['module']['mailman']['question']['reallydelete'] = 'Do you really want to delete this list?';
/* END mailman module */
if you need more than english and german language support, please add the english version to your language file
STEP 4: Changes in files:
touch $froxpath/scripts/jobs/mailmanscript.php
insert into $froxpath/scripts/jobs/mailmanscript.php
<?php
fwrite($debugHandler, 'Analysing mailman structure for possible updates' . "\n");
$DEBUG=0;
$aliases_file = "/var/lib/mailman/data/aliases";
if(@php_sapi_name() != 'cli' && @php_sapi_name() != 'cgi')
{
die('This script will only work in the shell.');
}
define('TABLE_MODULE_MAILMAN','modules_mailman');
/*
* Read in the existing lists from the system
*/
$cmd = $settings['mailman']['system_list_lists_path'].' -b';
$existing_lists = shell_exec("$cmd");
strtolower($existing_lists);
$existing_lists_array = split("\n", $existing_lists);
/*
* Create all new lists
*/
/*
* Create the List in mailman
*/
$result = $db->query("SELECT * FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'new'");
// foreach dataset
while ($row = $db->fetch_array($result)){
$new_created=1;
$id=$row['id'];
$list_name = substr($row['list_name'],0,strpos($row['list_name'],"@"));
$list_mailhost = substr($row['list_name'],strpos($row['list_name'],"@")+1);
$list_webhost = $row['list_webhost'];
$list_owner = $row['list_owner'];
$list_password = $row['list_password'];
$cmd=$settings['mailman']['system_newlist_path']." -q --urlhost=".$list_webhost." --emailhost=".$list_mailhost." ".$list_name." ".$list_owner." ".$list_password;
$output=shell_exec("$cmd");
$cmd = $settings['mailman']['system_withlist_path'].' -l -r fix_url '.$list_name.' -u '.$list_mailhost.' >/dev/null 2>&1';
$output = shell_exec($cmd);
}
if($new_created=="1"){
if(!is_file($aliases_file)){
touch($aliases_file);
}
$cmd=$settings['mailman']['system_genaliases_path']." -q";
$output=shell_exec($cmd);
$aliases_file_handler = fopen($aliases_file, 'w');
fwrite($aliases_file_handler, $output);
fclose($aliases_file_handler);
$cmd=$settings['mailman']['system_newaliases_path'];
$output=shell_exec($cmd);
}
unset($new_created);
/*
* Reread in the existing lists from the system
*/
$cmd = $settings['mailman']['system_list_lists_path'].' -b';
$existing_lists = shell_exec("$cmd");
strtolower($existing_lists);
$existing_lists_array = split("\n", $existing_lists);
/*
* Delete the entry, the list is created
*/
$query =
'DELETE FROM `'.TABLE_MODULE_MAILMAN.'` ' .
'WHERE `id`="'.$id.'" AND `type`="new"';
$result = $db->query($query);
unset($result);
/*
* Updating an existing list
*/
$result = $db->query("SELECT * FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'update'");
// foreach dataset
while ($row = $db->fetch_array($result)){
$id=$row['id'];
$list_name = substr($row['list_name'],0,strpos($row['list_name'],"@"));
$list_mailhost = substr($row['list_name'],strpos($row['list_name'],"@")+1);
$list_webhost = $row['list_webhost'];
$list_owner = $row['list_owner'];
$tmpfname = tempnam("/tmp", "syscp_mailman_");
$handle = fopen($tmpfname, "w");
fwrite($handle, "owner = ['".$list_owner."']\n".
"host_name = '".$list_mailhost."'\n".
"web_page_url = '".$list_webhost."'\n");
$cmd = $settings['mailman']['system_config_list_path']." -i ".$tmpfname." ".$list_name." >/dev/null 2>&1";
$output=shell_exec($cmd);
fclose($handle);
unlink($tmpfname);
$cmd = $settings['mailman']['system_change_pw_path']." -q -l ".$list_name." -p ".$row['list_password']." >/dev/null 2>&1";
$output = shell_exec($cmd);
$query2 = "DELETE FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'update' AND `id`=".$id;
$result2 = $db->query($query2);
$cmd = $settings['mailman']['system_withlist_path'].' -l -r fix_url '.$list_name.' -u '.$list_mailhost.' >/dev/null 2>&1';
$output = shell_exec($cmd);
}
/*
* Delete the lists
*/
$result = $db->query("SELECT * FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'delete'");
while ($row = $db->fetch_array($result)){
$id=$row['id'];
$list_name = substr($row['list_name'],0,strpos($row['list_name'],"@"));
$list_mailhost = substr($row['list_name'],strpos($row['list_name'],"@")+1);
$list_webhost = $row['list_webhost'];
$cmd=$settings['mailman']['system_rmlist_path']." ".$list_name." ";
$output=shell_exec("$cmd");
$query2 = "DELETE FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'delete' AND `id`=".$id;
$result2 = $db->query($query2);
$cmd=$settings['mailman']['system_genaliases_path']." -q";
$output=shell_exec($cmd);
$aliases_file_handler = fopen($aliases_file, 'w');
fwrite($aliases_file_handler, $output);
fclose($aliases_file_handler);
$cmd=$settings['mailman']['system_newaliases_path'];
$output=shell_exec($cmd);
}
/*
* Remove archives
*/
$result = $db->query("SELECT * FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'del_archive'");
while ($row = $db->fetch_array($result)){
$list_name = substr($row['list_name'],0,strpos($row['list_name'],"@"));
$cmd = $settings['mailman']['system_rmlist_path']." -a ".$list_name." ";
$output = shell_exec($cmd);
$db->query('DELETE FROM `'.TABLE_MODULE_MAILMAN.'` WHERE `id` = "'.$row['id'].'"');
$db->query('DELETE FROM `'.TABLE_MODULE_MAILMAN.'` WHERE type = "system" AND `list_name`="'.$list_name.'"');
}
/*
* Check whether there are unused vhosts
*/
$result = $db->query("SELECT * FROM `".TABLE_PANEL_DOMAINS."` WHERE specialsettings != ''");
while ($row = $db->fetch_array($result)){
if(stristr($row['specialsettings'], mailman)){
$keep=0;
$result2 = $db->query("SELECT list_webhost FROM `".TABLE_MODULE_MAILMAN."` WHERE type = 'list' OR type = 'new' OR type = 'del_archive'");
while ($list_webhost = $db->fetch_array($result2)){
$list_webhost = $list_webhost['list_webhost'];
if($row['domain'] == $list_webhost ){
$keep=1;
}
}
if($keep == 0 ){
$db->query("DELETE FROM `".TABLE_PANEL_DOMAINS."` WHERE `id`=".$row['id']);
inserttask(1);
inserttask(4);
}
}
}
/*
* Reread in the existing lists from the system
*/
$cmd = $settings['mailman']['system_list_lists_path'].' -b';
$existing_lists = shell_exec("$cmd");
strtolower($existing_lists);
$existing_lists_array = split("\n", $existing_lists);
/*
* Sync mailman --> database
*/
foreach ($existing_lists_array as $value){
if($value!=""){
$query ='SELECT * FROM `'.TABLE_MODULE_MAILMAN.'` WHERE `type` ="system" AND `list_name`="'.$value.'"';
$result = $db->query_first($query);
if (!$result){
$query2='INSERT INTO `'.TABLE_MODULE_MAILMAN.'` (`list_name`, `type`, `transport`, `list_mailhost`) VALUES ("'.$value.'", "system", "mailman:", "'.$settings['system']['hostname'].'")';
$db->query($query2);
}
}
}
$output = shell_exec("/etc/init.d/postfix reload");
?>
STEP 5: New files:
touch $froxpath/lib/navigation/99.mailman.php
insert into $froxpath/lib/navigation/99.mailman.php
Question
jogr
Please note:
- If you have installed the froxlor files under /var/www, $froxpath is /var/www
- If you have installed the forxlor files under /var/www/localhost/htdocs/froxlor, $froxpath is /var/www/localhost/htdocs/froxlor
ASSUMPTION: You have all files from syscp mailman module (if not, you may get it here: http://www.syscp-for...hp?topic=3541.0 and note, that you have to be logged in to get the download link)
STEP 1: Changes in the database.
Run the following commands:
STEP 2: File upload:
STEP 3: Adept language files.
STEP 4: Changes in files:
STEP 5: New files:
6 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.