CQU Mailing List Creation
";
echo "List description = ",$_REQUEST['listdescription'],"
";
echo "List password = ",$_REQUEST['listpassword'],"
";
echo "List owner = ",$_REQUEST['listowner'],"
";
echo "List visibility = ",$_REQUEST['listvisibility'],"
";
echo "Subscribe policy = ",$_REQUEST['subscribepolicy'],"
";
echo "Unsubscribe policy = ",$_REQUEST['unsubscribepolicy'],"
";
echo "List reply = ",$_REQUEST['listreply'],"
";
echo "Moderation = ",$_REQUEST['moderation'],"
";
echo "List archive = ",$_REQUEST['listarchive'],"
";
echo "Archive visibility = ",$_REQUEST['archivevisibility'],"
";
echo "Initial subscribers = ",$_REQUEST['initalsubscribers'],"
";
echo "Ceiling posts = ",$_REQUEST['ceilingposts'],"
";
echo "Archive frequency = ",$_REQUEST['archivefrequency'],"
";
}
if ($_REQUEST['listname'] == "") {
echo "listname isn't set, it must be
\n";
$exit = 1;
}
if (strlen($_REQUEST['listname']) < 3) {
echo "listname must have more than 2 characters
\n";
$exit = 1;
}
if (preg_match("/-(admin|bounces|join|leave|confirm|owner|request)/",$_REQUEST['listname'],$match)) {
echo "listname is invalid because of -" . $match[1] . " in the name
\n";
$exit = 1;
}
if (preg_match("/ /",$_REQUEST['listname'],$match)) {
echo "listname is invalid because of space in the name
\n";
$exit = 1;
}
$filename = "/usr/local/mailman/lists/" . $_REQUEST['listname'] . "/config.pck";
if (file_exists($filename)) {
echo "list already exists, please choose another name
\n";
$exit = 1;
}
if ($_REQUEST['listdescription'] == "") {
echo "list description isn't set, it must be
\n";
$exit = 1;
}
if ($_REQUEST['listpassword'] == "") {
echo "list password isn't set, it must be
\n";
$exit = 1;
}
if ($_REQUEST['listowner'] == "") {
echo "list owner isn't set, it must be
\n";
$exit = 1;
}
if (preg_match("/ /",$_REQUEST['listowner'],$match)) {
echo "listowner is invalid because of space in the name
\n";
$exit = 1;
}
if (! preg_match("/@/",$_REQUEST['listowner'],$match)) {
echo "listowner is invalid because it doesn't have an @
\n";
$exit = 1;
}
if ($exit) {
echo "Please fix the above errors and resubmit
\n";
exit(1);
}
$agent = $_SERVER['HTTP_USER_AGENT'];
$address = $_SERVER['REMOTE_ADDR'];
$user = $_SERVER['REMOTE_USER'];
$referer = $_SERVER['HTTP_REFERER'];
$log_file = "/var/log/list-create.log";
if (is_writable($log_file)) {
$log = fopen($log_file,"a");
$date = date("r");
$logstring = "$date - $address ($user) using $agent from $referer created " . $_REQUEST['listname'] . "\n";
if (!fwrite($log, $logstring)) {
echo "Problem with writing logs
";
}
}
fclose($log);
// listname:list description:list password:list owner:list visibility:subscribe policy:unsubscribe policy:list reply:moderation:list archive:archive visibility:inital subscribers:ceiling posts:archive frequency
// while ($ent = current($_REQUEST)) {
// echo key($_REQUEST).'='.$ent.'
' if $debug;
// next($_REQUEST);
// }
$str = implode("::", $_REQUEST);
$str = str_replace("","|",$str);
$str = str_replace("\n","",$str);
if ($debug) {
echo "str = ". $str . "
\n";
}
$spool_file = "/var/spool/mailman/listcreate.txt";
if (touch($spool_file)) {
$spool = fopen($spool_file,"a");
if (!fwrite($spool, $str."\n")) {
echo "Problem with writing spool file
";
}
}
fclose($spool);
echo "Thank you for submitting a request to create mailing list " . $_REQUEST['listname'] . ".
";
echo "It has been submitted to our queue and will be processed soon.
";
}
?>
Back to Mailman Services Page