? Copy of audio.install_to_core
? Copy of views_audio.inc
? ____audio_images.module
? audio.install______
? audio.module_____________
? getid3
? players/Thumbs.db
Index: audio.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.install,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 audio.install
--- audio.install	3 Aug 2007 02:41:12 -0000	1.17
+++ audio.install	26 Oct 2007 17:59:14 -0000
@@ -375,3 +375,42 @@ function audio_update_5202() {
   return $ret;
 }
 
+
+/**
+ * Now that we've got raw tokens we need to update the existing audio nodes to
+ * update the title_format and replace the existing audio-tag-* tokens with the
+ * new audio-tag-*-raw tokens.
+ */
+function audio_update_5203() {
+  $ret = array();
+
+  // Build an array of tokens to rename.
+  $tokens = array();
+  foreach (audio_get_tags_allowed() as $tag) {
+    $name = strtr($tag, '_', '-');
+    $tokens["[audio-tag-$name]"] =  "[audio-tag-$name-raw]";
+  }
+
+  // Gather a list of all the different title formats and then replace them
+  // with the new token based equivalents.
+  $result = db_query('SELECT DISTINCT title_format FROM {audio}');
+  while ($o = db_fetch_object($result)) {
+    $new_value = strtr($o->title_format, $tokens);
+    if ($new_value != $o->title_format) {
+      db_query("UPDATE {audio} SET title_format = '%s' WHERE title_format = '%s'", $new_value, $o->title_format);
+      $ret[] = array('success' => TRUE, 'query' => check_plain("Updated audio node titles from '$o->title_format'' to '$new_value'."));
+    }
+  }
+
+  // Update the default title format.
+  if ($old_value = variable_get('audio_default_title_format', FALSE)) {
+    $new_value = strtr($old_value, $tokens);
+    if ($old_value != $new_value) {
+      variable_set('audio_default_title_format', $new_value);
+      $ret[] = array('success' => TRUE, 'query' => check_plain("Updated the default audio node title from '$old_value' to '$new_value'."));
+    }
+  }
+
+  return $ret;
+}
+
Index: audio.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.module,v
retrieving revision 1.129
diff -u -p -u -p -r1.129 audio.module
--- audio.module	9 Oct 2007 19:05:03 -0000	1.129
+++ audio.module	26 Oct 2007 17:49:05 -0000
@@ -394,7 +394,7 @@ function audio_validate(&$node, &$form) 
 
   // Build the title from metadata. If there's not title format use the default.
   if (empty($node->title_format)) {
-    $node->title_format = variable_get('audio_default_title_format', '[audio-tag-title] by [audio-tag-artist]');
+    $node->title_format = variable_get('audio_default_title_format', '[audio-tag-title-raw] by [audio-tag-artist-raw]');
   }
   $node->title = token_replace($node->title_format, 'node', $node);
   form_set_value($form['title'], $node->title);
