Completed
Push — master ( b3c1c7...c901c8 )
by Marcus
02:39
created
src/Customer/Helper.php 1 patch
Braces   +53 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,18 +29,42 @@  discard block
 block discarded – undo
29 29
 {
30 30
     public static function validateCustomerForm($sLang, $aErr = [], $bEdit = false)
31 31
     {
32
-        if (!isset($_POST["email"]) || !\filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) $aErr["email"] = true;
33
-        if (HelperConfig::$customer["validate_corpname"] && (!isset($_POST["corpname"]) || strlen(trim($_POST["corpname"])) < 3)) $aErr["corpname"] = true;
34
-        if (HelperConfig::$customer["validate_name"] && (!isset($_POST["name"]) || strlen(trim($_POST["name"])) < 3)) $aErr["name"] = true;
35
-        if (HelperConfig::$customer["validate_street"] && (!isset($_POST["street"]) || strlen(trim($_POST["street"])) < 3)) $aErr["street"] = true;
36
-        if (HelperConfig::$customer["validate_zip"] && (!isset($_POST["zip"]) || strlen(trim($_POST["zip"])) < 4)) $aErr["zip"] = true;
37
-        if (HelperConfig::$customer["validate_town"] && (!isset($_POST["town"]) || strlen(trim($_POST["town"])) < 3)) $aErr["town"] = true;
38
-        if (HelperConfig::$customer["validate_phone"] && (!isset($_POST["phone"]) || strlen(trim($_POST["phone"])) < 6)) $aErr["phone"] = true;
39
-        if (HelperConfig::$customer["validate_cellphone"] && (!isset($_POST["cellphone"]) || strlen(trim($_POST["cellphone"])) < 11)) $aErr["cellphone"] = true;
40
-        if (HelperConfig::$customer["validate_fax"] && (!isset($_POST["fax"]) || strlen(trim($_POST["fax"]))) < 6) $aErr["fax"] = true;
41
-        if (HelperConfig::$customer["validate_country"] && (!isset($_POST["country"]) || !isset(HelperConfig::$countries["countries_".$sLang][$_POST["country"]]))) $aErr["country"] = true;
42
-        if (!$bEdit && (!isset($_POST["tos"]) || $_POST["tos"] != 'y')) $aErr["tos"] = true;
43
-        if (!$bEdit && (!isset( $_POST["cancellationdisclaimer"] ) || $_POST["cancellationdisclaimer"] != 'y')) $aErr["cancellationdisclaimer"] = true;
32
+        if (!isset($_POST["email"]) || !\filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
33
+            $aErr["email"] = true;
34
+        }
35
+        if (HelperConfig::$customer["validate_corpname"] && (!isset($_POST["corpname"]) || strlen(trim($_POST["corpname"])) < 3)) {
36
+            $aErr["corpname"] = true;
37
+        }
38
+        if (HelperConfig::$customer["validate_name"] && (!isset($_POST["name"]) || strlen(trim($_POST["name"])) < 3)) {
39
+            $aErr["name"] = true;
40
+        }
41
+        if (HelperConfig::$customer["validate_street"] && (!isset($_POST["street"]) || strlen(trim($_POST["street"])) < 3)) {
42
+            $aErr["street"] = true;
43
+        }
44
+        if (HelperConfig::$customer["validate_zip"] && (!isset($_POST["zip"]) || strlen(trim($_POST["zip"])) < 4)) {
45
+            $aErr["zip"] = true;
46
+        }
47
+        if (HelperConfig::$customer["validate_town"] && (!isset($_POST["town"]) || strlen(trim($_POST["town"])) < 3)) {
48
+            $aErr["town"] = true;
49
+        }
50
+        if (HelperConfig::$customer["validate_phone"] && (!isset($_POST["phone"]) || strlen(trim($_POST["phone"])) < 6)) {
51
+            $aErr["phone"] = true;
52
+        }
53
+        if (HelperConfig::$customer["validate_cellphone"] && (!isset($_POST["cellphone"]) || strlen(trim($_POST["cellphone"])) < 11)) {
54
+            $aErr["cellphone"] = true;
55
+        }
56
+        if (HelperConfig::$customer["validate_fax"] && (!isset($_POST["fax"]) || strlen(trim($_POST["fax"]))) < 6) {
57
+            $aErr["fax"] = true;
58
+        }
59
+        if (HelperConfig::$customer["validate_country"] && (!isset($_POST["country"]) || !isset(HelperConfig::$countries["countries_".$sLang][$_POST["country"]]))) {
60
+            $aErr["country"] = true;
61
+        }
62
+        if (!$bEdit && (!isset($_POST["tos"]) || $_POST["tos"] != 'y')) {
63
+            $aErr["tos"] = true;
64
+        }
65
+        if (!$bEdit && (!isset( $_POST["cancellationdisclaimer"] ) || $_POST["cancellationdisclaimer"] != 'y')) {
66
+            $aErr["cancellationdisclaimer"] = true;
67
+        }
44 68
 
45 69
         if (!$bEdit || (isset($_POST["pwd"]) && trim($_POST["pwd"]) != '')) {
46 70
             if (
@@ -70,7 +94,9 @@  discard block
 block discarded – undo
70 94
 
71 95
     public static function getCustomerFormDefaultValue($sKeyConfig, $sKeyForm, $aUserData) {
72 96
         $sDefaultValue = self::getUserData($sKeyConfig, $aUserData);
73
-        if (!$sDefaultValue && isset($_SESSION["formsave_addrform"][$sKeyForm])) $sDefaultValue = $_SESSION["formsave_addrform"][$sKeyForm];
97
+        if (!$sDefaultValue && isset($_SESSION["formsave_addrform"][$sKeyForm])) {
98
+            $sDefaultValue = $_SESSION["formsave_addrform"][$sKeyForm];
99
+        }
74 100
 
75 101
         return $sDefaultValue;
76 102
     }
@@ -210,8 +236,7 @@  discard block
 block discarded – undo
210 236
             $aP['link'] .= $_SERVER["SERVER_NAME"].'/_misc/verifyemail.html?key='.$sEmailVerificationcode;
211 237
 
212 238
             $sMessage = $serviceManager->get('twig')->render('customer/sendverificationmail.twig', $aP);
213
-        }
214
-        else {
239
+        } else {
215 240
             $sSubject = HardcodedText::get('newcustomerregistration_mail_subject');
216 241
             $sMessage = HardcodedText::get('newcustomerregistration_mail_text1').' ';
217 242
             $sMessage .= $sTargetAddress.HardcodedText::get(
@@ -226,13 +251,21 @@  discard block
 block discarded – undo
226 251
     public static function getUserData($sField = '', $aUserdata = false)
227 252
     {
228 253
         if (!$aUserdata) {
229
-            if (!isset($_SESSION["user"]) || !is_array($_SESSION["user"])) return false;
230
-            elseif ($sField == '') return true;
254
+            if (!isset($_SESSION["user"]) || !is_array($_SESSION["user"])) {
255
+                return false;
256
+            } elseif ($sField == '') {
257
+                return true;
258
+            }
231 259
 
232
-            if ($sField != '' && isset($_SESSION["user"][$sField]) && $_SESSION["user"][$sField] != '') return $_SESSION["user"][$sField];
260
+            if ($sField != '' && isset($_SESSION["user"][$sField]) && $_SESSION["user"][$sField] != '') {
261
+                return $_SESSION["user"][$sField];
262
+            }
233 263
         } else {
234
-            if (isset($aUserdata[$sField])) return $aUserdata[$sField];
235
-            elseif ($sField = '') return false;
264
+            if (isset($aUserdata[$sField])) {
265
+                return $aUserdata[$sField];
266
+            } elseif ($sField = '') {
267
+                return false;
268
+            }
236 269
         }
237 270
     }
238 271
 }
Please login to merge, or discard this patch.
src/Controller/Customer/Login.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,21 +76,31 @@
 block discarded – undo
76 76
     private function getLogin()
77 77
     {
78 78
         $bTryEmail = false;
79
-        if ('cust_no' != 'cust_email') $bTryEmail = true;
79
+        if ('cust_no' != 'cust_email') {
80
+            $bTryEmail = true;
81
+        }
80 82
 
81 83
         $sEmail = filter_var(trim(Tools::getFormfield("user")), FILTER_SANITIZE_EMAIL);
82 84
         $sUser = filter_var(trim(Tools::getFormfield("user")), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
83 85
 
84 86
         $sql = 'SELECT cust_no, cust_email, cust_password, cust_active, cust_emailverified, cust_tosaccepted'
85 87
             . ' FROM customer WHERE ';
86
-        if ($bTryEmail) $sql .= "(";
88
+        if ($bTryEmail) {
89
+            $sql .= "(";
90
+        }
87 91
         $sql .= 'cust_no = :user';
88
-        if ($bTryEmail) $sql .= ' OR cust_email = :email) ';
92
+        if ($bTryEmail) {
93
+            $sql .= ' OR cust_email = :email) ';
94
+        }
89 95
         $sql .= " AND ";
90
-        if ($bTryEmail) $sql .= "(";
96
+        if ($bTryEmail) {
97
+            $sql .= "(";
98
+        }
91 99
         $sql .= 'cust_no != \'\'';
92 100
 
93
-        if ($bTryEmail) $sql .= ' OR cust_email != \'\')';
101
+        if ($bTryEmail) {
102
+            $sql .= ' OR cust_email != \'\')';
103
+        }
94 104
 
95 105
         /** @var \PDOStatement $hResult */
96 106
         $hResult = $this->serviceManager->get('db')->prepare($sql);
Please login to merge, or discard this patch.
src/Controller/Customer/Forgotpassword.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,9 @@
 block discarded – undo
105 105
                     ];
106 106
                     $sql = \HaaseIT\Toolbox\DBTools::buildPSUpdateQuery($aData, 'customer', 'cust_id');
107 107
                     $hResult = $this->db->prepare($sql);
108
-                    foreach ($aData as $sKey => $sValue) $hResult->bindValue(':'.$sKey, $sValue);
108
+                    foreach ($aData as $sKey => $sValue) {
109
+                        $hResult->bindValue(':'.$sKey, $sValue);
110
+                    }
109 111
                     $hResult->execute();
110 112
 
111 113
                     $sTargetAddress = $aResult['cust_email'];
Please login to merge, or discard this patch.
src/Controller/Customer/Userhome.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,9 @@
 block discarded – undo
82 82
                     $hResult->bindValue(':email', $sEmail, \PDO::PARAM_STR);
83 83
                     $hResult->execute();
84 84
                     $iRows = $hResult->rowCount();
85
-                    if ($iRows == 1) $sErr .= $this->textcats->T("userprofile_emailalreadyinuse") . '<br>';
85
+                    if ($iRows == 1) {
86
+                        $sErr .= $this->textcats->T("userprofile_emailalreadyinuse") . '<br>';
87
+                    }
86 88
                     $sErr = CHelper::validateCustomerForm(HelperConfig::$lang, $sErr, true);
87 89
 
88 90
                     if ($sErr == '') {
Please login to merge, or discard this patch.
src/Controller/Customer/Resetpassword.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -108,8 +108,12 @@  discard block
 block discarded – undo
108 108
             if (
109 109
                 strlen($_POST["pwd"]) < HelperConfig::$customer["minimum_length_password"]
110 110
                 || strlen($_POST["pwd"]) > HelperConfig::$customer["maximum_length_password"]
111
-            ) $aErr[] = 'pwlength';
112
-            if ($_POST["pwd"] != $_POST["pwdc"]) $aErr[] = 'pwmatch';
111
+            ) {
112
+                $aErr[] = 'pwlength';
113
+            }
114
+            if ($_POST["pwd"] != $_POST["pwdc"]) {
115
+                $aErr[] = 'pwmatch';
116
+            }
113 117
             if (count($aErr) == 0) {
114 118
                 $sEnc = password_hash($_POST["pwd"], PASSWORD_DEFAULT);
115 119
                 $aData = [
@@ -119,7 +123,9 @@  discard block
 block discarded – undo
119 123
                 ];
120 124
                 $sql = \HaaseIT\Toolbox\DBTools::buildPSUpdateQuery($aData, 'customer', 'cust_id');
121 125
                 $hResult = $this->db->prepare($sql);
122
-                foreach ($aData as $sKey => $sValue) $hResult->bindValue(':'.$sKey, $sValue);
126
+                foreach ($aData as $sKey => $sValue) {
127
+                    $hResult->bindValue(':'.$sKey, $sValue);
128
+                }
123 129
                 $hResult->execute();
124 130
             }
125 131
         } else {
Please login to merge, or discard this patch.
src/Controller/Shop/Shoppingcart.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -347,7 +347,9 @@
 block discarded – undo
347 347
             $aFilesToSend[] =
348 348
                 PATH_DOCROOT.HelperConfig::$core['directory_emailattachments'].'/'
349 349
                 .HelperConfig::$shop["email_orderconfirmation_attachment_cancellationform_".HelperConfig::$lang];
350
-        } else $aFilesToSend = [];
350
+        } else {
351
+            $aFilesToSend = [];
352
+        }
351 353
 
352 354
         Helper::mailWrapper(
353 355
             $this->post["email"],
Please login to merge, or discard this patch.
src/Controller/Shop/Updatecart.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,11 +132,15 @@
 block discarded – undo
132 132
                 'numberformat_decimal_point' => HelperConfig::$core['numberformat_decimal_point'],
133 133
                 'numberformat_thousands_seperator' => HelperConfig::$core['numberformat_thousands_seperator'],
134 134
             ];
135
-            if (count($aMore)) $aAR = array_merge($aAR, $aMore);
135
+            if (count($aMore)) {
136
+                $aAR = array_merge($aAR, $aMore);
137
+            }
136 138
             echo $this->serviceManager->get('twig')->render('shop/update-cart.twig', $aAR);
137 139
         } else {
138 140
             $aMSG["msg"] =  $sReply;
139
-            if (count($aMore)) $aMSG = array_merge($aMSG, $aMore);
141
+            if (count($aMore)) {
142
+                $aMSG = array_merge($aMSG, $aMore);
143
+            }
140 144
             header('Location: '.\HaaseIT\Toolbox\Tools::makeLinkHRefWithAddedGetVars($_SERVER["HTTP_REFERER"], $aMSG, true, false));
141 145
         }
142 146
         die();
Please login to merge, or discard this patch.
src/Controller/Shop/Myorders.php 1 patch
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -158,14 +158,23 @@  discard block
 block discarded – undo
158 158
             while ($aRow = $hResult->fetch()) {
159 159
                 $sStatus = SHelper::showOrderStatusText($this->textcats, $aRow["o_ordercompleted"]);
160 160
 
161
-                if ($aRow["o_paymentmethod"] == 'prepay') $sPaymentmethod = $this->textcats->T("order_paymentmethod_prepay");
162
-                elseif ($aRow["o_paymentmethod"] == 'paypal') $sPaymentmethod = $this->textcats->T("order_paymentmethod_paypal");
163
-                elseif ($aRow["o_paymentmethod"] == 'debit') $sPaymentmethod = $this->textcats->T("order_paymentmethod_debit");
164
-                elseif ($aRow["o_paymentmethod"] == 'invoice') $sPaymentmethod = $this->textcats->T("order_paymentmethod_invoice");
165
-                else $sPaymentmethod = ucwords($aRow["o_paymentmethod"]);
161
+                if ($aRow["o_paymentmethod"] == 'prepay') {
162
+                    $sPaymentmethod = $this->textcats->T("order_paymentmethod_prepay");
163
+                } elseif ($aRow["o_paymentmethod"] == 'paypal') {
164
+                    $sPaymentmethod = $this->textcats->T("order_paymentmethod_paypal");
165
+                } elseif ($aRow["o_paymentmethod"] == 'debit') {
166
+                    $sPaymentmethod = $this->textcats->T("order_paymentmethod_debit");
167
+                } elseif ($aRow["o_paymentmethod"] == 'invoice') {
168
+                    $sPaymentmethod = $this->textcats->T("order_paymentmethod_invoice");
169
+                } else {
170
+                    $sPaymentmethod = ucwords($aRow["o_paymentmethod"]);
171
+                }
166 172
 
167
-                if ($aRow["o_paymentcompleted"] == 'y') $sPaymentstatus = ucwords($this->textcats->T("misc_yes"));
168
-                else $sPaymentstatus = ucwords($this->textcats->T("misc_no"));
173
+                if ($aRow["o_paymentcompleted"] == 'y') {
174
+                    $sPaymentstatus = ucwords($this->textcats->T("misc_yes"));
175
+                } else {
176
+                    $sPaymentstatus = ucwords($this->textcats->T("misc_no"));
177
+                }
169 178
 
170 179
                 $aData[] = [
171 180
                     'o_id' => $aRow["o_id"],
@@ -181,7 +190,9 @@  discard block
 block discarded – undo
181 190
                 ];
182 191
             }
183 192
             $return .= \HaaseIT\Toolbox\Tools::makeListtable($COList, $aData, $this->serviceManager->get('twig'));
184
-        } else $return .= $this->textcats->T("myorders_no_orders_to_display");
193
+        } else {
194
+            $return .= $this->textcats->T("myorders_no_orders_to_display");
195
+        }
185 196
 
186 197
         return $return;
187 198
     }
Please login to merge, or discard this patch.
src/Controller/Admin/Customer/Customeradmin.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -161,7 +161,9 @@  discard block
 block discarded – undo
161 161
                         }
162 162
                         $sql = \HaaseIT\Toolbox\DBTools::buildPSUpdateQuery($aData, 'customer', 'cust_id');
163 163
                         $hResult = $this->db->prepare($sql);
164
-                        foreach ($aData as $sKey => $sValue) $hResult->bindValue(':' . $sKey, $sValue);
164
+                        foreach ($aData as $sKey => $sValue) {
165
+                            $hResult->bindValue(':' . $sKey, $sValue);
166
+                        }
165 167
                         $hResult->execute();
166 168
                         $aInfo["changeswritten"] = true;
167 169
                     }
@@ -180,7 +182,9 @@  discard block
 block discarded – undo
180 182
         }
181 183
         $aPData["customeradmin"]["text"] = $return;
182 184
         $aPData["customeradmin"]["type"] = $sType;
183
-        if (isset($aInfo)) $aPData["customeradmin"]["info"] = $aInfo;
185
+        if (isset($aInfo)) {
186
+            $aPData["customeradmin"]["info"] = $aInfo;
187
+        }
184 188
         return $aPData;
185 189
     }
186 190
 
Please login to merge, or discard this patch.