cceb44f86d1abf27982910eb3682a087807ffe52
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

16) 
17) require_once('inc/base.php');
18) require_once('inc/debug.php');
19) require_once('inc/security.php');
20) 
21) 
Bernd Wurst Mailman-Interface

Bernd Wurst authored 5 years ago

22) function get_lists($filter)
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

23) {
24)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Mailman-Interface

Bernd Wurst authored 5 years ago

25)   $result = NULL;
26)   if ($filter) {
27)       $filter = '%'.$filter.'%';
28)       $result = db_query("SELECT id, created, status, listname, fqdn, admin, archivesize 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)   } else {
30)       $result = db_query("SELECT id, created, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner=:uid ORDER BY listname", array('uid' => $uid));
31)   }
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

32)   $ret = array();
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

33)   while ($list = $result->fetch())
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

34)     $ret[] = $list;
35)   DEBUG($ret);
36)   return $ret;
37) }
38) 
39) 
40) function get_list($id)
41) {
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

42)   $args = array(":id" => $id,
43)                 ":uid" => $_SESSION['userinfo']['uid']);
Bernd Wurst Mailman-Interface

Bernd Wurst authored 5 years ago

44)   $result = db_query("SELECT id, created, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner=:uid AND id=:id", $args);
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

45)   if ($result->rowCount() < 1)
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

46)     system_failure('Die gewünschte Mailingliste konnte nicht gefunden werden');
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

47)   $list = $result->fetch();
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

48)   DEBUG($list);
49) 
50)   return $list;
51) }
52) 
53) 
54) function delete_list($id)
55) {
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

56)   $args = array(":id" => $id,
57)                 ":uid" => $_SESSION['userinfo']['uid']);
58)   db_query("UPDATE mail.mailman_lists SET status='delete' WHERE owner=:uid AND id=:id", $args);
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

59) }
60) 
Bernd Wurst Ermögliche das Rücksetzen d...

Bernd Wurst authored 6 years ago

61) function request_new_password($id)
62) {
63)   $args = array(":id" => $id,
64)                 ":uid" => $_SESSION['userinfo']['uid']);
65)   db_query("UPDATE mail.mailman_lists SET status='newpw' WHERE owner=:uid AND id=:id", $args);
66) }
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

67) 
68) function create_list($listname, $maildomain, $admin)
69) {
Bernd Wurst Mailman-Interface

Bernd Wurst authored 5 years ago

70)     $listname = strtolower($listname);
bernd bei ungültigen Zeichen abbr...

bernd authored 14 years ago

71)   verify_input_username($listname);
bernd bei ungültigen Zeichen abbr...

bernd authored 14 years ago

72)   verify_input_general($admin);
Hanno Böck exclude administrative addr...

Hanno Böck authored 9 years ago

73)   if (in_array($listname, array("admin", "administrator", "webmaster", "hostmaster", "postmaster")))
74)     system_failure('Der Mailinglistenname '.$listname.' ist unzulässig.');
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

75)   if (! check_emailaddr($admin))
76)     system_failure('Der Verwalter muss eine gültige E-Mail-Adresse sein ('.$admin.').');
Bernd Wurst Mailman-Interface

Bernd Wurst authored 5 years ago

77)   $result = db_query("SELECT id FROM mail.mailman_lists WHERE listname LIKE ?", array($listname));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

78)   if ($result->rowCount() > 0)
Bernd Wurst Formulierung der Fehlermeld...

Bernd Wurst authored 7 years ago

79)     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.');
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

80) 
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

81)   $args = array(":listname" => $listname,
82)                 ":maildomain" => $maildomain,
83)                 ":owner" => $_SESSION['userinfo']['uid'],
84)                 ":admin" => $admin);
85) 
86)   db_query("INSERT INTO mail.mailman_lists (status, listname, maildomain, owner, admin) VALUES ('pending', :listname, :maildomain, :owner, :admin)", $args);
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

87)   DEBUG('Neue ID: '.db_insert_id());
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

88) }
89) 
90) 
91) function get_mailman_domains()
92) {
93)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

94)   $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));
bernd Neues Modul für Mailman-Ver...

bernd authored 14 years ago

95)   $ret = array();
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

96)   while ($dom = $result->fetch())