diff options
Diffstat (limited to 'lib/class/query.class.php')
-rw-r--r-- | lib/class/query.class.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/class/query.class.php b/lib/class/query.class.php index 898e8029..11095b80 100644 --- a/lib/class/query.class.php +++ b/lib/class/query.class.php @@ -144,6 +144,10 @@ class Query { 'alpha_match', 'starts_with' ), + 'smartplaylist' => array( + 'alpha_match', + 'starts_with' + ), 'tag' => array( 'tag', 'object_type', @@ -194,6 +198,10 @@ class Query { 'name', 'user' ), + 'smartplaylist' => array( + 'name', + 'user' + ), 'shoutbox' => array( 'date', 'user', @@ -465,6 +473,7 @@ class Query { case 'video': case 'playlist': case 'playlist_song': + case 'smartplaylist': case 'song': case 'flagged': case 'catalog': @@ -735,6 +744,10 @@ class Query { $this->set_select("`playlist`.`id`"); $sql = "SELECT %%SELECT%% FROM `playlist` "; break; + case 'smartplaylist': + self::set_select('`search`.`id`'); + $sql = "SELECT %%SELECT%% FROM `search` "; + break; case 'flagged': $this->set_select("`flagged`.`id`"); $sql = "SELECT %%SELECT%% FROM `flagged` "; @@ -1127,6 +1140,20 @@ class Query { break; } // end filter break; + case 'smartplaylist': + switch ($filter) { + case 'alpha_match': + $filter_sql = " `search`.`name` LIKE '%" . Dba::escape($value) . "%' AND "; + break; + case 'starts_with': + $filter_sql = " `search`.`name` LIKE '" . Dba::escape($value) . "%' AND "; + break; + case 'playlist_type': + $user_id = intval($GLOBALS['user']->id); + $filter_sql = " (`search`.`type` = 'public' OR `search`.`user`='$user_id') AND "; + break; + } // end switch on $filter + break; case 'tag': switch ($filter) { case 'alpha_match': @@ -1251,6 +1278,19 @@ class Query { break; } // end switch break; + case 'smartplaylist': + switch ($field) { + case 'type': + $sql = "`search`.`type`"; + break; + case 'name': + $sql = "`search`.`name`"; + break; + case 'user': + $sql = "`search`.`user`"; + break; + } // end switch on $field + break; case 'live_stream': switch ($field) { case 'name': |