... | ... |
@@ -2,14 +2,11 @@ |
2 | 2 |
/* |
3 | 3 |
This file belongs to the Webinterface of schokokeks.org Hosting |
4 | 4 |
|
5 |
-Written 2008-2018 by schokokeks.org Hosting, namely |
|
5 |
+Written by schokokeks.org Hosting, namely |
|
6 | 6 |
Bernd Wurst <bernd@schokokeks.org> |
7 | 7 |
Hanno Böck <hanno@schokokeks.org> |
8 | 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/ |
|
9 |
+This code is published under a 0BSD license. |
|
13 | 10 |
|
14 | 11 |
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 | 12 |
*/ |
... | ... |
@@ -22,7 +22,7 @@ if (! function_exists("user_has_vmail_domain")) { |
22 | 22 |
return false; |
23 | 23 |
} |
24 | 24 |
$uid = (int) $_SESSION['userinfo']['uid']; |
25 |
- $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", array($uid)); |
|
25 |
+ $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", [$uid]); |
|
26 | 26 |
$row = $result->fetch(); |
27 | 27 |
$count = $row[0]; |
28 | 28 |
DEBUG("User has {$count} vmail-domains"); |
... | ... |
@@ -39,7 +39,7 @@ if (! function_exists("user_has_dotcourier_domain")) { |
39 | 39 |
} |
40 | 40 |
$uid = (int) $_SESSION['userinfo']['uid']; |
41 | 41 |
$result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid UNION ". |
42 |
- "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.mail != 'none' AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid)); |
|
42 |
+ "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.mail != 'none' AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", [":uid" => $uid]); |
|
43 | 43 |
$ret = ($result->rowCount() > 0); |
44 | 44 |
if ($ret) { |
45 | 45 |
DEBUG("User {$uid} has dotcourier-domains"); |
... | ... |
@@ -39,7 +39,7 @@ if (! function_exists("user_has_dotcourier_domain")) { |
39 | 39 |
} |
40 | 40 |
$uid = (int) $_SESSION['userinfo']['uid']; |
41 | 41 |
$result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid UNION ". |
42 |
- "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid)); |
|
42 |
+ "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.mail != 'none' AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid)); |
|
43 | 43 |
$ret = ($result->rowCount() > 0); |
44 | 44 |
if ($ret) { |
45 | 45 |
DEBUG("User {$uid} has dotcourier-domains"); |
... | ... |
@@ -8,45 +8,42 @@ Written 2008-2018 by schokokeks.org Hosting, namely |
8 | 8 |
|
9 | 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 | 10 |
|
11 |
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see |
|
11 |
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see |
|
12 | 12 |
http://creativecommons.org/publicdomain/zero/1.0/ |
13 | 13 |
|
14 | 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 | 15 |
*/ |
16 | 16 |
|
17 |
-if (! function_exists("user_has_vmail_domain")) |
|
18 |
-{ |
|
19 |
- function user_has_vmail_domain() |
|
20 |
- { |
|
21 |
- $role = $_SESSION['role']; |
|
22 |
- if (! ($role & ROLE_SYSTEMUSER)) { |
|
23 |
- return false; |
|
24 |
- } |
|
25 |
- $uid = (int) $_SESSION['userinfo']['uid']; |
|
26 |
- $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", array($uid)); |
|
27 |
- $row = $result->fetch(); |
|
28 |
- $count = $row[0]; |
|
29 |
- DEBUG("User has {$count} vmail-domains"); |
|
30 |
- return ( (int) $count > 0 ); |
|
31 |
- } |
|
17 |
+if (! function_exists("user_has_vmail_domain")) { |
|
18 |
+ function user_has_vmail_domain() |
|
19 |
+ { |
|
20 |
+ $role = $_SESSION['role']; |
|
21 |
+ if (! ($role & ROLE_SYSTEMUSER)) { |
|
22 |
+ return false; |
|
23 |
+ } |
|
24 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
25 |
+ $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", array($uid)); |
|
26 |
+ $row = $result->fetch(); |
|
27 |
+ $count = $row[0]; |
|
28 |
+ DEBUG("User has {$count} vmail-domains"); |
|
29 |
+ return ((int) $count > 0); |
|
30 |
+ } |
|
32 | 31 |
} |
33 | 32 |
|
34 |
-if (! function_exists("user_has_dotcourier_domain")) |
|
35 |
-{ |
|
36 |
- function user_has_dotcourier_domain() |
|
37 |
- { |
|
38 |
- $role = $_SESSION['role']; |
|
39 |
- if (! ($role & ROLE_SYSTEMUSER)) { |
|
40 |
- return false; |
|
41 |
- } |
|
42 |
- $uid = (int) $_SESSION['userinfo']['uid']; |
|
43 |
- $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid UNION ". |
|
33 |
+if (! function_exists("user_has_dotcourier_domain")) { |
|
34 |
+ function user_has_dotcourier_domain() |
|
35 |
+ { |
|
36 |
+ $role = $_SESSION['role']; |
|
37 |
+ if (! ($role & ROLE_SYSTEMUSER)) { |
|
38 |
+ return false; |
|
39 |
+ } |
|
40 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
41 |
+ $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid UNION ". |
|
44 | 42 |
"SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid)); |
45 |
- $ret = ($result->rowCount() > 0); |
|
46 |
- if ($ret) |
|
47 |
- DEBUG("User {$uid} has dotcourier-domains"); |
|
48 |
- return $ret; |
|
49 |
- } |
|
43 |
+ $ret = ($result->rowCount() > 0); |
|
44 |
+ if ($ret) { |
|
45 |
+ DEBUG("User {$uid} has dotcourier-domains"); |
|
46 |
+ } |
|
47 |
+ return $ret; |
|
48 |
+ } |
|
50 | 49 |
} |
51 |
- |
|
52 |
-?> |
... | ... |
@@ -40,7 +40,7 @@ if (! function_exists("user_has_dotcourier_domain")) |
40 | 40 |
return false; |
41 | 41 |
} |
42 | 42 |
$uid = (int) $_SESSION['userinfo']['uid']; |
43 |
- $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid}UNION ". |
|
43 |
+ $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid UNION ". |
|
44 | 44 |
"SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid)); |
45 | 45 |
$ret = ($result->rowCount() > 0); |
46 | 46 |
if ($ret) |
... | ... |
@@ -23,7 +23,7 @@ if (! function_exists("user_has_vmail_domain")) |
23 | 23 |
return false; |
24 | 24 |
} |
25 | 25 |
$uid = (int) $_SESSION['userinfo']['uid']; |
26 |
- $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount='{$uid}'"); |
|
26 |
+ $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount=?", array($uid)); |
|
27 | 27 |
$row = $result->fetch(); |
28 | 28 |
$count = $row[0]; |
29 | 29 |
DEBUG("User has {$count} vmail-domains"); |
... | ... |
@@ -40,8 +40,8 @@ if (! function_exists("user_has_dotcourier_domain")) |
40 | 40 |
return false; |
41 | 41 |
} |
42 | 42 |
$uid = (int) $_SESSION['userinfo']['uid']; |
43 |
- $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user={$uid} or c.uid={$uid} UNION ". |
|
44 |
- "SELECT 1 FROM mail.v_domains AS d WHERE d.user={$uid} AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains);"); |
|
43 |
+ $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user=:uid or c.uid=:uid}UNION ". |
|
44 |
+ "SELECT 1 FROM mail.v_domains AS d WHERE d.user=:uid AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains)", array(":uid" => $uid)); |
|
45 | 45 |
$ret = ($result->rowCount() > 0); |
46 | 46 |
if ($ret) |
47 | 47 |
DEBUG("User {$uid} has dotcourier-domains"); |
... | ... |
@@ -24,7 +24,7 @@ if (! function_exists("user_has_vmail_domain")) |
24 | 24 |
} |
25 | 25 |
$uid = (int) $_SESSION['userinfo']['uid']; |
26 | 26 |
$result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount='{$uid}'"); |
27 |
- $row = mysql_fetch_array($result); |
|
27 |
+ $row = $result->fetch(); |
|
28 | 28 |
$count = $row[0]; |
29 | 29 |
DEBUG("User has {$count} vmail-domains"); |
30 | 30 |
return ( (int) $count > 0 ); |
... | ... |
@@ -42,7 +42,7 @@ if (! function_exists("user_has_dotcourier_domain")) |
42 | 42 |
$uid = (int) $_SESSION['userinfo']['uid']; |
43 | 43 |
$result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user={$uid} or c.uid={$uid} UNION ". |
44 | 44 |
"SELECT 1 FROM mail.v_domains AS d WHERE d.user={$uid} AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains);"); |
45 |
- $ret = (mysql_num_rows($result) > 0); |
|
45 |
+ $ret = ($result->rowCount() > 0); |
|
46 | 46 |
if ($ret) |
47 | 47 |
DEBUG("User {$uid} has dotcourier-domains"); |
48 | 48 |
return $ret; |
... | ... |
@@ -1,4 +1,18 @@ |
1 | 1 |
<?php |
2 |
+/* |
|
3 |
+This file belongs to the Webinterface of schokokeks.org Hosting |
|
4 |
+ |
|
5 |
+Written 2008-2012 by schokokeks.org Hosting, namely |
|
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 |
+*/ |
|
2 | 16 |
|
3 | 17 |
if (! function_exists("user_has_vmail_domain")) |
4 | 18 |
{ |
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1693 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -17,4 +17,22 @@ if (! function_exists("user_has_vmail_domain")) |
17 | 17 |
} |
18 | 18 |
} |
19 | 19 |
|
20 |
+if (! function_exists("user_has_dotcourier_domain")) |
|
21 |
+{ |
|
22 |
+ function user_has_dotcourier_domain() |
|
23 |
+ { |
|
24 |
+ $role = $_SESSION['role']; |
|
25 |
+ if (! ($role & ROLE_SYSTEMUSER)) { |
|
26 |
+ return false; |
|
27 |
+ } |
|
28 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
29 |
+ $result = db_query("select 1 from mail.custom_mappings as c left join mail.v_domains as d on (d.id=c.domain) where d.user={$uid} or c.uid={$uid} UNION ". |
|
30 |
+ "SELECT 1 FROM mail.v_domains AS d WHERE d.user={$uid} AND d.id != ALL(SELECT domain FROM mail.virtual_mail_domains);"); |
|
31 |
+ $ret = (mysql_num_rows($result) > 0); |
|
32 |
+ if ($ret) |
|
33 |
+ DEBUG("User {$uid} has dotcourier-domains"); |
|
34 |
+ return $ret; |
|
35 |
+ } |
|
36 |
+} |
|
37 |
+ |
|
20 | 38 |
?> |
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1012 87cf0b9e-d624-0410-a070-f6ee81989793
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+if (! function_exists("user_has_vmail_domain")) |
|
4 |
+{ |
|
5 |
+ function user_has_vmail_domain() |
|
6 |
+ { |
|
7 |
+ $role = $_SESSION['role']; |
|
8 |
+ if (! ($role & ROLE_SYSTEMUSER)) { |
|
9 |
+ return false; |
|
10 |
+ } |
|
11 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
12 |
+ $result = db_query("SELECT COUNT(*) FROM mail.v_vmail_domains WHERE useraccount='{$uid}'"); |
|
13 |
+ $row = mysql_fetch_array($result); |
|
14 |
+ $count = $row[0]; |
|
15 |
+ DEBUG("User has {$count} vmail-domains"); |
|
16 |
+ return ( (int) $count > 0 ); |
|
17 |
+ } |
|
18 |
+} |
|
19 |
+ |
|
20 |
+?> |