bd22f03937341179a1beaf87aafcde8e61882589
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'];
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

20) 	$res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid={$uid};");
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

21) 	$return = array();
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

22) 	while ($line = mysql_fetch_assoc($res))
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'];
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

32) 	$res = db_query("SELECT id,local,domain,date,expire FROM mail.greylisting_manual_whitelist WHERE uid={$uid} AND id={$id};");
33) 	if (mysql_num_rows($res) != 1)
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

34) 		system_failure('Kann diesen Eintrag nicht finden');
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

35) 	return mysql_fetch_assoc($res);
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) 
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

45) 	db_query("DELETE FROM mail.greylisting_manual_whitelist WHERE id={$id} LIMIT 1;");
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

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 Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

58) 	$d = mysql_real_escape_string($domain);
59) 	$res = db_query("SELECT id FROM mail.v_domains WHERE domainname='{$d}' AND user={$_SESSION['userinfo']['uid']} LIMIT 1");
60) 	if (mysql_num_rows($res) != 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 Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

71) 	$domain = mysql_real_escape_string($domain);
bernd Neues Modul: Kann greylisti...

bernd authored 16 years ago

72) 	
73) 	$expire = '';
74) 	if ($minutes == 'none')
75) 		$expire = 'NULL';
76) 	else
77) 		$expire = "NOW() + INTERVAL ". (int) $minutes ." MINUTE";
Bernd Wurst Revert "Umstellung auf mysqli"

Bernd Wurst authored 10 years ago

78) 	db_query("INSERT INTO mail.greylisting_manual_whitelist (local,domain,date,expire,uid) VALUES ".