Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dba/PaginationFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function getQueryString(AbstractModelFactory $factory, bool $includeTable = fals
//ex. SELECT hashTypeId, description, isSalted, isSlowHash FROM HashType
// where (HashType.isSalted < 1) OR (HashType.isSalted = 1 and HashType.hashTypeId < 12600)
// ORDER BY HashType.isSalted DESC, HashType.hashTypeId DESC LIMIT 25;
$queryString = "(" . $table . AbstractModelFactory::getMappedModelKey($factory->getNullObject(), $this->key) . $this->operator . "?" . ") OR (" . AbstractModelFactory::getMappedModelKey($factory->getNullObject(), $this->key) . "=" . "?"
. " AND " . AbstractModelFactory::getMappedModelKey($factory->getNullObject(), $this->tieBreakerKey) . $this->operator . "?";
$queryString = "(" . $table . AbstractModelFactory::getMappedModelKey($factory->getNullObject(), $this->key) . $this->operator . "?" . ") OR (" . $table . AbstractModelFactory::getMappedModelKey($factory->getNullObject(), $this->key) . "=" . "?"
. " AND " . $table . AbstractModelFactory::getMappedModelKey($factory->getNullObject(), $this->tieBreakerKey) . $this->operator . "?";
if (count($this->filters) > 0) {
$queryString = $queryString . " AND " . implode(" AND ", $parts);
}
Expand Down
7 changes: 5 additions & 2 deletions src/inc/apiv2/common/AbstractBaseAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,11 @@ protected function makeFilter(array $filters, object $apiClass, array &$joinFilt
throw new HttpForbidden("Filter parameter '" . $filter . "' is not valid (key not valid field)");
};

$valueList = explode(",", $value);
// Only __in and __nin support comma-separated multiple values;
// all other operators treat the value as a literal string.
$operator = $matches['operator'];
$isListOperator = in_array($operator, ['__in', '__nin']);
$valueList = $isListOperator ? explode(",", $value) : [$value];

// TODO Merge/Combine with validate parameters
foreach ($valueList as &$value) {
Expand Down Expand Up @@ -1178,7 +1182,6 @@ protected function makeFilter(array $filters, object $apiClass, array &$joinFilt

$amount_values = count($valueList);
$single_val = $valueList[0];
$operator = $matches['operator'];
$query_operator = "";
switch (true) {
case (($operator == '__eq' | $operator == '') && $amount_values == 1):
Expand Down
Loading