Browse code

Umstellung von filter_input_general() auf filter_output_html()

Bernd Wurst authored on21/09/2019 17:07:48
Showing1 changed files
... ...
@@ -37,12 +37,12 @@ function contract_html()
37 37
 
38 38
     $kundenkontakte = get_kundenkontakte();
39 39
     $kunde = get_contact($kundenkontakte['kunde']);
40
-    $adresse = nl2br("\n".filter_input_general($kunde['address'])."\n".filter_input_general($kunde['country']).'-'.filter_input_general($kunde['zip']).' '.filter_input_general($kunde['city']));
41
-    $name = filter_input_general($kunde['name']);
40
+    $adresse = nl2br("\n".filter_output_html($kunde['address']."\n".$kunde['country'].'-'.$kunde['zip'].' '.$kunde['city']));
41
+    $name = filter_output_html($kunde['name']);
42 42
     if ($kunde['company']) {
43
-        $name = filter_input_general($kunde['company'])."<br />".filter_input_general($kunde['name']);
43
+        $name = filter_output_html($kunde['company'])."<br />".filter_output_html($kunde['name']);
44 44
     }
45
-    $email = filter_input_general($kunde['email']);
45
+    $email = filter_output_html($kunde['email']);
46 46
     $address = "<strong>$name</strong>$adresse</p><p>E-Mail-Adresse: $email";
47 47
 
48 48
     $date = date('d.m.Y');
Browse code

remove whitespace in empty lines

Hanno authored on26/06/2018 23:36:40
Showing1 changed files
... ...
@@ -34,7 +34,7 @@ function contract_html()
34 34
 {
35 35
     use_module('contacts');
36 36
     require_once('contacts.php');
37
-    
37
+
38 38
     $kundenkontakte = get_kundenkontakte();
39 39
     $kunde = get_contact($kundenkontakte['kunde']);
40 40
     $adresse = nl2br("\n".filter_input_general($kunde['address'])."\n".filter_input_general($kunde['country']).'-'.filter_input_general($kunde['zip']).' '.filter_input_general($kunde['city']));
... ...
@@ -44,7 +44,7 @@ function contract_html()
44 44
     }
45 45
     $email = filter_input_general($kunde['email']);
46 46
     $address = "<strong>$name</strong>$adresse</p><p>E-Mail-Adresse: $email";
47
- 
47
+
48 48
     $date = date('d.m.Y');
49 49
 
50 50
     $DIR=realpath(dirname(__FILE__).'/..');
Browse code

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

Hanno authored on26/06/2018 13:58:19
Showing1 changed files
... ...
@@ -8,7 +8,7 @@ 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.
... ...
@@ -17,19 +17,21 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 require_role(ROLE_CUSTOMER);
18 18
 
19 19
 