@@ -644,8 +644,8 @@ function audio_form(&$node) {
     $form['title']['title_format'] = array(
       '#type' => 'textfield',
       '#title' => check_plain($type->title_label),
-      '#default_value' => !empty($node->title_format) ? $node->title_format : variable_get('audio_default_title_format', '[audio-tag-title] by [audio-tag-artist]'),
-      '#description' => t("The title can use the file's metadata. You can use the tokens listed below to insert information into the title."),
+      '#default_value' => !empty($node->title_format) ? $node->title_format : variable_get('audio_default_title_format', '[audio-tag-title-raw] by [audio-tag-artist-raw]'),
+      '#description' => t("The title can use the file's metadata. You can use the tokens listed below to insert information into the title. <strong>Note:</strong> the node title is escaped so it is safe to use the -raw tokens."),
       '#required' => TRUE,
     );
     $form['title']['token_help'] = array(
@@ -943,15 +943,15 @@ function audio_admin_settings() {
     '#type' => 'textfield',
     '#title' => t('Default node title format'),
     '#maxlength' => 128,
-    '#default_value' => variable_get('audio_default_title_format', '[audio-tag-artist] - [audio-tag-title]'),
-    '#description' => t("The audio node's title can use the file's metadata as variables. This will be used as the default title for all new audio nodes. By using the tokens listed below, you can automatically create titles from things like a song's artist or title."),
+    '#default_value' => variable_get('audio_default_title_format', '[audio-tag-title-raw] by [audio-tag-artist-raw]'),
+    '#description' => t("The audio node's title can use the file's metadata as variables. This will be used as the default title for all new audio nodes. By using the tokens listed below, you can automatically create titles from things like a song's artist or title. <strong>Note:</strong> the node title is escaped so it is safe to use the -raw tokens."),
   );
   $form['audio_teaser_format'] = array(
     '#type' => 'textfield',
     '#title' => t('Node teaser format'),
     '#maxlength' => 128,
     '#default_value' => variable_get('audio_teaser_format', '[audio-player]<br />[audio-length]'),
-    '#description' => t("Use this setting to customize the teasers for audio nodes. Using the tokens listed below you can select what information about the file will be displayed."),
+    '#description' => t("Use this setting to customize the teasers for audio nodes. Using the tokens listed below you can select what information about the file will be displayed. <strong>Note: the teaser is not escaped so it is unsafe to use the -raw tokens.</strong>"),
   );
   $form['token_help'] = array(
     '#title' => t('List of available tokens'),
@@ -978,6 +978,13 @@ function audio_admin_settings() {
   return system_settings_form($form);
 }
 
+function audio_admin_settings_validate($form_id, $form_values) {
+  // Ensure they don't try to slip raw tokens in.
+  if (preg_match("/\[.*?\-raw\s*?\]/i", $form_values['audio_teaser_format'])) {
+    form_set_error('audio_teaser_format', t('Raw tokens are not allowed.'));
+  }
+}
+
 /**
  * The ID3 tag settings page.
  */
@@ -1444,9 +1451,9 @@ function audio_clean_tag($string) {
   // them.
   if (preg_match('/[^-\w]/', $string)) {
     // Remove accents...
-    $string = strtr($string, 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
+    $string = strtr($string, 'ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
     // ...convert to equivalent chars...
-    $string = strtr($string, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u'));
+    $string = strtr($string, array('ï¿½' => 'TH', 'ï¿½' => 'th', 'ï¿½' => 'DH', 'ï¿½' => 'dh', 'ï¿½' => 'ss', 'ï¿½' => 'OE', 'ï¿½' => 'oe', 'ï¿½' => 'AE', 'ï¿½' => 'ae', 'ï¿½' => 'u'));
     // ... and remove anything else that's not alphanumeric and replace it with an underscore.
     $string = preg_replace('/[^-\w]+/', '_', $string);
   }
@@ -1657,7 +1664,7 @@ function audio_api_insert($filepath, $ti
   // Build the title manually (since we don't call node_validate()).
   $node->title_format = $title_format;
   if (empty($node->title_format)) {
-    $node->title_format = variable_get('audio_default_title_format', '[audio-tag-title] by [audio-tag-artist]');
+    $node->title_format = variable_get('audio_default_title_format', '[audio-tag-title-raw] by [audio-tag-artist-raw]');
   }
   $node->title = token_replace($node->title_format, 'node', $node);
 
@@ -1766,7 +1773,9 @@ function audio_token_values($type, $obje
     // Tags.
     foreach (audio_get_tags_allowed() as $tag) {
       if (isset($node->audio_tags[$tag])) {
-        $tokens['audio-tag-'. strtr($tag, '_', '-')] = check_plain($node->audio_tags[$tag]);
+        $name = strtr($tag, '_', '-');
+        $tokens['audio-tag-'. $name] = check_plain($node->audio_tags[$tag]);
+        $tokens['audio-tag-'. $name .'-raw'] = $node->audio_tags[$tag];
       }
     }
 
@@ -1808,7 +1817,9 @@ function audio_token_list($type = 'all')
   if ($type == 'node' || $type == 'all') {
     // Tags.
     foreach (audio_get_tags_allowed() as $tag) {
-      $tokens['node']['audio-tag-'. strtr($tag, '_', '-')] = t("Audio node @tag tag value.", array('@tag' => $tag));
+      $name = strtr($tag, '_', '-');
+      $tokens['node']['audio-tag-'. $name] = t("Audio node @tag tag value.", array('@tag' => $tag));
+      $tokens['node']['audio-tag-'. $name .'-raw'] = t("Audio node @tag tag value. WARNING - raw user input.", array('@tag' => $tag));
     }
 
     // Formatted file info.
