| @@ -303,8 +303,12 @@ | ||
| 303 | 303 | foreach ($cfields as $cf) { |
| 304 | 304 | $user_inp_val = VikRequest::getString('vbf' . $cf['id'], '', 'request'); |
| 305 | 305 | if (intval($cf['isemail']) == 1 && $emailwasfound == false) { |
| 306 | 306 | $useremail = trim($user_inp_val); |
| 307 | + if (!preg_match('/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/', $useremail)) { | |
| 308 | + showSelectVb('Invalid email address provided.'); | |
| 309 | + return; | |
| 310 | + } | |
| 307 | 311 | $emailwasfound = true; |
| 308 | 312 | } |
| 309 | 313 | if ($cf['isnominative'] == 1) { |
| 310 | 314 | if (strlen(str_replace(' ', '', trim($user_inp_val)))) { |
| @@ -1881,9 +1885,12 @@ | ||
| 1881 | 1885 | $vbo_tn = VikBooking::getTranslator(); |
| 1882 | 1886 | |
| 1883 | 1887 | if ($row['status'] == 'confirmed' && !(VikBooking::multiplePayments() && $row['paymcount'] > 0)) { |
| 1884 | 1888 | // booking can be paid only if not confirmed or if multiple payments are enabled and payment counter for booking greater than zero |
| 1885 | - VBOHttpDocument::getInstance()->close(409, 'Conflicting and unexpected payment validation for this reservation'); | |
| 1889 | + if (empty($row['idorderota']) || !empty($row['totpaid'])) { | |
| 1890 | + // accept only the first payment for an OTA reservation | |
| 1891 | + VBOHttpDocument::getInstance()->close(409, 'Conflicting and unexpected payment validation for this reservation'); | |
| 1892 | + } | |
| 1886 | 1893 | } |
| 1887 | 1894 | |
| 1888 | 1895 | /** |
| 1889 | 1896 | * Check split stay reservation data. |
| @@ -3264,13 +3271,18 @@ | ||
| 3264 | 3271 | |
| 3265 | 3272 | foreach ($pguests as $ind => $adults) { |
| 3266 | 3273 | foreach ($adults as $aduind => $details) { |
| 3267 | 3274 | foreach ($details as $detkey => $detval) { |
| 3275 | + // accept no raw HTML tags as keys | |
| 3276 | + $detkey = htmlspecialchars(strip_tags($detkey)); | |
| 3277 | + if (!$detkey) { | |
| 3278 | + continue; | |
| 3279 | + } | |
| 3268 | 3280 | if (!in_array($detkey, $front_keys)) { |
| 3269 | 3281 | // push the key of the guest details for later comparison |
| 3270 | 3282 | array_push($front_keys, $detkey); |
| 3271 | 3283 | } |
| 3272 | - if (strlen($detval)) { | |
| 3284 | + if (is_scalar($detval) && strlen($detval)) { | |
| 3273 | 3285 | // push value only if not empty |
| 3274 | 3286 | if (!isset($guests_details[$ind])) { |
| 3275 | 3287 | $guests_details[$ind] = array(); |
| 3276 | 3288 | } |
| @@ -3299,8 +3311,13 @@ | ||
| 3299 | 3311 | // current pax data include a guest not present, set it to not lose it |
| 3300 | 3312 | $guests_details[$ind][$aduind] = $details; |
| 3301 | 3313 | } |
| 3302 | 3314 | foreach ($details as $detkey => $detval) { |
| 3315 | + // accept no raw HTML tags as keys | |
| 3316 | + $detkey = htmlspecialchars(strip_tags($detkey)); | |
| 3317 | + if (!$detkey) { | |
| 3318 | + continue; | |
| 3319 | + } | |
| 3303 | 3320 | if (!in_array($detkey, $front_keys)) { |
| 3304 | 3321 | // merge this key probably reserved to the back-end |
| 3305 | 3322 | $guests_details[$ind][$aduind][$detkey] = $detval; |
| 3306 | 3323 | } |
| @@ -4575,11 +4592,11 @@ | ||
| 4575 | 4592 | $checkout_h = $input->getInt('checkouth', 0); |
| 4576 | 4593 | $checkout_m = $input->getInt('checkoutm', 0); |
| 4577 | 4594 | $categories = $input->getString('categories', ''); |
| 4578 | 4595 | $roomsnum = $input->getInt('roomsnum', 1); |
| 4579 | - $adults = $input->get('adults', array(), 'int'); | |
| 4580 | - $children = $input->get('children', array(), 'int'); | |
| 4581 | - $inquiry = $input->get('inquiry', array(), 'raw'); | |
| 4596 | + $adults = $input->get('adults', [], 'int'); | |
| 4597 | + $children = $input->get('children', [], 'int'); | |
| 4598 | + $inquiry = $input->get('inquiry', [], 'array'); | |
| 4582 | 4599 | $ulang = $input->getString('ulang', ''); |
| 4583 | 4600 | |
| 4584 | 4601 | $timeopst = VikBooking::getTimeOpenStore(); |
| 4585 | 4602 | if (empty($checkin_h) && empty($checkout_h) && is_array($timeopst)) { |
| @@ -4624,8 +4641,10 @@ | ||
| 4624 | 4641 | if (!is_scalar($info_val) || !strlen($info_val)) { |
| 4625 | 4642 | // empty or invalid field |
| 4626 | 4643 | continue; |
| 4627 | 4644 | } |
| 4645 | + // accept only text from submitted value | |
| 4646 | + $info_val = strip_tags($info_val); | |
| 4628 | 4647 | if ($info_type == 'nominative') { |
| 4629 | 4648 | if (empty($t_first_name)) { |
| 4630 | 4649 | $t_first_name = $info_val; |
| 4631 | 4650 | $res_custdata[JText::translate('VBNAME')] = $info_val; |