mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 17:59:21 +02:00
Fix broken API method
Api::search_songs needed to declare a type, and Search::run needed to honour that declaration.
This commit is contained in:
parent
6fd6cc1fcc
commit
1e05bfe554
3 changed files with 16 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
--------------------------------------------------------------------------
|
||||
v.3.6-Alpha2
|
||||
- Fixed search_songs API method to use Search::run properly
|
||||
- Fixed require_session when auth_type is 'local'
|
||||
- Catalog filtering fix
|
||||
- Toggle artwork with a button instead of a checkbox (patch from mywindow)
|
||||
|
|
|
@ -581,6 +581,7 @@ class Api {
|
|||
* This searches the songs and returns... songs
|
||||
*/
|
||||
public static function search_songs($input) {
|
||||
$array['type'] = 'song';
|
||||
$array['rule_1'] = 'anywhere';
|
||||
$array['rule_1_input'] = $input['filter'];
|
||||
$array['rule_1_operator'] = 0;
|
||||
|
|
|
@ -461,6 +461,19 @@ class Search extends playlist_object {
|
|||
$request['operator'] = 'AND';
|
||||
break;
|
||||
} // end switcn on operator
|
||||
|
||||
// Verify the type
|
||||
switch($data['type']) {
|
||||
case 'album':
|
||||
case 'artist':
|
||||
case 'video':
|
||||
case 'song':
|
||||
$request['type'] = $data['type'];
|
||||
break;
|
||||
default:
|
||||
$request['type'] = 'song';
|
||||
break;
|
||||
}
|
||||
|
||||
return $request;
|
||||
} // end clean_request
|
||||
|
@ -504,7 +517,7 @@ class Search extends playlist_object {
|
|||
/* Create an array of the object we need to search on */
|
||||
$data = Search::clean_request($data);
|
||||
|
||||
$search = new Search($_REQUEST['type']);
|
||||
$search = new Search($data['type']);
|
||||
$search->parse_rules($data);
|
||||
|
||||
/* Generate BASE SQL */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue