12 Commits
v1.0 ... v1.1

14 changed files with 61 additions and 4830 deletions

View File

@@ -1,15 +1,3 @@
# ROADMAP
Updated at: 08/13/2021
## v1.1
nothing there yet
## Feature wishes
- [ ] Automatically put square brackets around the prefix `[prefix]`
- [ ] Count number of subscribers and moderators in the text areas
- [ ] Allow admins to edit all mailing lists
- [ ] Check for duplicates in the subscriber / moderator text area
- [ ] Allow users to subscribe to a list by clicking a button
- [ ] Show the list-description
- [ ] Someone enters his email address into an input field and gets an email with all mailing lists he is subscribed to
refer to [Milestones](https://git.ecogood.org/services/mlmmj-light-web-ecg/milestones)

View File

@@ -71,6 +71,20 @@ $prefix = file_get_contents("$lists_path/$domain/$list_name/control/prefix");
// Remove trailing empty symbols
$prefix = trim($prefix);
# Check whether there is a listdescription file
if (file_exists("$lists_path/$domain/$list_name/control/listdescription"))
{
// Get list description
$listdescription = file_get_contents("$lists_path/$domain/$list_name/control/listdescription");
// Remove trailing empty symbols
$listdescription = trim($listdescription);
}
else
{
$listdescription = NULL;
}
// Load page
$smarty->assign("headline", $headline);
$smarty->assign("web_url", $web_url);
@@ -79,6 +93,7 @@ $smarty->assign("list_name", $list_name);
$smarty->assign("domain", $domain);
$smarty->assign("moderators", $moderators);
$smarty->assign("prefix", $prefix);
$smarty->assign("listdescription", $listdescription);
$smarty->assign("username", $_SESSION["username"]);
$smarty->assign("success", $success);
$smarty->display("edit_list.tpl");

View File

@@ -22,7 +22,7 @@ $domain_global = "mlmmj";
$rc_webhook = "";
# No need to change this values
$current_version = "v1.0";
$current_version = "v1.1";
$headline = "Manage your ECG mailing lists " . $current_version;
$debug = false;

View File

@@ -18,7 +18,20 @@ if (!empty($login_username) && !empty($login_pass))
$ldap_server = "localhost";
$ldap_port = 30389;
$connect = ldap_connect($ldap_server, $ldap_port); #or die("Failed to connect to the LDAP server.");
$connect = ldap_connect($ldap_server, $ldap_port);
if (!$connect)
{
# If debug mode is on show error message
if ($debug)
{
echo "Failed to connect to the LDAP server.";
}
else
{
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"Failed to connect to the LDAP server."}\' https://chat.ecogood.org/hooks/A' . $rc_webhook);
}
exit;
}
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
@@ -26,7 +39,7 @@ if (!empty($login_username) && !empty($login_pass))
# 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.");
$bind = ldap_bind($connect, $auth_user, $auth_pass);
# If the bind was successfull
if ($bind)
@@ -49,7 +62,7 @@ if (!empty($login_username) && !empty($login_pass))
# If debug mode is on show error message
if ($debug)
{
echo $return["message"];
echo $return["message"];
}
else
{
@@ -62,6 +75,9 @@ if (!empty($login_username) && !empty($login_pass))
}
else
{
# Send audit message on failed login
shell_exec('curl -X POST -H \'Content-Type: application/json\' --data \'{"alias":"ECG Notification Bot","emoji":":ghost:","text":"Login failed: ' . $login_username . ' (' . $_SERVER["REMOTE_ADDR"] . ')"}\' https://chat.ecogood.org/hooks/' . $rc_webhook);
// Incorrect password
$_SESSION["error_code"] = 3;
header("Location: error.php");

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
if $message_body contains "DISCARD_THIS_MAIL" and not error_message
then seen finish endif

View File

@@ -1,14 +0,0 @@
all: foot_filter
dev: tags splint foot_filter
.PHONY: splint clean clobber
tags: foot_filter.c
ctags --excmd=number '--regex-c=-/\*[[:blank:]]*tag:[[:blank:]]*([[:alnum:]_]+)-\1-' foot_filter.c
splint:
splint +unixlib -exitarg -initallelements foot_filter.c
foot_filter: foot_filter.c
gcc -Wall -g -o foot_filter foot_filter.c -O3
clean:
-rm tags
clobber: clean
-rm foot_filter
-rm test

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
#!/bin/bash
#
# mlmmj-footer-receive
#
# Adds the footer to incoming message
#
/usr/bin/foot_filter -P /$1/$2/control/footer-text -H /$1/$2/control/footer-html | /usr/bin/mlmmj-receive -F -L /$1/$2/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -44,7 +44,7 @@
//{/literal}
</script>
</head>
<body>
<body onload="document.getElementById('subscribers').value = document.getElementById('subscribers').value.split('\n').sort().join('\n'); document.getElementById('moderators').value = document.getElementById('moderators').value.split('\n').sort().join('\n');">
<div id="header">
<div id="header_left">
<a href="{$web_url}">{$headline}</a>
@@ -56,6 +56,9 @@
<div id="breadcrumbs">
<a href="index.php">Home</a>&nbsp;/&nbsp;{$list_name}
</div>
<div style="width: 75%; border: 2px solid #000; margin: 0 auto 30px; text-align: center; padding: 20px; border-radius: 10px; background-color: #FFF7A4; border-color: #C1AE00;">
Please be aware that you need the user's consent to receive mails from the list <strong>before</strong> you add him to the list of subscribers.<br />This tool <strong>won't send a double opt-in message</strong> to new subscribers automatically.
</div>
{if $success eq true}<p class="success">List was successfully updated.</p>{/if}
<form method="post" action="save_list.php" id="save_list" onsubmit="return validate_form()">
<div id="edit_page">
@@ -66,9 +69,10 @@
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_sub">
Please provide one email address per line.<br /><br />Please be aware that you need the user's consent to receive mails from the list <strong>before</strong> you add him to the list of subscribers. This tool won't send a double opt-in message to new subscribers.
Please provide one email address per line.<br /><br />Please be aware that you need the user's consent to receive mails from the list <strong>before</strong> you add him to the list of subscribers. This tool won't send a double opt-in message to new subscribers automatically.
</span>
</div>
&nbsp;|&nbsp;<a href="#" onclick="document.getElementById('subscribers').value = document.getElementById('subscribers').value.split('\n').sort().join('\n'); alert('Subscribers list has been sorted alphabetically.');">A-Z</a>&nbsp;|&nbsp;<a href="#" onclick="alert('Current subscribers count: ' + document.getElementById('subscribers').value.trim().split('\n').length);">Count</a>
</div>
<div id="subscribers_body">
<textarea name="subscribers" id="subscribers">{$subscribers}</textarea>
@@ -95,6 +99,22 @@
</td>
</tr>
</table>
<table style="width: 100%; text-align: center; margin-top: 50px; padding: 0 25px 0 25px;">
<tr>
<td colspan="2">
<div id="listdescription_header">
<div class="tooltip">
<img src="help.svg" width=15 height=15>
<span class="help_prefix">
This is the list description which is displayed in the overview.<br /><br />Can be left blank.
</span>
</div>
&nbsp;List description:
</div>
<textarea name="listdescription" id="listdescription" style="height: 100%; width: 100%;">{$listdescription|escape:'htmlall'}</textarea>
</td>
</tr>
</table>
</div>
<div id="save_btn">
<input type="submit" name="submit" value="Save">
@@ -112,6 +132,7 @@
In case of a moderated list the messages will be send to these recipients before they get published to the list.<br /><br />Please be aware that you need the user's consent to receive mails from the list <strong>before</strong> you add him to the list of moderators. This tool won't send a double opt-in message to new moderators.
</span>
</div>
&nbsp;|&nbsp;<a href="#" onclick="document.getElementById('moderators').value = document.getElementById('moderators').value.split('\n').sort().join('\n'); alert('Moderators list has been sorted alphabetically.');">A-Z</a>&nbsp;|&nbsp;<a href="#" onclick="alert('Current moderators count: ' + document.getElementById('moderators').value.trim().split('\n').length);">Count</a>
</div>
<div id="moderators_body">
<textarea name="moderators" id="moderators">{$moderators}</textarea>

View File

@@ -42,7 +42,7 @@
Username:
</div>
<div id="username_right">
<input type="text" name="login_username" id="username_input">
<input type="text" name="login_username" id="username_input" autofocus>
</div>
</div>
<div id="password">

View File

@@ -89,7 +89,7 @@ if ($new_subscribers != NULL)
header("Location: error.php");
exit();
}
shell_exec("/usr/bin/mlmmj-sub -L $lists_path/$domain/$list_name -a $new_subscriber -fq");
shell_exec("/usr/bin/mlmmj-sub -L $lists_path/$domain/$list_name -a $new_subscriber -fsq");
}
}