bd22f03937341179a1beaf87aafcde8e61882589
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 Updated copyright notice (2...

Bernd Wurst authored 11 years ago

5) Written 2008-2013 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 Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

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

bernd authored 15 years ago

26)   $ret = array();
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

27)   while ($list = mysql_fetch_assoc($result))
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) {
36)   $id = (int) $id;
37)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

38)   $result = db_query("SELECT id, status, listname, fqdn, admin, archivesize FROM mail.v_mailman_lists WHERE owner={$uid} AND id={$id};");
39)   if (mysql_num_rows($result) < 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 Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

41)   $list = mysql_fetch_assoc($result);
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) {
50)   $uid = (int) $_SESSION['userinfo']['uid'];
51)   $id = (int) $id;
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

52)   db_query("UPDATE mail.mailman_lists SET status='delete' WHERE owner={$uid} AND id={$id};");
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 Neues Modul für Mailman-Ver...

bernd authored 15 years ago

59)   $maildomain = maybe_null( (int) $maildomain );
60)   $owner = (int) $_SESSION['userinfo']['uid'];
bernd bei ungültigen Zeichen abbr...

bernd authored 14 years ago

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

bernd authored 15 years ago

62)   if (! check_emailaddr($admin))
63)     system_failure('Der Verwalter muss eine gültige E-Mail-Adresse sein ('.$admin.').');
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

64)   $admin = mysql_real_escape_string($admin);
65)   $result = db_query("SELECT id FROM mail.mailman_lists WHERE listname='{$listname}'");
66)   if (mysql_num_rows($result) > 0)
bernd Neues Modul für Mailman-Ver...

bernd authored 15 years ago

67)     system_failure('Eine Liste mit diesem Namen existiert bereits (unter dieser oder einer anderen Domain). Jeder Listenname kann nur einmal verwendet werden.');
68) 
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

69)   db_query("INSERT INTO mail.mailman_lists (status, listname, maildomain, owner, admin) VALUES ('pending', '{$listname}', {$maildomain}, {$owner}, '{$admin}');");
70)   DEBUG('Neue ID: '.mysql_insert_id());
bernd Neues Modul für Mailman-Ver...

bernd authored 15 years ago

71) }
72) 
73) 
74) function get_mailman_domains()
75) {
76)   $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

77)   $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={$uid}");
bernd Neues Modul für Mailman-Ver...

bernd authored 15 years ago

78)   $ret = array();
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

79)   while ($dom = mysql_fetch_assoc($result))