--- webform-orig/webform.module	Sun Mar 21 02:42:51 2010 -0400
+++ webform-patched/webform.module	Sun Mar 21 02:43:33 2010 -0400
@@ -2138,6 +2138,12 @@
   global $user;
   static $replacements;
 
+  // Token module replacements
+  if (module_exists('token')) {
+      $string = token_replace($string, 'global', NULL, '[[', ']]');
+      $string = token_replace($string, 'user', $user, '[[', ']]');
+  }
+
   // Setup default token replacements.
   if (!isset($replacements)) {
     $replacements['unsafe'] = array();
@@ -2229,6 +2235,7 @@
   foreach ($special_tokens as $safe_state => $tokens) {
     foreach (array_keys($tokens) as $token) {
       $string = preg_replace('/\\'. $token .'\[\w+\]/', '', $string);
+      //$string = preg_replace('/\[\[[a-zA-Z0-9-]+\]\]/', '', $string);
     }
   }
 
@@ -2347,13 +2354,25 @@
     $output .= ' '. t('If you are using the profiles module, you can also access all profile data using the syntax %profile[form_name]. If you for example have a profile value named profile_city, add the variable %profile[profile_city].');
   }
 
-  $fieldset = array(
-    '#title' => t('Token values'),
-    '#type' => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#children' => '<div>'. $output .'</div>',
-  );
+  if (module_exists('token')) {
+      $fieldset = array(
+        '#title' => t('Token values'),
+        '#type' => 'fieldset',
+        '#collapsible' => TRUE,
+        '#collapsed' => TRUE,
+        '#children' => '<div>'. $output .'</div><br><p>Additional tokens. Make sure to include the \'<b>[[</b>\' and \'<b>]]</b>\'. </p>' . theme('token_help', array('global', 'user'), '[[', ']]'),
+      );
+    }
+    else {
+      $fieldset = array(
+        '#title' => t('Token values'),
+        '#type' => 'fieldset',
+        '#collapsible' => TRUE,
+        '#collapsed' => TRUE,
+        '#children' => '<div>'. $output .'</div>',
+      );
+  }
+
   return theme('fieldset', $fieldset);
 }
