... | ... |
@@ -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 |
*/ |
... | ... |
@@ -17,13 +17,13 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r |
17 | 17 |
function set_newsletter_address($address) |
18 | 18 |
{ |
19 | 19 |
$cid = $_SESSION['customerinfo']['customerno']; |
20 |
- db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", array(":address" => $address, ":cid" => $cid)); |
|
20 |
+ db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", [":address" => $address, ":cid" => $cid]); |
|
21 | 21 |
} |
22 | 22 |
|
23 | 23 |
function get_newsletter_address() |
24 | 24 |
{ |
25 | 25 |
$cid = $_SESSION['customerinfo']['customerno']; |
26 |
- $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", array($cid)); |
|
26 |
+ $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", [$cid]); |
|
27 | 27 |
$r = $result->fetch(); |
28 | 28 |
return $r['email_newsletter']; |
29 | 29 |
} |
... | ... |
@@ -32,7 +32,7 @@ function get_newsletter_address() |
32 | 32 |
function get_latest_news() |
33 | 33 |
{ |
34 | 34 |
$result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 2 YEAR ORDER BY date DESC"); |
35 |
- $ret = array(); |
|
35 |
+ $ret = []; |
|
36 | 36 |
while ($item = $result->fetch()) { |
37 | 37 |
$ret[] = $item; |
38 | 38 |
} |
... | ... |
@@ -44,7 +44,7 @@ function get_latest_news() |
44 | 44 |
function get_news_item($id) |
45 | 45 |
{ |
46 | 46 |
$id = (int) $id; |
47 |
- $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", array($id)); |
|
47 |
+ $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", [$id]); |
|
48 | 48 |
$ret = $result->fetch(); |
49 | 49 |
DEBUG($ret); |
50 | 50 |
return $ret; |
... | ... |
@@ -8,42 +8,44 @@ 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 |
-function set_newsletter_address($address) { |
|
18 |
- $cid = $_SESSION['customerinfo']['customerno']; |
|
19 |
- db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", array(":address" => $address, ":cid" => $cid)); |
|
17 |
+function set_newsletter_address($address) |
|
18 |
+{ |
|
19 |
+ $cid = $_SESSION['customerinfo']['customerno']; |
|
20 |
+ db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", array(":address" => $address, ":cid" => $cid)); |
|
20 | 21 |
} |
21 | 22 |
|
22 |
-function get_newsletter_address() { |
|
23 |
- $cid = $_SESSION['customerinfo']['customerno']; |
|
24 |
- $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", array($cid)); |
|
25 |
- $r = $result->fetch(); |
|
26 |
- return $r['email_newsletter']; |
|
23 |
+function get_newsletter_address() |
|
24 |
+{ |
|
25 |
+ $cid = $_SESSION['customerinfo']['customerno']; |
|
26 |
+ $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", array($cid)); |
|
27 |
+ $r = $result->fetch(); |
|
28 |
+ return $r['email_newsletter']; |
|
27 | 29 |
} |
28 | 30 |
|
29 | 31 |
|
30 |
-function get_latest_news() { |
|
31 |
- $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 2 YEAR ORDER BY date DESC"); |
|
32 |
- $ret = array(); |
|
33 |
- while ($item = $result->fetch()) { |
|
34 |
- $ret[] = $item; |
|
35 |
- } |
|
36 |
- DEBUG($ret); |
|
37 |
- return $ret; |
|
32 |
+function get_latest_news() |
|
33 |
+{ |
|
34 |
+ $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 2 YEAR ORDER BY date DESC"); |
|
35 |
+ $ret = array(); |
|
36 |
+ while ($item = $result->fetch()) { |
|
37 |
+ $ret[] = $item; |
|
38 |
+ } |
|
39 |
+ DEBUG($ret); |
|
40 |
+ return $ret; |
|
38 | 41 |
} |
39 | 42 |
|
40 | 43 |
|
41 |
-function get_news_item($id) { |
|
42 |
- $id = (int) $id; |
|
43 |
- $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", array($id)); |
|
44 |
- $ret = $result->fetch(); |
|
45 |
- DEBUG($ret); |
|
46 |
- return $ret; |
|
44 |
+function get_news_item($id) |
|
45 |
+{ |
|
46 |
+ $id = (int) $id; |
|
47 |
+ $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", array($id)); |
|
48 |
+ $ret = $result->fetch(); |
|
49 |
+ DEBUG($ret); |
|
50 |
+ return $ret; |
|
47 | 51 |
} |
48 |
- |
|
49 |
- |
... | ... |
@@ -28,7 +28,7 @@ function get_newsletter_address() { |
28 | 28 |
|
29 | 29 |
|
30 | 30 |
function get_latest_news() { |
31 |
- $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 1 YEAR ORDER BY date DESC"); |
|
31 |
+ $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 2 YEAR ORDER BY date DESC"); |
|
32 | 32 |
$ret = array(); |
33 | 33 |
while ($item = $result->fetch()) { |
34 | 34 |
$ret[] = $item; |
... | ... |
@@ -16,21 +16,19 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r |
16 | 16 |
|
17 | 17 |
function set_newsletter_address($address) { |
18 | 18 |
$cid = $_SESSION['customerinfo']['customerno']; |
19 |
- $address = maybe_null(db_escape_string($address)); |
|
20 |
- db_query("UPDATE kundendaten.kunden SET email_newsletter={$address} WHERE id={$cid}"); |
|
19 |
+ db_query("UPDATE kundendaten.kunden SET email_newsletter=:address WHERE id=:cid", array(":address" => $address, ":cid" => $cid)); |
|
21 | 20 |
} |
22 | 21 |
|
23 | 22 |
function get_newsletter_address() { |
24 | 23 |
$cid = $_SESSION['customerinfo']['customerno']; |
25 |
- $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id={$cid}"); |
|
24 |
+ $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id=?", array($cid)); |
|
26 | 25 |
$r = $result->fetch(); |
27 | 26 |
return $r['email_newsletter']; |
28 | 27 |
} |
29 | 28 |
|
30 | 29 |
|
31 | 30 |
function get_latest_news() { |
32 |
- $today = strftime('%Y-%m-%d'); |
|
33 |
- $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > '{$today}' - INTERVAL 1 YEAR ORDER BY date DESC"); |
|
31 |
+ $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > CURDATE() - INTERVAL 1 YEAR ORDER BY date DESC"); |
|
34 | 32 |
$ret = array(); |
35 | 33 |
while ($item = $result->fetch()) { |
36 | 34 |
$ret[] = $item; |
... | ... |
@@ -42,7 +40,7 @@ function get_latest_news() { |
42 | 40 |
|
43 | 41 |
function get_news_item($id) { |
44 | 42 |
$id = (int) $id; |
45 |
- $result = db_query("SELECT date, subject, content FROM misc.news WHERE id={$id}"); |
|
43 |
+ $result = db_query("SELECT date, subject, content FROM misc.news WHERE id=?", array($id)); |
|
46 | 44 |
$ret = $result->fetch(); |
47 | 45 |
DEBUG($ret); |
48 | 46 |
return $ret; |
... | ... |
@@ -16,14 +16,14 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r |
16 | 16 |
|
17 | 17 |
function set_newsletter_address($address) { |
18 | 18 |
$cid = $_SESSION['customerinfo']['customerno']; |
19 |
- $address = maybe_null(mysql_real_escape_string($address)); |
|
19 |
+ $address = maybe_null(db_escape_string($address)); |
|
20 | 20 |
db_query("UPDATE kundendaten.kunden SET email_newsletter={$address} WHERE id={$cid}"); |
21 | 21 |
} |
22 | 22 |
|
23 | 23 |
function get_newsletter_address() { |
24 | 24 |
$cid = $_SESSION['customerinfo']['customerno']; |
25 | 25 |
$result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id={$cid}"); |
26 |
- $r = mysql_fetch_assoc($result); |
|
26 |
+ $r = $result->fetch(); |
|
27 | 27 |
return $r['email_newsletter']; |
28 | 28 |
} |
29 | 29 |
|
... | ... |
@@ -32,7 +32,7 @@ function get_latest_news() { |
32 | 32 |
$today = strftime('%Y-%m-%d'); |
33 | 33 |
$result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > '{$today}' - INTERVAL 1 YEAR ORDER BY date DESC"); |
34 | 34 |
$ret = array(); |
35 |
- while ($item = mysql_fetch_assoc($result)) { |
|
35 |
+ while ($item = $result->fetch()) { |
|
36 | 36 |
$ret[] = $item; |
37 | 37 |
} |
38 | 38 |
DEBUG($ret); |
... | ... |
@@ -43,7 +43,7 @@ function get_latest_news() { |
43 | 43 |
function get_news_item($id) { |
44 | 44 |
$id = (int) $id; |
45 | 45 |
$result = db_query("SELECT date, subject, content FROM misc.news WHERE id={$id}"); |
46 |
- $ret = mysql_fetch_assoc($result); |
|
46 |
+ $ret = $result->fetch(); |
|
47 | 47 |
DEBUG($ret); |
48 | 48 |
return $ret; |
49 | 49 |
} |
... | ... |
@@ -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 |
function set_newsletter_address($address) { |
4 | 18 |
$cid = $_SESSION['customerinfo']['customerno']; |
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1964 87cf0b9e-d624-0410-a070-f6ee81989793
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,37 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+function set_newsletter_address($address) { |
|
4 |
+ $cid = $_SESSION['customerinfo']['customerno']; |
|
5 |
+ $address = maybe_null(mysql_real_escape_string($address)); |
|
6 |
+ db_query("UPDATE kundendaten.kunden SET email_newsletter={$address} WHERE id={$cid}"); |
|
7 |
+} |
|
8 |
+ |
|
9 |
+function get_newsletter_address() { |
|
10 |
+ $cid = $_SESSION['customerinfo']['customerno']; |
|
11 |
+ $result = db_query("SELECT email_newsletter FROM kundendaten.kunden WHERE id={$cid}"); |
|
12 |
+ $r = mysql_fetch_assoc($result); |
|
13 |
+ return $r['email_newsletter']; |
|
14 |
+} |
|
15 |
+ |
|
16 |
+ |
|
17 |
+function get_latest_news() { |
|
18 |
+ $today = strftime('%Y-%m-%d'); |
|
19 |
+ $result = db_query("SELECT id, date, subject, content FROM misc.news WHERE date > '{$today}' - INTERVAL 1 YEAR ORDER BY date DESC"); |
|
20 |
+ $ret = array(); |
|
21 |
+ while ($item = mysql_fetch_assoc($result)) { |
|
22 |
+ $ret[] = $item; |
|
23 |
+ } |
|
24 |
+ DEBUG($ret); |
|
25 |
+ return $ret; |
|
26 |
+} |
|
27 |
+ |
|
28 |
+ |
|
29 |
+function get_news_item($id) { |
|
30 |
+ $id = (int) $id; |
|
31 |
+ $result = db_query("SELECT date, subject, content FROM misc.news WHERE id={$id}"); |
|
32 |
+ $ret = mysql_fetch_assoc($result); |
|
33 |
+ DEBUG($ret); |
|
34 |
+ return $ret; |
|
35 |
+} |
|
36 |
+ |
|
37 |
+ |