diff --git a/core/models/media_model.php b/core/models/media_model.php index ad873823..14312178 100644 --- a/core/models/media_model.php +++ b/core/models/media_model.php @@ -954,7 +954,7 @@ public function search_filters_validate($args = []) OBFHelpers::require_args($args, ['filters']); $filters = $args['filters']; - $allowed_filters = ['comments','artist','title','album','year','type','category','country','language','genre','duration','is_copyright_owner','status','dynamic_select']; + $allowed_filters = ['id','comments','artist','title','album','year','type','category','country','language','genre','duration','is_copyright_owner','status','dynamic_select']; $allowed_operators = [ // deprecated 'like', @@ -1036,6 +1036,7 @@ public function search_filters_where_array($args = []) $column_array['duration'] = 'media.duration'; $column_array['comments'] = 'media.comments'; $column_array['is_copyright_owner'] = 'media.is_copyright_owner'; + $column_array['id'] = 'media.id'; $column_array['dynamic_select'] = 'media.dynamic_select'; $metadata_fields = $this->models->mediametadata('get_all'); diff --git a/core/models/playlists_model.php b/core/models/playlists_model.php index 86649a37..c95422da 100644 --- a/core/models/playlists_model.php +++ b/core/models/playlists_model.php @@ -299,7 +299,12 @@ public function search($query, $limit, $offset, $sort_by, $sort_dir, $my = false $where_strings = []; if ($query !== '' && $query !== false && $query !== null) { - $where_strings[] = '(name LIKE "%' . $this->db->escape($query) . '%" OR description LIKE "%' . $this->db->escape($query) . '%")'; + // If query is numeric, also search by ID + if (is_numeric($query)) { + $where_strings[] = '(id = "' . $this->db->escape($query) . '" OR name LIKE "%' . $this->db->escape($query) . '%" OR description LIKE "%' . $this->db->escape($query) . '%")'; + } else { + $where_strings[] = '(name LIKE "%' . $this->db->escape($query) . '%" OR description LIKE "%' . $this->db->escape($query) . '%")'; + } } if (!$this->user->check_permission('manage_playlists')) { $where_strings[] = '(status = "public" or status = "visible" or owner_id = "' . $this->db->escape($this->user->param('id')) . '")'; diff --git a/public/html/sidebar/advanced_search.html b/public/html/sidebar/advanced_search.html index cffcba45..27327104 100644 --- a/public/html/sidebar/advanced_search.html +++ b/public/html/sidebar/advanced_search.html @@ -7,6 +7,7 @@