Bernd Wurst commited on 2021-02-04 10:35:02
Zeige 2 geänderte Dateien mit 22 Einfügungen und 11 Löschungen.
| ... | ... |
@@ -25,9 +25,9 @@ function get_lists($filter) |
| 25 | 25 |
$result = null; |
| 26 | 26 |
if ($filter) {
|
| 27 | 27 |
$filter = '%'.$filter.'%'; |
| 28 |
- $result = db_query("SELECT id, created, status, listname, fqdn, admin, archivesize, subscribers, lastactivity FROM mail.v_mailman_lists WHERE owner=:uid AND (listname LIKE :filter OR fqdn LIKE :filter OR admin LIKE :filter) ORDER BY listname", array('uid' => $uid, 'filter' => $filter));
|
|
| 28 |
+ $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE owner=:uid AND (listname LIKE :filter OR fqdn LIKE :filter OR admin LIKE :filter) ORDER BY listname", array('uid' => $uid, 'filter' => $filter));
|
|
| 29 | 29 |
} else {
|
| 30 |
- $result = db_query("SELECT id, created, status, listname, fqdn, admin, archivesize, subscribers, lastactivity FROM mail.v_mailman_lists WHERE owner=:uid ORDER BY listname", array('uid' => $uid));
|
|
| 30 |
+ $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE owner=:uid ORDER BY listname", array('uid' => $uid));
|
|
| 31 | 31 |
} |
| 32 | 32 |
$ret = array(); |
| 33 | 33 |
while ($list = $result->fetch()) {
|
| ... | ... |
@@ -42,7 +42,7 @@ function get_list($id) |
| 42 | 42 |
{
|
| 43 | 43 |
$args = array(":id" => $id,
|
| 44 | 44 |
":uid" => $_SESSION['userinfo']['uid']); |
| 45 |
- $result = db_query("SELECT id, created, status, listname, fqdn, admin, archivesize, subscribers, lastactivity FROM mail.v_mailman_lists WHERE owner=:uid AND id=:id", $args);
|
|
| 45 |
+ $result = db_query("SELECT id, created, status, listname, fqdn, urlhost, admin, archivesize, subscribers, lastactivity, backend FROM mail.v_mailman_lists WHERE owner=:uid AND id=:id", $args);
|
|
| 46 | 46 |
if ($result->rowCount() < 1) {
|
| 47 | 47 |
system_failure('Die gewünschte Mailingliste konnte nicht gefunden werden');
|
| 48 | 48 |
} |
| ... | ... |
@@ -77,6 +77,7 @@ function create_list($listname, $maildomain, $admin) |
| 77 | 77 |
if (! check_emailaddr($admin)) {
|
| 78 | 78 |
system_failure('Der Verwalter muss eine gültige E-Mail-Adresse sein ('.$admin.').');
|
| 79 | 79 |
} |
| 80 |
+ # FIXME: Zukünftig soll diese Beschränkung weg fallen! |
|
| 80 | 81 |
$result = db_query("SELECT id FROM mail.mailman_lists WHERE listname LIKE ?", array($listname));
|
| 81 | 82 |
if ($result->rowCount() > 0) {
|
| 82 | 83 |
system_failure('Eine Liste mit diesem Namen existiert bereits auf unserem Mailinglisten-Server (unter einer Ihrer Domains oder unter einer Domain eines anderen Kunden). Jeder Listenname kann auf dem gesamten Server nur einmal verwendet werden.');
|
| ... | ... |
@@ -95,7 +96,7 @@ function get_possible_mailmandomains() |
| 95 | 96 |
{
|
| 96 | 97 |
DEBUG('get_possible_mailmandomains()');
|
| 97 | 98 |
$uid = (int) $_SESSION['userinfo']['uid']; |
| 98 |
- $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS fqdn FROM kundendaten.domains AS d LEFT JOIN mail.mailman_domains AS m ON (m.domain=d.id) WHERE d.useraccount=:uid AND m.id IS NULL ORDER BY CONCAT_WS('.',d.domainname,d.tld)", array(":uid" => $uid));
|
|
| 99 |
+ $result = db_query("SELECT d.id, CONCAT_WS('.',d.domainname,d.tld) AS fqdn, m.backend AS backend FROM kundendaten.domains AS d LEFT JOIN mail.mailman_domains AS m ON (m.domain=d.id) WHERE d.useraccount=:uid AND m.id IS NULL ORDER BY CONCAT_WS('.',d.domainname,d.tld)", array(":uid" => $uid));
|
|
| 99 | 100 |
$ret = array(); |
| 100 | 101 |
while ($dom = $result->fetch()) {
|
| 101 | 102 |
$ret[] = $dom; |
| ... | ... |
@@ -105,9 +106,9 @@ function get_possible_mailmandomains() |
| 105 | 106 |
} |
| 106 | 107 |
|
| 107 | 108 |
|
| 108 |
-function insert_mailman_domain($subdomain, $domainid) |
|
| 109 |
+function insert_mailman_domain($subdomain, $domainid, $backend = 'mailman') |
|
| 109 | 110 |
{
|
| 110 |
- DEBUG("insert_mailman_domain($subdomain, $domainid)");
|
|
| 111 |
+ DEBUG("insert_mailman_domain($subdomain, $domainid, $backend)");
|
|
| 111 | 112 |
$possible = get_possible_mailmandomains(); |
| 112 | 113 |
$found = false; |
| 113 | 114 |
foreach ($possible as $dom) {
|
| ... | ... |
@@ -118,7 +119,7 @@ function insert_mailman_domain($subdomain, $domainid) |
| 118 | 119 |
if (! $found) {
|
| 119 | 120 |
system_failue('invalid domain id');
|
| 120 | 121 |
} |
| 121 |
- db_query("INSERT INTO mail.mailman_domains (hostname, domain) VALUES (:hostname, :domain)", array(":hostname" => $subdomain, ":domain" => $domainid));
|
|
| 122 |
+ db_query("INSERT INTO mail.mailman_domains (hostname, domain, backend) VALUES (:hostname, :domain, :backend)", array(":hostname" => $subdomain, ":domain" => $domainid, ":backend" => $backend));
|
|
| 122 | 123 |
return db_insert_id(); |
| 123 | 124 |
} |
| 124 | 125 |
|
| ... | ... |
@@ -150,7 +151,7 @@ function get_mailman_domains() |
| 150 | 151 |
{
|
| 151 | 152 |
DEBUG('get_mailman_domains()');
|
| 152 | 153 |
$uid = (int) $_SESSION['userinfo']['uid']; |
| 153 |
- $result = db_query("SELECT md.id, md.fqdn FROM mail.v_mailman_domains AS md left join mail.v_domains AS d on (d.id=md.domain) where d.user=?", array($uid));
|
|
| 154 |
+ $result = db_query("SELECT md.id, md.fqdn, md.is_webhost, md.backend FROM mail.v_mailman_domains AS md left join mail.v_domains AS d on (d.id=md.domain) where d.user=?", array($uid));
|
|
| 154 | 155 |
$ret = array(); |
| 155 | 156 |
while ($dom = $result->fetch()) {
|
| 156 | 157 |
$ret[] = $dom; |
| ... | ... |
@@ -80,11 +80,21 @@ if (! empty($lists)) {
|
| 80 | 80 |
output("<div class=\"mailman_list $class\"><p class=\"listname\"><span class=\"listname\">{$list['listname']}</span>@{$list['fqdn']}</p>
|
| 81 | 81 |
<p class=\"listadmin\">Verwalter: {$admin}</p><p class=\"status\">Status: {$status}<br/>Anzahl Mitglieder: {$list['subscribers']}<br/>Letzte Nutzung: {$lastactivity}</p><p class=\"archivesize\">Archivgröße: {$sizestr}</p>");
|
| 82 | 82 |
if ($list['status'] == 'running') {
|
| 83 |
- output("<p class=\"operations\">".internal_link('save', other_icon("lock.png", "Neues Passwort anfordern").' Neues Passwort anfordern', "action=newpw&id={$list['id']}")."<br>".internal_link('save', icon_delete("Mailingliste löschen").' Liste löschen', "action=delete&id={$list['id']}")."<br><a href=\"https://".config('mailman_host')."/mailman/admin.cgi/{$list['listname']}\">".other_icon("database_go.png", "Listen-Verwaltung aufrufen")." Verwaltung aufrufen</a></p></div>\n");
|
|
| 84 |
- } else {
|
|
| 85 |
- output("</div>\n");
|
|
| 83 |
+ if ($list['backend'] == 'mailman' || $list['backend'] === null) {
|
|
| 84 |
+ output("<p class=\"operations\">".
|
|
| 85 |
+ internal_link('save', other_icon("lock.png", "Neues Passwort anfordern").' Neues Passwort anfordern', "action=newpw&id={$list['id']}")."<br>".
|
|
| 86 |
+ internal_link('save', icon_delete("Mailingliste löschen").' Liste löschen', "action=delete&id={$list['id']}")."<br>".
|
|
| 87 |
+ "<a href=\"https://".config('mailman_host')."/mailman/admin.cgi/{$list['listname']}\">".other_icon("database_go.png", "Listen-Verwaltung aufrufen")." Verwaltung aufrufen</a>".
|
|
| 88 |
+ "</p>\n"); |
|
| 89 |
+ } elseif ($list['backend'] == 'mailman3') {
|
|
| 90 |
+ output("<p class=\"operations\">".
|
|
| 91 |
+ internal_link('save', icon_delete("Mailingliste löschen").' Liste löschen', "action=delete&id={$list['id']}")."<br>".
|
|
| 92 |
+ "<a href=\"https://".$list['urlhost']."/postorius/lists/{$list['listname']}.{$list['fqdn']}\">".other_icon("database_go.png", "Listen-Verwaltung aufrufen")." Verwaltung aufrufen</a>".
|
|
| 93 |
+ "</p>\n"); |
|
| 86 | 94 |
} |
| 87 | 95 |
} |
| 96 |
+ output("</div>\n");
|
|
| 97 |
+ } |
|
| 88 | 98 |
output("</div>");
|
| 89 | 99 |
} else {
|
| 90 | 100 |
// keine Listen |
| 91 | 101 |