Browse code

Codingstyle PSR12 + array syntax

Hanno Böck authored on 30/10/2021 21:18:17
Showing 1 changed files
... ...
@@ -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;
Browse code

Fix coding style with php-cs-checker, see https://cs.sensiolabs.org/

Hanno authored on 26/06/2018 13:58:19
Showing 1 changed files
... ...
@@ -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
-
Browse code

Copyright year update

Bernd Wurst authored on 13/01/2018 06:07:05
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2014 by schokokeks.org Hosting, namely
5
+Written 2008-2018 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Zeige Newsletter für zwei Jahre zurück

Bernd Wurst authored on 19/02/2016 05:00:42
Showing 1 changed files
... ...
@@ -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;
Browse code

Lizenzinfos in eigenes Modul ausgelagert und Copyright auf 2014 angepasst

Bernd Wurst authored on 08/02/2014 05:45:07
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2013 by schokokeks.org Hosting, namely
5
+Written 2008-2014 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

* Weitere Module auf prepared-statements umgestellt * Warnung beim Aufruf von db_escape_string() und maybe_null() hinzugefügt

Bernd Wurst authored on 03/02/2014 16:57:44
Showing 1 changed files
... ...
@@ -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;
Browse code

Umstellung auf PDO-Datenbankverbindung

Bernd Wurst authored on 01/02/2014 18:38:23
Showing 1 changed files
... ...
@@ -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
 }
Browse code

Updated copyright notice (2012 => 2013)

Bernd Wurst authored on 19/01/2013 10:49:50
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2012 by schokokeks.org Hosting, namely
5
+Written 2008-2013 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Added license tags for CC0, README and COPYING

Bernd Wurst authored on 11/03/2012 15:40:04
Showing 1 changed files
... ...
@@ -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'];
Browse code

Rudimentäres Newsletter-Archiv-Modul. Versand des Newsletters fehlt komplett.

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1964 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 30/03/2011 16:59:34
Showing 1 changed files
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
+