320b9969b5235af5b8728db59e4fe0a3bbd558d4
bernd Neues Modul für Mailman-Ver...

bernd authored 15 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 Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 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 15 years ago

16) 
17) require_once('inc/base.php');
18) require_once('inc/debug.php');
19) require_once('inc/security.php');
20) 
21) 
22) function get_lists()
23) {
24)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Sortiere die Übersicht der...

Bernd Wurst authored 6 years ago

25)   $result = db_query("SELECT id, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner=? ORDER BY listname", array($uid));
bernd Neues Modul für Mailman-Ver...

bernd authored 15 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 15 years ago

28)     $ret[] = $list;
29)   DEBUG($ret);
30)   return $ret;
31) }
32) 
33) 
34) function get_list($id)
35) {
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

36)   $args = array(":id" => $id,
37)                 ":uid" => $_SESSION['userinfo']['uid']);
38)   $result = db_query("SELECT id, 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

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

bernd authored 15 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 15 years ago

42)   DEBUG($list);
43) 
44)   return $list;
45) }
46) 
47) 
48) function delete_list($id)
49) {
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

50)   $args = array(":id" => $id,
51)                 ":uid" => $_SESSION['userinfo']['uid']);
52)   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 15 years ago

53) }
54) 
Bernd Wurst Ermögliche das Rücksetzen d...

Bernd Wurst authored 6 years ago

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

bernd authored 15 years ago

61) 
62) function create_list($listname, $maildomain, $admin)
63) {
bernd bei ungültigen Zeichen abbr...

bernd authored 14 years ago

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

bernd authored 14 years ago

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

Hanno Böck authored 9 years ago

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

bernd authored 15 years ago

68)   if (! check_emailaddr($admin))
69)     system_failure('Der Verwalter muss eine gültige E-Mail-Adresse sein ('.$admin.').');
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 7 years ago

72)     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 15 years ago

73) 
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

74)   $args = array(":listname" => $listname,
75)                 ":maildomain" => $maildomain,
76)                 ":owner" => $_SESSION['userinfo']['uid'],
77)                 ":admin" => $admin);
78) 
79)   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

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

bernd authored 15 years ago

81) }
82) 
83) 
84) function get_mailman_domains()
85) {
86)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

87)   $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 15 years ago

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

Bernd Wurst authored 10 years ago

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