Fixed: validate request parameters before database query

Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
amit sharma
2026-07-14 17:07:24 +05:30
parent 5b4d65cbb8
commit 123c97c110
5 changed files with 12 additions and 12 deletions

View File

@@ -543,14 +543,14 @@ class AddressCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'state` s
ON s.`id_country` = cl.`id_country` AND s.`id_state` = a.`id_state`
WHERE id_customer > 0 AND a.`deleted` = 0 AND
(a.`address1` LIKE \'%'.$query.'%\' OR
a.`postcode` LIKE \'%'.$query.'%\' OR
a.`city` LIKE \'%'.$query.'%\' OR
a.`phone` LIKE \'%'.$query.'%\' OR
a.`company` LIKE \'%'.$query.'%\' OR
a.`alias` LIKE \'%'.$query.'%\' OR
s.`name` LIKE \'%'.$query.'%\' OR
cl.`name` LIKE \'%'.$query.'%\'
(a.`address1` LIKE \'%'.pSQL($query).'%\' OR
a.`postcode` LIKE \'%'.pSQL($query).'%\' OR
a.`city` LIKE \'%'.pSQL($query).'%\' OR
a.`phone` LIKE \'%'.pSQL($query).'%\' OR
a.`company` LIKE \'%'.pSQL($query).'%\' OR
a.`alias` LIKE \'%'.pSQL($query).'%\' OR
s.`name` LIKE \'%'.pSQL($query).'%\' OR
cl.`name` LIKE \'%'.pSQL($query).'%\'
)
');
}

View File

@@ -146,7 +146,7 @@ class CustomerMessageCore extends ObjectModel
ON (ct.`id_customer_thread` = cm.`id_customer_thread`)
LEFT JOIN '._DB_PREFIX_.'customer c
ON (IFNULL(ct.`id_customer`, ct.`email`) = IFNULL(c.`id_customer`, c.`email`))
WHERE `message` LIKE \'%'.$query.'%\'
WHERE `message` LIKE \'%'.pSQL($query).'%\'
');
}

View File

@@ -87,7 +87,7 @@ class HotelBranchRefundRules extends ObjectModel
$condition .= ' AND `id_refund_rule` = '.(int)$idRefundRule;
}
if ($notInVals) {
$condition .= ' AND `id_refund_rule` NOT IN ('.implode(',', $notInVals).')';
$condition .= ' AND `id_refund_rule` NOT IN ('.implode(',', array_map('intval', $notInVals)).')';
}
return Db::getInstance()->delete(
'htl_branch_refund_rules',

View File

@@ -149,7 +149,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp
ON (rtfpr.`id_feature_price` = rtfp.`id_feature_price` AND rtfp.`id_product`='.(int) $idRoomType.')
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg
ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price` '.($groups ? ' AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')' : ' ' ).')
ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price` '.($groups ? ' AND rtfpg.`id_group` IN ('.implode(', ', array_map('intval', $groups)).')' : ' ' ).')
WHERE 1 '.( !is_null($active) ? ' AND rtfp.`active`= '.(int) $active: ' ').' ' .(!is_null($skipFeaturePriceId) ? ' AND rtfpr.`id_feature_price`!='.(int) $skipFeaturePriceId : ' ');
$sqlWhere = '';
if ($restrictions && is_array($restrictions)) {

View File

@@ -113,7 +113,7 @@ class HotelRoomTypeGlobalDemandAdvanceOption extends ObjectModel
$sql = 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`
WHERE `id_global_demand` = '.(int)$idGlobalDemand;
if (count($skipIds)) {
$sql .= ' AND `id_option` NOT IN ('.pSQL(implode(',', $skipIds)).')' ;
$sql .= ' AND `id_option` NOT IN ('.implode(',', array_map('intval', $skipIds)).')' ;
}
if ($advOptions = Db::getInstance()->executeS($sql)) {
foreach ($advOptions as &$option) {