Initial commit for release of version 1.0

This commit is contained in:
2021-08-12 22:55:38 +02:00
parent b9a88906ce
commit 9db6477952
70 changed files with 415 additions and 2129 deletions

View File

@@ -1,46 +0,0 @@
<?php
# Stop script from being executed
die("This function is deactivated!");
require("init.php");
$list_name = isset($_POST["list_name"]) ? $_POST["list_name"] : "";
if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
{
// If not authenticated, then redirect to login page
header("Location: login.php");
exit();
}
if( !empty($list_name) )
{
$list_name = strtolower($list_name);
if ( preg_match("/[^a-z0-9_]/", $list_name) )
{
// List name must contain only english letters, digits and undercores
$_SESSION["error_code"] = 5;
header("Location: error.php");
exit();
}
if ( strlen($list_name) > 30 )
{
// List name must not be longer than 30 characters
$_SESSION["error_code"] = 6;
header("Location: error.php");
exit();
}
$domain = $_SESSION["domain"];
shell_exec("cp -r misc/template_$language $lists_path/$domain/$list_name");
file_put_contents("$lists_path/$domain/$list_name/control/listaddress", "$list_name@$domain");
file_put_contents("$lists_path/$domain/$list_name/control/customheaders", "From: $list_name@$domain\nReply-To: $list_name@$domain\n");
file_put_contents("$lists_path/$domain/$list_name/control/prefix", "[$list_name]");
shell_exec("sed -i -e 's/_unsub_addr_/$list_name\+unsubscribe@$domain/g' $lists_path/$domain/$list_name/control/footer-*");
}
header("Location: index.php");
exit();
?>

View File

@@ -1,44 +0,0 @@
<?php
# Stop script from being executed
die("This function is deactivated!");
require("init.php");
$list_name = isset($_GET["list_name"]) ? $_GET["list_name"] : "";
$domain = $_SESSION["domain"];
// We do not print any error in the next three cases, because a legitimate
// user will never produce such results, even with disables javascript
if ( preg_match("/[^a-z0-9_]/", $list_name) )
{
header("Location: error.php");
exit();
}
if ( strlen($list_name) > 30 )
{
header("Location: error.php");
exit();
}
// Test list existence
if( !is_dir("$lists_path/$domain/$list_name") )
{
header("Location: error.php");
exit();
}
if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
{
// If not authenticated, then redirect to login page
header("Location: login.php");
exit();
}
if(!empty($list_name))
{
shell_exec("rm -rf $lists_path/$domain/$list_name");
header("Location: index.php");
exit();
}
?>

View File

@@ -1,5 +1,7 @@
<?php
require("init.php");
$list_name = isset($_GET["list_name"]) ? $_GET["list_name"] : "";
$domain = $_SESSION["domain"];
@@ -31,31 +33,32 @@ if( !is_dir("$lists_path/$domain/$list_name") )
exit();
}
# Check whether the user may edit this list as he owns it
if (!in_array($list_name, $_SESSION["array_lists_owned"]))
{
$_SESSION["error_code"] = 11;
header("Location: error.php");
exit;
}
// Get a subscribers list
$subscribers = shell_exec("/usr/bin/mlmmj-list -L $lists_path/$domain/$list_name");
// Remove trailing empty symbols
$subscribers = trim($subscribers);
// Get a list type. There are three types of lists:
// a closed moderated list (0), a newslist (1) and a conference (2)
$list_type = file_get_contents("$lists_path/$domain/$list_name/list_type.txt");
$list_type = trim($list_type);
// Select current list in select html elemant
$list_type_selected = ["", "", ""];
$list_type_selected[$list_type] = "selected";
// Get a footer
$footer = file_get_contents("$lists_path/$domain/$list_name/control/footer-text");
$footer = trim($footer);
// News list do not has moderators file
if ($list_type !== "2")
# Check whether there is a moderators file
if (file_exists("$lists_path/$domain/$list_name/control/moderators"))
{
// Get a moderators list
$moderators = file_get_contents("$lists_path/$domain/$list_name/control/moderators");
// Remove trailing empty symbols
$moderators = trim($moderators);
# If theres no @ inside the file it seems to be empty
if (!preg_match("/[@]/", $moderators))
{
$moderators = NULL;
}
}
else
{
@@ -67,16 +70,14 @@ $prefix = file_get_contents("$lists_path/$domain/$list_name/control/prefix");
// Remove trailing empty symbols
$prefix = trim($prefix);
$notmetoo_checked = file_exists("$lists_path/$domain/$list_name/control/notmetoo") ? "checked" : "";
// Load page
$smarty->assign("headline", $headline);
$smarty->assign("subscribers", $subscribers);
$smarty->assign("list_name", $list_name);
$smarty->assign("domain", $domain);
$smarty->assign("list_type_selected", $list_type_selected);
$smarty->assign("footer", $footer);
$smarty->assign("moderators", $moderators);
$smarty->assign("prefix", $prefix);
$smarty->assign("notmetoo_checked", $notmetoo_checked);
$smarty->assign("username", $_SESSION["username"]);
$smarty->display("edit_list.tpl");
?>

View File

@@ -1,7 +1,10 @@
<?php
require("init.php");
$error_code = isset($_SESSION["error_code"]) ? $_SESSION["error_code"] : "";
unset($_SESSION["error_code"]);
$smarty->assign("error_code", $error_code);
$smarty->display("error.tpl");
?>

View File

@@ -1,4 +1,5 @@
<?php
require("init.php");
if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
@@ -13,24 +14,40 @@ $domain = $_SESSION["domain"];
// Are there any lists?
if ( count( glob("$lists_path/$domain/*") ) !== 0 )
{
// Get all folders and tranform into array
$lists = explode("\n", shell_exec("cd $lists_path/$domain; ls -1d */ | cut -f1 -d'/'"));
// Get all folders and tranform into array
$lists = explode("\n", shell_exec("cd $lists_path/$domain; ls -1d */ | cut -f1 -d'/'"));
}
if ( isset($lists) )
if (isset($lists))
{
// If the last string is empty then delete it
if ( end($lists) === "" )
{
array_pop($lists);
}
// If the last string is empty then delete it
if (end($lists) === "")
{
array_pop($lists);
}
$lists_new = [];
foreach($lists as $list)
{
if (!in_array($list, $_SESSION["array_lists_owned"]))
{
$lists_new[$list] = 0;
}
else
{
$lists_new[$list] = 1;
}
}
}
else
{
$lists = NULL;
$lists = NULL;
}
$smarty->assign("lists", $lists);
$smarty->assign("headline", $headline);
$smarty->assign("lists", $lists_new);
$smarty->assign("domain", $domain);
$smarty->assign("username", $_SESSION["username"]);
$smarty->display("index.tpl");
?>

108
init.php
View File

@@ -1,14 +1,103 @@
<?php
// Loading config
$config = file_get_contents("misc/config.txt");
preg_match("/lists_path[\s]*=[\s]*(.*)/", $config, $lists_path);
$lists_path = $lists_path[1];
preg_match("/web_path[\s]*=[\s]*(.*)/", $config, $web_path);
$web_path = $web_path[1];
preg_match("/web_url[\s]*=[\s]*(.*)/", $config, $web_url);
$web_url = $web_url[1];
preg_match("/language[\s]*=[\s]*(.*)/", $config, $language);
$language = $language[1];
#$config = file_get_contents("misc/config.txt");
#preg_match("/lists_path[\s]*=[\s]*(.*)/", $config, $lists_path);
#$lists_path = $lists_path[1];
#preg_match("/web_path[\s]*=[\s]*(.*)/", $config, $web_path);
#$web_path = $web_path[1];
#preg_match("/web_url[\s]*=[\s]*(.*)/", $config, $web_url);
#$web_url = $web_url[1];
#preg_match("/language[\s]*=[\s]*(.*)/", $config, $language);
#$language = $language[1];
# -------------------------------------------------------------
# We want to have the config values in here to easily be able to extend it
$lists_path = "/home/pacs/ecg00/users/mlmmj";
$web_path = "/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/";
$web_url = "https://list.ecogood.org/";
$language = "en";
$domain_global = "mlmmj";
$current_version = "v1.0";
$headline = "Manage your ECG mailing lists " . $current_version;
$debug = true;
$rc_webhook = "";
# -------------------------------------------------------------
# Custom PHP functions
# Registers user's activity in a file (audit log)
function audit_log($action = "", $custom_input = "", $logfile = "audit_log.php")
{
# Initially set return value to false
$return['success'] = false;
$return['message'] = "";
# If $action is empty
if ($action == "")
{
$action = "-empty-";
}
# If $custom_input is empty
if ($custom_input == "")
{
$custom_input = "-empty-";
}
# Build the request string
$request = date("Ymd-His") . " " . $_SESSION['username'] . "\n";
$request .= "Action: " . $action . "\n";
$request .= "Custom input: " . $custom_input . "\n";
# For security reasons don't include the GET/POST requests during login process as they might contain passwords
if ($action != "login")
{
$request .= "\$_SESSION['array_lists_owned']: " . json_encode($_SESSION['array_lists_owned']) . "\n";
$request .= "\$_GET: " . json_encode($_GET) . "\n";
$request .= "\$_POST: " . json_encode($_POST) . "\n";
}
$request .= "\$_SERVER['PHP_SELF']: " . basename($_SERVER['PHP_SELF']) . "\n";
$request .= "\$_SERVER['REMOTE_ADDR']: " . basename($_SERVER['REMOTE_ADDR']) . "\n";
$request .= "\n\n";
# Let's make sure the log file exists and is writable
if (is_writable($logfile))
{
# We're opening $filename in append mode.
if (!$handle = fopen($logfile, 'a')) {
$return['message'] = "Cannot open file ($logfile)";
}
// Write $somecontent to our opened file.
if (fwrite($handle, $request) === FALSE) {
$return['message'] = "Cannot write to file ($logfile)";
}
$return['success'] = true;
fclose($handle);
}
else
{
$return['message'] = "The file $logfile is not writable.";
}
return $return;
}
# -------------------------------------------------------------
if ($debug)
{
error_reporting(E_ALL && ~E_NOTICE);
ini_set("display_errors", 1);
}
// Initializing Smarty
require("misc/smarty_libs/Smarty.class.php");
@@ -20,4 +109,5 @@ $smarty->setCacheDir("misc/smarty/cache");
$smarty->setConfigDir("misc/smarty/configs");
session_start();
?>

123
login.php
View File

@@ -1,79 +1,78 @@
<?php
# TODO: Remove this afterwards
error_reporting(E_ALL);
ini_set("display_errors", 1);
require("init.php");
$login_domain = isset($_POST["login_domain"]) ? $_POST["login_domain"] : "";
$login_username = isset($_POST["login_username"]) ? $_POST["login_username"] : "";
$login_pass = isset($_POST["login_pass"]) ? $_POST["login_pass"] : "";
// Convert to lower case
#$login_domain = strtolower($login_domain);
# Sanitize user input
$login_username = filter_var($_POST['login_username'], FILTER_SANITIZE_STRING);
# TODO: Maybe this filter applied to the password does not fit our password rules - we will see
$login_pass = filter_var($_POST['login_pass'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if( !empty($login_domain) && !empty($login_pass) )
# Convert username to lower case
$login_username = strtolower($login_username);
if (!empty($login_username) && !empty($login_pass))
{
#if ( preg_match("/[^a-z0-9\-\.]/", $login_domain) )
#{
# // Domain must contain only english letters, digits, hyphens and dots
# $_SESSION["error_code"] = 1;
# header("Location: error.php");
# exit();
#}
$ldap_server = "localhost";
$ldap_port = 30389;
if ( preg_match("/[^A-Za-z0-9]/", $login_pass) )
{
// Password must contain only english letters and digits
$_SESSION["error_code"] = 2;
header("Location: error.php");
exit();
}
$connect = ldap_connect($ldap_server, $ldap_port); #or die("Failed to connect to the LDAP server.");
// Sha256 sum of entered password
$login_hash = hash("sha256", $login_pass);
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
#$hashes = file_get_contents("$lists_path/passwords.txt");
#preg_match("/^$login_domain:(.*).*/m", $hashes, $hash);
# bind user
$auth_user = "uid=" . $login_username . ",ou=users,ou=ecg";
$auth_pass = $login_pass;
$bind = ldap_bind($connect, $auth_user, $auth_pass); #or die("Failed to bind to LDAP server.");
// Is there such domain?
#if ( count($hash) == 0 )
#{
# preg_match("/^list\.$login_domain:(.*).*/m", $hashes, $hash);
# // Maybe user omitted "list." prefix?
# if ( count($hash) == 0 )
# {
# // No luck. Incorrect domain
# $_SESSION["error_code"] = 4;
# header("Location: error.php");
# exit();
# }
# else
# {
# // Yes, he omitted "list."
# $login_domain = "list.$login_domain";
# }
#}
# If the bind was successfull
if ($bind)
{
# Get list of all lists the person owns and tranform them into an array
$array_lists_owned = explode("\n", shell_exec("cd $lists_path/$domain_global ; grep -r \"" . $login_username . "@ecogood.org\" */control/owner | cut -d':' -f1 | cut -d'/' -f1"));
// Compare hashes
if($login_hash == "3b844f5e23039700921b7a301b99d17470cf1f466986aa4e4e2e566369412d32")
{
// Authentication successful - Set session
$_SESSION["auth"] = 1;
$_SESSION["domain"] = "mlmmj"; #$login_domain;
header("Location: index.php");
exit();
}
else
{
// Incorrect password
$_SESSION["error_code"] = 3;
header("Location: error.php");
exit();
}
// Authentication successful - Set session
$_SESSION["auth"] = 1;
$_SESSION["username"] = $login_username;
$_SESSION["domain"] = $domain_global; # This is needed for the script to function properly
$_SESSION["array_lists_owned"] = $array_lists_owned;
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"' . $_SESSION["username"] . ' logged in"}\' https://chat.ecogood.org/hooks/' . $rc_webhook);
# Audit log
$return = audit_log("login");
if (!$return["success"])
{
# If debug mode is on show error message
if ($debug)
{
echo $return["message"];
}
else
{
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"' . $return["message"] . '"}\' https://chat.ecogood.org/hooks/' . $rc_webhook);
}
}
header("Location: index.php");
exit();
}
else
{
// Incorrect password
$_SESSION["error_code"] = 3;
header("Location: error.php");
exit();
}
}
else
{
// If no submission, display login form
$smarty->display("login.tpl");
// If no submission, display login form
$smarty->assign("headline", $headline);
$smarty->display("login.tpl");
}
?>

