diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2011-06-28 14:30:52 -0400 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2011-06-28 14:30:52 -0400 |
commit | 1e05bfe554bb26c439fa19aa61ed692c858d773f (patch) | |
tree | 40e5b2cfa3e74ce034c4e1063bcc5fbc1190d85b | |
parent | 6fd6cc1fcc62f0d4e4af767b4119b388d9a3221b (diff) | |
download | ampache-1e05bfe554bb26c439fa19aa61ed692c858d773f.tar.gz ampache-1e05bfe554bb26c439fa19aa61ed692c858d773f.tar.bz2 ampache-1e05bfe554bb26c439fa19aa61ed692c858d773f.zip |
Fix broken API method
Api::search_songs needed to declare a type, and Search::run needed to
honour that declaration.
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rw-r--r-- | lib/class/api.class.php | 1 | ||||
-rw-r--r-- | lib/class/search.class.php | 15 |
3 files changed, 16 insertions, 1 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 6ee0f3f8..38b6267f 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -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) diff --git a/lib/class/api.class.php b/lib/class/api.class.php index 631308eb..91433437 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -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; diff --git a/lib/class/search.class.php b/lib/class/search.class.php index f2c3cee9..cdb9422e 100644 --- a/lib/class/search.class.php +++ b/lib/class/search.class.php @@ -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 */ |