@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
227 | - * @return bool |
|
227 | + * @return false|null |
|
228 | 228 | */ |
229 | 229 | private function doCheckout() |
230 | 230 | { |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * @param $iInsertID |
|
332 | + * @param string $iInsertID |
|
333 | 333 | * @param $sMailbody_us |
334 | 334 | * @param $sMailbody_they |
335 | 335 | * @param $aImagesToSend |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | - * @param $field |
|
379 | + * @param string $field |
|
380 | 380 | * @return string |
381 | 381 | */ |
382 | 382 | private function getPostValue($field) |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | if (HelperConfig::$shop['email_orderconfirmation_embed_itemimages_method'] === 'glide') { |
144 | 144 | $sPathToImage = '/'.HelperConfig::$core['directory_images'].'/'.HelperConfig::$shop['directory_images_items'].'/'; |
145 | - $sImageroot = PATH_BASEDIR . HelperConfig::$core['directory_glide_master']; |
|
145 | + $sImageroot = PATH_BASEDIR.HelperConfig::$core['directory_glide_master']; |
|
146 | 146 | |
147 | 147 | if ( |
148 | 148 | is_file($sImageroot.substr($sPathToImage.$aV["img"], strlen(HelperConfig::$core['directory_images']) + 1)) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'cache' => PATH_GLIDECACHE, |
154 | 154 | 'max_image_size' => HelperConfig::$core['glide_max_imagesize'], |
155 | 155 | ]); |
156 | - $glideserver->setBaseUrl('/' . HelperConfig::$core['directory_images'] . '/'); |
|
156 | + $glideserver->setBaseUrl('/'.HelperConfig::$core['directory_images'].'/'); |
|
157 | 157 | $base64Img = $glideserver->getImageAsBase64($sPathToImage.$aV["img"], HelperConfig::$shop['email_orderconfirmation_embed_itemimages_glideparams']); |
158 | 158 | $TMP = explode(',', $base64Img); |
159 | 159 | $binImg = base64_decode($TMP[1]); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | .HelperConfig::$shop['directory_images_items_email'].'/'; |
167 | 167 | if ($aImgInfo = getimagesize($sPathToImage.$aV["img"])) { |
168 | 168 | $binImg = file_get_contents($sPathToImage.$aV["img"]); |
169 | - $base64Img = 'data:' . $aImgInfo["mime"] . ';base64,'; |
|
169 | + $base64Img = 'data:'.$aImgInfo["mime"].';base64,'; |
|
170 | 170 | $base64Img .= base64_encode($binImg); |
171 | 171 | } |
172 | 172 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $sql = DBTools::buildPSInsertQuery($aDataOrder, 'orders'); |
243 | 243 | $hResult = $db->prepare($sql); |
244 | 244 | foreach ($aDataOrder as $sKey => $sValue) { |
245 | - $hResult->bindValue(':' . $sKey, $sValue); |
|
245 | + $hResult->bindValue(':'.$sKey, $sValue); |
|
246 | 246 | } |
247 | 247 | $hResult->execute(); |
248 | 248 | $iInsertID = $db->lastInsertId(); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $sql = DBTools::buildPSInsertQuery($aV, 'orders_items'); |
278 | 278 | $hResult = $db->prepare($sql); |
279 | 279 | foreach ($aV as $sKey => $sValue) { |
280 | - $hResult->bindValue(':' . $sKey, $sValue); |
|
280 | + $hResult->bindValue(':'.$sKey, $sValue); |
|
281 | 281 | } |
282 | 282 | $hResult->execute(); |
283 | 283 | } |
@@ -315,15 +315,15 @@ discard block |
||
315 | 315 | && array_search('paypal', HelperConfig::$shop["paymentmethods"]) !== false |
316 | 316 | && isset(HelperConfig::$shop["paypal_interactive"]) && HelperConfig::$shop["paypal_interactive"] |
317 | 317 | ) { |
318 | - header('Location: /_misc/paypal.html?id=' . $iInsertID); |
|
318 | + header('Location: /_misc/paypal.html?id='.$iInsertID); |
|
319 | 319 | } elseif ( |
320 | 320 | isset($this->post["paymentmethod"]) |
321 | 321 | && $this->post["paymentmethod"] == 'sofortueberweisung' |
322 | 322 | && array_search('sofortueberweisung', HelperConfig::$shop["paymentmethods"]) !== false |
323 | 323 | ) { |
324 | - header('Location: /_misc/sofortueberweisung.html?id=' . $iInsertID); |
|
324 | + header('Location: /_misc/sofortueberweisung.html?id='.$iInsertID); |
|
325 | 325 | } else { |
326 | - header('Location: /_misc/checkedout.html?id=' . $iInsertID); |
|
326 | + header('Location: /_misc/checkedout.html?id='.$iInsertID); |
|
327 | 327 | } |
328 | 328 | die(); |
329 | 329 | } |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | |
352 | 352 | Helper::mailWrapper( |
353 | 353 | $this->post["email"], |
354 | - $this->textcats->T("shoppingcart_mail_subject") . ' ' . $iInsertID, |
|
354 | + $this->textcats->T("shoppingcart_mail_subject").' '.$iInsertID, |
|
355 | 355 | $sMailbody_they, |
356 | 356 | $aImagesToSend, |
357 | 357 | $aFilesToSend |
358 | 358 | ); |
359 | 359 | Helper::mailWrapper( |
360 | 360 | HelperConfig::$core["email_sender"], |
361 | - 'Bestellung im Webshop Nr: ' . $iInsertID, |
|
361 | + 'Bestellung im Webshop Nr: '.$iInsertID, |
|
362 | 362 | $sMailbody_us, |
363 | 363 | $aImagesToSend |
364 | 364 | ); |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | */ |
370 | 370 | private function writeCheckoutToFile($sMailbody_us) |
371 | 371 | { |
372 | - $fp = fopen(PATH_LOGS . 'shoplog_' . date("Y-m-d") . '.html', 'a'); |
|
372 | + $fp = fopen(PATH_LOGS.'shoplog_'.date("Y-m-d").'.html', 'a'); |
|
373 | 373 | // Write $somecontent to our opened file. |
374 | - fwrite($fp, $sMailbody_us . "\n\n-------------------------------------------------------------------------\n\n"); |
|
374 | + fwrite($fp, $sMailbody_us."\n\n-------------------------------------------------------------------------\n\n"); |
|
375 | 375 | fclose($fp); |
376 | 376 | } |
377 | 377 | |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | 'cancellationdisclaimer' => $this->getPostValue('cancellationdisclaimer'), |
428 | 428 | 'paymentmethod' => $this->getPostValue('paymentmethod'), |
429 | 429 | 'shippingcost' => (!isset($_SESSION["shippingcost"]) || $_SESSION["shippingcost"] == 0 ? false : $_SESSION["shippingcost"]), |
430 | - 'paypallink' => (isset($this->post["paymentmethod"]) && $this->post["paymentmethod"] == 'paypal' ? $_SERVER["SERVER_NAME"].'/_misc/paypal.html?id='.$iId : ''), |
|
431 | - 'sofortueberweisunglink' => (isset($this->post["paymentmethod"]) && $this->post["paymentmethod"] == 'sofortueberweisung' ? $_SERVER["SERVER_NAME"].'/_misc/sofortueberweisung.html?id='.$iId : ''), |
|
430 | + 'paypallink' => (isset($this->post["paymentmethod"]) && $this->post["paymentmethod"] == 'paypal' ? $_SERVER["SERVER_NAME"].'/_misc/paypal.html?id='.$iId : ''), |
|
431 | + 'sofortueberweisunglink' => (isset($this->post["paymentmethod"]) && $this->post["paymentmethod"] == 'sofortueberweisung' ? $_SERVER["SERVER_NAME"].'/_misc/sofortueberweisung.html?id='.$iId : ''), |
|
432 | 432 | 'SESSION' => (!$bCust ? Tools::debug($_SESSION, '$_SESSION', true, true) : ''), |
433 | 433 | 'POST' => (!$bCust ? Tools::debug($this->post, '$this->post', true, true) : ''), |
434 | 434 | 'orderid' => $iId, |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | || ($this->get["msg"] == 'removed') |
458 | 458 | && isset($this->get["cartkey"]) |
459 | 459 | ) { |
460 | - $return .= $this->textcats->T("shoppingcart_msg_" . $this->get["msg"] . "_1") . ' '; |
|
460 | + $return .= $this->textcats->T("shoppingcart_msg_".$this->get["msg"]."_1").' '; |
|
461 | 461 | if (isset(HelperConfig::$shop["custom_order_fields"]) && mb_strpos($this->get["cartkey"], '|') !== false) { |
462 | 462 | $mCartkeys = explode('|', $this->get["cartkey"]); |
463 | 463 | foreach ($mCartkeys as $sKey => $sValue) { |
464 | 464 | if ($sKey == 0) { |
465 | - $return .= $sValue . ', '; |
|
465 | + $return .= $sValue.', '; |
|
466 | 466 | } else { |
467 | 467 | $TMP = explode(':', $sValue); |
468 | - $return .= $this->textcats->T("shoppingcart_item_" . $TMP[0]) . ' ' . $TMP[1] . ', '; |
|
468 | + $return .= $this->textcats->T("shoppingcart_item_".$TMP[0]).' '.$TMP[1].', '; |
|
469 | 469 | unset($TMP); |
470 | 470 | } |
471 | 471 | } |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | } else { |
474 | 474 | $return .= $this->get["cartkey"]; |
475 | 475 | } |
476 | - $return.= ' ' . $this->textcats->T("shoppingcart_msg_" . $this->get["msg"] . "_2"); |
|
476 | + $return .= ' '.$this->textcats->T("shoppingcart_msg_".$this->get["msg"]."_2"); |
|
477 | 477 | if ($this->get["msg"] == 'updated') { |
478 | - $return .= ' ' . $this->get["amount"]; |
|
478 | + $return .= ' '.$this->get["amount"]; |
|
479 | 479 | } |
480 | 480 | $return .= '<br><br>'; |
481 | 481 | } |
@@ -347,7 +347,9 @@ |
||
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"], |
@@ -118,7 +118,7 @@ |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | - * @param $sReply |
|
121 | + * @param string $sReply |
|
122 | 122 | * @param array $aMore |
123 | 123 | */ |
124 | 124 | private function replyToCartUpdate($sReply, $aMore = []) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | unset($sTMP); |
78 | 78 | |
79 | 79 | if (isset($_REQUEST[$sValue]) && in_array($_REQUEST[$sValue], $aOptions)) { |
80 | - $sCartKey .= '|' . $sValue . ':' . $_REQUEST[$sValue]; |
|
80 | + $sCartKey .= '|'.$sValue.':'.$_REQUEST[$sValue]; |
|
81 | 81 | } else { |
82 | 82 | $this->replyToCartUpdate('requiredfieldmissing'); |
83 | 83 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if (count($aMore)) $aAR = array_merge($aAR, $aMore); |
136 | 136 | echo $this->serviceManager->get('twig')->render('shop/update-cart.twig', $aAR); |
137 | 137 | } else { |
138 | - $aMSG["msg"] = $sReply; |
|
138 | + $aMSG["msg"] = $sReply; |
|
139 | 139 | if (count($aMore)) $aMSG = array_merge($aMSG, $aMore); |
140 | 140 | header('Location: '.\HaaseIT\Toolbox\Tools::makeLinkHRefWithAddedGetVars($_SERVER["HTTP_REFERER"], $aMSG, true, false)); |
141 | 141 | } |
@@ -132,11 +132,15 @@ |
||
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(); |
@@ -27,6 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | class Helper |
29 | 29 | { |
30 | + /** |
|
31 | + * @param string $sLang |
|
32 | + */ |
|
30 | 33 | public static function validateCustomerForm($sLang, $aErr = [], $bEdit = false) |
31 | 34 | { |
32 | 35 | if (!isset($_POST["email"]) || !\filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) $aErr["email"] = true; |
@@ -68,6 +71,11 @@ discard block |
||
68 | 71 | return ''; |
69 | 72 | } |
70 | 73 | |
74 | + /** |
|
75 | + * @param string $sKeyConfig |
|
76 | + * @param string $sKeyForm |
|
77 | + * @param boolean $aUserData |
|
78 | + */ |
|
71 | 79 | public static function getCustomerFormDefaultValue($sKeyConfig, $sKeyForm, $aUserData) { |
72 | 80 | $sDefaultValue = self::getUserData($sKeyConfig, $aUserData); |
73 | 81 | if (!$sDefaultValue && isset($_SESSION["formsave_addrform"][$sKeyForm])) $sDefaultValue = $_SESSION["formsave_addrform"][$sKeyForm]; |
@@ -75,6 +83,9 @@ discard block |
||
75 | 83 | return $sDefaultValue; |
76 | 84 | } |
77 | 85 | |
86 | + /** |
|
87 | + * @param string $sLang |
|
88 | + */ |
|
78 | 89 | public static function buildCustomerForm($sLang, $sPurpose = 'none', $sErr = '', $aUserData = false) |
79 | 90 | { |
80 | 91 | $sDefaultCountry = self::getCustomerFormDefaultValue('cust_country', "country", $aUserData); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | if (HelperConfig::$customer["validate_fax"] && (!isset($_POST["fax"]) || strlen(trim($_POST["fax"]))) < 6) $aErr["fax"] = true; |
41 | 41 | if (HelperConfig::$customer["validate_country"] && (!isset($_POST["country"]) || !isset(HelperConfig::$countries["countries_".$sLang][$_POST["country"]]))) $aErr["country"] = true; |
42 | 42 | if (!$bEdit && (!isset($_POST["tos"]) || $_POST["tos"] != 'y')) $aErr["tos"] = true; |
43 | - if (!$bEdit && (!isset( $_POST["cancellationdisclaimer"] ) || $_POST["cancellationdisclaimer"] != 'y')) $aErr["cancellationdisclaimer"] = true; |
|
43 | + if (!$bEdit && (!isset($_POST["cancellationdisclaimer"]) || $_POST["cancellationdisclaimer"] != 'y')) $aErr["cancellationdisclaimer"] = true; |
|
44 | 44 | |
45 | 45 | if (!$bEdit || (isset($_POST["pwd"]) && trim($_POST["pwd"]) != '')) { |
46 | 46 | if ( |
@@ -29,18 +29,42 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -214,6 +214,9 @@ discard block |
||
214 | 214 | return $aP; |
215 | 215 | } |
216 | 216 | |
217 | + /** |
|
218 | + * @param Page $P |
|
219 | + */ |
|
217 | 220 | private static function getDebug($aP, $P) |
218 | 221 | { |
219 | 222 | if (!empty($_POST)) { |
@@ -260,6 +263,9 @@ discard block |
||
260 | 263 | return $sLang; |
261 | 264 | } |
262 | 265 | |
266 | + /** |
|
267 | + * @param string $purpose |
|
268 | + */ |
|
263 | 269 | public static function getPurifier($purpose) |
264 | 270 | { |
265 | 271 | $purifier_config = \HTMLPurifier_Config::createDefault(); |
@@ -85,6 +85,9 @@ |
||
85 | 85 | return $hResult->execute(); |
86 | 86 | } |
87 | 87 | |
88 | + /** |
|
89 | + * @param string $sPagekeytoadd |
|
90 | + */ |
|
88 | 91 | public function insert($sPagekeytoadd) { |
89 | 92 | $aData = [ |
90 | 93 | 'cb_key' => $sPagekeytoadd, |
@@ -56,7 +56,9 @@ |
||
56 | 56 | $hResult->fetch(); |
57 | 57 | |
58 | 58 | if ($this->cb_pagetype !== 'shorturl') { |
59 | - if (!$bReturnRaw) $this->cb_pageconfig = json_decode($this->cb_pageconfig); |
|
59 | + if (!$bReturnRaw) { |
|
60 | + $this->cb_pageconfig = json_decode($this->cb_pageconfig); |
|
61 | + } |
|
60 | 62 | $this->oPayload = $this->getPayload(); |
61 | 63 | } |
62 | 64 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $iRows = $hResult->rowCount(); |
52 | 52 | |
53 | 53 | if ($iRows == 0) { |
54 | - $sEmailVerificationcode = md5($_POST["email"] . time()); |
|
54 | + $sEmailVerificationcode = md5($_POST["email"].time()); |
|
55 | 55 | $aData = [ |
56 | 56 | 'cust_email' => $sEmail, |
57 | 57 | 'cust_corp' => filter_var(trim(Tools::getFormfield("corpname")), |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | $hResult = $this->serviceManager->get('db')->prepare($sql); |
86 | 86 | foreach ($aData as $sKey => $sValue) { |
87 | - $hResult->bindValue(':' . $sKey, $sValue, \PDO::PARAM_STR); |
|
87 | + $hResult->bindValue(':'.$sKey, $sValue, \PDO::PARAM_STR); |
|
88 | 88 | } |
89 | 89 | $hResult->execute(); |
90 | 90 |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | } else { |
46 | 46 | $mLogin = $this->getLogin(); |
47 | 47 | if (isset($mLogin["status"]) && $mLogin["status"] == 'success') { |
48 | - $this->P->oPayload->cl_html = $textcats->T("login_success") . '<br>'; |
|
48 | + $this->P->oPayload->cl_html = $textcats->T("login_success").'<br>'; |
|
49 | 49 | header('Location: /_misc/userhome.html?login=true'); |
50 | 50 | die(); |
51 | 51 | } elseif (isset($mLogin["status"]) && $mLogin["status"] == 'tosnotaccepted') { |
52 | - $this->P->oPayload->cl_html = $textcats->T("login_fail_tosnotaccepted") . '<br>'; |
|
52 | + $this->P->oPayload->cl_html = $textcats->T("login_fail_tosnotaccepted").'<br>'; |
|
53 | 53 | $this->P->cb_customcontenttemplate = 'customer/login'; |
54 | 54 | } elseif (isset($mLogin["status"]) && $mLogin["status"] == 'emailnotverified') { |
55 | - $this->P->oPayload->cl_html = $textcats->T("login_fail_emailnotverified") . '<br><br>'; |
|
55 | + $this->P->oPayload->cl_html = $textcats->T("login_fail_emailnotverified").'<br><br>'; |
|
56 | 56 | $this->P->oPayload->cl_html .= '<a href="/_misc/resendverificationmail.html?email=' |
57 | - . $mLogin["data"]['cust_email'] . '">' . $textcats->T("login_fail_emailnotverifiedresend") . '</a>'; |
|
57 | + . $mLogin["data"]['cust_email'].'">'.$textcats->T("login_fail_emailnotverifiedresend").'</a>'; |
|
58 | 58 | $this->P->cb_customcontenttemplate = 'customer/login'; |
59 | 59 | } elseif (isset($mLogin["status"]) && $mLogin["status"] == 'accountinactive') { |
60 | - $this->P->oPayload->cl_html = $textcats->T("login_fail_accountinactive") . '<br>'; |
|
60 | + $this->P->oPayload->cl_html = $textcats->T("login_fail_accountinactive").'<br>'; |
|
61 | 61 | $this->P->cb_customcontenttemplate = 'customer/login'; |
62 | 62 | } else { |
63 | 63 | $this->P->oPayload->cl_html = $textcats->T("login_fail"); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $hResult->execute(); |
102 | 102 | |
103 | 103 | $iRows = $hResult->rowCount(); |
104 | - if($iRows == 1) { |
|
104 | + if ($iRows == 1) { |
|
105 | 105 | $aRow = $hResult->fetch(); |
106 | 106 | |
107 | 107 | if (password_verify($_POST["password"], $aRow['cust_password'])) { |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | } elseif ($aRow['cust_tosaccepted'] == 'n') { |
112 | 112 | return ['status' => 'tosnotaccepted']; |
113 | 113 | } elseif ($aRow['cust_emailverified'] == 'n') { |
114 | - return ['status' => 'emailnotverified', 'data' => $aRow,]; |
|
114 | + return ['status' => 'emailnotverified', 'data' => $aRow, ]; |
|
115 | 115 | } elseif ($aRow['cust_active'] == 'n') { |
116 | - return ['status' => 'accountinactive',]; |
|
116 | + return ['status' => 'accountinactive', ]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
@@ -76,21 +76,31 @@ |
||
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); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | /** @var \PDOStatement $hResult */ |
76 | 76 | $hResult = $this->db->prepare($sql); |
77 | 77 | foreach ($aData as $sKey => $sValue) { |
78 | - $hResult->bindValue(':' . $sKey, $sValue); |
|
78 | + $hResult->bindValue(':'.$sKey, $sValue); |
|
79 | 79 | } |
80 | 80 | $hResult->execute(); |
81 | 81 | $this->P->oPayload->cl_html = $this->textcats->T("register_emailverificationsuccess"); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | if (CHelper::getUserData()) { |
33 | 33 | $this->P->oPayload->cl_html = $this->serviceManager->get('textcats')->T("denied_default"); |
34 | 34 | } else { |
35 | - $sql = 'SELECT ' . DB_ADDRESSFIELDS . ', cust_emailverificationcode FROM customer'; |
|
35 | + $sql = 'SELECT '.DB_ADDRESSFIELDS.', cust_emailverificationcode FROM customer'; |
|
36 | 36 | $sql .= ' WHERE cust_email = :email AND cust_emailverified = \'n\''; |
37 | 37 | |
38 | 38 | /** @var \PDOStatement $hResult */ |