Skip to content

Commit

Permalink
Added Quote In Condition Filters
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaantony92 authored and dvesh3 committed Apr 13, 2022
1 parent 809851a commit adae3be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions bundles/AdminBundle/Controller/Admin/ElementController.php
Expand Up @@ -232,21 +232,20 @@ public function noteListAction(Request $request)
$filter['value'] = (int) $filter['value'];
}
// system field
$value = $filter['value'];
$value = ($filter['value']??'');
if ($operator == 'LIKE') {
$value = '%' . $value . '%';
}

if ($filter[$propertyKey] == 'user') {
$conditions[] = '`user` IN (SELECT `id` FROM `users` WHERE `name` LIKE ' . $list->quote('%'.$filter['value'].'%') . ')';
$conditions[] = '`user` IN (SELECT `id` FROM `users` WHERE `name` LIKE ' . $list->quote($value) . ')';
} else {
if ($filter['type'] == 'date' && $filter[$comparisonKey] == 'eq') {
$maxTime = $filter['value'] + (86400 - 1); //specifies the top point of the range used in the condition
$dateCondition = '`' . $filter[$propertyKey] . '` ' . ' BETWEEN ' . $db->quote($filter['value']) . ' AND ' . $db->quote($maxTime);
$maxTime = $value + (86400 - 1); //specifies the top point of the range used in the condition
$dateCondition = '`' . $filter[$propertyKey] . '` ' . ' BETWEEN ' . $db->quote($value) . ' AND ' . $db->quote($maxTime);
$conditions[] = $dateCondition;
} else {
$field = '`'.$filter[$propertyKey].'` ';
$conditions[] = $field.$operator.' '.$db->quote($value);
$conditions[] = $db->quoteIdentifier($filter[$propertyKey]).' '.$operator.' '.$db->quote($value);
}
}
}
Expand Down
Expand Up @@ -109,7 +109,7 @@ public function listAction(Request $request)
$value = '%' . $value . '%';
}

$field = '`' . $filterField . '` ';
$field = $db->quoteIdentifier($filterField);
if (($filter['field'] ?? false) == 'fullpath') {
$field = 'CONCAT(path,filename)';
}
Expand Down

0 comments on commit adae3be

Please sign in to comment.