? filename.patch
? xspf_playlist.admin.inc
? xspf_playlist.drupal6.patch
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/README.txt,v
retrieving revision 1.4.2.4
diff -u -p -r1.4.2.4 README.txt
--- README.txt	3 Jul 2008 20:37:54 -0000	1.4.2.4
+++ README.txt	10 Oct 2008 11:29:15 -0000
@@ -1,16 +1,16 @@
 // $Id $
 
-The XSPF Playlist module generates a XSPF playlist suitable for use with various 
-players. While et was designed for Jeroen Wijering's flash player, it should work with
+The XSPF Playlist module generates a XSPF playlist suitable for use with various
+players. While it was designed for Jeroen Wijering's flash player, it should work with
 other players.
 
-The admin interface allows the administrator to select what node types 
-it works on, choose a default thumbnail file to use, and forthcoming support for CCK 
-fields. It also supports multiple file types (audio, video, flash) that are supported 
+The admin interface allows the administrator to select what node types
+it works on, choose a default thumbnail file to use, and forthcoming support for CCK
+fields. It also supports multiple file types (audio, video, flash) that are supported
 by the flash player.
 
 You can generate a xspf playlist for a node by using the url:
-http//mysite.com/xspf/node/NID 
+http//mysite.com/xspf/node/NID
 where NID is the node id of the node that you want the playlist for.
 
 You can also create an XSPF file form a view- go to admin/build/views and select XSPF Playlist
Index: xspf_playlist.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist.info,v
retrieving revision 1.5.2.3
diff -u -p -r1.5.2.3 xspf_playlist.info
--- xspf_playlist.info	4 Jul 2008 21:23:47 -0000	1.5.2.3
+++ xspf_playlist.info	10 Oct 2008 11:29:15 -0000
@@ -2,3 +2,5 @@
 name = "XSPF Playlist"
 description = "Generates XSPF playlists."
 package = "Media"
+core = 6.x
+version = 6.x-2.0
Index: xspf_playlist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist.module,v
retrieving revision 1.26.2.37
diff -u -p -r1.26.2.37 xspf_playlist.module
--- xspf_playlist.module	7 Oct 2008 19:09:39 -0000	1.26.2.37
+++ xspf_playlist.module	10 Oct 2008 11:29:15 -0000
@@ -1,72 +1,28 @@
 <?php
-
 // $Id: xspf_playlist.module,v 1.26.2.37 2008/10/07 19:09:39 arthuregg Exp $
 
-/* ******************************************************* */
-/* DRUPAL FUNCTIONS */
-/* ******************************************************* */
-
 /**
- * Implementation of hook_menu().
+ * @file
+ * Engine behind the XSPF Playlist set of modules.
  */
