diff --git a/src/Models/SearchServices/PostSearchService.php b/src/Models/SearchServices/PostSearchService.php index a20ffcb7..d5e2c0d0 100644 --- a/src/Models/SearchServices/PostSearchService.php +++ b/src/Models/SearchServices/PostSearchService.php @@ -11,9 +11,10 @@ class PostSearchService extends AbstractSearchService protected static function filterUserSafety(SqlQuery $sqlQuery) { $allowedSafety = PrivilegesHelper::getAllowedSafety(); - $sqlQuery->raw('safety')->in()->genSlots($allowedSafety); - foreach ($allowedSafety as $s) - $sqlQuery->put($s); + if (empty($allowedSafety)) + $sqlQuery->raw('0'); + else + $sqlQuery->raw('safety')->in()->genSlots($allowedSafety)->put($allowedSafety); } protected static function filterUserHidden(SqlQuery $sqlQuery) @@ -55,7 +56,10 @@ class PostSearchService extends AbstractSearchService { $ids = preg_split('/[;,]/', $val); $ids = array_map('intval', $ids); - $sqlQuery->raw('id')->in()->genSlots($ids)->put($ids); + if (empty($ids)) + $sqlQuery->raw('0'); + else + $sqlQuery->raw('id')->in()->genSlots($ids)->put($ids); } protected static function filterTokenIdMin($searchContext, SqlQuery $sqlQuery, $val) diff --git a/src/Models/SearchServices/TagSearchService.php b/src/Models/SearchServices/TagSearchService.php index d0aa588d..9035bb2c 100644 --- a/src/Models/SearchServices/TagSearchService.php +++ b/src/Models/SearchServices/TagSearchService.php @@ -12,8 +12,11 @@ class TagSearchService extends AbstractSearchService ->innerJoin('post_tag') ->on('tag.id = post_tag.tag_id') ->innerJoin('post') - ->on('post.id = post_tag.post_id') - ->where('safety')->in()->genSlots($allowedSafety); + ->on('post.id = post_tag.post_id'); + if (empty($allowedSafety)) + $sqlQuery->where('0'); + else + $sqlQuery->where('safety')->in()->genSlots($allowedSafety); foreach ($allowedSafety as $s) $sqlQuery->put($s);