5effc2bd7685822df276c1372dab480cff321941
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 Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

25)   $result = db_query("SELECT id, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner=?", 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) 
55) 
56) function create_list($listname, $maildomain, $admin)
57) {
bernd bei ungültigen Zeichen abbr...

bernd authored 14 years ago

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

bernd authored 14 years ago

59)   verify_input_general($admin);
bernd Neues Modul für Mailman-Ver...

bernd authored 15 years ago

60)   if (! check_emailaddr($admin))
61)     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

62)   $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

63)   if ($result->rowCount() > 0)
bernd Neues Modul für Mailman-Ver...

bernd authored 15 years ago

64)     system_failure('Eine Liste mit diesem Namen existiert bereits (unter dieser oder einer anderen Domain). Jeder Listenname kann nur einmal verwendet werden.');
65) 
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

66)   $args = array(":listname" => $listname,
67)                 ":maildomain" => $maildomain,
68)                 ":owner" => $_SESSION['userinfo']['uid'],
69)                 ":admin" => $admin);
70) 
71)   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

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

bernd authored 15 years ago

73) }
74) 
75) 
76) function get_mailman_domains()
77) {
78)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Weitere Umstellungen auf pr...

Bernd Wurst authored 10 years ago

79)   $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

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

Bernd Wurst authored 10 years ago

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