Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.113
diff -u -r1.113 webform.module
--- webform.module	10 Jan 2007 20:34:13 -0000	1.113
+++ webform.module	15 Jun 2007 22:56:56 -0000
@@ -45,7 +45,7 @@
       break;
     case 'webform/helptext#variables' :
       $output= t('Available variables are: %username, %useremail, %site, %date.');
-      $output .= ' '.t('You can also use %server[key] to add any of the special PHP <a href="http://www.php.net/reserved.variables#reserved.variables.server">$_SERVER</a> variables and %get[key] to create prefilled forms from from the <a href="http://www.php.net/reserved.variables#reserved.variables.get">URL</a>. (e.g. %server[HTTP_USER_AGENT] or %get[id])');
+      $output .= ' '.t('You can also use %server[key] to add any of the special PHP <a href="http://www.php.net/reserved.variables#reserved.variables.server">$_SERVER</a> variables, %session[key] to add any of the special PHP <a href="http://www.php.net/reserved.variables#reserved.variables.session">$_SESSION</a> variables, %cookie[key] to add any of the special PHP <a href="http://www.php.net/reserved.variables#reserved.variables.cookies">$_COOKIE</a> variables and %get[key] to create prefilled forms from from the <a href="http://www.php.net/reserved.variables#reserved.variables.get">URL</a>. (e.g. %server[HTTP_USER_AGENT] or %session[id] or %get[id])');
       if (module_exists('profile')) {
         $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 varible %profile[profile_city].');
       }
@@ -1284,6 +1284,14 @@
     $find[]= "%server[$k]";
     $replace[]= $v;
   }
+  foreach ($_SESSION as $k => $v) {
+    $find[]= "%session[$k]";
+    $replace[]= $v;
+  }
+  foreach ($_COOKIE as $k => $v) {
+    $find[]= "%cookie[$k]";
+    $replace[]= $v;
+  }
   foreach ($_GET as $k => $v) {
     $find[]= "%get[$k]";
     $replace[]= $v;
@@ -1303,6 +1311,8 @@
   $string= preg_replace('/\%post\[\w+\]/', '', $string);
   // Clean up any unused %system stuff
   $string= preg_replace('/\%server\[\w+\]/', '', $string);
+  $string= preg_replace('/\%session\[\w+\]/', '', $string);
+  $string= preg_replace('/\%cookie\[\w+\]/', '', $string);
 
   if ($strict) {
   	return filter_xss($string);