20
-function get_orderprocessing_contract() {
20
+function get_orderprocessing_contract()
21
+{
21 22
     $args = array(
22 23
         "cid" => (int) $_SESSION['customerinfo']['customerno']);
23 24
     $result = db_query("SELECT id, signed, type, startdate, enddate FROM kundendaten.contract WHERE customer=:cid AND type='orderprocessing' AND (enddate IS NULL OR enddate < CURDATE())", $args);
24 25
     if ($result->rowCount() == 0) {
25
-        return NULL;
26
+        return null;
26 27
     }
27 28
     $line = $result->fetch();
28 29
     return $line;
29 30
 }
30 31
 
31 32
 
32
-function contract_html() {
33
+function contract_html()
34
+{
33 35
     use_module('contacts');
34 36
     require_once('contacts.php');
35 37
     
... ...
@@ -58,21 +60,22 @@ function contract_html() {
58 60
 }
59 61
 
60 62
 
61
-function save_op_contract($pdfdata) {
63
+function save_op_contract($pdfdata)
64
+{
62 65
     $args = array("cid" => $_SESSION['customerinfo']['customerno'],
63 66
             "pdfdata" => $pdfdata);
64
-    db_query("INSERT INTO kundendaten.contract (customer, signed, type, startdate, pdfdata) VALUES (:cid, NOW(), 'orderprocessing', CURDATE(), :pdfdata)",
65
-        $args);
67
+    db_query(
68
+        "INSERT INTO kundendaten.contract (customer, signed, type, startdate, pdfdata) VALUES (:cid, NOW(), 'orderprocessing', CURDATE(), :pdfdata)",
69
+        $args
70
+    );
66 71
 }
67 72
 
68 73
 
69
-function get_contract_pdf($id) {
74
+function get_contract_pdf($id)
75
+{
70 76
     $args = array("id" => $id,
71 77
         "cid" => $_SESSION['customerinfo']['customerno']);
72 78
     $result = db_query("SELECT pdfdata FROM kundendaten.contract WHERE id=:id AND customer=:cid", $args);
73 79
     $line = $result->fetch();
74 80
     return $line['pdfdata'];
75 81
 }
76
-
77
-
78
-?>
Browse code

Neues Modul zum Abschließen eines AV-Vertrags

Bernd Wurst authored on11/05/2018 11:16:25
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,78 @@
1
+<?php
2
+/*
3
+This file belongs to the Webinterface of schokokeks.org Hosting
4
+
5
+Written 2008-2018 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
+*/
16
+
17
+require_role(ROLE_CUSTOMER);
18
+
19
+
20
+function get_orderprocessing_contract() {
21
+    $args = array(
22
+        "cid" => (int) $_SESSION['customerinfo']['customerno']);
23
+    $result = db_query("SELECT id, signed, type, startdate, enddate FROM kundendaten.contract WHERE customer=:cid AND type='orderprocessing' AND (enddate IS NULL OR enddate < CURDATE())", $args);
24
+    if ($result->rowCount() == 0) {
25
+        return NULL;
26
+    }
27
+    $line = $result->fetch();
28
+    return $line;
29
+}
30
+
31
+
32
+function contract_html() {
33
+    use_module('contacts');
34
+    require_once('contacts.php');
35
+    
36
+    $kundenkontakte = get_kundenkontakte();
37
+    $kunde = get_contact($kundenkontakte['kunde']);
38
+    $adresse = nl2br("\n".filter_input_general($kunde['address'])."\n".filter_input_general($kunde['country']).'-'.filter_input_general($kunde['zip']).' '.filter_input_general($kunde['city']));
39
+    $name = filter_input_general($kunde['name']);
40
+    if ($kunde['company']) {
41
+        $name = filter_input_general($kunde['company'])."<br />".filter_input_general($kunde['name']);
42
+    }
43
+    $email = filter_input_general($kunde['email']);
44
+    $address = "<strong>$name</strong>$adresse</p><p>E-Mail-Adresse: $email";
45
+ 
46
+    $date = date('d.m.Y');
47
+
48
+    $DIR=realpath(dirname(__FILE__).'/..');
49
+
50
+    $vertrag = file_get_contents($DIR.'/vertrag.html');
51
+    $vertrag = str_replace('((ADRESSE))', $address, $vertrag);
52
+    $vertrag = str_replace('((DATUM))', $date, $vertrag);
53
+
54
+    $vertrag = str_replace('</body>', '', $vertrag);
55
+    $vertrag = str_replace('</html>', '', $vertrag);
56
+
57
+    return $vertrag."<br><br><pagebreak>\n".file_get_contents($DIR.'/anlage1.html')."<br><br><pagebreak>\n".file_get_contents($DIR.'/anlage2.html')."</body></html>";
58
+}
59
+
60
+
61
+function save_op_contract($pdfdata) {
62
+    $args = array("cid" => $_SESSION['customerinfo']['customerno'],
63
+            "pdfdata" => $pdfdata);
64
+    db_query("INSERT INTO kundendaten.contract (customer, signed, type, startdate, pdfdata) VALUES (:cid, NOW(), 'orderprocessing', CURDATE(), :pdfdata)",
65
+        $args);
66
+}
67
+
68
+
69
+function get_contract_pdf($id) {
70
+    $args = array("id" => $id,
71
+        "cid" => $_SESSION['customerinfo']['customerno']);
72
+    $result = db_query("SELECT pdfdata FROM kundendaten.contract WHERE id=:id AND customer=:cid", $args);
73
+    $line = $result->fetch();
74
+    return $line['pdfdata'];
75
+}
76
+
77
+
78
+?>