diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/ajax.class.php | 6 | ||||
-rw-r--r-- | lib/class/browse.class.php | 14 | ||||
-rw-r--r-- | lib/class/localplay.abstract.php | 2 | ||||
-rw-r--r-- | lib/class/localplay.class.php | 45 | ||||
-rw-r--r-- | lib/ui.lib.php | 10 |
5 files changed, 32 insertions, 45 deletions
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php index f5984912..e4e4baf8 100644 --- a/lib/class/ajax.class.php +++ b/lib/class/ajax.class.php @@ -82,12 +82,6 @@ class Ajax { $source_txt = "'$source'"; } - /* - Replaces ampersand with & for w3c conformance. - Fixme: ajax doesn't seem to work anymore with this... - */ - //$url = htmlspecialchars($url); - if ($post) { $ajax_string = "ajaxPost('$url','$post',$source_txt)"; } diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index fbcc2948..cb8acbb7 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -78,6 +78,20 @@ class Browse { } // set_filter /** + * reset_filter + * This is a wrapper function that resets the filters + */ + public static function reset_filters() { + + if (!is_array($_SESSION['browse']['filter'])) { return true; } + + foreach ($_SESSION['browse']['filter'] AS $key=>$value) { + self::set_filter($key,''); + } + + } // reset_filters + + /** * get_filter * returns the specified filter value */ diff --git a/lib/class/localplay.abstract.php b/lib/class/localplay.abstract.php index 12df43cb..0d870b05 100644 --- a/lib/class/localplay.abstract.php +++ b/lib/class/localplay.abstract.php @@ -26,7 +26,7 @@ abstract class localplay_controller { // Required Functions abstract public function add($objects); // Takes an array of song_ids - abstract public function delete($objects); // Takes an array of song_ids + abstract public function delete_track($object_id); // Takes a single object_id and removes it from the playlist abstract public function play(); abstract public function stop(); abstract public function get(); diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 6f996e3f..7b2ffbd6 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -120,22 +120,6 @@ class Localplay { } // _load_player /** - * has_function - * This is used to check the function map and see if the current - * player type supports the indicated function. - */ - public function has_function($function_name) { - - /* Check the function map, if it's got a value it must - * be possible - */ - if (strlen($this->_function_map[$function_name]) > 0) { return true; } - - return false; - - } // has_function - - /** * format_name * This function takes the track name and checks to see if 'skip' * is supported in the current player, if so it returns a 'skip to' @@ -144,13 +128,7 @@ class Localplay { public function format_name($name,$id) { $name = scrub_out($name); - - if ($this->has_function('skip')) { - $url = conf('ajax_url') . "?action=localplay&cmd=skip&value=$id" . conf('ajax_info'); - - $name = "<span style=\"cursor:pointer;text-decoration:underline;\" onclick=\"ajaxPut('$url');return true;\">$name</span>"; - } - + $name = Ajax::text('?page=localplay&action=command&command=skip&id=' . $id,$name,'localplay_skip_' . $id); return $name; } // format_name @@ -385,10 +363,8 @@ class Localplay { */ public function get() { - $function = $this->_function_map['get']; - - $data = $this->_player->$function(); - + $data = $this->_player->get(); + if (!count($data) OR !is_array($data)) { debug_event('localplay','Error Unable to get song info, check ' . $this->type . ' controller','1'); return array(); @@ -481,9 +457,9 @@ class Localplay { * skip * This isn't a required function, it tells the daemon to skip to the specified song */ - public function skip($song_id) { + public function skip($track_id) { - if (!$this->_player->$function($song_id)) { + if (!$this->_player->skip($track_id)) { debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1'); return false; } @@ -608,14 +584,13 @@ class Localplay { } // set_active_instance /** - * delete - * This removes songs from the players playlist as defined get function + * delete_track + * This removes songs from the players playlist it takes a single ID as provided + * by the get command */ - public function delete($songs) { + public function delete_track($object_id) { - $function = $this->_function_map['delete']; - - if (!$this->_player->$function($songs)) { + if (!$this->_player->delete_track($object_id)) { debug_event('localplay','Error: Unable to remove songs, check ' . $this->type . ' controller','1'); return false; } diff --git a/lib/ui.lib.php b/lib/ui.lib.php index d785431f..cbfb0fc1 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -1004,8 +1004,12 @@ function get_user_icon($name,$title='',$id='') { * primarly by the ajax mojo */ function xml_from_array($array,$callback=0,$type='') { + + // If we weren't passed an array then return a blank string + if (!is_array($array)) { return ''; } + + // The type is used for the different XML docs we pass switch ($type) { - case 'itunes': foreach ($array as $key=>$value) { if (is_array($value)) { @@ -1025,7 +1029,7 @@ function xml_from_array($array,$callback=0,$type='') { } } - } + } // end foreach return $string; break; @@ -1046,7 +1050,7 @@ function xml_from_array($array,$callback=0,$type='') { } } - } + } // end foreach return $string; break; |