diff --git a/public/api/ajax_pastes.php b/public/api/ajax_pastes.php index 4688dc8..b1ad931 100644 --- a/public/api/ajax_pastes.php +++ b/public/api/ajax_pastes.php @@ -23,12 +23,12 @@ $pastes = Paste::with([ ->where('hidden', false) ->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))"); -if (!empty($_GET['q']) && is_string($_GET['q'])) { - $tags = explode(',', $_GET['q']); - $pastes = $pastes->whereHas('tags', function($query) use ($tags) { - $query->where('name', $tags); - }); -} +// if (!empty($_GET['q']) && is_string($_GET['q'])) { +// $tags = explode(',', $_GET['q']); +// $pastes = $pastes->whereHas('tags', function($query) use ($tags) { +// $query->where('name', $tags); +// }); +// } $pastes = $pastes->orderBy('id', 'desc')->get(); diff --git a/public/archive.php b/public/archive.php index 2ff5f44..b0ef514 100644 --- a/public/archive.php +++ b/public/archive.php @@ -33,15 +33,16 @@ $pastes = Paste::with([ ->where('hidden', false) ->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))"); - if (!empty($filter_value)) { if ($filter_value === 'untagged') { $pastes = $pastes->doesntHave('tags'); } else { - $pastes = $pastes->where('title', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%') - ->orWhereHas('tags', function($q) use ($filter_value) { - $q->where('name', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%'); - }); + $pastes = $paste->where(function($query) { + $query->where('title', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%') + ->orWhereHas('tags', function($q) use ($filter_value) { + $q->where('name', 'LIKE', '%' . escapeLikeQuery($filter_value) . '%'); + }); + }); } }