View File

@@ -1,8 +1,29 @@
<?php
require("init.php");
unset($_SESSION["domain"]);
# Audit log
$return = audit_log("logout");
if (!$return["success"])
{
# If debug mode is on show error message
if ($debug)
{
echo $return["message"];
}
else
{
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"' . $return["message"] . '"}\' https://chat.ecogood.org/hooks/A' . $rc_webhook);
}
}
unset($_SESSION["auth"]);
unset($_SESSION["domain"]);
unset($_SESSION["array_lists_owned"]);
unset($_SESSION["username"]);
unset($_SESSION["error_code"]);
header("Location: index.php");
exit();
?>

View File

@@ -1,122 +0,0 @@
<?php
/* Smarty version 3.1.31, created on 2021-07-23 15:23:28
from "/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/index.tpl" */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.31',
'unifunc' => 'content_60fac2d08b3df8_25701302',
'has_nocache_code' => false,
'file_dependency' =>
array (
'0dee7916f2ab5d00e5d3cc848d789a3c9c535c34' =>
array (
0 => '/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/index.tpl',
1 => 1627046606,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_60fac2d08b3df8_25701302 (Smarty_Internal_Template $_smarty_tpl) {
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<?php echo '<script'; ?>
>
function validate_form()
{
var name = document.getElementById('add_list_input').value;
var name = name.toLowerCase();
if (name == "")
{
return false;
}
if (name.length > 30)
{
alert("Mailing list name must not be longer than 30 characters.");
return false;
}
if ( name.match(/[^a-z0-9_]/) )
{
alert("Mailing list name must contain only english letters, digits and undercores.");
return false;
}
}
function confirm_delete()
{
return confirm("Are you really want to delete the mailing list?");
}
<?php echo '</script'; ?>
>
</head>
<body>
<div id="header">
<div id="header_left">
Manage your ECG mailing lists
</div>
<div id="header_right">
<a href="logout.php">Log out</a>
</div>
</div>
<div id="breadcrumbs"><?php echo $_smarty_tpl->tpl_vars['domain']->value;?>
</div>
<div id="index">
<div id="lists_header">
<b>All available mailing lists:</b>
&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_add_list">
You can edit mailing lists on this page. Just click on its name.
To post a message into a mailing list send an email to example@<?php echo $_smarty_tpl->tpl_vars['domain']->value;?>
, where "example" is the list name.
</span>
</div>
</div>
<table id="lists">
<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['lists']->value, 'list');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['list']->value) {
?>
<tr>
<td>
&bull;
</td>
<td>
<a href="edit_list.php?list_name=<?php echo $_smarty_tpl->tpl_vars['list']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['list']->value;?>
</a>
</td>
<!--<td>
<a href="del_list.php?list_name=<?php echo $_smarty_tpl->tpl_vars['list']->value;?>
" onclick="return confirm_delete()"><img src="delete.svg" width=15></a>
</td>-->
</tr>
<?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);
?>
</table>
<!--<form method="post" action="add_list.php" onsubmit="return validate_form()">
<div id="add_list">
<input type="text" name="list_name" id="add_list_input">
&nbsp;
<input type="submit" name="submit" value="Add" id="add_list_button">
</div>
</form>-->
</div>
</body>
</html>
<?php }
}

View File

