}
$cond[] = "{$key} {$value[$i]['operator']} (" . implode(',', $tcond) . ')';
$value[$i]['operator'] = '';
+ } elseif ($value[$i]['operator'] == 'LIKE') {
+ $tcond = [];
+ for ($j = 0; $j < count($value[$i]['vals']); $j++) {
+ $tcond[] = "{$key} {$value[$i]['operator']} :{$kval}{$i}{$j}";
+ $vals[":{$kval}{$i}{$j}"] = $value[$i]['vals'][$j];
+ }
+ $cond[] = implode(' OR ', $tcond);
+ $value[$i]['operator'] = '';
} else {
// other operators
for ($j = 0; $j < count($value[$i]['vals']); $j++) {
public function get() {
$misc = $this->getModule('misc');
- $content = $this->Request->contains('content') && $misc->isValidName($this->Request['content']) ? $this->Request['content'] : '';
+ $content = $this->Request->contains('content') && $misc->isValidNameList($this->Request['content']) ? $this->Request['content'] : '';
$limit = $this->Request->contains('limit') && $misc->isValidInteger($this->Request['limit']) ? (int)$this->Request['limit'] : 0;
$offset = $this->Request->contains('offset') && $misc->isValidInteger($this->Request['offset']) ? (int)$this->Request['offset'] : 0;
$result = $this->getModule('bconsole')->bconsoleCommand(
];
if (!empty($content)) {
+ $cnts = explode(',', $content);
+ $cb = function ($item) {
+ return ('%' . trim($item) . '%');
+ };
+ $cnts = array_map($cb, $cnts);
$params['FileSet.Content'][] = [
'operator' => 'LIKE',
- 'vals' => '%' . $content . '%'
+ 'vals' => $cnts
];
}
{
"name": "content",
"in": "query",
- "description": "Content property value. There is possible to provide whole content value or only a part",
+ "description": "Content property value. There is possible to provide whole content value or only a part. Multiple comma separated values are allowed. Example: 'postgresql,file' value searches for filesets with postgresql OR file OR both.",
"required": false,
"schema": {
"type": "string",
return (preg_match('/^[\d,]+$/', $list) === 1);
}
+ public function isValidNameList($list) {
+ return (preg_match('/^[\w:\.\-\s,]+$/', $list) === 1);
+ }
+
public function isValidBvfsPath($path) {
return (preg_match('/^b2\d+$/', $path) === 1);
}