forked from services/mlmmj-light-web-ecg
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85f5824f7b | |||
| 9bff04b518 | |||
| e995eb6648 | |||
| 82ff17132d | |||
| d7621582da | |||
| fcd2a0e395 | |||
| b4cd6b8628 | |||
| 15482bf028 | |||
|
|
8524670e59 | ||
| b79f0e1844 |
@@ -13,7 +13,9 @@ A light PHP web interface for managing [mlmmj](http://mlmmj.org/) mailing lists.
|
|||||||
### For users
|
### For users
|
||||||
- Authentication via LDAP
|
- Authentication via LDAP
|
||||||
- List all available mailinglists on the server
|
- List all available mailinglists on the server
|
||||||
|
- Display owners and listdescription of the respective mailing lists on the index page
|
||||||
- Only show the edit function for mailing lists where the user is set as owner
|
- Only show the edit function for mailing lists where the user is set as owner
|
||||||
|
- Edit functions per mailing list: subscribers, moderators, prefix and listdescription
|
||||||
|
|
||||||
### For admins
|
### For admins
|
||||||
- Error handling regarding invalid user input
|
- Error handling regarding invalid user input
|
||||||
@@ -69,7 +71,9 @@ Check if the values from `init.php` are still valid or need to be adapted.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
v1.0 - Initial release (08/13/2021)
|
[v1.2](https://git.ecogood.org/services/mlmmj-light-web-ecg/releases/tag/v1.2) - Version 1.2 (2022-02-01)
|
||||||
|
[v1.1](https://git.ecogood.org/services/mlmmj-light-web-ecg/releases/tag/v1.1) - Version 1.1 (2021-11-25)
|
||||||
|
[v1.0](https://git.ecogood.org/services/mlmmj-light-web-ecg/releases/tag/v1.0) - Initial release (2021-08-13)
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
|
|||||||
@@ -13,23 +13,24 @@ if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not print any error in the next three cases, because a legitimate
|
|
||||||
// user will never produce such results, even with disabled javascript
|
|
||||||
if ( preg_match("/[^a-z0-9_-]/", $list_name) )
|
if ( preg_match("/[^a-z0-9_-]/", $list_name) )
|
||||||
{
|
{
|
||||||
|
$_SESSION["error_code"] = 14;
|
||||||
header("Location: error.php");
|
header("Location: error.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strlen($list_name) > 30 )
|
if ( strlen($list_name) > 50 )
|
||||||
{
|
{
|
||||||
|
$_SESSION["error_code"] = 13;
|
||||||
header("Location: error.php");
|
header("Location: error.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test list existence
|
// Test list existence
|
||||||
if( !is_dir("$lists_path/$domain/$list_name") )
|
if( !is_dir("$lists_path/$domain/$list_name") || $list_name == "" )
|
||||||
{
|
{
|
||||||
|
$_SESSION["error_code"] = 12;
|
||||||
header("Location: error.php");
|
header("Location: error.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|||||||
38
index.php
38
index.php
@@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
# Scan loading time
|
||||||
|
$time_start = microtime(true);
|
||||||
|
|
||||||
require("init.php");
|
require("init.php");
|
||||||
|
|
||||||
if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
|
if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
|
||||||
@@ -27,16 +30,40 @@ if (isset($lists))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lists_new = [];
|
$lists_new = [];
|
||||||
|
|
||||||
|
# Iterate through all lists
|
||||||
foreach($lists as $list)
|
foreach($lists as $list)
|
||||||
{
|
{
|
||||||
|
# If list is in array of owned lists
|
||||||
if (!in_array($list, $_SESSION["array_lists_owned"]))
|
if (!in_array($list, $_SESSION["array_lists_owned"]))
|
||||||
{
|
{
|
||||||
$lists_new[$list] = 0;
|
$lists_new[$list]["iamowner"] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$lists_new[$list] = 1;
|
$lists_new[$list]["iamowner"] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get the owners of the list and put them into the array
|
||||||
|
$owners = explode("\n", trim(shell_exec("/usr/bin/mlmmj-list -o -L $lists_path/$domain/$list")));
|
||||||
|
$lists_new[$list]["owners"] = $owners;
|
||||||
|
|
||||||
|
# Check whether there is a listdescription file
|
||||||
|
if (file_exists("$lists_path/$domain/$list/control/listdescription") && @file_get_contents("$lists_path/$domain/$list/control/listdescription") != "")
|
||||||
|
{
|
||||||
|
// Get list description
|
||||||
|
$listdescription = file_get_contents("$lists_path/$domain/$list/control/listdescription");
|
||||||
|
// Remove trailing empty symbols
|
||||||
|
$listdescription = trim($listdescription);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Set listdescription to none
|
||||||
|
$listdescription = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add the listdescription to the array
|
||||||
|
$lists_new[$list]["description"] = $listdescription;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -44,11 +71,18 @@ else
|
|||||||
$lists = NULL;
|
$lists = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Scan loading time
|
||||||
|
$time_end = microtime(true);
|
||||||
|
|
||||||
|
# Calculate loading time
|
||||||
|
$loadingtime = round(($time_end - $time_start), 2);
|
||||||
|
|
||||||
$smarty->assign("headline", $headline);
|
$smarty->assign("headline", $headline);
|
||||||
$smarty->assign("web_url", $web_url);
|
$smarty->assign("web_url", $web_url);
|
||||||
$smarty->assign("lists", $lists_new);
|
$smarty->assign("lists", $lists_new);
|
||||||
$smarty->assign("domain", $domain);
|
$smarty->assign("domain", $domain);
|
||||||
$smarty->assign("username", $_SESSION["username"]);
|
$smarty->assign("username", $_SESSION["username"]);
|
||||||
|
$smarty->assign("loadingtime", $loadingtime);
|
||||||
$smarty->display("index.tpl");
|
$smarty->display("index.tpl");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
1
info.svg
Normal file
1
info.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"><path d="m32 2c-16.568 0-30 13.432-30 30s13.432 30 30 30 30-13.432 30-30-13.432-30-30-30m5 49.75h-10v-24h10v24m-5-29.5c-2.761 0-5-2.238-5-5s2.239-5 5-5c2.762 0 5 2.238 5 5s-2.238 5-5 5" fill="#dddddd"/></svg>
|
||||||
|
After Width: | Height: | Size: 303 B |
2
init.php
2
init.php
@@ -22,7 +22,7 @@ $domain_global = "mlmmj";
|
|||||||
$rc_webhook = "";
|
$rc_webhook = "";
|
||||||
|
|
||||||
# No need to change this values
|
# No need to change this values
|
||||||
$current_version = "v1.1";
|
$current_version = "v1.2";
|
||||||
$headline = "Manage your ECG mailing lists " . $current_version;
|
$headline = "Manage your ECG mailing lists " . $current_version;
|
||||||
$debug = false;
|
$debug = false;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,12 @@
|
|||||||
There is an incorrect email in the moderators list.
|
There is an incorrect email in the moderators list.
|
||||||
{elseif $error_code == 11}
|
{elseif $error_code == 11}
|
||||||
You do not own this list.
|
You do not own this list.
|
||||||
|
{elseif $error_code == 12}
|
||||||
|
The list does not exist within the mlmmj working folder.
|
||||||
|
{elseif $error_code == 13}
|
||||||
|
The list name exceeds the maximum length of 50 chars.
|
||||||
|
{elseif $error_code == 14}
|
||||||
|
The list name contains chars which are not allowed.
|
||||||
{else}
|
{else}
|
||||||
Unknown error.
|
Unknown error.
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -58,13 +58,19 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{foreach $lists as $list}
|
{foreach $lists as $list}
|
||||||
{if $list == 1}
|
{if $list.iamowner == 1}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
✓
|
✓
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="edit_list.php?list_name={$list@key}">{$list@key}</a>
|
<a href="edit_list.php?list_name={$list@key}">{$list@key}</a>
|
||||||
|
<div class="tooltip">
|
||||||
|
<img src="info.svg" width=15 height=15>
|
||||||
|
<span class="help_add_list">
|
||||||
|
<strong>Description</strong><br />{$list.description}<br /><br /><strong>List owner(s)</strong><br />{foreach $list.owners as $owner}{$owner}<br />{/foreach}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -94,18 +100,26 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{foreach $lists as $list}
|
{foreach $lists as $list}
|
||||||
{if $list == 0}
|
{if $list.iamowner == 0}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
✗
|
✗
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{$list@key}
|
{$list@key}
|
||||||
|
<div class="tooltip">
|
||||||
|
<img src="info.svg" width=15 height=15>
|
||||||
|
<span class="help_add_list">
|
||||||
|
<strong>Description</strong><br />{$list.description}<br /><br /><strong>List owner(s)</strong><br />{foreach $list.owners as $owner}{$owner}<br />{/foreach}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
<br />
|
||||||
|
<span>Loading time: {$loadingtime} seconds</span>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ function trim_array($arr)
|
|||||||
|
|
||||||
$list_name = isset( $_POST["list_name"] ) ? $_POST["list_name"] : NULL;
|
$list_name = isset( $_POST["list_name"] ) ? $_POST["list_name"] : NULL;
|
||||||
$prefix = isset ( $_POST["prefix"] ) ? $_POST["prefix"] : NULL;
|
$prefix = isset ( $_POST["prefix"] ) ? $_POST["prefix"] : NULL;
|
||||||
|
$listdescription = isset ( $_POST["listdescription"] ) ? $_POST["listdescription"] : NULL;
|
||||||
$new_subscribers = isset ( $_POST["subscribers"] ) ? $_POST["subscribers"] : NULL;
|
$new_subscribers = isset ( $_POST["subscribers"] ) ? $_POST["subscribers"] : NULL;
|
||||||
$moderators = isset ( $_POST["moderators"] ) ? $_POST["moderators"] : NULL;
|
$moderators = isset ( $_POST["moderators"] ) ? $_POST["moderators"] : NULL;
|
||||||
|
|
||||||
@@ -31,23 +32,24 @@ if ( !isset($_SESSION["auth"]) || $_SESSION["auth"] != 1 )
|
|||||||
|
|
||||||
$domain = $_SESSION["domain"];
|
$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 disabled javascript
|
|
||||||
if ( preg_match("/[^a-z0-9_-]/", $list_name) )
|
if ( preg_match("/[^a-z0-9_-]/", $list_name) )
|
||||||
{
|
{
|
||||||
|
$_SESSION["error_code"] = 14;
|
||||||
header("Location: error.php");
|
header("Location: error.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strlen($list_name) > 30 )
|
if ( strlen($list_name) > 50 )
|
||||||
{
|
{
|
||||||
|
$_SESSION["error_code"] = 13;
|
||||||
header("Location: error.php");
|
header("Location: error.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test list existence
|
// Test list existence
|
||||||
if( !is_dir("$lists_path/$domain/$list_name") )
|
if( !is_dir("$lists_path/$domain/$list_name") || $list_name == "" )
|
||||||
{
|
{
|
||||||
|
$_SESSION["error_code"] = 12;
|
||||||
header("Location: error.php");
|
header("Location: error.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@@ -158,11 +160,18 @@ if ($moderators !== NULL)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add prefix to the respective file
|
||||||
if ($prefix !== NULL)
|
if ($prefix !== NULL)
|
||||||
{
|
{
|
||||||
file_put_contents("$lists_path/$domain/$list_name/control/prefix", "$prefix");
|
file_put_contents("$lists_path/$domain/$list_name/control/prefix", "$prefix");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add listdescription to the respective file
|
||||||
|
if ($listdescription !== NULL)
|
||||||
|
{
|
||||||
|
file_put_contents("$lists_path/$domain/$list_name/control/listdescription", "$listdescription");
|
||||||
|
}
|
||||||
|
|
||||||
# The following code section is for audit log only
|
# The following code section is for audit log only
|
||||||
|
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user