Skip to content
Open
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
3 changes: 2 additions & 1 deletion core/models/media_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion core/models/playlists_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) . '")';
Expand Down
1 change: 1 addition & 0 deletions public/html/sidebar/advanced_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<div class="fieldrow">
<select onchange="OB.Sidebar.advancedSearchFilterChange();" id="advanced_search_filter">
<option value="id" data-compare="number" data-value="text" data-t>Media ID</option>
<option value="artist" data-compare="text" data-value="text" data-t>Artist</option>
<option value="title" data-compare="text" data-value="text" data-t>Title</option>
<option value="album" data-compare="text" data-value="text" data-t>Album</option>
Expand Down
Loading