--- token.rules.inc	2010-06-09 06:18:56.000000000 +0530
+++ token.rules.inc	2010-12-23 20:36:56.062500000 +0530
@@ -33,11 +33,14 @@ function token_rules_evaluator() {
  */
 function token_rules_input_evaluator_prepare($string, $variables) {
   $used_vars = array();
+  
   foreach ($variables as $name => $info) {
     if (strpos($string, TOKEN_PREFIX. $name .':') !== FALSE) {
       $used_vars[] = $name;
     }
   }
+
+ 
   return $used_vars ? $used_vars : NULL;
 }
 
@@ -53,16 +56,23 @@ function token_rules_input_evaluator_pre
  */
 function token_rules_input_evaluator_apply($text, $used_vars, &$state) {
   static $token_cache = array();
-
+  
   if ($used_vars) {
     $vars = rules_get_variables(drupal_map_assoc($used_vars), $state);
+   
     if (!$vars) {
       //there not all needed variables available!
       return FALSE;
     }
-
+   $used_vars[] = 'global';
+  
     foreach ($used_vars as $name) {
+      if($name=='global'){
+      $type ='global';
+      }else{
       $type = _token_rules_map_type($state['variables'][$name]->info['type']);
+      }
+      //echo $name.'-'.$type.'<br>';
       if ($type) {
         $token_id = _token_get_id($type, $vars[$name]);
         if (isset($token_cache[$token_id]) && $token_cache[$token_id] != $name) {
@@ -70,7 +80,7 @@ function token_rules_input_evaluator_app
           // so we need to flush the token cache to get the fresh values
           token_get_values('global', NULL, TRUE);
         }
-
+ 
         $text = token_replace($text, $type, $vars[$name], TOKEN_PREFIX. $name .':', TOKEN_SUFFIX);
 
         // remember that this variable has been used and got cached
@@ -86,6 +96,8 @@ function token_rules_input_evaluator_app
  * Map rules types to corresponding token types
  */
 function _token_rules_map_type($type) {
+
+  
   if (($data_type = rules_get_data_types($type)) && isset($data_type['token type'])) {
     return $data_type['token type'];
   }
@@ -96,9 +108,24 @@ function _token_rules_map_type($type) {
  * Some token replacement help for the condition/action edit form.
  */
 function token_rules_input_evaluator_help($variables) {
+  
+     $type='global';
+
+     $form[$name] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Replacement patterns for @name', array('@name' => 'global')),
+        '#collapsible' => TRUE,
+        '#collapsed' => TRUE,
+      );
+      $form[$name]['content'] = array(
+        '#value' => theme('token_help', $type, TOKEN_PREFIX.'global' . ':', TOKEN_SUFFIX),
+      );
 
   foreach ($variables as $name => $info) {
+    
     $type = _token_rules_map_type($info['type']);
+    
+   
     if ($type) {
       $form[$name] = array(
         '#type' => 'fieldset',
