forked from services/mlmmj-light-web-ecg
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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
|
||||
- Authentication via LDAP
|
||||
- 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
|
||||
- Edit functions per mailing list: subscribers, moderators, prefix and listdescription
|
||||
|
||||
### For admins
|
||||
- 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
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ if ( strlen($list_name) > 30 )
|
||||
}
|
||||
|
||||
// Test list existence
|
||||
if( !is_dir("$lists_path/$domain/$list_name") )
|
||||
if( !is_dir("$lists_path/$domain/$list_name") || $list_name == "" )
|
||||
{
|
||||
header("Location: error.php");
|
||||
exit();
|
||||
|
||||
38
index.php
38
index.php
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
# Scan loading time
|
||||
$time_start = microtime(true);
|
||||
|
||||
require("init.php");
|
||||
|
||||
if (!isset($_SESSION["auth"]) || $_SESSION["auth"] != 1)
|
||||
@@ -27,16 +30,40 @@ if (isset($lists))
|
||||
}
|
||||
|
||||
$lists_new = [];
|
||||
|
||||
# Iterate through all lists
|
||||
foreach($lists as $list)
|
||||
{
|
||||
# If list is in array of owned lists
|
||||
if (!in_array($list, $_SESSION["array_lists_owned"]))
|
||||
{
|
||||
$lists_new[$list] = 0;
|
||||
$lists_new[$list]["iamowner"] = 0;
|
||||
}
|
||||
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
|
||||
@@ -44,11 +71,18 @@ else
|
||||
$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("web_url", $web_url);
|
||||
$smarty->assign("lists", $lists_new);
|
||||
$smarty->assign("domain", $domain);
|
||||
$smarty->assign("username", $_SESSION["username"]);
|
||||
$smarty->assign("loadingtime", $loadingtime);
|
||||
$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 = "";
|
||||
|
||||
# No need to change this values
|
||||
$current_version = "v1.1";
|
||||
$current_version = "v1.2";
|
||||
$headline = "Manage your ECG mailing lists " . $current_version;
|
||||
$debug = false;
|
||||
|
||||
|
||||
@@ -58,13 +58,19 @@
|
||||
</tr>
|
||||
|
||||
{foreach $lists as $list}
|
||||
{if $list == 1}
|
||||
{if $list.iamowner == 1}
|
||||
<tr>
|
||||
<td>
|
||||
✓
|
||||
</td>
|
||||
<td>
|
||||
<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>
|
||||
</tr>
|
||||
{/if}
|
||||
@@ -94,18 +100,26 @@
|
||||
</tr>
|
||||
|
||||
{foreach $lists as $list}
|
||||
{if $list == 0}
|
||||
{if $list.iamowner == 0}
|
||||
<tr>
|
||||
<td>
|
||||
✗
|
||||
</td>
|
||||
<td>
|
||||
{$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>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</table>
|
||||
<br />
|
||||
<span>Loading time: {$loadingtime} seconds</span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,6 +19,7 @@ function trim_array($arr)
|
||||
|
||||
$list_name = isset( $_POST["list_name"] ) ? $_POST["list_name"] : NULL;
|
||||
$prefix = isset ( $_POST["prefix"] ) ? $_POST["prefix"] : NULL;
|
||||
$listdescription = isset ( $_POST["listdescription"] ) ? $_POST["listdescription"] : NULL;
|
||||
$new_subscribers = isset ( $_POST["subscribers"] ) ? $_POST["subscribers"] : NULL;
|
||||
$moderators = isset ( $_POST["moderators"] ) ? $_POST["moderators"] : NULL;
|
||||
|
||||
@@ -46,7 +47,7 @@ if ( strlen($list_name) > 30 )
|
||||
}
|
||||
|
||||
// Test list existence
|
||||
if( !is_dir("$lists_path/$domain/$list_name") )
|
||||
if( !is_dir("$lists_path/$domain/$list_name") || $list_name == "" )
|
||||
{
|
||||
header("Location: error.php");
|
||||
exit();
|
||||
@@ -158,11 +159,18 @@ if ($moderators !== NULL)
|
||||
}
|
||||
}
|
||||
|
||||
# Add prefix to the respective file
|
||||
if ($prefix !== NULL)
|
||||
{
|
||||
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
|
||||
|
||||
# -------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user