-function xspf_playlist_menu($may_cache) {
-  $items = array();
-  
-  if ($may_cache) {
-    $items[] = array (
-      'path' => 'admin/settings/xspf-playlist',
-      'title' => t('XSPF playlist settings'),
-      'description' => t('Settings for the xspf playlist module.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('xspf_playlist_admin_settings'),
-      'access' => user_access('administer xspf_playlist'),
-    );
-  }
-
-  return $items;
-}
-
 
 /**
- * Menu callback for administrative settings.
+ * Implementation of hook_menu().
  */
-function xspf_playlist_admin_settings() {
-
-  $form = array();
-  
-  $form['settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Settings'),
-  );
-
-  $form['settings']['xspf_playlist_title'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Default playlist title'),
-    '#default_value' => variable_get('xspf_playlist_title', t('!sitename playlist', array('!sitename' =>  variable_get('site_name', 'Drupal')))),
-    '#description' => t('Displayed on playlist.'),
-  );
-
-  $form['settings']['xspf_playlist_info'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Default playlist info'),
-    '#default_value' => variable_get('xspf_playlist_info', ''),
-    '#description' => t('Information about this playlist. Some players will display this information')
-  );
-
-  $form['settings']['xspfp_filetype'] = array(
-    '#type' => 'textfield',
-    '#title' => t('File type support'),
-    '#default_value' => variable_get('xspfp_filetype', 'flv,jpg,gif,png,mp3'),
-    '#description' =>t('Will only use attached files of these file types. Comma seperated list, avoid spaces.'),
+function xspf_playlist_menu() {
+  $items['admin/settings/xspf-playlist'] = array(
+    'title' => 'XSPF playlist settings',
+    'description' => 'Settings for the xspf playlist module.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('xspf_playlist_admin_settings'),
+    'access arguments' => array('administer xspf_playlist'),
+    'type' => MENU_NORMAL_ITEM,
+    'file' => 'xspf_playlist.admin.inc',
   );
 
-  $form = system_settings_form($form);
-  // Set a high weight to facilitate other modules adding items above the buttons.
-  $form['buttons']['#weight'] = 5;
-  return $form;
+  return $items;
 }
 
-
 /**
  * Implementation of hook_perm().
  */
@@ -144,7 +100,7 @@ function _xspf_playlist_item_get_value($
  *   The value to set the key to.
  */
 function _xspf_playlist_item_set_value(&$item, $key, $value) {
-  // Set any existing 
+  // Set any existing
   foreach ($item as $index => $attribute) {
     if (isset($attribute['key']) && $attribute['key'] == $key) {
       $item[$index]['value'] = $value;
@@ -166,13 +122,12 @@ function xspf_playlist_configuration() {
   $configuration = array(
     'title' => variable_get('xspf_playlist_title', t('My playlist')),
     'info' => variable_get('xspf_playlist_info', ''),
-    'link' => url(null, null, null, true),
+    'link' => url(NULL, array('absolute' => TRUE)),
     'annotation' => variable_get('xspf_playlist_info', ''),
   );
   return $configuration;
 }
 
-
 /**
  * Adaptation of Drupal 6 drupal_alter().
  *
@@ -251,7 +206,9 @@ function _xspf_playlist_filetype_support
   $allowed = variable_get('xspfp_filetype', 'flv,jpg,gif,png,mp3');
   $pattern = "/$filetype/i";
   preg_match($pattern, $allowed, $matches);
-  if ($matches) { return true; }
+  if ($matches) {
+    return TRUE;
+  }
 }
 
 /**
@@ -266,16 +223,15 @@ function _xspf_playlist_filetype_support
 function xspf_playlist_url($path, $custom_base_url = NULL) {
   // Fetch a custom base URL, if present.
   $custom_base_url = variable_get('xspf_playlist_base_url', $GLOBALS['base_url']);
-  
+
   // NOTE: doing it this way because i18n gets in the way url()
   $url = $custom_base_url .'/'. $path;
-  
+
   // Restore the cached $base_url value.
   $base_url = $cached;
   return $url;
 }
 
-
 /**
  * Create an XML playlist file.
  *
@@ -299,7 +255,7 @@ function xspf_playlist_list($playlist, $
   $output[] = format_xml_elements($playlist) . '<trackList>';
 
   if (!empty($items)) {
-    foreach($items as $item){
+    foreach ($items as $item) {
       // Add another item.
       $output[] = xspf_playlist_item($item);
     }
@@ -310,7 +266,6 @@ function xspf_playlist_list($playlist, $
   return implode("\n", $output);
 }
 
-
 /**
  * Create a playlist item for an xml file.
  *
@@ -348,17 +303,3 @@ function xspf_playlist_render($playlist 
   xspf_playlist_build_list($playlist, $type, $subtype, $object);
   print xspf_playlist_list($playlist, $type, $subtype, $object);
 }
-
-/* ******************************************************* */
-/* THEME FUNCTIONS */
-/* ******************************************************* */
-
-/**
- * creates the potential for overriding this
- * @param $node is a node object
- * @return string
- */
-function theme_xspf_playlist_info($node) {
-  return variable_get('xspf_playlist_info', '');
-}
-
Index: xspf_playlist_node/xspf_playlist_node.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist_node/xspf_playlist_node.info,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 xspf_playlist_node.info
--- xspf_playlist_node/xspf_playlist_node.info	4 Jul 2008 21:23:47 -0000	1.1.2.3
+++ xspf_playlist_node/xspf_playlist_node.info	10 Oct 2008 11:29:15 -0000
@@ -2,5 +2,7 @@
 name = "XSPF Playlist Node"
 description = "Generates an XSPF playlist from node content."
 package = "Media"
-dependencies = xspf_playlist xspf_playlist_thumb
-
+dependencies[] = xspf_playlist
+dependencies[] = xspf_playlist_thumb
+core = 6.x
+version = 6.x-2.0
Index: xspf_playlist_node/xspf_playlist_node.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist_node/xspf_playlist_node.install,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 xspf_playlist_node.install
--- xspf_playlist_node/xspf_playlist_node.install	4 Jul 2008 21:23:47 -0000	1.1.2.3
+++ xspf_playlist_node/xspf_playlist_node.install	10 Oct 2008 11:29:15 -0000
@@ -1,4 +1,10 @@
 <?php
+// $Id$
+
+/**
+ * @file
+ * Install file for the XSPF Playlist Node module.
+ */
 
 /**
  * Implementation of hook_install().
@@ -16,7 +22,7 @@ function xspf_playlist_node_import_setti
 
   // Import any variables previously handled by xsdf_playlist module.
   // Import the xspf_playlist_types variable.
-  if ($enabled_types = array_filter(variable_get('xspf_playlist_types', FALSE))) {
+  if ($enabled_types = array_filter(variable_get('xspf_playlist_types', array()))) {
     // Update settings for existing content types.
     foreach ($enabled_types as $type) {
       if ($types = array_filter(variable_get('xspf_' . $type . '_use'))) {
@@ -28,7 +34,7 @@ function xspf_playlist_node_import_setti
         variable_set('xspf_' . $type . '_use', drupal_map_assoc($values));
       }
       // Import any field-related variables.
-      if (isset($types[$type]['fields'])){
+      if (isset($types[$type]['fields'])) {
         foreach ($types[$type]['fields'] as $field) {
           // Only bother with text, images or files.
           if (in_array($field['type'], array('text', 'image', 'file', 'file_video') )) {
@@ -50,7 +56,7 @@ function xspf_playlist_node_import_setti
   variable_del('xspf_playlist_types');
 
   // Claim any views previously created with xspf_playlist module.
-  if (module_exists('views') && db_num_rows("SELECT * FROM {view_view} WHERE page_type = 'xspf_playlist'")) {
+  if (module_exists('views') && db_result(db_query("SELECT COUNT(*) FROM {view_view} WHERE page_type = 'xspf_playlist'"))) {
     db_query("UPDATE {view_view} SET page_type = 'xspf_playlist_node' WHERE page_type = 'xspf_playlist'");
     views_invalidate_cache();
   }
@@ -58,8 +64,6 @@ function xspf_playlist_node_import_setti
 
 /**
  * Implementation of hook_uninstall().
- *
- * Remove variables handled by this module.
  */
 function xspf_playlist_node_uninstall() {
   $variables = array(
@@ -67,7 +71,7 @@ function xspf_playlist_node_uninstall() 
   );
   // Clean up variables set by content type.
   $types = _node_types_build();
-  if ($enabled_types = array_filter(variable_get('xspf_playlist_node_types', FALSE))) {
+  if ($enabled_types = array_filter(variable_get('xspf_playlist_node_types', array()))) {
     foreach ($enabled_types as $type) {
       $variables[] = 'xspf_' . $type . '_use';
       $variables[] = 'xspf_playlist_'. $type .'_fields';
@@ -79,4 +83,3 @@ function xspf_playlist_node_uninstall() 
     variable_del($name);
   }
 }
-
Index: xspf_playlist_node/xspf_playlist_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist_node/xspf_playlist_node.module,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 xspf_playlist_node.module
--- xspf_playlist_node/xspf_playlist_node.module	7 Oct 2008 19:09:39 -0000	1.1.2.5
+++ xspf_playlist_node/xspf_playlist_node.module	10 Oct 2008 11:29:16 -0000
@@ -1,19 +1,20 @@
 <?php
+// $Id$
+
+/**
+ * @file
+ * Module to extend the XSPF Playlist functionality to nodes
+ */
 
 /**
  * Implementation of hook_menu().
  */
-function xspf_playlist_node_menu($may_cache) {
-  $items = array();
-  
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'xspf/node',
-      'callback' => 'xspf_playlist_node_view',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK,
-    );
-  }
+function xspf_playlist_node_menu() {
+  $items['xspf/node'] = array(
+    'page callback' => 'xspf_playlist_node_view',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
 
   return $items;
 }
@@ -26,14 +27,30 @@ function xspf_playlist_node_perm() {
 }
 
 /**
+ * Implementation of hook_theme().
+ */
+function xspf_playlist_theme() {
+  return array(
+    'xspf_playlist_node_feed' => array(
+      'arguments' => array(
+        'view' => NULL,
+        'results' => NULL,
+        'type' => NULL,
+      ),
+    ),
+  );
+}
+
+/**
  * Implementation of hook_form_alter().
  *
  * Display a playlist builder on the node edit form and add configuration fields
  * to the XSPF Playlist admin settings form.
  */
-function xspf_playlist_node_form_alter($form_id, &$form) {
+function xspf_playlist_node_form_alter(&$form, &$form_state, $form_id) {
   // Get the node types that xspf is enabled on.
   $node_types = variable_get('xspf_playlist_node_types', array());
+
   // Display playlist builder on node edit page
   if (isset($form['type']) && isset($node_types[$form['type']['#value']]) && user_access('build playlist on node') ) {
     xspf_playlist_node_builder($form);
@@ -48,20 +65,19 @@ function xspf_playlist_node_form_alter($
 
     // get all the content types and put them into an array
     $types = _node_types_build();
-    foreach($types[0] as $type){
+    foreach ($types[0] as $type) {
       $options[$type->type] = $type->name;
     }
     $enabled_types = array_filter(variable_get('xspf_playlist_node_types', array()));
     $form['content']['xspf_playlist_node_types'] = array(
      '#type' => 'select',
-     '#multiple' => true,
+     '#multiple' => TRUE,
      '#title' => t('Playlist enabled'),
      '#description' => t('Choose which content types you want to be able to use playlists on.'),
      '#options' => $options,
      '#default_value' => $enabled_types,
     );
 
-
     if (!empty($enabled_types)) {
       foreach ($enabled_types as $name => $value) {
         // create content type field set
@@ -71,24 +87,31 @@ function xspf_playlist_node_form_alter($
         );
 
         // implement xspf_playlist_use
-        $options = module_invoke_all('xspf_playlist_use', 'define', null, null);
+        $options = module_invoke_all('xspf_playlist_use', 'define', NULL, NULL);
 
+        // if there are no items to build the checkbox, we can't go on with this type
+        // so we display an error message instructing the user what to do next
+        if (empty($options)) {
+          $message  = $types[1][$value]. " content type doesn't have any method of attaching files for the playlist. ";
+          $message .= 'Please enable either the upload module or the CCK module.';
+          $form['content']['thetype_'. $value]['#description'] = t($message);
+          continue;
+        }
+
+        // prepare a message depending on the results of xspf_playlist_use
         // select where to build
         $form['content']['thetype_'. $value]['xspf_'. $value .'_use'] = array(
           '#type' => 'checkboxes',
           '#title' => t('Build playlist from'),
           '#options' => $options,
-          '#default_value' => variable_get('xspf_'. $value .'_use', ''),
+          '#default_value' => variable_get('xspf_'. $value .'_use', array()),
           '#description' => t('XSPF playlist will build its playlist from files associated with the items that you\'ve selected.'),
         );
 
-
-        if (isset($types[$name]) && isset($types[$name]['fields'])){
+        if (isset($types[$name]) && isset($types[$name]['fields'])) {
           foreach ($types[$name]['fields'] as $field) {
-
             // only bother with text, images or files
             if (in_array($field['type'], array('text', 'image', 'file', 'file_video') )) {
-
               // create the field name option list used below
               $field_names[$field['field_name']] = $field['widget']['label'];
 
@@ -107,20 +130,20 @@ function xspf_playlist_node_form_alter($
 
         // Add any config items that we've got
         // make an artifical node
-        $my_node = new StdClass();
+        $my_node = new stdClass();
         $my_node->type = $value;
         foreach (variable_get('xspf_'. $value .'_use', array()) as $extension) {
           $form['content']['thetype_'. $value][] =  xspf_playlist_invoke_fire('xspf_playlist_use', 'config', $my_node, $extension);
         }
 
         // get any modules which implement thumbnails
-        $fields = module_invoke_all('xspf_playlist_thumbnail', 'define', null);
+        $fields = module_invoke_all('xspf_playlist_thumbnail', 'define', NULL);
 
         $form['content']['thetype_'. $value]['xspf_'. $value .'_thumb'] = array(
           '#title' => t('Default thumbnail field'),
           '#type' => 'select',
           '#options' => $fields,
-          '#multiple' => true,
+          '#multiple' => TRUE,
           '#default_value' => variable_get('xspf_'. $value .'_thumb', ''),
           '#description' => t('Select the thumbnail type you would like to use. You can select multiple, but if multiple thumbnails for an item exist, the first one found will be used.'),
         );
@@ -134,17 +157,16 @@ function xspf_playlist_node_form_alter($
         $form['content']['thetype_'. $value]['xspf_'. $value .'_thumb_first'] = array(
           '#title' => t('Use thumbnail only for first playlist item'),
           '#type' => 'checkbox',
-          '#default_value' => variable_get('xspf_'. $value .'_thumb_first', false),
+          '#default_value' => variable_get('xspf_'. $value .'_thumb_first', FALSE),
           '#description' => t('By default, all items on the playlist have a thumbnail applied. This can create conditions where the thumbnail is shown behind the content being displayed (especially on images). If you check this, a thumbnail will only be show on the first item on the playlist.'),
         );
-
       }
     }
   }
 }
 
 /**
- * Implementation of hook_nodeapi
+ * Implementation of hook_nodeapi().
  *
  * @param object $node
  * @param string $op
@@ -165,10 +187,10 @@ function xspf_playlist_node_nodeapi(&$no
 }
 
 /**
- * Implemenation of hook_xspf_playlist_use().
+ * Implementation of hook_xspf_playlist_use().
  */
 function xspf_playlist_node_xspf_playlist_use($op, $node, $config) {
-  switch($op){
+  switch ($op) {
     case 'define':
       $types = array();
       if (module_exists('upload')) {
@@ -181,7 +203,7 @@ function xspf_playlist_node_xspf_playlis
       break;
 
     case 'config':
-      switch($config) {
+      switch ($config) {
         case 1:
         break;
         case 2:
@@ -191,7 +213,7 @@ function xspf_playlist_node_xspf_playlis
     break;
 
     case 'return':
-      switch($config) {
+      switch ($config) {
         case 1:
           if ($node->files) {
             $items = xspf_playlist_node_get_files_from_node($node);
@@ -237,21 +259,21 @@ function xspf_playlist_node_view($nid) {
  * @param int $limit
  * @return array of item arrays
  */
-function xspf_playlist_node_items($node, $limit = null) {
+function xspf_playlist_node_items($node, $limit = NULL) {
   // Check to see if we should use any files
-  if ($modules = variable_get('xspf_'. $node->type .'_use', null) ) {
+  if ($modules = variable_get('xspf_'. $node->type .'_use', NULL) ) {
     $items = array();
     $nodes = array();
-    foreach (array_filter($modules) as $config) {      
+    foreach (array_filter($modules) as $config) {
       if ($item = xspf_playlist_invoke_fire('xspf_playlist_use', 'return', $node, $config)) {
         // has a limit been set on how many items to return?
-        if ($limit) { 
+        if ($limit) {
           // correct the split for one off error
           $item = array_slice($item, 0, $limit);
           // increment our counter
           $nodes[$node->nid] = $nodes[$node->nid] + 1;
           if ($limit >= $nodes[$node->nid]) {
-            $items = array_merge($items, $item);  
+            $items = array_merge($items, $item);
           }
         }
         else {
@@ -286,7 +308,7 @@ function xspf_playlist_node_create_file_
  */
 function xspf_playlist_node_get_files_from_node($node) {
   $items = array();
-  
+
   // loop through files
   if (isset($node->files)) {
     foreach ($node->files as $file) {
@@ -311,10 +333,10 @@ function xspf_playlist_node_get_files_fr
  * @param string $url url to file that is being added to the items array
  * @param string $thumb is a thumbnail path string
  */
-function xspf_playlist_node_build_file_item($node, $url, $thumb = null, $meta = null) {
+function xspf_playlist_node_build_file_item($node, $url, $thumb = NULL, $meta = NULL) {
 
   $item = array();
-  
+
   $item[] = array(
     'key' => 'creator',
     'value' => check_plain($node->name),
@@ -323,10 +345,10 @@ function xspf_playlist_node_build_file_i
   // check which thumb value to use
   $thumb = $thumb ? $thumb : xspf_playlist_node_thumb_get($node, $url);
   if ($thumb) {
-	  $item[] = array(
-	    'key' => 'image',
-	    'value' => $thumb,
-	  );
+    $item[] = array(
+      'key' => 'image',
+      'value' => $thumb,
+    );
   }
 
   $item[] = array(
@@ -341,7 +363,9 @@ function xspf_playlist_node_build_file_i
   );
 
   // only return last three chars of file type
-  if ($meta) { $type = $meta; }
+  if ($meta) {
+    $type = $meta;
+  }
   else {
     $path_parts = pathinfo($url);
     $type = $path_parts['extension'];
@@ -377,15 +401,15 @@ function xspf_playlist_node_build_file_i
  */
 function xspf_playlist_node_config_files_from_cck($node) {
   $form = array();
-  
+
   $form['xspf_playlist_node_cck_fields_'. $node->type] = array(
     '#title' => t('CCK fields to get files from'),
     '#type' => 'select',
-    '#multiple' => true,
+    '#multiple' => TRUE,
     '#options' => xspf_playlist_content_fields(),
     '#default_value' => variable_get('xspf_playlist_node_cck_fields_'. $node->type, array()),
   );
-  
+
   return $form;
 }
 
@@ -410,20 +434,20 @@ function xspf_playlist_node_content_fiel
  * @return array of items
  */
 function xspf_playlist_node_get_files_from_cck($node) {
-	$items = array();
-  if ($fields = variable_get('xspf_playlist_node_cck_fields_'. $node->type, null)) {
-  	if (count($fields)) {
-	    foreach ($fields as $fieldname) {
+  $items = array();
+  if ($fields = variable_get('xspf_playlist_node_cck_fields_'. $node->type, NULL)) {
+    if (count($fields)) {
+      foreach ($fields as $fieldname) {
         // check file fields and then normal fields
-	      $field = $node->{$fieldname}[0]['filepath'] ? url($node->{$fieldname}[0]['filepath'], NULL, NULL, TRUE) : $node->{$fieldname}[0]['value'];
-	      if ($field) {
-		      // build an xspf item
-		      if ($item =  xspf_playlist_node_build_file_item($node, $field) ) {
-		        $items[] = $item;
-		      }
-	      }
-	    }
-  	}
+        $field = $node->{$fieldname}[0]['filepath'] ? url($node->{$fieldname}[0]['filepath'], NULL, NULL, TRUE) : $node->{$fieldname}[0]['value'];
+        if ($field) {
+          // build an xspf item
+          if ($item =  xspf_playlist_node_build_file_item($node, $field) ) {
+            $items[] = $item;
+          }
+        }
+      }
+    }
   }
   if (count($items)) {
     return $items;
@@ -478,15 +502,15 @@ function xspf_playlist_node_builder(&$fo
   // make it obvious that we've got thumbnails
   $form['xspf_thumbnails'] = array(
     '#type' => 'hidden',
-    '#value' => $thumbs,
+    '#value' => implode(',', $thumbs),
   );
 
   $form['xspf_playlist'] = array(
     '#type' => 'fieldset',
     '#title' => t('Playlist builder'),
     '#description' => t('You can define options for the playlist (if any) on this node here'),
-    '#collapsible' => true,
-    '#collapsed' => false,
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
   );
 
   // get all the files for this node
@@ -495,7 +519,7 @@ function xspf_playlist_node_builder(&$fo
     '#type' => 'value',
     '#value' => $items,
   );
-  foreach($items as $xid => $item) {
+  foreach ($items as $xid => $item) {
     $file = pathinfo(_xspf_playlist_item_get_value($item, 'location'));
     $form['xspf_playlist']['xspf_playlist_thumb_'. $xid] = array(
       '#type' => 'select',
@@ -522,7 +546,7 @@ function xspf_playlist_node_builder(&$fo
  *   A node object.
  */
 function xspf_playlist_node_thumb_save($node) {
-  foreach($node->xspf_thumbnails_items as $xid => $playlist_item) {
+  foreach ($node->xspf_thumbnails_items as $xid => $playlist_item) {
     $key = 'xspf_playlist_thumb_' . $xid;
     if (isset($node->$key)) {
       $item = array(
@@ -577,7 +601,7 @@ function xspf_playlist_node_thumb_get($n
     }
   }
   // Otherwise, look for modules that return potential thumbs.
-  $modules = variable_get('xspf_'. $node->type .'_thumb', false);
+  $modules = variable_get('xspf_'. $node->type .'_thumb', FALSE);
   if ($modules) {
     foreach ($modules as $module) {
       // split the name into parts
@@ -586,7 +610,9 @@ function xspf_playlist_node_thumb_get($n
       if (module_exists($module_name)) {
         if ($thumb = module_invoke($module_name, 'xspf_playlist_thumbnail', 'return', $node, $config)) {
           // Some modules may pass back an array. Only take the first item
-          if (is_array($thumb)) {$thumb = $thumb[0]; }
+          if (is_array($thumb)) {
+            $thumb = $thumb[0];
+          }
           // We're only returning the specified thumb.
           return $thumb;
         }
@@ -601,7 +627,8 @@ function xspf_playlist_node_thumb_get($n
  * @return array of file paths
  */
 function xspf_playlist_node_thumb_get_all($node) {
-  $modules = variable_get('xspf_'. $node->type .'_thumb', false);
+  $modules = variable_get('xspf_'. $node->type .'_thumb', FALSE);
+  $thumbs = array();
   if ($modules) {
     foreach ($modules as $module) {
       // split the name into parts
@@ -611,7 +638,9 @@ function xspf_playlist_node_thumb_get_al
         if ($thumb = module_invoke($module_name, 'xspf_playlist_thumbnail', 'return', $node, $config)) {
           // some modules may pass back multiple items
           if (is_array($thumb)) {
-            foreach ($thumb as $item) {$thumbs[] = $item; }
+            foreach ($thumb as $item) {
+              $thumbs[] = $item;
+            }
           }
           else {
             $thumbs[] = $thumb;
@@ -619,8 +648,8 @@ function xspf_playlist_node_thumb_get_al
         }
       }
     }
-    if ($thumbs) {return $thumbs; }
   }
+  return $thumbs;
 }
 
 /**
@@ -632,7 +661,7 @@ function xspf_playlist_node_thumb_get_al
  */
 function xspf_playlist_node_thumbs($node, $filter = array('jpeg', 'jpg', 'gif', 'png')) {
   // get all the thumbnails for this node
-  $all_thumbs = xspf_playlist_node_thumb_get_all($node, true);
+  $all_thumbs = xspf_playlist_node_thumb_get_all($node);
   $i = 1;
   // now filter out the thumbs that we can't use
   foreach ($all_thumbs as $id => $thumb) {
@@ -654,9 +683,9 @@ function xspf_playlist_node_thumbs($node
 /* *********************************************************** */
 
 /**
- * define xspf_playlist filter 
+ * define xspf_playlist filter
  *
- * @return array of tables 
+ * @return array of tables
  */
 function xspf_playlist_node_views_tables() {
   // define the tables
@@ -679,7 +708,7 @@ function xspf_playlist_node_views_tables
 
 
 /**
- * build the joins for the xspf playlist filter. Calls all modules that implement 
+ * build the joins for the xspf playlist filter. Calls all modules that implement
  * the hook and then builds a join statement frm them
  *
  * @param string $op
@@ -689,17 +718,17 @@ function xspf_playlist_node_views_tables
  */
 function views_handler_xspf_playlist_node_filter($op, $filter, $filterinfo, &$query) {
   // get all the queries that have been implemented.
-  $conditions = xspf_playlist_extend('xspf_playlist_use', 'views', null, null);
-  
+  $conditions = xspf_playlist_extend('xspf_playlist_use', 'views', NULL, NULL);
+
   // go through each of the queries to create an clause
   foreach ($conditions as $condition) {
-    // get table name for this table 
+    // get table name for this table
     $tablename = $query->get_table_name($condition['tablename'], $num);
-    $query->add_table($tablename, false, 1, array('left' => array('table' => 'node', 'field' => 'nid'), 'right' => array('field' => 'nid')));
+    $query->add_table($tablename, FALSE, 1, array('left' => array('table' => 'node', 'field' => 'nid'), 'right' => array('field' => 'nid')));
     $where[] = sprintf($condition['conditions'], $tablename);
   }
   // take all the condtions and merge them into an array
-  $query->add_where(implode(' OR ', $where));  
+  $query->add_where(implode(' OR ', $where));
 }
 
 
@@ -726,13 +755,15 @@ function theme_xspf_playlist_node_feed($
     return;
   }
   global $base_url;
-  
+
   // do we have a limit on the number of tracks to return per node?
   // itterate through the filters to find the limit value
   foreach ($view->filter as $filter) {
     if ($filter['field'] == 'xspf_playlist.playlist') {
-      if ($filter['value']) {$limit = $filter['value']; }
-    }    
+      if ($filter['value']) {
+        $limit = $filter['value'];
+      }
+    }
   }
 
   $items = array();
@@ -752,7 +783,7 @@ function theme_xspf_playlist_node_feed($
   $playlist = array(
     'title' => filter_xss_admin(views_get_title($view, 'page')),
     'annotation' => filter_xss_admin($view->description),
-    'link' => url($base_url, NULL, NULL, TRUE),
+    'link' => url($base_url, array('absolute' => TRUE)),
     'items' => $items,
   );
 
@@ -763,4 +794,3 @@ function theme_xspf_playlist_node_feed($
   module_invoke_all('exit');
   exit;
 }
-
Index: xspf_playlist_thumb/xspf_playlist_thumb.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist_thumb/xspf_playlist_thumb.info,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 xspf_playlist_thumb.info
--- xspf_playlist_thumb/xspf_playlist_thumb.info	4 Jul 2008 21:23:47 -0000	1.1.2.3
+++ xspf_playlist_thumb/xspf_playlist_thumb.info	10 Oct 2008 11:29:16 -0000
@@ -2,4 +2,6 @@
 name = "XSPF Playlist Thumbnails"
 description = "Manages thumbnails for XSPF playlists."
 package = "Media"
-dependencies = xspf_playlist
+dependencies[] = xspf_playlist
+core = 6.x
+version = 6.x-2.0
Index: xspf_playlist_thumb/xspf_playlist_thumb.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist_thumb/xspf_playlist_thumb.install,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 xspf_playlist_thumb.install
--- xspf_playlist_thumb/xspf_playlist_thumb.install	4 Jul 2008 21:23:47 -0000	1.1.2.4
+++ xspf_playlist_thumb/xspf_playlist_thumb.install	10 Oct 2008 11:29:16 -0000
@@ -1,39 +1,37 @@
 <?php
-
 // $Id: xspf_playlist_thumb.install,v 1.1.2.4 2008/07/04 21:23:47 nedjo Exp $
 
-// xspf_playlist.install
+/**
+ * @file
+ * Install file for the XSPF Playlist Thumb module
+ */
 
+/**
+ * Implementation of hook_schema().
+ */
+function xspf_playlist_thumb_schema() {
+  $schema['xspf_playlist_thumb'] = array(
+    'fields' => array(
+    'type' => array('type' => 'varchar', 'length' => '32', 'not null' => TRUE, 'default' => ''),
+    'id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
+    'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
+    'item_path' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
+    'thumbnail_path' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '')),
+    'primary key' => array('type', 'id', 'vid'),
+  );
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install().
+ */
 function xspf_playlist_thumb_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      db_query("CREATE TABLE {xspf_playlist_thumb} (
-        type varchar(32) NOT NULL default '',
-        id int unsigned NOT NULL default 0,
-        vid int unsigned NOT NULL default 0,
-        item_path varchar(255) NOT NULL default '',
-        thumbnail_path varchar(255) NOT NULL default '',
-        PRIMARY KEY (type, id, vid)
-      ) DEFAULT CHARACTER SET=utf8");
-      break;
-    
-    case 'pgsql':
-      db_query("CREATE TABLE {xspf_playlist_thumb} (
-        type varchar(32) NOT NULL default '',
-        id int_unsigned NOT NULL default '0',
-        vid int_unsigned NOT NULL default '0',
-        item_path varchar(255) NOT NULL default '',
-        thumbnail_path varchar(255) NOT NULL default '',
-        PRIMARY KEY (type, id, vid)
-      )");
-      break;
-  }  
+  drupal_install_schema('xspf_playlist_thumb');
 }
 
 /**
- * implmentation of uninstall, drops tables
+ * Implementation of hook_uninstall().
  */
 function xspf_playlist_thumb_uninstall() {
-  db_query('DROP TABLE {xspf_playlist_thumb}');
+  drupal_uninstall_schema('xspf_playlist_thumb');
 }
Index: xspf_playlist_thumb/xspf_playlist_thumb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/xspf_playlist/xspf_playlist_thumb/xspf_playlist_thumb.module,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 xspf_playlist_thumb.module
--- xspf_playlist_thumb/xspf_playlist_thumb.module	4 Jul 2008 21:23:47 -0000	1.1.2.3
+++ xspf_playlist_thumb/xspf_playlist_thumb.module	10 Oct 2008 11:29:16 -0000
@@ -1,4 +1,33 @@
 <?php
+// $Id$
+
+/**
+ * @file
+ * Provides thumbnail functionality to XSPF Playlists.
+ */
+
+/**
+ * Implementation of hook_theme().
+ */
+function xspf_playlist_thumb_theme() {
+  return array(
+    'xspf_playlist_thumb_image' => array(
+      'arguments' => array(
+        'path' => NULL,
+        'alt' => '',
+        'title' => '',
+        'attributes' => '',
+        'getsize' => FALSE,
+      ),
+    ),
+    'xspf_playlist_thumbnailer_picker' => array(
+      'arguments' => array(
+        'thumbs' => NULL,
+        'xid' => NULL,
+      ),
+    ),
+  );
+}
 
 /**
  * Return an array of files attached to a node suitable for use as thumbnail images.
@@ -9,13 +38,15 @@
 function xspf_playlist_thumb_get_attached_files($node) {
   if (isset($node->files)) {
     $thumbs = array();
-    foreach($node->files as $file) {
+    foreach ($node->files as $file) {
       $info = pathinfo($file->filename);
       if (in_array($info['extension'], array('jpeg', 'jpg', 'gif', 'png'))) {
         $thumbs[] = $file->filepath;
       }
     }
-    if ($thumbs) {return $thumbs;}
+    if ($thumbs) {
+      return $thumbs;
+    }
   }
 }
 
@@ -30,8 +61,8 @@ function xspf_playlist_thumb_get_attache
  * @param $node is a node object
  * @param $config is which config to run
  */
-function xspf_playlist_thumb_xspf_playlist_thumbnail ($op, $node, $config = null) {
-  switch($op){
+function xspf_playlist_thumb_xspf_playlist_thumbnail($op, $node, $config = NULL) {
+  switch ($op) {
     case 'define':
       $items = array(
         'xspf_playlist_thumb--1' => t('none'),
@@ -46,7 +77,7 @@ function xspf_playlist_thumb_xspf_playli
       $form['xspf_playlist_thumb_'. $node->type] = array(
         '#type' => 'textfield',
         '#title' => t('Path to default thumbnail'),
-        '#default_value' => variable_get('xspf_playlist_thumb_'. $node->type, null),
+        '#default_value' => variable_get('xspf_playlist_thumb_'. $node->type, NULL),
         '#description' => t('Enter a path to a thumbnail you wish to use as a default'),
         '#prefix' => '<div id="xspf_playlist--2_config" class="xspf_playlist_config_thumb">',
         '#suffix' => '</div>',
@@ -55,13 +86,13 @@ function xspf_playlist_thumb_xspf_playli
     break;
 
     case 'return':
-      switch ($config){
+      switch ($config) {
         case 1:
           return;
         break;
         case 2:
           // return default thumbnail
-          return variable_get('xspf_playlist_thumb_'. $node->type, null);
+          return variable_get('xspf_playlist_thumb_'. $node->type, NULL);
         break;
 
         case 3:
@@ -77,7 +108,7 @@ function xspf_playlist_thumb_xspf_playli
 /**
  * this wraps the theme image function so we can pass urls and paths
  */
-function theme_xspf_playlist_thumb_image($path, $alt = '', $title = '', $attributes = '', $getsize = false) {
+function theme_xspf_playlist_thumb_image($path, $alt = '', $title = '', $attributes = '', $getsize = FALSE) {
   if (strstr($path, 'http://')) {
     $attributes = drupal_attributes($attributes);
     return '<img src="'. check_url($path) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
@@ -126,9 +157,9 @@ function xspf_playlist_thumb_save($item)
   // Use a VID as the primary key if present, otherwise an ID.
   $key = isset($item['vid']) && $item['vid'] ? 'vid' : 'id';
   // Test for an existing record.
-  $result = db_query("SELECT * FROM {xspf_playlist_thumb} WHERE $key = %d AND type = '%s'", $item[$key], $item['type']);
+  $result = db_result(db_query("SELECT COUNT(*) FROM {xspf_playlist_thumb} WHERE $key = %d AND type = '%s'", $item[$key], $item['type']));
   // If found, update.
-  if (db_num_rows($result)) {
+  if ($result) {
     db_query("UPDATE {xspf_playlist_thumb} SET item_path = '%s', thumbnail_path = '%s' WHERE $key = %d AND type = '%s'", $item['item_path'], $item['thumbnail_path'], $item[$key], $item['type']);
   }
   // Otherwise, create a new record.
@@ -173,7 +204,7 @@ function xspf_playlist_thumb_load($item)
   // At a minimum, test for a given type.
   $conditions = array("type = '%s'");
   $parameters = array($item['type']);
-  
+
   // For other properties, test for them if present in the incoming item.
   $fields = array(
     'id' => '%d',
@@ -189,4 +220,3 @@ function xspf_playlist_thumb_load($item)
   }
   return db_fetch_array(db_query('SELECT * FROM {xspf_playlist_thumb} WHERE ' . implode(' AND ', $conditions), $parameters));
 }
-
