f1f231f5e074dfa038e70a67d39849e80f2b4b4d
bernd Neues Modul: Kann greylisti...

bernd authored 16 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: Kann greylisti...

bernd authored 16 years ago

16) 
17) function whitelist_entries() 
18) {
19) 	$uid = (int) $_SESSION['userinfo']['uid'];
20) 	$res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid={$uid};");
21) 	$return = array();
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

22) 	while ($line = $res->fetch())
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

23) 		array_push($return, $line);
24) 	return $return;
25) }
26) 
27) 
28) function get_whitelist_details($id)
29) {
30) 	$id = (int) $id;
31) 	$uid = (int) $_SESSION['userinfo']['uid'];
32) 	$res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid={$uid} AND id={$id};");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

33) 	if ($res->rowCount() != 1)
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

34) 		system_failure('Kann diesen Eintrag nicht finden');
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

35) 	return $res->fetch();
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

36) }
37) 
38) 
39) function delete_from_whitelist($id)
40) {
41) 	$id = (int) $id;
42) 	// Check if the ID is valid: This will die if not.
43) 	$entry = get_whitelist_details($id);
44) 
45) 	db_query("DELETE FROM mail.greylisting_manual_whitelist WHERE id={$id} LIMIT 1;");
46) }
47) 
48) 
49) function valid_entry($local, $domain)
50) {
51) 	if ($domain == 'schokokeks.org')
52) 	{
53) 		if (($local != $_SESSION['userinfo']['username']) && 
54) 		    (strpos($local, $_SESSION['userinfo']['username'].'-') !== 0))
55) 			system_failure('Diese E-Mail-Adresse gehört Ihnen nicht!');
56) 		return true;
57) 	}
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

58) 	$d = db_escape_string($domain);
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

59) 	$res = db_query("SELECT id FROM mail.v_domains WHERE domainname='{$d}' AND user={$_SESSION['userinfo']['uid']} LIMIT 1");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

60) 	if ($res->rowCount() != 1)
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

61) 		system_failure('Diese domain gehört Ihnen nicht!');
62) 	return true;
63) }
64) 
65) 
66) function new_whitelist_entry($local, $domain, $minutes)
67) {
68) 	valid_entry($local, $domain);
69) 	$uid = (int) $_SESSION['userinfo']['uid'];
70) 	$local = maybe_null($local);
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

71) 	$domain = db_escape_string($domain);