<?
define('MM_PATH','/usr/local/cpanel/3rdparty/mailman');
define('LIST_PATH',MM_PATH.'/lists/');
define('BIN_PATH',MM_PATH.'/bin/');
foreach (glob(LIST_PATH."*") as $filename) {
$list = substr($filename,strlen(LIST_PATH));
echo '*** '.$list." ***\n";
$config = shell_exec(BIN_PATH.'config_list -o - '.$list);
$out = '';
if (ereg ("respond_to_post_requests = [1].", $config, $regs)) {
echo "PROBLEM: respond_to_post_requests is active.\n";
$out = "respond_to_post_requests = 0\n";
}
if (ereg ("generic_nonmember_action = [2].", $config, $regs)) {
echo "PROBLEM: generic_nonmember_action is bouncing.\n";
$out.= "generic_nonmember_action = 3\n";
}
if (ereg ("member_moderation_action = [1].", $config, $regs)) {
echo "PROBLEM: member_moderation_action is bouncing.\n";
$out.= "member_moderation_action = 2\n";
}
if (ereg ("autorespond_postings = [1].", $config, $regs)) {
echo "PROBLEM: autorespond_postings is autoresponding.\n";
$out.= "autorespond_postings = 0\n";
}
if (ereg ("autorespond_admin = [1].", $config, $regs)) {
echo "PROBLEM: autorespond_admin is autoresponding.\n";
$out.= "autorespond_admin = 0\n";
}
if (ereg ("autorespond_requests = [1].", $config, $regs)) {
echo "PROBLEM: autorespond_requests is autoresponding.\n";
$out.= "autorespond_requests = 0\n";
}
ereg ("max_days_to_hold = ([0-9]*)", $config, $regs);
if ($regs[1]=='0') {
echo "PROBLEM: max_days_to_hold is deactivated.\n";
$out.= "max_days_to_hold = 30\n";
}
if(!empty($out)) {
file_put_contents($list.'.conf.bak',$config);
file_put_contents('mm_config.tmp',$out);
shell_exec(BIN_PATH.'config_list -i mm_config.tmp '.$list);
unlink('mm_config.tmp');
echo "The list has been updated with the following settings:\n".$out;
} else {
echo "The list needs no reconfiguration.\n";
}
echo "\n";
}
?>