@@ -1,59 +0,0 @@
<?php
/* Smarty version 3.1.31, created on 2021-07-23 15:20:28
from "/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/error.tpl" */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.31',
'unifunc' => 'content_60fac21cabbde3_88848843',
'has_nocache_code' => false,
'file_dependency' =>
array (
'87eadf281c71f110fa4c4ea961640eb703d16d4a' =>
array (
0 => '/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/error.tpl',
1 => 1485891660,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_60fac21cabbde3_88848843 (Smarty_Internal_Template $_smarty_tpl) {
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="header">Mailing lists service</div>
<div id="error">
<?php if ($_smarty_tpl->tpl_vars['error_code']->value == 1) {?>
Domain can contain only english letters, dots, hyphens and digits.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 2) {?>
Password can contain only english letters and digits.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 3) {?>
Incorrect password.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 4) {?>
There is no such domain.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 5) {?>
Mailing list name can contain only english letters, digits and undercores.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 6) {?>
The length of a list name can not exceed 30 characters.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 7) {?>
The length of a prefix can not exceed 128 characters.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 8) {?>
The length of a footer can not exceed 1024 characters.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 9) {?>
There is an incorrect email in the subscribers list.
<?php } elseif ($_smarty_tpl->tpl_vars['error_code']->value == 10) {?>
There is an incorrect email in the moderators list.
<?php } else { ?>
Unknown error.
<?php }?>
</div>
</body>
</html>
<?php }
}

View File

@@ -1,90 +0,0 @@
<?php
/* Smarty version 3.1.31, created on 2021-07-23 15:15:40
from "/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/login.tpl" */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.31',
'unifunc' => 'content_60fac0fc392119_19400816',
'has_nocache_code' => false,
'file_dependency' =>
array (
'bebbc40e386876d1f34a8c037161406e34f7e878' =>
array (
0 => '/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/login.tpl',
1 => 1485892620,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_60fac0fc392119_19400816 (Smarty_Internal_Template $_smarty_tpl) {
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<?php echo '<script'; ?>
>
function validate_form()
{
var domain = document.getElementById('domain_input').value;
var password = document.getElementById('password_input').value;
if (domain == "")
{
alert("Enter domain.");
return false;
}
if (password == "")
{
alert("Enter password.");
return false;
}
if ( domain.match(/[^A-Za-z0-9\-\.]/) )
{
alert("Domain can contain only english letters, dots, hyphens and digits.");
return false;
}
if ( password.match(/[^A-Za-z0-9]/) )
{
alert("Password can contain only english letters and digits.");
return false;
}
}
<?php echo '</script'; ?>
>
</head>
<body>
<div id="header">Mailing lists service</div>
<div id="login">
<div id="login_form">
<form method="post" action="login.php" onsubmit="return validate_form()">
<div id="domain">
<div id="domain_left">
Domain:
</div>
<div id="domain_right">
<input type="text" name="login_domain" id="domain_input">
</div>
</div>
<div id="password">
<div id="password_left">
Password:
</div>
<div id="password_right">
<input type="password" name="login_pass" id="password_input">
</div>
</div>
<div id="enter">
<input type="submit" name="submit" value="Enter">
</div>
</form>
</div>
</div>
</body>
</html>
<?php }
}

View File

@@ -1,254 +0,0 @@
<?php
/* Smarty version 3.1.31, created on 2021-07-23 15:27:15
from "/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/edit_list.tpl" */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.31',
'unifunc' => 'content_60fac3b35e71a9_13035792',
'has_nocache_code' => false,
'file_dependency' =>
array (
'd26886be440fe5530a216e22cdbebb3e8d3eb432' =>
array (
0 => '/home/pacs/ecg00/users/mlmmj/doms/list.ecogood.org/htdocs-ssl/mlmmj-light-web-ecg/misc/smarty/templates_en/edit_list.tpl',
1 => 1627046833,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_60fac3b35e71a9_13035792 (Smarty_Internal_Template $_smarty_tpl) {
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<?php echo '<script'; ?>
>
// Do not use Smarty here
function switch_moderators_form()
{
// Get a selected value
var select = document.getElementById("list_type");
var selected_value = select.options[select.selectedIndex].value;
// If selected conference list type, then disable moderators form
if (selected_value == "2")
{
document.getElementById("moderators").disabled = true;
document.getElementById("moderators_header").style.color = "#777777";
}
else
{
document.getElementById("moderators").disabled = false;
document.getElementById("moderators_header").style.color = "#222222";
}
}
function validate_form()
{
var prefix = document.getElementById('prefix').value;
var footer = document.getElementById('footer').value;
var subscribers = document.getElementById('subscribers').value;
var moderators = document.getElementById('moderators').value;
// Regex for a valid e-mail
var re_email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
// Transform subscribers and moderators into array
subscribers = subscribers.split("\n");
moderators = moderators.split("\n");
if (prefix.length > 128)
{
alert("A prefix length can not be longer than 128 characters.");
return false;
}
if (footer.length > 1024)
{
alert("A footer length can not be longer than 1024 characters.");
return false;
}
for(var i in subscribers)
{
if ( subscribers[i] != "" && !re_email.test(subscribers[i]) )
{
alert('Subscriber "' + subscribers[i] + '" (line #' + (parseFloat(i)+1) + ') have incorrect email.');
return false;
}
}
for(var i in moderators)
{
if ( moderators[i] != "" && !re_email.test(moderators[i]) )
{
alert('Moderator "' + moderators[i] + '" (line #' + (parseFloat(i)+1) + ') have incorrect email.');
return false;
}
}
}
//
<?php echo '</script'; ?>
>
</head>
<body onload="switch_moderators_form()">
<div id="header">
<div id="header_left">
Manage your ECG mailing lists
</div>
<div id="header_right">
<a href="logout.php">Log out</a>
</div>
</div>
<div id="breadcrumbs">
<a href="index.php"><?php echo $_smarty_tpl->tpl_vars['domain']->value;?>
</a>&nbsp;/&nbsp;<?php echo $_smarty_tpl->tpl_vars['list_name']->value;?>
</div>
<form method="post" action="save_list.php" id="save_list" onsubmit="return validate_form()">
<div id="edit_page">
<input type="hidden" name="list_name" value="<?php echo $_smarty_tpl->tpl_vars['list_name']->value;?>
">
<div id="column_left">
<div id="subscribers_header">
Subscribers:&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_sub">
Please, provide one email per line. Do not forget to add moderators if you
want them able to post into the mailing list.
</span>
</div>
</div>
<div id="subscribers_body">
<textarea name="subscribers" id="subscribers"><?php echo $_smarty_tpl->tpl_vars['subscribers']->value;?>
</textarea>
</div>
</div>
<div id="column_middle">
<div id="column_middle_inner">
<div id="table_div">
<table id="table_middle">
<!--<tr>
<td>
<div id="list_type_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_list_type">
<b>Moderated list:</b> you assign subscribers and moderators. Messages will be
moderated before publishing.<br><br>
<b>News list:</b> everybody can subscribe without moderator confirmation by sending
an empty email to <?php echo $_smarty_tpl->tpl_vars['list_name']->value;?>
+subscribe@<?php echo $_smarty_tpl->tpl_vars['domain']->value;?>
. Messages into mailing list can
post only moderators.<br><br>
<b>Conference:</b> IRC channel analogue. You assign subscribers, every subscriber
can send messages without moderation.
</span>
</div>
&nbsp;List type:
</div>
</td>
<td>
<select name="list_type" id="list_type" onChange="switch_moderators_form()">
<option value="0" <?php echo $_smarty_tpl->tpl_vars['list_type_selected']->value[0];?>
>
Moderated list
</option>
<option value="1" <?php echo $_smarty_tpl->tpl_vars['list_type_selected']->value[1];?>
>
News list
</option>
<option value="2" <?php echo $_smarty_tpl->tpl_vars['list_type_selected']->value[2];?>
>
Conference
</option>
</select>
</td>
</tr>-->
<tr>
<td>
<div id="prefix_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_prefix">
Prefix added to the subject field of each message.
</span>
</div>
&nbsp;Prefix:
</div>
</td>
<td>
<input type="text" name="prefix" value="<?php echo mb_convert_encoding(htmlspecialchars($_smarty_tpl->tpl_vars['prefix']->value, ENT_QUOTES, 'UTF-8', true), "HTML-ENTITIES", 'UTF-8');?>
" id="prefix">
</td>
</tr>
<!--<tr>
<td>
<div id="footer_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_footer">
Footer added to the body of each message.
</span>
</div>
&nbsp;Footer:
</div>
</td>
<td>
<textarea name="footer" id="footer"><?php echo $_smarty_tpl->tpl_vars['footer']->value;?>
</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<div id="notmetoo">
<div id="notmetoo_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_notmetoo">
Sender of a post will be excluded from the distribution list for
that post so people don't receive copies of their own posts.
</span>
</div>
<input type="checkbox" id="notmetoo_checkbox" name="notmetoo" value="checked" <?php echo $_smarty_tpl->tpl_vars['notmetoo_checked']->value;?>
>
Do not send mails to yourself.
</div>
</div>
</td>
</tr>-->
</table>
</div>
<div id="save_btn">
<input type="submit" name="submit" value="Save">
</div>
</div>
</div>
<div id="column_right">
<div id="moderators_header">
Moderators:&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_mod">
In case of a moderated list the messages will be send to these
emails before publishing. In case of a news list only moderators can post to the mailing list.
In case of conference there are no moderators.
</span>
</div>
</div>
<div id="moderators_body">
<textarea name="moderators" id="moderators"><?php echo $_smarty_tpl->tpl_vars['moderators']->value;?>
</textarea>
</div>
</div>
</div>
</form>
</body>
</html>
<?php }
}

View File

@@ -3,29 +3,9 @@
<link rel="stylesheet" type="text/css" href="style.css">
<script>
//{literal} Do not use Smarty here
function switch_moderators_form()
{
// Get a selected value
var select = document.getElementById("list_type");
var selected_value = select.options[select.selectedIndex].value;
// If selected conference list type, then disable moderators form
if (selected_value == "2")
{
document.getElementById("moderators").disabled = true;
document.getElementById("moderators_header").style.color = "#777777";
}
else
{
document.getElementById("moderators").disabled = false;
document.getElementById("moderators_header").style.color = "#222222";
}
}
function validate_form()
{
var prefix = document.getElementById('prefix').value;
var footer = document.getElementById('footer').value;
var subscribers = document.getElementById('subscribers').value;
var moderators = document.getElementById('moderators').value;
@@ -42,12 +22,6 @@
return false;
}
if (footer.length > 1024)
{
alert("A footer length can not be longer than 1024 characters.");
return false;
}
for(var i in subscribers)
{
if ( subscribers[i] != "" && !re_email.test(subscribers[i]) )
@@ -72,10 +46,10 @@
<body onload="switch_moderators_form()">
<div id="header">
<div id="header_left">
Manage your ECG mailing lists
{$headline}
</div>
<div id="header_right">
<a href="logout.php">Log out</a>
<a href="logout.php">Logout ({$username})</a>
</div>
</div>
<div id="breadcrumbs">
@@ -90,8 +64,7 @@
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_sub">
Please, provide one email per line. Do not forget to add moderators if you
want them able to post into the mailing list.
Please provide one email address per line.
</span>
</div>
</div>
@@ -103,45 +76,13 @@
<div id="column_middle_inner">
<div id="table_div">
<table id="table_middle">
<!--<tr>
<td>
<div id="list_type_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_list_type">
<b>Moderated list:</b> you assign subscribers and moderators. Messages will be
moderated before publishing.<br><br>
<b>News list:</b> everybody can subscribe without moderator confirmation by sending
an empty email to {$list_name}+subscribe@{$domain}. Messages into mailing list can
post only moderators.<br><br>
<b>Conference:</b> IRC channel analogue. You assign subscribers, every subscriber
can send messages without moderation.
</span>
</div>
&nbsp;List type:
</div>
</td>
<td>
<select name="list_type" id="list_type" onChange="switch_moderators_form()">
<option value="0" {$list_type_selected[0]}>
Moderated list
</option>
<option value="1" {$list_type_selected[1]}>
News list
</option>
<option value="2" {$list_type_selected[2]}>
Conference
</option>
</select>
</td>
</tr>-->
<tr>
<td>
<div id="prefix_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_prefix">
Prefix added to the subject field of each message.
The prefix will be added to the subject field of each message.
</span>
</div>
&nbsp;Prefix:
@@ -151,39 +92,6 @@
<input type="text" name="prefix" value="{$prefix|escape:'htmlall'}" id="prefix">
</td>
</tr>
<!--<tr>
<td>
<div id="footer_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_footer">
Footer added to the body of each message.
</span>
</div>
&nbsp;Footer:
</div>
</td>
<td>
<textarea name="footer" id="footer">{$footer}</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<div id="notmetoo">
<div id="notmetoo_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_notmetoo">
Sender of a post will be excluded from the distribution list for
that post so people don't receive copies of their own posts.
</span>
</div>
<input type="checkbox" id="notmetoo_checkbox" name="notmetoo" value="checked" {$notmetoo_checked}>
Do not send mails to yourself.
</div>
</div>
</td>
</tr>-->
</table>
</div>
<div id="save_btn">
@@ -192,20 +100,26 @@
</div>
</div>
<div id="column_right">
<div id="moderators_header">
Moderators:&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_mod">
In case of a moderated list the messages will be send to these
emails before publishing. In case of a news list only moderators can post to the mailing list.
In case of conference there are no moderators.
</span>
{if $moderators ne NULL}
<div id="moderators_header">
Moderators:&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_mod">
In case of a moderated list the messages will be send to these
emails before publishing. In case of a news list only moderators can post to the mailing list.
In case of conference there are no moderators.
</span>
</div>
</div>
</div>
<div id="moderators_body">
<textarea name="moderators" id="moderators">{$moderators}</textarea>
</div>
<div id="moderators_body">
<textarea name="moderators" id="moderators">{$moderators}</textarea>
</div>
{else}
<div id="moderators_header">
List not moderated.
</div>
{/if}
</div>
</div>
</form>

View File

@@ -3,7 +3,7 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="header">Mailing lists service</div>
<div id="header">{$headline}</div>
<div id="error">
{if $error_code == 1}
Domain can contain only english letters, dots, hyphens and digits.
@@ -25,6 +25,8 @@
There is an incorrect email in the subscribers list.
{elseif $error_code == 10}
There is an incorrect email in the moderators list.
{elseif $error_code == 11}
You do not own this list.
{else}
Unknown error.
{/if}

View File

@@ -27,54 +27,85 @@
function confirm_delete()
{
return confirm("Are you really want to delete the mailing list?");
return confirm("Do you really want to delete the mailing list?");
}
</script>
</head>
<body>
<div id="header">
<div id="header_left">
Manage your ECG mailing lists
{$headline}
</div>
<div id="header_right">
<a href="logout.php">Log out</a>
<a href="logout.php">Logout ({$username})</a>
</div>
</div>
<div id="breadcrumbs">{$domain}</div>
<div id="index">
<div id="lists_header">
<b>All available mailing lists:</b>
<b>All available mailing lists</b>
&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_add_list">
You can edit mailing lists on this page. Just click on its name.
To post a message into a mailing list send an email to example@{$domain}, where "example" is the list name.
To post a message into a mailing list send an email to example@{$domain}, where "example" is the lists name.
</span>
</div>
</div>
<table id="lists">
<tr>
<td>
&starf;
</td>
<td style="font-weight: bold;">
Lists you own (editable)
</td>
</tr>
{foreach $lists as $list}
<tr>
<td>
&bull;
</td>
<td>
<a href="edit_list.php?list_name={$list}">{$list}</a>
</td>
<!--<td>
<a href="del_list.php?list_name={$list}" onclick="return confirm_delete()"><img src="delete.svg" width=15></a>
</td>-->
</tr>
{if $list == 1}
<tr>
<td>
&check;
</td>
<td>
<a href="edit_list.php?list_name={$list@key}">{$list@key}</a>
</td>
</tr>
{/if}
{/foreach}
<tr>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
</tr>
<tr>
<td>
&starf;
</td>
<td style="font-weight: bold;">
All other lists (not editable)
</td>
</tr>
{foreach $lists as $list}
{if $list == 0}
<tr>
<td>
&cross;
</td>
<td>
{$list@key}
</td>
</tr>
{/if}
{/foreach}
</table>
<!--<form method="post" action="add_list.php" onsubmit="return validate_form()">
<div id="add_list">
<input type="text" name="list_name" id="add_list_input">
&nbsp;
<input type="submit" name="submit" value="Add" id="add_list_button">
</div>
</form>-->
</div>
</body>
</html>

View File

@@ -4,44 +4,40 @@
<script>
function validate_form()
{
var domain = document.getElementById('domain_input').value;
var username = document.getElementById('username_input').value;
var password = document.getElementById('password_input').value;
if (domain == "")
if (username == "")
{
alert("Enter domain.");
alert("Please enter your username.");
return false;
}
if (password == "")
{
alert("Enter password.");
alert("Please enter your password.");
return false;
}
if ( domain.match(/[^A-Za-z0-9\-\.]/) )
if (username.match(/[^A-Za-z\-\.]/))
{
alert("Domain can contain only english letters, dots, hyphens and digits.");
return false;
}
if ( password.match(/[^A-Za-z0-9]/) )
{
alert("Password can contain only english letters and digits.");
alert("The username may only contain english letters, dots and hyphens.");
return false;
}
}
</script>
</head>
<body>
<div id="header">Mailing lists service</div>
<div id="header">{$headline}</div>
<div id="login">
<div id="login_form">
<p>Please enter the credentials of your ECG account (<strong>without</strong> @ecogood.org).</p>
<form method="post" action="login.php" onsubmit="return validate_form()">
<div id="domain">
<div id="domain_left">
Domain:
<div id="username">
<div id="username_left">
Username:
</div>
<div id="domain_right">
<input type="text" name="login_domain" id="domain_input">
<div id="username_right">
<input type="text" name="login_username" id="username_input">
</div>
</div>
<div id="password">
@@ -52,8 +48,9 @@
<input type="password" name="login_pass" id="password_input">
</div>
</div>
<a href="https://wiki.ecogood.org/display/PUBLIC/IT-Support" target="_blank"><p>Forgot your password?</p></a>
<div id="enter">
<input type="submit" name="submit" value="Enter">
<input type="submit" name="submit" value="Login">
</div>
</form>
</div>

View File

@@ -1,213 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
//{literal} Do not use Smarty here
function switch_moderators_form()
{
// Get a selected value
var select = document.getElementById("list_type");
var selected_value = select.options[select.selectedIndex].value;
// If selected conference list type, then disable moderators form
if (selected_value == "2")
{
document.getElementById("moderators").disabled = true;
document.getElementById("moderators_header").style.color = "#777777";
}
else
{
document.getElementById("moderators").disabled = false;
document.getElementById("moderators_header").style.color = "#222222";
}
}
function validate_form()
{
var prefix = document.getElementById('prefix').value;
var footer = document.getElementById('footer').value;
var subscribers = document.getElementById('subscribers').value;
var moderators = document.getElementById('moderators').value;
// Regex for a valid e-mail
var re_email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
// Transform subscribers and moderators into array
subscribers = subscribers.split("\n");
moderators = moderators.split("\n");
if (prefix.length > 128)
{
alert("Длина префикса не должна превышать 128-ми символов.");
return false;
}
if (footer.length > 1024)
{
alert("Длина подписи не должна превышать 1024-ёх символов.");
return false;
}
for(var i in subscribers)
{
if ( subscribers[i] != "" && !re_email.test(subscribers[i]) )
{
alert('Подписчик "' + subscribers[i] + '" (строка №' + (parseFloat(i)+1) + ') является невалидным адресом электронной почты.');
return false;
}
}
for(var i in moderators)
{
if ( moderators[i] != "" && !re_email.test(moderators[i]) )
{
alert('Модератор "' + moderators[i] + '" (строка №' + (parseFloat(i)+1) + ') является невалидным адресом электронной почты.');
return false;
}
}
}
//{/literal}
</script>
</head>
<body onload="switch_moderators_form()">
<div id="header">
<div id="header_left">
Сервис рассылок
</div>
<div id="header_right">
<a href="logout.php">Выйти</a>
</div>
</div>
<div id="breadcrumbs">
<a href="index.php">{$domain}</a>&nbsp;/&nbsp;{$list_name}
</div>
<form method="post" action="save_list.php" id="save_list" onsubmit="return validate_form()">
<div id="edit_page">
<input type="hidden" name="list_name" value="{$list_name}">
<div id="column_left">
<div id="subscribers_header">
Список подписчиков:&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_sub">
Добавляйте по одному почтовому адресу в каждой строке. Не забудьте добавить
модераторов, если хотите, чтобы они также могли писать в рассылку.
</span>
</div>
</div>
<div id="subscribers_body">
<textarea name="subscribers" id="subscribers">{$subscribers}</textarea>
</div>
</div>
<div id="column_middle">
<div id="column_middle_inner">
<div id="table_div">
<table id="table_middle">
<tr>
<td>
<div id="list_type_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_list_type">
<b>Модерируемая рассылка:</b> подписчиков устанавливаете Вы, сообщения
от обычных участников проходят модерацию.<br><br>
<b>Новостная рассылка:</b> подписаться может кто угодно, отправив пустое письмо
на {$list_name}+subscribe@{$domain}, при этом подтверждение модератора не требуется.
Письма в рассылку могут отправлять только модераторы.<br><br>
<b>Конференция:</b> аналог канала в IRC. Подписчиков устанавливаете Вы,
сообщения может отправлять любой подписчик без модерации.
</span>
</div>
&nbsp;Тип рассылки:
</div>
</td>
<td>
<select name="list_type" id="list_type" onChange="switch_moderators_form()">
<option value="0" {$list_type_selected[0]}>
Модерируемая рассылка
</option>
<option value="1" {$list_type_selected[1]}>
Новостная рассылка
</option>
<option value="2" {$list_type_selected[2]}>
Конференция
</option>
</select>
</td>
</tr>
<tr>
<td>
<div id="prefix_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_prefix">
Текст, добавляемый в начало заголовка каждого сообщения рассылки.
</span>
</div>
&nbsp;Префикс:
</div>
</td>
<td>
<input type="text" name="prefix" value="{$prefix|escape:'htmlall'}" id="prefix">
</td>
</tr>
<tr>
<td>
<div id="footer_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_footer">
Текст, добавляемый в конец тела каждого сообщения рассылки.
</span>
</div>
&nbsp;Подпись:
</div>
</td>
<td>
<textarea name="footer" id="footer">{$footer}</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<div id="notmetoo">
<div id="notmetoo_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_notmetoo">
Отправитель будет исключён из списка рассылки для своего сообщения.
Это означает, что ему не будут приходить копии своих сообщений.
</span>
</div>
<input type="checkbox" id="notmetoo_checkbox" name="notmetoo" value="checked" {$notmetoo_checked}>
Не отправлять копию своих сообщений.
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="save_btn">
<input type="submit" name="submit" value="Сохранить">
</div>
</div>
</div>
<div id="column_right">
<div id="moderators_header">
Список модераторов:&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_mod">
Для модерируемой рассылки на эти email будут отправляться письма перед их
опубликованием в рассылку. Для новостной рассылки только эти адреса могут
могут писать в рассылку. Для конференции модераторы не предумотрены.
</span>
</div>
</div>
<div id="moderators_body">
<textarea name="moderators" id="moderators">{$moderators}</textarea>
</div>
</div>
</div>
</form>
</body>
</html>

View File

@@ -1,33 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="header">Сервис рассылок</div>
<div id="error">
{if $error_code == 1}
Домен может содержать только латинские буквы, точки, дефисы и цифры.
{elseif $error_code == 2}
Пароль может содержать только латинские буквы и цифры.
{elseif $error_code == 3}
Неверный пароль.
{elseif $error_code == 4}
Такой домен не зарегистрирован.
{elseif $error_code == 5}
Название рассылки может содержать только латинские буквы, цифры и символы нижнего подчёркивания.
{elseif $error_code == 6}
Длина названия рассылки не может превышать 30-ти символов.
{elseif $error_code == 7}
Длина префикса не может превышать 128-ти символов.
{elseif $error_code == 8}
Длина подписи не может превышать 1024-ти символов.
{elseif $error_code == 9}
Среди подписчиков есть некорректный e-mail.
{elseif $error_code == 10}
Среди модераторов есть некорректный e-mail.
{else}
Неизвестная ошибка.
{/if}
</div>
</body>
</html>

View File

@@ -1,80 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
function validate_form()
{
var name = document.getElementById('add_list_input').value;
var name = name.toLowerCase();
if (name == "")
{
return false;
}
if (name.length > 30)
{
alert("Название списка рассылки должно содержать не более 30-ти символов.");
return false;
}
if ( name.match(/[^a-z0-9_]/) )
{
alert("Название списка рассылки может содержать только латинские буквы, цифры и символы нижнего подчёркивания.");
return false;
}
}
function confirm_delete()
{
return confirm("Вы действительно хотите удалить список рассылки?");
}
</script>
</head>
<body>
<div id="header">
<div id="header_left">
Сервис рассылок
</div>
<div id="header_right">
<a href="logout.php">Выйти</a>
</div>
</div>
<div id="breadcrumbs">{$domain}</div>
<div id="index">
<div id="lists_header">
<b>Все листы рассылок:</b>
&nbsp;
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_add_list">
Добавляйте и удаляйте списки рассылки с помощью данной формы. Вы можете редактировать список, кликнув по его названию.
Письмо в рассылку отправляется на адрес example@{$domain}, где example имя рассылки.
</span>
</div>
</div>
<table id="lists">
{foreach $lists as $list}
<tr>
<td>
&bull;
</td>
<td>
<a href="edit_list.php?list_name={$list}">{$list}</a>
</td>
<td>
<a href="del_list.php?list_name={$list}" onclick="return confirm_delete()"><img src="delete.svg" width=15></a>
</td>
</tr>
{/foreach}
</table>
<form method="post" action="add_list.php" onsubmit="return validate_form()">
<div id="add_list">
<input type="text" name="list_name" id="add_list_input">
&nbsp;
<input type="submit" name="submit" value="Добавить" id="add_list_button">
</div>
</form>
</div>
</body>
</html>

View File

@@ -1,62 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
function validate_form()
{
var domain = document.getElementById('domain_input').value;
var password = document.getElementById('password_input').value;
if (domain == "")
{
alert("Введите домен.");
return false;
}
if (password == "")
{
alert("Введите пароль.");
return false;
}
if ( domain.match(/[^A-Za-z0-9\-\.]/) )
{
alert("Домен может содержать только латинские буквы, цифры, точки и дефисы.");
return false;
}
if ( password.match(/[^A-Za-z0-9]/) )
{
alert("Пароль может содержать только латинские буквы и цифры.");
return false;
}
}
</script>
</head>
<body>
<div id="header">Сервис рассылок</div>
<div id="login">
<div id="login_form">
<form method="post" action="login.php" onsubmit="return validate_form()">
<div id="domain">
<div id="domain_left">
Домен:
</div>
<div id="domain_right">
<input type="text" name="login_domain" id="domain_input">
</div>
</div>
<div id="password">
<div id="password_left">
Пароль:
</div>
<div id="password_right">
<input type="password" name="login_pass" id="password_input">
</div>
</div>
<div id="enter">
<input type="submit" name="submit" value="Войти">
</div>
</form>
</div>
</div>
</body>
</html>

View File

@@ -1,3 +0,0 @@
From:
To:
Reply-To:

View File

@@ -1,2 +0,0 @@
------<br>
To unsubscribe please send empty letter to _unsub_addr_

View File

@@ -1,2 +0,0 @@
------
To unsubscribe please send empty letter to _unsub_addr_

View File

@@ -1 +0,0 @@
template@template

View File

View File

@@ -1 +0,0 @@
0

View File

@@ -1,52 +0,0 @@
%ifaction sub%Subject: Confirm subscription to $list$@$domain$%endif%
%ifaction unsub%Subject: Confirm unsubscribe from $list$@$domain$%endif%
%text prologue%
%ifaction sub%
%^%%wrap%
%ifreason admin%
An administrator
%endif%
%ifreason request%
Somebody (and we hope it was you)
%endif%
has requested that your email address <$subaddr$> be added
%iftype normal%
to the list. This means every time a post is sent to the list, you will
receive a copy of it.
%endif%
%iftype digest%
to the list, to receive digests. This means you will receive multiple
posts in a single mail message, at regular intervals, or when a lot of
posts have accumulated.
%endif%
%iftype nomail%
to the list, without mail delivery. This means you will not receive any
posts to the list, but you are considered a member. This means, for
instance, you are able to post to a list which only subscribers may post
to, while you follow the list using a web archive or another subscribed
email address.
%endif%
%endif%
%ifaction unsub%
%^%%wrap%
%ifreason admin%
An administrator
%endif%
%ifreason request%
Somebody (and we hope it was you)
%endif%
has requested that the email address <$subaddr$> be removed from the list.
%endif%
%wrap%To confirm you want to do this, please send a message to <$confaddr$>
which can usually be done simply by replying to this message. The subject
and the body of the message can be anything.
After doing so, you should receive a reply informing you that the operation
succeeded.
If you do not want to do this, simply ignore this message.

View File

@@ -1,76 +0,0 @@
%ifaction sub%Subject: Unable to subscribe to $list$@$domain$%endif%
%ifaction unsub%Subject: Unable to unsubscribe from $list$@$domain$%endif%
%ifaction release reject%Subject: Unable to moderate $list$@$domain$%endif%
%ifaction permit obstruct%Subject: Unable to gatekeep $list$@$domain$%endif%
%text prologue%
%ifaction sub%
%^%%wrap%You were unable to be subscribed to the list
%ifreason disabled%
because the
%iftype normal% normal %endif%
%iftype digest% digest %endif%
%iftype nomail% no-mail %endif%
version of the list is turned off.
%endif%
%ifreason closed%
because people are not allowed to subscribe to this list by email.
%endif%
%ifreason subbed%
because you are already subscribed.
%endif%
%ifreason expired%
because too much time passed without a gatekeeper permitting your entry.
%endif%
%ifreason obstruct%
because a gatekeeper obstructed your entry.
%endif%
%endif%
%ifaction unsub%
%^%%wrap%You were unable to be unsubscribed from the list
%ifreason unsubbed%
because you are not subscribed.
%^%%wrap%If you are receiving messages, perhaps a different email
address is subscribed. To find out which address you are subscribed
with, refer to the message welcoming you to the list, or look at the
envelope "Return-Path" header of a message you receive from the list.
%endif%
%endif%
%ifaction release reject%
%^%%wrap%
%ifaction release%
You were unable to release the specified post to the list
%endif%
%ifaction reject%
You were unable to reject the specified post
%endif%
%ifreason notfound%
because it could not be found. Perhaps another moderator already
released or rejected it, or it expired.
%endif%
%ifreason moderators%
because you are not a moderator for the list.
%endif%
%endif%
%ifaction permit obstruct%
%^%%wrap%
%ifaction permit%
You were unable to permit the specified subscription request
%endif%
%ifaction obstruct%
You were unable to obstruct the specified subscription request
%endif%
%ifreason notfound%
because it could not be found. Perhaps another gatekeeper already
permitted or obstructed it, or it expired.
%endif%
%ifreason gatekeepers%
because you are not a gatekeeper for the list.
%endif%
%endif%

View File

@@ -1,63 +0,0 @@
Subject: Post to $list$@$domain$ denied: $subject$
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_$random0$$random1$_="
Content-Transfer-Encoding: 8bit
--=_$random0$$random1$_=
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
%text prologue%
%wrap%The message from <$posteraddr$> with subject "$subject$" was unable to
be delivered to the list
%ifreason maxmailsize%
because it exceeded the maximum allowed message size of $maxmailsize$
bytes.
%endif%
%ifreason tocc%
because the list address was not found in either the To: or CC: header.
%endif%
%ifreason access%
because of an access rule set up by the list administrator.
%endif%
%ifreason expired%
because too much time passed without any moderator releasing it.
%endif%
%ifreason reject%
because a moderator rejected it.
%endif%
%ifreason subonlypost%
because you are not a list subscriber.
%ifcontrol closedlist closedlistsub%
%^%%wrap%If you wish to become a subscriber, you will need to contact a
list administrator. You can email <$list+$owner@$domain$> to contact the
list owner.
%endif%
%^%%wrap%If you believe you are a subscriber, you are probably subscribed
with a different email address. To find out which address you are
subscribed with, refer to the message welcoming you to the list, or look
at the envelope "Return-Path" header of a message you receive from the
list.
%endif%
%ifreason maxmailsize%
%^%(The beginning of the denied message is below.)
%else%
%^%(The denied message is below.)
%endif%
--=_$random0$$random1$_=
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="message.eml"
%ifreason maxmailsize%
%^%%originalmail 300%
%else%
%^%%originalmail%
%endif%
--=_$random0$$random1$_=--

View File

@@ -1,5 +0,0 @@
Subject: Digest of $list$@$domain$ issue $digestissue$ ($digestinterval$)
Topics (messages $digestfirst$ through $digestlast$):
- %digestthreads%

View File

@@ -1,4 +0,0 @@
Subject: Frequently asked questions of $list$@$domain$
Sorry, no FAQ available yet.

View File

@@ -1,55 +0,0 @@
%ifaction unsub%Subject: Goodbye from $list$@$domain$%endif%
%ifaction release reject%Subject: Moderated $list$@$domain$: $subject$%endif%
%ifaction permit obstruct%Subject: Guarded $list$@$domain$: $subaddr$%endif%
%ifaction post%Subject: Posted to $list$@$domain$: $subject$%endif%
%text prologue%
%ifaction unsub%
%^%%wrap%
%ifreason request%
%endif%
%ifreason confirm%
Thank you for confirming your unsubscribe.
%endif%
%ifreason admin%
An administrator has removed you from the list.
%else%
You have now been removed from the list.
%endif%
%endif%
%ifaction release%
%^%%wrap%You have successfully released the message from <$posteraddr$>
with subject "$subject$" to the list.
%endif%
%ifaction reject%
%^%%wrap%You have successfully rejected the message from <$posteraddr$>
with subject "$subject$".
%endif%
%ifaction permit%
%^%%wrap%You have successfully permitted <$subaddr$> to join the list.
%endif%
%ifaction obstruct%
%^%%wrap%You have successfully obstructed <$subaddr$> from joining the
list.
%endif%
%ifaction post%
%^%%wrap%
%ifreason confirm%
Thank you for confirming
%endif%
%ifreason release%
A moderator has released
%endif%
%ifreason request%
Thank you for
%endif%
your post with subject "$subject$". It is now being distributed to the
list.
%endif%

View File

@@ -1,44 +0,0 @@
Subject: Welcome to $list$@$domain$
%text prologue%
%wrap%
%ifreason request%
Thank you for your request to join us.
%endif%
%ifreason confirm%
Thank you for confirming your subscription.
%endif%
%ifreason permit%
A gatekeeper has permitted you to join us.
%endif%
%ifreason switch%
Your subscription has been switched to the
%else%
%ifreason admin%
An administrator has subscribed you to the
%else%
You have now been added to the
%endif%
%endif%
%iftype normal% normal %endif%
%iftype digest% digest %endif%
%iftype nomail% no-mail %endif%
version of the list.
%wrap%The email address you are subscribed with is <$subaddr$>.
%ifcontrol closedlist%
%^%%wrap%If you ever wish to unsubscribe, you will need to contact a list
administrator. You can email <$list+$owner@$domain$> to contact the list
owner.
%else%
%^%%wrap%If you ever wish to unsubscribe, send a message to
<$list+$unsubscribe@$domain$> using this email address. The subject and
the body of the message can be anything. You will then receive
confirmation or further instructions.
%endif%
%wrap%For other information and help about this list, send a message to
<$list+$help@$domain$>.

View File

@@ -1,19 +0,0 @@
Subject: Subscription request for $list$@$domain$: $subaddr$
%text prologue%
%wrap%There has been a request from <$subaddr$> to join the
%iftype normal% normal %endif%
%iftype digest% digest %endif%
%iftype nomail% no-mail %endif%
version of the list.
%wrap%To permit this, please send a message to <$permitaddr$> which can
usually be done simply by replying to this message.
%wrap%If you do not want to do this, either send a message to
<$obstructaddr$> or simply ignore this message.
The following gatekeepers have received this mail:
- %gatekeepers%

View File

@@ -1,88 +0,0 @@
Subject: Information for $list$@$domain$
%text prologue%
Here is some information about the list.
You can subscribe to the following versions:
- %wrap%The normal version: Every time a post is sent to the list,
subscribers receive a copy of it.
%ifcontrol closedlist closedlistsub%
Subscribe by contacting a list administrator.
%else%
Subscribe by emailing <$list+$subscribe@$domain$>.
%endif%
%ifncontrol nodigestsub%
%^%- %wrap%The digest version: Subscribers receive multiple posts in a
single mail message, at regular intervals, or when a lot of posts have
accumulated.
%ifcontrol closedlist closedlistsub%
Subscribe by contacting a list administrator.
%else%
Subscribe by emailing <$list+$subscribe-digest@$domain$>.
%endif%
%endif%
%ifncontrol nonomailsub%
%^%- %wrap%The no-mail version: Subscribers do not receive any posts to
the list. This means, though, they are able to post to a list which only
subscribers may post to, while they follow the list using a web archive or
another subscribed email address.
%ifcontrol closedlist closedlistsub%
Subscribe by contacting a list administrator.
%else%
Subscribe by emailing <$list+$subscribe-nomail@$domain$>.
%endif%
%endif%
%ifcontrol submod%
%^%%wrap%The list has gatekeepers who will review subscription requests
before permitting new members.
%endif%
%ifcontrol closedlist%
%^%%wrap%Unsubscribe by contacting a list administrator.
%else%
%^%%wrap%Unsubscribe by emailing <$list+$unsubscribe@$domain$>.
%endif%
%wrap%Posts are made by emailing <$list$@$domain$>.
%ifcontrol subonlypost%%ifncontrol modnonsubposts%
%^%%wrap%However, only subscribers may post to the list.
%endif%%endif%
%ifcontrol moderated%
%^%%wrap%The list has moderators who will review all posts before
releasing them to the list.
%else%
%ifcontrol subonlypost%%ifcontrol modnonsubposts%
%^%%wrap%The list has moderators who will review posts from
non-subscribers before releasing them to the list.
%endif%%endif%
%endif%
%ifcontrol access%
%^%%wrap%The list also has access rules which may affect who can post and
which posts are moderated.
%endif%
%ifncontrol noget%%ifncontrol noarchive%
%^%%wrap%
%ifcontrol subonlyget%
Anyone
%else%
Subscribers
%endif%
can retrieve message number N from the list's archive by sending a message
to <$list+$get-N@$domain$> (change the N to the number of the desired
message).
%endif%%endif%
%wrap%You can retrieve the frequently asked questions document for the list
by sending a message to <$list+$faq@$domain$>.
%wrap%To contact the list owner, send a message to <$list+$owner@$domain$>.

View File

@@ -1,25 +0,0 @@
Subject: Subscribers to $list$@$domain$
%text prologue%
%wrap%Here is the list of subscribers
%iftype all%
(to all versions of the list):
%else%
to the
%iftype normal% normal %endif%
%iftype digest% digest %endif%
%iftype nomail% no-mail %endif%
version of the list:
%endif%
%iftype all normal%
%^%- %listsubs%
%endif%
%iftype all digest%
%^%- %digestsubs%
%endif%
%iftype all nomail%
%^%- %nomailsubs%
%endif%

View File

@@ -1,41 +0,0 @@
Subject: Please moderate $list$@$domain$: $subject$
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_$random0$$random1$_="
Content-Transfer-Encoding: 8bit
--=_$random0$$random1$_=
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
%text prologue%
%wrap%A message from <$posteraddr$> with subject "$subject$" has been
submitted for posting. You are being asked to moderate
%ifreason modnonsubposts%
because the requester is not a subscriber.
%endif%
%ifreason moderated%
because this is a moderated list.
%endif%
%ifreason access%
because of an access rule.
%endif%
The message is below.
%wrap%To release it to the list, please send a message to <$releaseaddr$>
which can usually be done simply by replying to this message.
%wrap%If you do not want to do any of this, either send a message to
<$rejectaddr$> or simply ignore this message.
The following moderators have received this mail:
- %moderators%
--=_$random0$$random1$_=
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="message.eml"
%originalmail%
--=_$random0$$random1$_=--

View File

@@ -1,41 +0,0 @@
%ifaction sub%Subject: Subscribed to $list$@$domain$: $subaddr$%endif%
%ifaction unsub%Subject: Unsubscribed from $list$@$domain$: $subaddr$%endif%
%text prologue%
%ifaction sub%
%^%%wrap%The address <$subaddr$> has been subscribed to the
%iftype normal% normal %endif%
%iftype digest% digest %endif%
%iftype nomail% no-mail %endif%
version of the list
%ifreason request%
because a request to join was received.
%endif%
%ifreason confirm%
because a request to join was confirmed.
%endif%
%ifreason admin%
because an administrator commanded it.
%endif%
%ifreason permit%
because a gatekeeper permitted it.
%endif%
%endif%
%ifaction unsub%
%^%%wrap%The address <$subaddr$> has been unsubscribed from the list
%ifreason request%
because a request to unsubscribe was received.
%endif%
%ifreason confirm%
because a request to unsubscribe was confirmed.
%endif%
%ifreason admin%
because an administrator commanded it.
%endif%
%ifreason bouncing%
because it has been bouncing for too long.
%endif%
%endif%

View File

@@ -1,11 +0,0 @@
Subject: Bouncing messages from $list$@$domain$
%text prologue%
Some messages to you could not be delivered. If you're seeing this
message it means things are back to normal, and it's merely for your
information.
Here is the list of the bounced messages:
- %bouncenumbers%

View File

@@ -1,2 +0,0 @@
%wrap%Hi, this is the Mlmmj program managing the <$list$@$domain$> mailing
list.

View File

@@ -1 +0,0 @@
DISCARD_THIS_MAIL

View File

@@ -1,7 +0,0 @@
Subject: Awaiting permission to join $list$@$domain$
%text prologue%
%wrap%Your request to join the list has been received. However, the
gatekeepers are being asked to review it before permitting you to join.

View File

@@ -1,3 +0,0 @@
From:
To:
Reply-To:

View File

@@ -1,2 +0,0 @@
------<br>
Чтобы отписаться от рассылки, отправьте пустое письмо на _unsub_addr_

View File

@@ -1,2 +0,0 @@
------
Чтобы отписаться от рассылки, отправьте пустое письмо на _unsub_addr_

View File

@@ -1 +0,0 @@
template@template

View File

View File

@@ -1 +0,0 @@
0

View File

@@ -1,45 +0,0 @@
%ifaction sub%Subject: Подтвердите добавление к $list$@$domain$%endif%
%ifaction unsub%Subject: Подтвердите удаление из $list$@$domain$%endif%
%text prologue%
%ifaction sub%
%^%%wrap%
%ifreason admin%
Администратор
%endif%
%ifreason request%
Кто-то (мы надеемся, что это были Вы)
%endif%
запросил, чтобы Ваш e-mail <$subaddr$> был добавлен
%iftype normal%
к листу рассылки. Это означает, что каждый раз, когда сообщение отправляется
в рассылку, Вы будете получать его копию.
%endif%
%iftype digest%
to the list, to receive digests. This means you will receive multiple
posts in a single mail message, at regular intervals, or when a lot of
posts have accumulated.
%endif%
%endif%
%ifaction unsub%
%^%%wrap%
%ifreason admin%
Администратор
%endif%
%ifreason request%
Кто-то (мы надеемся, что это были Вы)
%endif%
запросил, чтобы Ваш e-mail <$subaddr$> был удалён из листа рассылки.
%endif%
%wrap%Для того, чтобы подтвердить это, пожалуйста, отправьте сообщение на
<$confaddr$>, обычно это можно сделать, просто ответив на это письмо. Темой
и телом письма может быть что угодно.
После этого, Вы получите сообщение, информируещее Вас об успешном окончании
операции.
Если Вы не хотите этого, просто проигнорируйте это сообщение.

View File

@@ -1,35 +0,0 @@
%ifaction sub%Subject: Невозможно подписаться на $list$@$domain$%endif%
%ifaction unsub%Subject: Невозможно отписаться от $list$@$domain$%endif%
%ifaction release reject%Subject: Невозможно модерировать $list$@$domain$%endif%
%text prologue%
%ifaction unsub%
%^%%wrap%Вы не можете отписаться от листа рассылки
%ifreason unsubbed%
потому что Вы не подписаны.
%^%%wrap%Если Вы получаете сообщения, возможно, подписан другой email.
Чтобы узнать, какой адрес подписан, обратитесь к письму-приветствию
о начале подписки, либо обратите внимание на поле "Return-Path" сообщений,
которые Вы получаете из рассылки.
%endif%
%endif%
%ifaction release reject%
%^%%wrap%
%ifaction release%
Вы не можете одобрить публикацию сообщения
%endif%
%ifaction reject%
Вы не можете запретить публикацию сообщения
%endif%
%ifreason notfound%
потому что оно не найдено. Возможно, потому что другой модератор
уже одобрил или запретил, или время ожидания истекло.
%endif%
%ifreason moderators%
потому что Вы не модератор рассылки.
%endif%
%endif%

View File

@@ -1,61 +0,0 @@
Subject: Post to $list$@$domain$ denied: $subject$
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_$random0$$random1$_="
Content-Transfer-Encoding: 8bit
--=_$random0$$random1$_=
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
%text prologue%
%wrap%Сообщение от <$posteraddr$> с темой "$subject$" не может быть доставлено
в лист рассылки
%ifreason maxmailsize%
потому что оно превышает максимально допустимый размер в $maxmailsize$
байт.
%endif%
%ifreason tocc%
потому что адрес листа рассылки не найден ни в поле To:, ни в поле CC:.
%endif%
%ifreason access%
из-за правил, установленных администратором.
%endif%
%ifreason expired%
потому что прошло слишком много времени и модераторы не одобрили публикацию.
%endif%
%ifreason reject%
потому что модератор отклонил его.
%endif%
%ifreason subonlypost%
потому что Вы не подписчик.
%ifcontrol closedlist closedlistsub%
%^%%wrap%Если Вы хотите стать подписчиком, Вам следует связаться с владельцем
листа рассылки.
%endif%
%^%%wrap%Если Вы считаете, что являетесь подписчиком, возможно, Вы подписаны
с другим адресом e-mail. Чтобы его выяснить, обратитесь к письму-приветствию,
либо обратите внимание на поле "Return-Path" сообщений, которые Вы получаете
из рассылки.
%endif%
%ifreason maxmailsize%
%^%(Начало отклонённого сообщения приведено ниже.)
%else%
%^%(Отклонённое сообщение приведено ниже.)
%endif%
--=_$random0$$random1$_=
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="message.eml"
%ifreason maxmailsize%
%^%%originalmail 300%
%else%
%^%%originalmail%
%endif%
--=_$random0$$random1$_=--

View File

@@ -1,18 +0,0 @@
%ifaction unsub%Subject: Вы отписались от $list$@$domain$%endif%
%text prologue%
%ifaction unsub%
%^%%wrap%
%ifreason request%
%endif%
%ifreason confirm%
Благодарим Вас за подтверждение удаления из листа рассылки.
%endif%
%ifreason admin%
Администратор исключил Вас из листа рассылки.
%else%
Вы были исключены из листа рассылки.
%endif%
%endif%

View File

@@ -1,30 +0,0 @@
Subject: Добро пожаловать в $list$@$domain$
%text prologue%
%wrap%
%ifreason request%
Благодарим Вас за запрос на добавление в список рассылки.
%endif%
%ifreason confirm%
Благодарим Вас за подтверждение вступления в список рассылки.
%endif%
%ifreason permit%
A gatekeeper has permitted you to join us.
%endif%
%ifreason switch%
Ваша подписка была изменена на
%else%
%ifreason admin%
Администратор подписал Вас
%else%
Вы были добавлены к
%endif%
%endif%
%iftype normal% нормальной %endif%
%iftype digest% дайджест %endif%
%iftype nomail% no-mail %endif%
версии листа.
%wrap%Ваш e-mail, который был добавлен <$subaddr$>.

View File

@@ -1,41 +0,0 @@
Subject: Необходима модерация для сообщения $list$@$domain$: $subject$
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_$random0$$random1$_="
Content-Transfer-Encoding: 8bit
--=_$random0$$random1$_=
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
%text prologue%
%wrap%Сообщение от <$posteraddr$> с темой "$subject$" было предложено
предложено к публикации. Вы должны разрешить или запретить его публикацию,
%ifreason modnonsubposts%
потому что он не подписчик.
%endif%
%ifreason moderated%
потому что это модерируемый лист.
%endif%
%ifreason access%
потому что таковы правила доступа.
%endif%
Сообщение приведено ниже.
%wrap%Для одобрения публикации, пожалуйста, отправьте сообщение на <$releaseaddr$>
обычно это можно сделать, просто ответив на это сообщение.
%wrap%В случае, если Вы не хотите этого, отправьте, пожалуйста, сообщение на
<$rejectaddr$> или просто проигнорируйте это письмо.
Следующие модераторы получили это письмо:
- %moderators%
--=_$random0$$random1$_=
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="message.eml"
%originalmail%
--=_$random0$$random1$_=--

View File

@@ -1 +0,0 @@
%wrap%Здравствуйте, это программа, управляющая списком рассылки <$list$@$domain$>.

View File

@@ -1 +0,0 @@
DISCARD_THIS_MAIL

View File

@@ -1,5 +1,7 @@
<?php
require("init.php");
function trim_array($arr)
{
// Trim each array element
@@ -15,14 +17,10 @@ function trim_array($arr)
return $clean;
}
require("init.php");
$list_name = isset( $_POST["list_name"] ) ? $_POST["list_name"] : NULL;
$new_list_type = isset( $_POST["list_type"] ) ? $_POST["list_type"] : NULL;
$prefix = isset ( $_POST["prefix"] ) ? $_POST["prefix"] : NULL;
$footer = isset( $_POST["footer"] ) ? $_POST["footer"] : NULL;
$new_subscribers = isset ( $_POST["subscribers"] ) ? $_POST["subscribers"] : NULL;
$moderators = isset ( $_POST["moderators"] ) ? $_POST["moderators"] : NULL;
$notmetoo = isset ( $_POST["notmetoo"] ) ? $_POST["notmetoo"] : NULL;
if ( !isset($_SESSION["auth"]) || $_SESSION["auth"] != 1 )
{
@@ -34,7 +32,7 @@ if ( !isset($_SESSION["auth"]) || $_SESSION["auth"] != 1 )
$domain = $_SESSION["domain"];
// We do not print any error in the next four cases, because a legitimate
// user will never produce such results, even with disables javascript
// user will never produce such results, even with disabled javascript
if ( preg_match("/[^a-z0-9_-]/", $list_name) )
{
header("Location: error.php");
@@ -54,11 +52,12 @@ if( !is_dir("$lists_path/$domain/$list_name") )
exit();
}
// Test list type
if ($new_list_type !== "0" && $new_list_type !== "1" && $new_list_type !== "2")
# Check whether the user may edit this list as he owns it
if (!in_array($list_name, $_SESSION["array_lists_owned"]))
{
$_SESSION["error_code"] = 11;
header("Location: error.php");
exit();
exit;
}
if ( strlen($prefix) > 128 )
@@ -69,14 +68,6 @@ if ( strlen($prefix) > 128 )
exit();
}
if ( strlen($footer) > 1024 )
{
// Footer must not be longer than 1024 characters
$_SESSION["error_code"] = 8;
header("Location: error.php");
exit();
}
if ($new_subscribers != NULL)
{
// Subscribe new subscribers and unsubscribe who is not present in the new list of subscribers
@@ -111,88 +102,59 @@ if ($new_subscribers != NULL)
}
}
$old_list_type = file_get_contents("$lists_path/$domain/$list_name/list_type.txt");
# --- SECURITY CHECK ---
// If list type changed
if ($new_list_type !== $old_list_type)
# Check if someone sent a manipulated POST request
# Check whether there is a moderators file
if (file_exists("$lists_path/$domain/$list_name/control/moderators"))
{
// Delete all files except three in control dir
shell_exec("cd $lists_path/$domain/$list_name/control/; \
ls | grep -E -v '(footer-html|footer-text|listaddress|owner|delheaders|addtohdr|customheaders)' | xargs rm");
// Create necessary files
switch ($new_list_type)
// Get a moderators list
$moderators_check = file_get_contents("$lists_path/$domain/$list_name/control/moderators");
// Remove trailing empty symbols
$moderators_check = trim($moderators_check);
# If theres no @ inside the file it seems to be empty
if (!preg_match("/[@]/", $moderators_check))
{
case 0: // Moderated list
shell_exec("cd $lists_path/$domain/$list_name/control/; \
touch closedlistsub moderated subonlypost notifymod noarchive noget nosubonlydenymails \
nodigestsub nolistsubsemail ifmodsendonlymodmoderate");
break;
case 1: // News list
shell_exec("cd $lists_path/$domain/$list_name/control/; \
touch moderated modonlypost noarchive nosubonlydenymails nodigestsub nomodonlydenymails \
nolistsubsemail subonlypost ifmodsendonlymodmoderate");
break;
case 2: // Conference list
shell_exec("cd $lists_path/$domain/$list_name/control/; \
touch closedlistsub subonlypost noarchive noget nosubonlydenymails nodigestsub \
nolistsubsemail");
break;
$moderators = NULL;
}
file_put_contents("$lists_path/$domain/$list_name/list_type.txt", "$new_list_type");
}
if ($footer !== NULL)
else
{
// Delete all \r symbols
$footer = str_replace("\r", "", $footer);
file_put_contents("$lists_path/$domain/$list_name/control/footer-text", "$footer\n");
// Insert <br>
$footer = str_replace("\n", "<br>\n", $footer);
file_put_contents("$lists_path/$domain/$list_name/control/footer-html", "$footer\n");
$moderators = NULL;
}
# --- SECURITY CHECK ---
if ($moderators !== NULL)
{
$moderators_array = explode("\n", $moderators);
$moderators_array = trim_array($moderators_array);
// Check moderators emails
foreach ($moderators_array as $moderator)
# If theres an @ inside the new moderators variable it seems to be empty
if (preg_match("/[@]/", $moderators))
{
if ( !filter_var($moderator, FILTER_VALIDATE_EMAIL) )
$moderators_array = explode("\n", $moderators);
$moderators_array = trim_array($moderators_array);
// Check moderators emails
foreach ($moderators_array as $moderator)
{
// Incorrect email
$_SESSION["error_code"] = 10;
header("Location: error.php");
exit();
if ( !filter_var($moderator, FILTER_VALIDATE_EMAIL) )
{
// Incorrect email
$_SESSION["error_code"] = 10;
header("Location: error.php");
exit();
}
}
}
// If this not a conference list type, then write moderators
if ($new_list_type !== "2")
{
file_put_contents("$lists_path/$domain/$list_name/control/moderators", "$moderators");
}
// If this is a news list type, create access file (only mods can post)
if ($new_list_type == "1")
else
{
// Delete all \r symbols
$moderators = str_replace("\r", "", $moderators);
// Escape dots
$moderators = str_replace(".", "\.", $moderators);
// Add first allow
$moderators = "allow ^From:.*" . $moderators;
// Add all other allows
$moderators = str_replace("\n", "\nallow ^From:.*", $moderators);
// Add discard as last string
$moderators = $moderators . "\ndiscard";
// Add .* to each allow
$moderators = str_replace("\n", ".*\n", $moderators);
// Write result
file_put_contents("$lists_path/$domain/$list_name/control/access", "$moderators");
# Someone wants to clear the moderators list which is not allowed (yet)
#$_SESSION["error_code"] = 12;
#header("Location: error.php");
#exit();
}
}
@@ -201,18 +163,54 @@ if ($prefix !== NULL)
file_put_contents("$lists_path/$domain/$list_name/control/prefix", "$prefix");
}
if ($notmetoo === "checked")
# The following code section is for audit log only
# -------------------------------------------------------------
# Check whether there is a moderators file
if (file_exists("$lists_path/$domain/$list_name/control/moderators"))
{
shell_exec("touch $lists_path/$domain/$list_name/control/notmetoo");
// Get a moderators list
$old_moderators = file_get_contents("$lists_path/$domain/$list_name/control/moderators");
// Remove trailing empty symbols
$old_moderators = trim($old_moderators);
# If theres no @ inside the file it seems to be empty
if (!preg_match("/[@]/", $old_moderators))
{
$old_moderators = NULL;
}
}
else
{
if ( file_exists("$lists_path/$domain/$list_name/control/notmetoo") )
$old_moderators = NULL;
}
// Get old prefix
$old_prefix = file_get_contents("$lists_path/$domain/$list_name/control/prefix");
// Remove trailing empty symbols
$old_prefix = trim($old_prefix);
# -------------------------------------------------------------
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"' . $_SESSION["username"] . ' changed list ' . $list_name . '"}\' https://chat.ecogood.org/hooks/' . $rc_webhook);
$return = audit_log("save_list", "Old subscribers: " . json_encode($old_subscribers) . " - Old prefix: " . $old_prefix . " - Old moderators: " . json_encode($old_moderators));
if (!$return["success"])
{
# If debug mode is on show error message
if ($debug)
{
shell_exec("rm $lists_path/$domain/$list_name/control/notmetoo");
echo $return["message"];
}
else
{
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"' . $return["message"] . '"}\' https://chat.ecogood.org/hooks/' . $rc_webhook);
}
}
header("Location: edit_list.php?list_name=$list_name");
exit();
?>

View File

@@ -94,24 +94,24 @@ td
align-self: center;
}
#domain, #password
#username, #password
{
width: 100%;
padding-bottom: 5px;
display: flex;
}
#domain_left, #password_left
#username_left, #password_left
{
align-self: center;
}
#domain_right, #password_right
#username_right, #password_right
{
margin-left: auto;
}
#domain_input, #password_input
#username_input, #password_input
{
width: 170px;
}