October 7, 201015 yr Please note: (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; INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('mailman', 'system_newlist_path', '/usr/sbin/newlist'), ('mailman', 'system_rmlist_path', '/usr/sbin/rmlist'), ('mailman', 'system_config_list_path', '/usr/sbin/config_list'), ('mailman', 'system_list_lists_path', '/usr/sbin/list_lists'), ('mailman', 'system_genaliases_path', '/usr/lib/mailman/bin/genaliases'), ('mailman', 'system_newaliases_path', '/usr/bin/newaliases'), ('mailman', 'system_change_pw_path', '/usr/lib/mailman/bin/change_pw'), ('mailman', 'system_withlist_path', '/usr/sbin/withlist'), ('mailman', 'system_mailman_cgi-bin_path', '/usr/lib/cgi-bin/mailman/'), ('mailman', 'system_mailman_images_path', '/usr/share/images/mailman/'), ('mailman', 'system_mailman_data_path', '/var/lib/mailman/'); INSERT INTO `cronjobs_run` SET `module` = 'mailman/mailman', `cronfile` = 'mailmanscript.php', `interval` = '1 HOUR', `isactive` = '1', `desc_lng_key` = 'cron_mailman' ; STEP 2: File upload: 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<?php return array ( 'admin' => array ( 'mailman' => array ( 'label' => $lng['admin']['mailman'], 'show_element' => true, 'elements' => array ( array ( 'url' => 'modules_admin_mailman.php?page=lists', 'label' => $lng['menue']['mailinglists']['mailinglists'], ), ), ), ), 'customer' => array( 'mailman' => array( 'label' => $lng['menue']['mailinglists']['mailinglists'] = 'Mailinglisten', 'show_element' => true, 'elements' => array( array( 'url' => 'modules_customer_mailman.php?page=lists', 'label' => $lng['menue']['mailinglists']['lists'], ), ), ), ), ); ?> touch $froxpath/actions/admin/settings/999.mailman.php insert into $froxpath/actions/admin/settings/999.mailman.php<?php /** * This file is part of the Froxlor project. * Copyright (c) 2003-2009 the SysCP Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors). * * For the full copyright and license information, please view the COPYING * file that was distributed with this source code. You can also view the * COPYING file online at http://files.froxlor.org/misc/COPYING.txt * * @copyright (c) the authors * @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Froxlor team <team@froxlor.org> (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Settings */ return array( 'groups' => array( 'mailman' => array( 'title' => $lng['admin']['mailman'], 'fields' => array( 'mailman_system_newlist_path' => array( 'label' => $lng['module']['mailman']['admin']['newlist_path'], 'settinggroup' => 'mailman', 'varname' => 'system_newlist_path', 'type' => 'string', 'default' => '/usr/sbin/newlist', 'save_method' => 'storeSettingField', ), 'mailman_system_rmlist_path' => array( 'label' => $lng['module']['mailman']['admin']['rmlist_path'], 'settinggroup' => 'mailman', 'varname' => 'system_rmlist_path', 'type' => 'string', 'default' => '/usr/sbin/rmlist', 'save_method' => 'storeSettingField', ), 'mailman_system_config_list_path' => array( 'label' => $lng['module']['mailman']['admin']['config_list_path'], 'settinggroup' => 'mailman', 'varname' => 'system_config_list_path', 'type' => 'string', 'default' => '/usr/sbin/config_list', 'save_method' => 'storeSettingField', ), 'mailman_system_list_lists_path' => array( 'label' => $lng['module']['mailman']['admin']['list_lists_path'], 'settinggroup' => 'mailman', 'varname' => 'system_list_lists_path', 'type' => 'string', 'default' => '/usr/sbin/list_lists', 'save_method' => 'storeSettingField', ), 'mailman_system_genaliases_path' => array( 'label' => $lng['module']['mailman']['admin']['genaliases_path'], 'settinggroup' => 'mailman', 'varname' => 'system_genaliases_path', 'type' => 'string', 'default' => '/usr/lib/mailman/bin/genaliases', 'save_method' => 'storeSettingField', ), 'mailman_system_newaliases_path' => array( 'label' => $lng['module']['mailman']['admin']['newaliases_path'], 'settinggroup' => 'mailman', 'varname' => 'system_newaliases_path', 'type' => 'string', 'default' => '/usr/bin/newaliases', 'save_method' => 'storeSettingField', ), 'mailman_system_change_pw_path' => array( 'label' => $lng['module']['mailman']['admin']['change_pw_path'], 'settinggroup' => 'mailman', 'varname' => 'system_change_pw_path', 'type' => 'string', 'default' => '/usr/lib/mailman/bin/change_pw', 'save_method' => 'storeSettingField', ), 'mailman_system_withlist_path' => array( 'label' => $lng['module']['mailman']['admin']['withlist_path'], 'settinggroup' => 'mailman', 'varname' => 'system_withlist_path', 'type' => 'string', 'default' => '/usr/sbin/withlist', 'save_method' => 'storeSettingField', ), 'mailman_system_mailman_cgi-bin_path' => array( 'label' => $lng['module']['mailman']['admin']['cgi-bin_path'], 'settinggroup' => 'mailman', 'varname' => 'system_mailman_cgi-bin_path', 'type' => 'string', 'default' => '/usr/lib/cgi-bin/mailman/', 'save_method' => 'storeSettingField', ), 'mailman_system_mailman_images_path' => array( 'label' => $lng['module']['mailman']['admin']['images_path'], 'settinggroup' => 'mailman', 'varname' => 'system_mailman_images_path', 'type' => 'string', 'default' => '/usr/share/images/mailman/', 'save_method' => 'storeSettingField', ), 'mailman_system_mailman_data_path' => array( 'label' => $lng['module']['mailman']['admin']['mailman_data_path'], 'settinggroup' => 'mailman', 'varname' => 'system_mailman_data_path', 'type' => 'string', 'default' => '/var/lib/mailman/', 'save_method' => 'storeSettingField', ), ), ), ) ); ?>
October 7, 201015 yr ATTENTION: Step 4 is COMPLETELY WRONG - please don't do that! You WILL run into errors as the Froxlor Cronjob does not work this way anymore
October 7, 201015 yr Author STEP 4 rewritten and minor changes in STEP 2 (the upload of the mailmanscript.php file was cut off. The file will applied in step 4)
November 23, 201015 yr I will post a complete tar.gz again as i used to... But it will take some time as i want to ensure that everything works fine with the current version of froxlor atari
February 14, 201114 yr Hi, I have a problem with this plugin. When i insert the plugin and there are no new mailinglist i get the folling erroers by mail: PHP Notice: Undefined variable: new_created in /var/www/froxlor/scripts/jobs/mailmanscript.php on line 47 PHP Notice: Undefined variable: id in /var/www/froxlor/scripts/jobs/mailmanscript.php on line 77 how can it be solved? greetings.
February 14, 201114 yr What did you do? What version of the module? http://forum.froxlor.org/index.php?/topic/582-mailman-module/
Archived
This topic is now archived and is closed to further replies.