diff -upr webform-orig/components/date.inc webform/components/date.inc
--- webform-orig/components/date.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/date.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: date.inc,v 1.15.2.14 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module date component.
+ */
+
+/**
  * Create a default date component.
  */
 function _webform_defaults_date() {
@@ -34,7 +39,7 @@ function _webform_edit_date($currfield) 
   $edit_fields = array();
   $edit_fields['value'] = array(
     '#type' => 'textfield',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field.') .'<br />'. t('Accepts any date in any <a href="http://www.gnu.org/software/tar/manual/html_node/tar_109.html">GNU Date Input Format</a>. Strings such as today, +2 months, and Dec 9 2004 are all valid.'),
     '#size' => 60,
@@ -43,15 +48,15 @@ function _webform_edit_date($currfield) 
   );
   $edit_fields['extra']['timezone'] = array(
     '#type' => 'radios',
-    '#title' => t("Timezone"),
-    '#default_value' => empty($currfield['extra']['timezone']) ? "site" : $currfield['extra']['timezone'],
+    '#title' => t('Timezone'),
+    '#default_value' => empty($currfield['extra']['timezone']) ? 'site' : $currfield['extra']['timezone'],
     '#description' => t('Adjust the date according to a specific timezone. Website timezone is defined in the <a href="!settings">Site Settings</a> and is the default.', array('!settings' => url('admin/settings/date-time'))),
     '#options' => array('site' => t('Website timezone'), 'user' => t('User timezone'), 'gmt' => t('GMT')),
     '#weight' => 1,
   );
   $edit_fields['extra']['check_daylight_savings'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Observe Daylight Savings"),
+    '#title' => t('Observe Daylight Savings'),
     '#default_value' => $currfield['extra']['check_daylight_savings'],
     '#checked_value' => 1,
     '#description' => t('Automatically adjust the time during daylight savings.'),
@@ -78,7 +83,7 @@ function _webform_edit_date($currfield) 
   );
   $edit_fields['extra']['year_textfield'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Use a textfield for year"),
+    '#title' => t('Use a textfield for year'),
     '#default_value' => $currfield['extra']['year_textfield'],
     '#description' => t('If checked, the generated date field will use a textfield for the year. Otherwise it will use a select list.'),
     '#weight' => 5,
@@ -127,16 +132,16 @@ function webform_expand_date($element) {
     unset($element['year']);
   }
   // Or, if none, use set the defaults of the component.
-  elseif (strlen($component['value']) > 0) {
+  elseif (drupal_strlen($component['value']) > 0) {
     // Calculate the timestamp in GMT.
     $timestamp = strtotime(_webform_filter_values($component['value']));
 
-    if ($component['extra']['timezone'] == "user") {
+    if ($component['extra']['timezone'] == 'user') {
       // Use the users timezone.
       global $user;
       $timestamp += (int)$user->timezone;
     }
-    elseif ($component['extra']['timezone'] == "gmt") {
+    elseif ($component['extra']['timezone'] == 'gmt') {
       // Use GMT.
       $timestamp += 0;
     }
@@ -146,7 +151,7 @@ function webform_expand_date($element) {
     }
 
     // Check for daylight savings time.
-    if ($component['extra']['check_daylight_savings'] && date("I")) {
+    if ($component['extra']['check_daylight_savings'] && date('I')) {
       $timestamp += 3600;
     }
 
@@ -174,7 +179,7 @@ function webform_expand_date($element) {
   foreach ($default_values as $type => $value) {
     unset($element[$type]['#value']);
     $element[$type]['#default_value'] = isset($default_values[$type]) ? $default_values[$type] : NULL;
-    $element[$type]['#options'] = array('' => t(ucfirst($type))) + $element[$type]['#options'];
+    $element[$type]['#options'] = array('' => t(drupal_ucfirst($type))) + $element[$type]['#options'];
   }
 
   // Tweak the year field.
@@ -202,19 +207,19 @@ function webform_validate_date($form_ite
   // Check if the user filled the required fields.
   foreach (array('day', 'month', 'year') as $field_type) {
     if (!is_numeric($form_item[$field_type]['#value']) && $form_item['#required']) {
-      form_set_error($form_key, t("!name field is required.", array('!name' => $name)));
+      form_set_error($form_key, t('!name field is required.', array('!name' => $name)));
       return;
     }
   }
   // Check for a valid date.
-  if ($form_item['month']['#value'] !== "" || $form_item['day']['#value'] !== "" || $form_item['year']['#value'] !== "") {
+  if ($form_item['month']['#value'] !== '' || $form_item['day']['#value'] !== '' || $form_item['year']['#value'] !== '') {
     if (!checkdate((int)$form_item['month']['#value'], (int)$form_item['day']['#value'], (int)$form_item['year']['#value'])) {
-      form_set_error($form_key, t("Entered !name is not a valid date.", array('!name' => $name)));
+      form_set_error($form_key, t('Entered !name is not a valid date.', array('!name' => $name)));
       return;
     }
   }
   // Check the date is between allowed years.
-  if ($form_item['year']['#value'] !== "" && is_numeric($component['extra']['year_start']) && is_numeric($component['extra']['year_end'])) {
+  if ($form_item['year']['#value'] !== '' && is_numeric($component['extra']['year_start']) && is_numeric($component['extra']['year_end'])) {
     if ($form_item['year']['#value'] < $component['extra']['year_start'] || $form_item['year']['#value'] > $component['extra']['year_end']) {
       form_set_error($form_key .'][year', t('The entered date needs to be between the years @start and @end.', array('@start' => $component['extra']['year_start'], '@end' => $component['extra']['year_end'])));
       return;
@@ -275,9 +280,9 @@ function _webform_submission_display_dat
  *   Textual output to be included in the email.
  */
 function theme_webform_mail_date($data, $component) {
-  $output = $component['name'] .":";
+  $output = $component['name'] .':';
   if ($data[0] && $data[1]) {
-    $timestamp = strtotime($data[0] ."/". $data[1] ."/". $data[2]);
+    $timestamp = strtotime($data[0] .'/'. $data[1] .'/'. $data[2]);
     $format = webform_date_format('medium');
     $output .= ' '. date($format, $timestamp);
   }
@@ -286,17 +291,17 @@ function theme_webform_mail_date($data, 
 }
 
 /**
- * Module specific instance of hook_help().
+ * Implementation of hook_help().
  */
 function _webform_help_date($section) {
   switch ($section) {
     case 'admin/settings/webform#date_description':
-      return t("Presents month, day, and year fields.");
+      return t('Presents month, day, and year fields.');
   }
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_date() {
   return array(
@@ -342,12 +347,12 @@ function _webform_analysis_rows_date($co
             if ($row['no'] == '2') {
               $year = $row['data'];
               // Build the full timestamp.
-              if (strlen($month) > 0  && strlen($day) > 0  && strlen($year) > 0 ) {
-                $timestamp = strtotime($month ."/". $day ."/". $year);
+              if (drupal_strlen($month) > 0  && drupal_strlen($day) > 0  && drupal_strlen($year) > 0 ) {
+                $timestamp = strtotime($month .'/'. $day .'/'. $year);
                 // Add usefull information about this date into an array.
                 $timestamps[$timestamp] = array(
-                  date("l", $timestamp), // Day of the week (Monday, Tuesday, etc.).
-                  date("F", $timestamp), // Full Month name (January, February, etc.).
+                  date('l', $timestamp), // Day of the week (Monday, Tuesday, etc.).
+                  date('F', $timestamp), // Full Month name (January, February, etc.).
                   $year, // Year.
                   $day,  // Day of the month (1,2,...,31).
                 );
@@ -377,11 +382,11 @@ function _webform_analysis_rows_date($co
  *   Textual output formatted for human reading.
  */
 function _webform_table_data_date($data) {
-  if (strlen($data['value']['0']) > 0 && strlen($data['value']['1']) > 0 && strlen($data['value']['2']) > 0) {
-    return check_plain($data['value']['0'] ."/". $data['value']['1'] ."/". $data['value']['2']);
+  if (drupal_strlen($data['value']['0']) > 0 && drupal_strlen($data['value']['1']) > 0 && drupal_strlen($data['value']['2']) > 0) {
+    return check_plain($data['value']['0'] .'/'. $data['value']['1'] .'/'. $data['value']['2']);
   }
   else {
-    return "";
+    return '';
   }
 }
 
@@ -416,13 +421,13 @@ function _webform_csv_headers_date($comp
  *   commas.
  */
 function _webform_csv_data_date($data) {
-  if (strlen($data['value']['0']) > 0 && strlen($data['value']['1']) > 0 && strlen($data['value']['2']) > 0) {
-    $timestamp = strtotime($data['value']['0'] ."/". $data['value']['1'] ."/". $data['value']['2']);
+  if (drupal_strlen($data['value']['0']) > 0 && drupal_strlen($data['value']['1']) > 0 && drupal_strlen($data['value']['2']) > 0) {
+    $timestamp = strtotime($data['value']['0'] .'/'. $data['value']['1'] .'/'. $data['value']['2']);
     $format = webform_date_format('short');
     return date($format, $timestamp);
   }
   else {
-    return "";
+    return '';
   }
 }
 
diff -upr webform-orig/components/email.inc webform/components/email.inc
--- webform-orig/components/email.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/email.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: email.inc,v 1.19.2.9 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module email component.
+ */
+
+/**
  * Create a default email component.
  */
 function _webform_defaults_email() {
@@ -35,7 +40,7 @@ function _webform_defaults_email() {
 function _webform_edit_email($currfield) {
   $edit_fields['value'] = array(
     '#type' => 'textfield',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field.') . theme('webform_token_help'),
     '#size' => 60,
@@ -46,7 +51,7 @@ function _webform_edit_email($currfield)
   );
   $edit_fields['user_email'] = array(
     '#type' => 'checkbox',
-    '#title' => t("User email as default"),
+    '#title' => t('User email as default'),
     '#default_value' => $currfield['value'] == '%useremail' ? 1 : 0,
     '#description' => t('Set the default value of this field to the user email, if he/she is logged in.'),
     '#attributes' => array('onclick' => 'getElementById("email-value").value = (this.checked ? "%useremail" : ""); getElementById("email-value").disabled = this.checked;'),
@@ -55,7 +60,7 @@ function _webform_edit_email($currfield)
   );
   $edit_fields['extra']['width'] = array(
     '#type' => 'textfield',
-    '#title' => t("Width"),
+    '#title' => t('Width'),
     '#default_value' => $currfield['extra']['width'],
     '#description' => t('Width of the textfield.') .' '. t('Leaving blank will use the default size.'),
     '#size' => 5,
@@ -63,14 +68,14 @@ function _webform_edit_email($currfield)
   );
   $edit_fields['extra']['email'] = array(
     '#type' => 'checkbox',
-    '#title' => t("E-mail a submission copy"),
+    '#title' => t('E-mail a submission copy'),
     '#return_value' => 1,
     '#default_value' => $currfield['extra']['email'],
     '#description' => t('Check this option if this component contains an e-mail address that should get a copy of the submission. Emails are sent individually so other emails will not be shown to the recipient.'),
   );
   $edit_fields['extra']['disabled'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Disabled"),
+    '#title' => t('Disabled'),
     '#return_value' => 1,
     '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
     '#weight' => 3,
@@ -134,7 +139,7 @@ function _webform_render_email($componen
 function _webform_validate_email($form_element, $form_state) {
   $component = $form_element['#webform_component'];
   if (!empty($form_element['#value']) && !valid_email_address($form_element['#value'])) {
-    form_error($form_element, t("%value is not a valid email address.", array('%value' => $form_element['#value'])));
+    form_error($form_element, t('%value is not a valid email address.', array('%value' => $form_element['#value'])));
   }
 }
 
@@ -162,7 +167,7 @@ function _webform_submission_display_ema
 }
 
 /**
- * Module specific instance of hook_help().
+ * Implementation of hook_help().
  */
 function _webform_help_email($section) {
   switch ($section) {
@@ -193,7 +198,7 @@ function _webform_analysis_rows_email($c
 
   $result = db_query($query, $component['nid'], $component['cid']);
   while ($data = db_fetch_array($result)) {
-    if ( strlen(trim($data['data'])) > 0 ) {
+    if (drupal_strlen(trim($data['data'])) > 0) {
       $nonblanks++;
       $wordcount += str_word_count(trim($data['data']));
     }
@@ -202,7 +207,7 @@ function _webform_analysis_rows_email($c
 
   $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks));
   $rows[1] = array(t('User entered value'), $nonblanks);
-  $rows[2] = array(t('Average submission length in words (ex blanks)'), ($nonblanks !=0 ? number_format($wordcount/$nonblanks, 2) : '0'));
+  $rows[2] = array(t('Average submission length in words (ex blanks)'), ($nonblanks != 0 ? number_format($wordcount/$nonblanks, 2) : '0'));
   return $rows;
 }
 
@@ -216,7 +221,7 @@ function _webform_analysis_rows_email($c
  *   Textual output formatted for human reading.
  */
 function _webform_table_data_email($data) {
-  return check_plain(empty($data['value']['0']) ? "" : $data['value']['0']);
+  return check_plain(empty($data['value']['0']) ? '' : $data['value']['0']);
 }
 
 
@@ -250,5 +255,5 @@ function _webform_csv_headers_email($com
  *   commas.
  */
 function _webform_csv_data_email($data) {
-  return empty($data['value']['0']) ? "" : $data['value']['0'];
+  return empty($data['value']['0']) ? '' : $data['value']['0'];
 }
diff -upr webform-orig/components/fieldset.inc webform/components/fieldset.inc
--- webform-orig/components/fieldset.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/fieldset.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: fieldset.inc,v 1.4.2.6 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module fieldset component.
+ */
+
+/**
  * Create a default fieldset component.
  */
 function _webform_defaults_fieldset() {
@@ -31,14 +36,14 @@ function _webform_edit_fieldset($currfie
   $edit_fields = array();
   $edit_fields['extra']['collapsible'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Collapsible"),
+    '#title' => t('Collapsible'),
     '#default_value' => $currfield['extra']['collapsible'],
     '#description' => t('If this fieldset is collapsible, the user may open or close the fieldset.'),
     '#weight' => 0,
   );
   $edit_fields['extra']['collapsed'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Collapsed by Default"),
+    '#title' => t('Collapsed by Default'),
     '#default_value' => $currfield['extra']['collapsed'],
     '#description' => t('Collapsible fieldsets are "open" by default. Select this option to default the fieldset to "closed."'),
     '#weight' => 3,
@@ -63,7 +68,7 @@ function _webform_render_fieldset($compo
     '#description'   => _webform_filter_descriptions($component['extra']['description']),
     '#collapsible'   => $component['extra']['collapsible'],
     '#collapsed'     => $component['extra']['collapsed'],
-    '#attributes'    => array("class" => "webform-component-". $component['type'], "id" => "webform-component-". $component['form_key']),
+    '#attributes'    => array('class' => 'webform-component-'. $component['type'], 'id' => 'webform-component-'. $component['form_key']),
   );
 
   return $form_item;
@@ -87,11 +92,11 @@ function _webform_submission_display_fie
 }
 
 /**
- * Module specific instance of hook_help().
+ * Implementation of hook_help().
  */
 function _webform_help_fieldset($section) {
   switch ($section) {
     case 'admin/settings/webform#fieldset_description':
-      return t("Fieldsets allow you to organize multiple fields into groups.");
+      return t('Fieldsets allow you to organize multiple fields into groups.');
   }
 }
diff -upr webform-orig/components/file.inc webform/components/file.inc
--- webform-orig/components/file.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/file.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: file.inc,v 1.4.2.25 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module file component.
+ */
+
+/**
  * Create a default file component.
  */
 function _webform_defaults_file() {
@@ -39,8 +44,8 @@ function _webform_edit_file($currfield) 
     $edit_fields['#theme'] = 'webform_edit_file';
     $edit_fields['extra']['filtering'] = array(
       '#type' => 'fieldset',
-      '#collapsible' => true,
-      '#collapsed' => false,
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
       '#title' => t('Upload Filtering'),
       '#description' => t('Select the types of uploads you would like to allow.'),
       '#element_validate' => array('_webform_edit_file_filtering_validate'),
@@ -91,7 +96,7 @@ function _webform_edit_file($currfield) 
 
     $edit_fields['extra']['filtering']['addextensions'] = array(
       '#type' => 'textfield',
-      '#title' => t("Additional Extensions"),
+      '#title' => t('Additional Extensions'),
       '#default_value' => $currfield['extra']['filtering']['addextensions'],
       '#description' => t('Enter a list of additional file extensions for this upload field, seperated by commas.<br /> Entered extensions will be appended to checked items above.'),
       '#size' => 60,
@@ -101,7 +106,7 @@ function _webform_edit_file($currfield) 
 
     $edit_fields['extra']['filtering']['size'] = array(
       '#type' => 'textfield',
-      '#title' => t("Max Upload Size"),
+      '#title' => t('Max Upload Size'),
       '#default_value' => $currfield['extra']['filtering']['size'],
       '#description' => t('Enter the max file size a user may upload (in KB).'),
       '#size' => 10,
@@ -110,16 +115,16 @@ function _webform_edit_file($currfield) 
     );
     $edit_fields['extra']['savelocation'] = array(
       '#type' => 'textfield',
-      '#title' => t("Upload Directory"),
+      '#title' => t('Upload Directory'),
       '#default_value' => $currfield['extra']['savelocation'],
-      '#description' => "<div style='display: block'>". t('Webform uploads are always saved in the site files directory. You may optionally specify a subfolder to store your files.') ."</div>",
+      '#description' => '<div style="display: block">'. t('Webform uploads are always saved in the site files directory. You may optionally specify a subfolder to store your files.') .'</div>',
       '#weight' => 3,
       '#element_validate' => array('_webform_edit_file_check_directory', '_webform_edit_file_validate'),
       '#after_build' => array('_webform_edit_file_check_directory'),
     );
     $edit_fields['extra']['width'] = array(
       '#type' => 'textfield',
-      '#title' => t("Width"),
+      '#title' => t('Width'),
       '#default_value' => $currfield['extra']['width'],
       '#description' => t('Width of the file field.') .' '. t('Leaving blank will use the default size.'),
       '#size' => 5,
@@ -130,7 +135,7 @@ function _webform_edit_file($currfield) 
 }
 
 function _webform_edit_file_check_directory($form_element) {
-  $base_dir = file_directory_path() ."/webform";
+  $base_dir = file_directory_path() .'/webform';
   $base_success = file_check_directory($base_dir, FILE_CREATE_DIRECTORY);
 
   $destination_dir = $base_dir .'/'. $form_element['#value'];
@@ -159,7 +164,7 @@ function _webform_edit_file_filtering_va
   // Additional types.
   $additional_extensions = explode(',', $form_element['addextensions']['#value']);
   foreach ($additional_extensions as $extension) {
-    $clean_extension = strtolower(trim($extension));
+    $clean_extension = drupal_strtolower(trim($extension));
     if (!empty($clean_extension) && !in_array($clean_extension, $extensions)) {
       $extensions[] = $clean_extension;
     }
@@ -191,12 +196,12 @@ function theme_webform_edit_file($form) 
     if ($form['extra']['filtering']['types'][$filtergroup]['#type'] == 'checkboxes') {
       // Add the title.
       $row[] = $form['extra']['filtering']['types'][$filtergroup]['#title'];
-      $row[] = "&nbsp;";
+      $row[] = '&nbsp;';
       // Convert the checkboxes into individual form-items.
       $checkboxes = expand_checkboxes($form['extra']['filtering']['types'][$filtergroup]);
       // Render the checkboxes in two rows.
       $checkcount = 0;
-      $jsboxes = "";
+      $jsboxes = '';
       foreach ($checkboxes as $key => $checkbox) {
         if ($checkbox['#type'] == 'checkbox') {
           $checkcount++;
@@ -221,7 +226,7 @@ function theme_webform_edit_file($form) 
         $row[$current_cell + 1]['colspan'] = $colspan;
       }
       // Add the javascript links.
-      $jsboxes = substr($jsboxes, 0, strlen($jsboxes) - 1);
+      $jsboxes = drupal_substr($jsboxes, 0, drupal_strlen($jsboxes) - 1);
       $rows[] = array('data' => $row);
       $select_link = ' <a href="javascript:check_category_boxes(\''. $filtergroup .'\','. $jsboxes .')">(select)</a>';
       $rows[$first_row]['data'][1] = array('data' => $select_link, 'width' => 40);
@@ -249,7 +254,7 @@ function theme_webform_edit_file($form) 
   $output = drupal_render($form);
 
   // Prefix the upload location field with the default path for webform.
-  $output = str_replace("Upload Directory: </label>", "Upload Directory: </label>". file_directory_path() ."/webform/", $output);
+  $output = str_replace('Upload Directory: </label>', 'Upload Directory: </label>'. file_directory_path() .'/webform/', $output);
 
   return $output;
 }
@@ -314,9 +319,9 @@ function _webform_validate_file($form_el
   $extensions = $component['extra']['filtering']['types'];
   if (count($extensions) > 1) {
     for ($n = 0; $n < count($extensions) - 1; $n++) {
-      $extension_list .= $extensions[$n] .", ";
+      $extension_list .= $extensions[$n] .', ';
     }
-    $extension_list .= "or ". $extensions[count($extensions)-1];
+    $extension_list .= 'or '. $extensions[count($extensions)-1];
   }
   else {
     $extension_list = $extensions[0];
@@ -327,7 +332,7 @@ function _webform_validate_file($form_el
   }
 
   $dot = strrpos($_FILES['files']['name'][$form_key], '.');
-  $extension = strtolower(substr($_FILES['files']['name'][$form_key], $dot+1));
+  $extension = drupal_strtolower(drupal_substr($_FILES['files']['name'][$form_key], $dot+1));
   if (!in_array($extension, $extensions)) {
     form_set_error($form_key, t("Files with the '%ext' extension are not allowed, please upload a file with a %exts extension.", array('%ext' => $extension, '%exts' => $extension_list)));
   }
@@ -350,12 +355,12 @@ function _webform_validate_file($form_el
  *   Nothing.
  */
 function _webform_submit_file(&$data, $component) {
-  $upload_dir = file_directory_path() ."/webform/". $component['extra']['savelocation'];
+  $upload_dir = file_directory_path() .'/webform/'. $component['extra']['savelocation'];
   if (!empty($_FILES['files']['name'][$data['new']])) {
     if (file_check_directory($upload_dir, FILE_CREATE_DIRECTORY)) {
       $file_saved = file_save_upload($data['new'], array(), $upload_dir);
       if (!$file_saved) {
-        drupal_set_message(t("The uploaded file %filename was unable to be saved. The destination directory may not be writable.", array('%filename' => $file_saved['filename'])), "error");
+        drupal_set_message(t('The uploaded file %filename was unable to be saved. The destination directory may not be writable.', array('%filename' => $file_saved['filename'])), 'error');
       }
       else {
         file_set_status($file_saved, FILE_STATUS_PERMANENT);
@@ -366,7 +371,7 @@ function _webform_submit_file(&$data, $c
       }
     }
     else {
-      drupal_set_message(t("The uploaded file was unable to be saved. The destination directory does not exist."), "error");
+      drupal_set_message(t('The uploaded file was unable to be saved. The destination directory does not exist.'), 'error');
     }
   }
   else {
@@ -387,7 +392,7 @@ function _webform_submit_file(&$data, $c
  */
 function theme_webform_mail_file($data, $component) {
   $file = unserialize($data);
-  $output = $component['name'] .": ". (!empty($file['filepath']) ? webform_file_url($file['filepath']) : '') ."\n";
+  $output = $component['name'] .': '. (!empty($file['filepath']) ? webform_file_url($file['filepath']) : '') ."\n";
   return $output;
 }
 
@@ -415,7 +420,7 @@ function _webform_submission_display_fil
     $form_item['#default_value'] = empty($filedata['filepath']) ? $filedata['error'] : $filedata['filepath'];
   }
   if ($filedata['filename']) {
-    $form_item['#suffix'] = ' <a href="'. webform_file_url($filedata['filepath']) .'">Download '. $filedata['filename'] .'</a>' . $form_item['#suffix'];
+    $form_item['#suffix'] = ' <a href="'. webform_file_url($filedata['filepath']) .'">Download '. $filedata['filename'] .'</a>'. $form_item['#suffix'];
     if ($enabled) {
       $form_item['#description'] = t('Uploading a new file will replace the current file.');
       $form_item['existing'] = array(
@@ -447,17 +452,17 @@ function _webform_delete_file($data, $co
 }
 
 /**
- * Module specific instance of hook_help().
+ * Implementation of hook_help().
  */
 function _webform_help_file($section) {
   switch ($section) {
     case 'admin/settings/webform#file_description':
-      return t("Allow users to submit files of the configured types.");
+      return t('Allow users to submit files of the configured types.');
   }
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_file() {
   return array(
@@ -502,7 +507,7 @@ function _webform_analysis_rows_file($co
 
   $rows[0] = array(t('Left Blank'), ($submissions - $nonblanks));
   $rows[1] = array(t('User uploaded file'), $nonblanks);
-  $rows[2] = array(t('Average uploaded file size'), ($sizetotal !=0 ? (int)(($sizetotal/$nonblanks)/1024) ." KB" : '0'));
+  $rows[2] = array(t('Average uploaded file size'), ($sizetotal !=0 ? (int)(($sizetotal/$nonblanks)/1024) .' KB' : '0'));
   return $rows;
 }
 
@@ -519,13 +524,13 @@ function _webform_table_data_file($data)
   $filedata = unserialize($data['value']['0']);
   if (!empty($filedata['filename'])) {
     $output = '<a href="'. base_path() . $filedata['filepath'] .'">'. $filedata['filename'] .'</a>';
-    $output .= " (". (int)($filedata['filesize']/1024) ." KB)";
+    $output .= ' ('. (int)($filedata['filesize']/1024) .' KB)';
   }
   elseif (!empty($filedata['error'])) {
     $output = $filedata['error'];
   }
   else {
-    $output = "";
+    $output = '';
   }
   return $output;
 }
diff -upr webform-orig/components/grid.inc webform/components/grid.inc
--- webform-orig/components/grid.inc	2008-11-20 07:31:35.000000000 +0100
+++ webform/components/grid.inc	2008-11-21 23:10:00.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: grid.inc,v 1.3.2.14 2008/11/20 06:31:35 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module grid component.
+ */
+
+/**
  * Create a default grid component.
  */
 function _webform_defaults_grid() {
@@ -29,12 +34,12 @@ function _webform_defaults_grid() {
  * are not necessary to specify here (although they may be overridden if desired).
  * @return
  *   An array of form items to be displayed on the edit component page
- **/
+ */
 function _webform_edit_grid($currfield) {
   $edit_fields = array();
   $edit_fields['extra']['options'] = array(
     '#type' => 'textarea',
-    '#title' => t("Options"),
+    '#title' => t('Options'),
     '#default_value' => $currfield['extra']['options'],
     '#description' => t('Options to select across the top. One option per line. Key-value pairs may be entered seperated by pipes. i.e. safe_key|Some readable option') . theme('webform_token_help'),
     '#cols' => 60,
@@ -44,7 +49,7 @@ function _webform_edit_grid($currfield) 
   );
   $edit_fields['extra']['questions'] = array(
     '#type' => 'textarea',
-    '#title' => t("Questions"),
+    '#title' => t('Questions'),
     '#default_value' => $currfield['extra']['questions'],
     '#description' => t('Questions list down the left side. One question per line.') . theme('webform_token_help'),
     '#cols' => 60,
@@ -69,10 +74,10 @@ function _webform_edit_grid($currfield) 
 
 function _webform_edit_validate_grid($form_values) {
   // Currently no validation for selects.
-  return true;
+  return TRUE;
 }
 
-function _webform_render_grid($component, $random = true) {
+function _webform_render_grid($component, $random = TRUE) {
   $form_item = array(
     '#title' => $component['name'],
     '#required' => $component['mandatory'],
@@ -90,7 +95,7 @@ function _webform_render_grid($component
     $aux = array();
     $keys = array_keys($options);
     shuffle($keys);
-    foreach($keys as $key) {
+    foreach ($keys as $key) {
       $aux[$key] = $options[$key];
       unset($options[$key]);
     }
@@ -100,7 +105,7 @@ function _webform_render_grid($component
     $aux = array();
     $keys = array_keys($questions);
     shuffle($keys);
-    foreach($keys as $key) {
+    foreach ($keys as $key) {
       $aux[$key] = $questions[$key];
       unset($questions[$key]);
     }
@@ -135,7 +140,7 @@ function _webform_render_grid($component
  *   If enabled, the value may be changed. Otherwise it will set to readonly.
  * @return
  *   Textual output formatted for human reading.
- **/
+ */
 function _webform_submission_display_grid($data, $component, $enabled = FALSE) {
   $form_item = _webform_render_grid($component, FALSE);
   $cid = 0;
@@ -157,7 +162,7 @@ function _webform_submission_display_gri
  *   the webform_component database schema
  * @return
  *   Nothing
- **/
+ */
 function _webform_submit_grid(&$data, $component) {
   $options = drupal_map_assoc(array_flip(_webform_select_options($component['extra']['options'])));
   $questions = drupal_map_assoc(array_flip(_webform_select_options($component['extra']['questions'])));
@@ -202,17 +207,17 @@ function theme_webform_mail_grid($data, 
 
 /**
  * function _webform_help_select
- * Module specific instance of hook_help
- **/
+ * Implementation of hook_help().
+ */
 function _webform_help_grid($section) {
   switch ($section) {
     case 'admin/settings/webform#grid_description':
-      return t("Allows creation of grid questions, denoted by radio buttons.");
+      return t('Allows creation of grid questions, denoted by radio buttons.');
   }
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_grid() {
   return array(
@@ -236,7 +241,7 @@ function _webform_theme_grid() {
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
- **/
+ */
 function _webform_analysis_rows_grid($component) {
   // Generate the list of options and questions.
   $options = _webform_grid_options($component['extra']['options']);
@@ -275,19 +280,19 @@ function _webform_analysis_rows_grid($co
  * Return the result of this component's submission for display in a table. The output of this function will be displayed under the "results" tab then "table"
  * @param $data An array of information containing the submission result, directly correlating to the webform_submitted_data database schema
  * @returns Textual output formatted for human reading.
- **/
+ */
 function _webform_table_data_grid($data, $component) {
   $questions = array_values(_webform_grid_options($component['extra']['questions']));
   // Set the value as a single string.
   if (is_array($data['value'])) {
     foreach ($data['value'] as $item => $value) {
       if ($value !== '0') {
-        $output .= $questions[$item] .': '. check_plain($value) ."<br />";
+        $output .= $questions[$item] .': '. check_plain($value) .'<br />';
       }
     }
   }
   else {
-    $output = check_plain(empty($data['value']['0']) ? "" : $data['value']['0']);
+    $output = check_plain(empty($data['value']['0']) ? '' : $data['value']['0']);
   }
   return $output;
 }
@@ -303,7 +308,7 @@ function _webform_table_data_grid($data,
  * @return
  *   An array of data to be displayed in the first three rows of a CSV file, not
  *   including either prefixed or trailing commas.
- **/
+ */
 function _webform_csv_headers_grid($component) {
   $header = array();
   $header[0] = array('');
@@ -334,7 +339,7 @@ function _webform_csv_headers_grid($comp
  * @return
  *   Textual output formatted for CSV, not including either prefixed or trailing
  *   commas.
- **/
+ */
 function _webform_csv_data_grid($data, $component) {
   $questions = array_keys(_webform_grid_options($component['extra']['questions']));
   $return = array();
diff -upr webform-orig/components/hidden.inc webform/components/hidden.inc
--- webform-orig/components/hidden.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/hidden.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,7 +2,12 @@
 // $Id: hidden.inc,v 1.12.2.9 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
- * Create a default markup component.
+ * @file
+ *   Webform module hidden component.
+ */
+
+/**
+ * Create a default hidden component.
  */
 function _webform_defaults_hidden() {
   return array(
@@ -30,7 +35,7 @@ function _webform_edit_hidden($currfield
   $edit_fields = array();
   $edit_fields['value'] = array(
     '#type' => 'textarea',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field.') . theme('webform_token_help'),
     '#cols' => 60,
@@ -43,7 +48,7 @@ function _webform_edit_hidden($currfield
   );
   $edit_fields['extra']['email'] = array(
     '#type' => 'checkbox',
-    '#title' => t("E-mail a submission copy"),
+    '#title' => t('E-mail a submission copy'),
     '#return_value' => 1,
     '#default_value' => $currfield['extra']['email'],
     '#description' => t('Check this option if this component contains an e-mail address that should get a copy of the submission. Emails are sent individually so other emails will not be shown to the recipient.'),
@@ -100,12 +105,12 @@ function _webform_submission_display_hid
 }
 
 /**
- * Module specific instance of hook_help
+ * Implementation of hook_help().
  */
 function _webform_help_hidden($section) {
   switch ($section) {
     case 'admin/settings/webform#hidden_description':
-      return t("A field which is not visible to the user, but is recorded with the submission.");
+      return t('A field which is not visible to the user, but is recorded with the submission.');
   }
 }
 
@@ -131,7 +136,7 @@ function _webform_analysis_rows_hidden($
 
   $result = db_query($query, $component['nid'], $component['cid']);
   while ($data = db_fetch_array($result)) {
-    if ( strlen(trim($data['data'])) > 0 ) {
+    if ( drupal_strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
       $wordcount += str_word_count(trim($data['data']));
     }
@@ -155,7 +160,7 @@ function _webform_analysis_rows_hidden($
  *   Textual output formatted for human reading.
  */
 function _webform_table_data_hidden($data) {
-  return check_plain(empty($data['value']['0']) ? "" : $data['value']['0']);
+  return check_plain(empty($data['value']['0']) ? '' : $data['value']['0']);
 }
 
 
@@ -189,5 +194,5 @@ function _webform_csv_headers_hidden($co
  *   commas.
  */
 function _webform_csv_data_hidden($data) {
-  return empty($data['value']['0']) ? "" : $data['value']['0'];
+  return empty($data['value']['0']) ? '' : $data['value']['0'];
 }
diff -upr webform-orig/components/markup.inc webform/components/markup.inc
--- webform-orig/components/markup.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/markup.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: markup.inc,v 1.5.2.6 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module markup component.
+ */
+
+/**
  * Create a default markup component.
  */
 function _webform_defaults_markup() {
@@ -31,7 +36,7 @@ function _webform_edit_markup($currfield
   $edit_fields['advanced']['mandatory'] = array(); // Do not render the mandatory checkbox.
   $edit_fields['value'] = array(
     '#type' => 'textarea',
-    '#title' => t("Value"),
+    '#title' => t('Value'),
     '#default_value' => $currfield['value'],
     '#description' => t('Markup allows you to enter custom HTML or PHP logic into your form.') . theme('webform_token_help'),
     '#weight' => -1,
@@ -56,10 +61,10 @@ function _webform_edit_markup($currfield
 function _webform_render_markup($component) {
   // We don't want users to be able to execute filters outside of their permissions on preview.
   if ($_POST['op'] == t('Preview')) {
-    $check_filter = true;
+    $check_filter = TRUE;
   }
   else {
-    $check_filter = false;
+    $check_filter = FALSE;
   }
 
   $form_item = array(
@@ -90,11 +95,11 @@ function _webform_submission_display_mar
 }
 
 /**
- * Module specific instance of hook_help().
+ * Implementation of hook_help().
  */
 function _webform_help_markup($section) {
   switch ($section) {
     case 'admin/settings/webform#markup_description':
-      return t("Displays text as HTML in the form; does not render a field.");
+      return t('Displays text as HTML in the form; does not render a field.');
   }
 }
diff -upr webform-orig/components/pagebreak.inc webform/components/pagebreak.inc
--- webform-orig/components/pagebreak.inc	2008-09-06 22:51:40.000000000 +0200
+++ webform/components/pagebreak.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: pagebreak.inc,v 1.3.2.3 2008/09/06 20:51:40 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module page break component.
+ */
+
+/**
  * Create a default pagebreak component.
  */
 function _webform_defaults_pagebreak() {
@@ -46,12 +51,12 @@ function _webform_edit_pagebreak($currfi
 }
 
 /**
- * Module specific instance of hook_help
+ * Implementation of hook_help().
  */
 function _webform_help_pagebreak($section) {
   switch ($section) {
     case 'admin/settings/webform#pagebreak_description':
-      return t("Break up a multi-page form.");
+      return t('Break up a multi-page form.');
   }
 }
 
@@ -68,7 +73,7 @@ function _webform_render_pagebreak($comp
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_pagebreak() {
   return array(
diff -upr webform-orig/components/select.inc webform/components/select.inc
--- webform-orig/components/select.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/select.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: select.inc,v 1.22.2.19 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module multiple select component.
+ */
+
+/**
  * Create a default select component.
  */
 function _webform_defaults_select() {
@@ -36,7 +41,7 @@ function _webform_edit_select($currfield
   $edit_fields = array();
   $edit_fields['extra']['items'] = array(
     '#type' => 'textarea',
-    '#title' => t("Options"),
+    '#title' => t('Options'),
     '#default_value' => $currfield['extra']['items'],
     '#description' => t('A list of selectable options. One option per line. Key-value pairs may be entered seperated by pipes, such as "safe_key|Some readable option". Option groups for lists and menus may be specified with &lt;Group Name&gt;. &lt;&gt; can be used to insert items at the root of the menu after specifying a group.') . theme('webform_token_help'),
     '#cols' => 60,
@@ -46,7 +51,7 @@ function _webform_edit_select($currfield
   );
   $edit_fields['value'] = array(
     '#type' => 'textfield',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field. For multiple selects use commas to separate multiple defaults.') . theme('webform_token_help'),
     '#size' => 60,
@@ -55,24 +60,24 @@ function _webform_edit_select($currfield
   );
   $edit_fields['extra']['multiple'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Multiple"),
+    '#title' => t('Multiple'),
     '#return_value' => 'Y',
     '#default_value' => ($currfield['extra']['multiple'] == 'Y' ? TRUE : FALSE),
     '#description' => t('Check this option if the user should be allowed to choose multiple values.'),
   );
   $edit_fields['extra']['aslist'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Listbox"),
+    '#title' => t('Listbox'),
     '#return_value' => 'Y',
     '#default_value' => ($currfield['extra']['aslist'] == 'Y' ? TRUE : FALSE),
     '#description' => t('Check this option if you want the select component to be of listbox type instead of radiobuttons or checkboxes.'),
   );
   $edit_fields['extra']['email'] = array(
     '#type' => 'checkbox',
-    '#title' => t("E-mail a submission copy"),
+    '#title' => t('E-mail a submission copy'),
     '#return_value' => 1,
     '#default_value' => $currfield['extra']['email'],
-    '#description' => t('Check this option if this component contains an e-mail address that should get a copy of the submission. Emails are sent individually so other emails will not be shown to the recipient.') ." ".
+    '#description' => t('Check this option if this component contains an e-mail address that should get a copy of the submission. Emails are sent individually so other emails will not be shown to the recipient.') .' '.
                       t('To use the option with a select component, you must use key-value pairs seperated by pipes. i.e. user@example.com|Sample user.'),
   );
   return $edit_fields;
@@ -81,7 +86,7 @@ function _webform_edit_select($currfield
 function _webform_edit_validate_select($form_values) {
   // Currently no validation for selects.
   // TODO: Validate e-mail addresses when used as keys?
-  return true;
+  return TRUE;
 }
 
 /**
@@ -255,31 +260,31 @@ function theme_webform_mail_select($data
     foreach ((array)$data as $value) {
       if ($value) {
         if ($options[$value]) {
-          $output .= "    - ". $options[$value] ."\n";
+          $output .= '    - '. $options[$value] ."\n";
         }
       }
     }
   }
   else {
     if ($options[$data]) {
-      $output = $component['name'] .": ". $options[$data] ."\n";
+      $output = $component['name'] .': '. $options[$data] ."\n";
     }
   }
   return $output;
 }
 
 /**
- * Module specific instance of hook_help().
+ * Implementation of hook_help().
  */
 function _webform_help_select($section) {
   switch ($section) {
     case 'admin/settings/webform#select_description':
-      return t("Allows creation of checkboxes, radio buttons, or select menus.");
+      return t('Allows creation of checkboxes, radio buttons, or select menus.');
   }
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_select() {
   return array(
@@ -337,12 +342,12 @@ function _webform_table_data_select($dat
   if (is_array($data['value'])) {
     foreach ($data['value'] as $value) {
       if ($value !== '0') {
-        $output .= check_plain($value) ."<br />";
+        $output .= check_plain($value) .'<br />';
       }
     }
   }
   else {
-    $output = check_plain(empty($data['value']['0']) ? "" : $data['value']['0']);
+    $output = check_plain(empty($data['value']['0']) ? '' : $data['value']['0']);
   }
   return $output;
 }
@@ -437,14 +442,14 @@ function _webform_select_options($text, 
     $option = trim($option);
     /**
      * If the Key of the option is within < >, treat as an optgroup
-     * 
+     *
      * <Group 1>
      *   creates an optgroup with the label "Group 1"
-     * 
+     *
      * <>
-     *   Unsets the current group, allowing items to be inserted at the root element.  
+     *   Unsets the current group, allowing items to be inserted at the root element.
      */
-    
+
     if (preg_match('/^\<([^>]*)\>$/', $option, $matches)) {
       if (empty($matches[1])) {
         unset($group);
@@ -453,7 +458,7 @@ function _webform_select_options($text, 
         $group = _webform_filter_values($matches[1], NULL, NULL, FALSE);
       }
     }
-    else if (preg_match('/^([^|]+)\|(.*)$/', $option, $matches)) {
+    elseif (preg_match('/^([^|]+)\|(.*)$/', $option, $matches)) {
       $key = _webform_filter_values($matches[1], NULL, NULL, FALSE);
       $value = _webform_filter_values($matches[2], NULL, NULL, FALSE);
       isset($group) ? $options[$group][$key] = $value : $options[$key] = $value;
diff -upr webform-orig/components/textarea.inc webform/components/textarea.inc
--- webform-orig/components/textarea.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/textarea.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: textarea.inc,v 1.12.2.7 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module textarea component.
+ */
+
+/**
  * Create a default textarea component.
  */
 function _webform_defaults_textarea() {
@@ -36,7 +41,7 @@ function _webform_edit_textarea($currfie
   $edit_fields = array();
   $edit_fields['value'] = array(
     '#type' => 'textarea',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field.') . theme('webform_token_help'),
     '#cols' => 60,
@@ -45,7 +50,7 @@ function _webform_edit_textarea($currfie
   );
   $edit_fields['extra']['cols'] = array(
     '#type' => 'textfield',
-    '#title' => t("Width"),
+    '#title' => t('Width'),
     '#default_value' => $currfield['extra']['cols'],
     '#description' => t('Width of the textfield.') .' '. t('Leaving blank will use the default size.'),
     '#size' => 5,
@@ -53,7 +58,7 @@ function _webform_edit_textarea($currfie
   );
   $edit_fields['extra']['rows'] = array(
     '#type' => 'textfield',
-    '#title' => t("Height"),
+    '#title' => t('Height'),
     '#default_value' => $currfield['extra']['rows'],
     '#description' => t('Height of the textfield.') .' '. t('Leaving blank will use the default size.'),
     '#size' => 5,
@@ -61,7 +66,7 @@ function _webform_edit_textarea($currfie
   );
   $edit_fields['extra']['disabled'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Disabled"),
+    '#title' => t('Disabled'),
     '#return_value' => 1,
     '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
     '#weight' => 3,
@@ -80,7 +85,7 @@ function _webform_edit_textarea($currfie
  */
 function _webform_render_textarea($component) {
   $form_item = array(
-    '#type'          => "textarea",
+    '#type'          => 'textarea',
     '#title'         => $component['name'],
     '#default_value' => _webform_filter_values($component['value']),
     '#required'      => $component['mandatory'],
@@ -121,12 +126,12 @@ function _webform_submission_display_tex
 }
 
 /**
- * Module specific instance of hook_help
+ * Implementation of hook_help().
  */
 function _webform_help_textarea($section) {
   switch ($section) {
     case 'admin/settings/webform#textarea_description':
-      return t("A large text area that allows for multiple lines of input.");
+      return t('A large text area that allows for multiple lines of input.');
   }
 }
 
@@ -152,7 +157,7 @@ function _webform_analysis_rows_textarea
 
   $result = db_query($query, $component['nid'], $component['cid']);
   while ($data = db_fetch_array($result)) {
-    if ( strlen(trim($data['data'])) > 0 ) {
+    if ( drupal_strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
       $wordcount += str_word_count(trim($data['data']));
     }
@@ -175,7 +180,7 @@ function _webform_analysis_rows_textarea
  *   Textual output formatted for human reading.
  */
 function _webform_table_data_textarea($data) {
-  return empty($data['value']['0']) ? "" : check_markup($data['value']['0'], FILTER_HTML_STRIP, FALSE);
+  return empty($data['value']['0']) ? '' : check_markup($data['value']['0'], FILTER_HTML_STRIP, FALSE);
 }
 
 
@@ -209,5 +214,5 @@ function _webform_csv_headers_textarea($
  *   commas.
  */
 function _webform_csv_data_textarea($data) {
-  return empty($data['value']['0']) ? "" : $data['value']['0'];
+  return empty($data['value']['0']) ? '' : $data['value']['0'];
 }
diff -upr webform-orig/components/textfield.inc webform/components/textfield.inc
--- webform-orig/components/textfield.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/textfield.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: textfield.inc,v 1.12.2.7 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module textfield component.
+ */
+
+/**
  * Create a default textfield component.
  */
 function _webform_defaults_textfield() {
@@ -38,7 +43,7 @@ function _webform_edit_textfield($currfi
   $edit_fields = array();
   $edit_fields['value'] = array(
     '#type' => 'textfield',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field.') . theme('webform_token_help'),
     '#size' => 60,
@@ -47,7 +52,7 @@ function _webform_edit_textfield($currfi
   );
   $edit_fields['extra']['width'] = array(
     '#type' => 'textfield',
-    '#title' => t("Width"),
+    '#title' => t('Width'),
     '#default_value' => $currfield['extra']['width'],
     '#description' => t('Width of the textfield.') .' '. t('Leaving blank will use the default size.'),
     '#size' => 5,
@@ -56,7 +61,7 @@ function _webform_edit_textfield($currfi
   );
   $edit_fields['extra']['maxlength'] = array(
     '#type' => 'textfield',
-    '#title' => t("Maxlength"),
+    '#title' => t('Maxlength'),
     '#default_value' => $currfield['extra']['maxlength'],
     '#description' => t('Maxlength of the textfield.'),
     '#size' => 5,
@@ -65,7 +70,7 @@ function _webform_edit_textfield($currfi
   );
   $edit_fields['extra']['field_prefix'] = array(
     '#type' => 'textfield',
-    '#title' => t("Label placed to the left of the textfield"),
+    '#title' => t('Label placed to the left of the textfield'),
     '#default_value' => $currfield['extra']['field_prefix'],
     '#description' => t('Examples: $, #, -.'),
     '#size' => 20,
@@ -74,7 +79,7 @@ function _webform_edit_textfield($currfi
   );
   $edit_fields['extra']['field_suffix'] = array(
     '#type' => 'textfield',
-    '#title' => t("Label placed to the right of the textfield"),
+    '#title' => t('Label placed to the right of the textfield'),
     '#default_value' => $currfield['extra']['field_suffix'],
     '#description' => t('Examples: lb, kg, %.'),
     '#size' => 20,
@@ -83,7 +88,7 @@ function _webform_edit_textfield($currfi
   );
   $edit_fields['extra']['disabled'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Disabled"),
+    '#title' => t('Disabled'),
     '#return_value' => 1,
     '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
     '#weight' => 3,
@@ -163,11 +168,11 @@ function _webform_submission_display_tex
  */
 function theme_webform_mail_textfield($data, $component) {
   $value = $data == '' ? '' : ' '. $component['extra']['field_prefix'] . $data . $component['extra']['field_suffix'];
-  return $component['name'] .":". $value;
+  return $component['name'] .':'. $value;
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_textfield() {
   return array(
@@ -178,12 +183,12 @@ function _webform_theme_textfield() {
 }
 
 /**
- * Module specific instance of hook_help
+ * Implementation of hook_help().
  */
 function _webform_help_textfield($section) {
   switch ($section) {
     case 'admin/settings/webform#textfield_description':
-      return t("Basic textfield type.");
+      return t('Basic textfield type.');
   }
 }
 
@@ -209,7 +214,7 @@ function _webform_analysis_rows_textfiel
 
   $result = db_query($query, $component['nid'], $component['cid']);
   while ($data = db_fetch_array($result)) {
-    if ( strlen(trim($data['data'])) > 0 ) {
+    if ( drupal_strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
       $wordcount += str_word_count(trim($data['data']));
     }
@@ -232,7 +237,7 @@ function _webform_analysis_rows_textfiel
  *   Textual output formatted for human reading.
  */
 function _webform_table_data_textfield($data) {
-  return check_plain(empty($data['value']['0']) ? "" : $data['value']['0']);
+  return check_plain(empty($data['value']['0']) ? '' : $data['value']['0']);
 }
 
 
@@ -266,5 +271,5 @@ function _webform_csv_headers_textfield(
  *   commas.
  */
 function _webform_csv_data_textfield($data) {
-  return !isset($data['value']['0']) ? "" : $data['value']['0'];
+  return !isset($data['value']['0']) ? '' : $data['value']['0'];
 }
diff -upr webform-orig/components/time.inc webform/components/time.inc
--- webform-orig/components/time.inc	2008-11-03 18:01:44.000000000 +0100
+++ webform/components/time.inc	2008-11-21 23:10:01.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: time.inc,v 1.16.2.8 2008/11/03 17:01:44 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module time component.
+ */
+
+/**
  * Create a default time component.
  */
 function _webform_defaults_time() {
@@ -33,7 +38,7 @@ function _webform_edit_time($currfield) 
   $edit_fields = array();
   $edit_fields['value'] = array(
     '#type' => 'textfield',
-    '#title' => t("Default value"),
+    '#title' => t('Default value'),
     '#default_value' => $currfield['value'],
     '#description' => t('The default value of the field.') .'<br />'. t('Accepts a time in any <a href="http://www.gnu.org/software/tar/manual/html_node/tar_109.html">GNU Date Input Format</a>. Strings such as now, +2 hours, and 10:30pm are all valid.'),
     '#size' => 60,
@@ -43,15 +48,15 @@ function _webform_edit_time($currfield) 
   );
   $edit_fields['extra']['timezone'] = array(
     '#type' => 'radios',
-    '#title' => t("Timezone"),
-    '#default_value' => empty($currfield['extra']['timezone']) ? "site" : $currfield['extra']['timezone'],
+    '#title' => t('Timezone'),
+    '#default_value' => empty($currfield['extra']['timezone']) ? 'site' : $currfield['extra']['timezone'],
     '#description' => t('Adjust the time according to a specific timezone. Website timezone is defined in the <a href="!settings">Site Settings</a> and is the default.', array('!settings' => url('admin/settings/date-time'))),
     '#options' => array('site' => 'Website Timezone', 'user' => 'User Timezone', 'gmt' => 'GMT'),
     '#weight' => 0,
   );
 $edit_fields['extra']['check_daylight_savings'] = array(
   '#type' => 'checkbox',
-  '#title' => t("Observe Daylight Savings"),
+  '#title' => t('Observe Daylight Savings'),
   '#default_value' => $currfield['extra']['check_daylight_savings'],
   '#checked_value' => 1,
   '#description' => t('Automatically adjust the time during daylight savings.'),
@@ -59,7 +64,7 @@ $edit_fields['extra']['check_daylight_sa
 );
   $edit_fields['extra']['hourformat'] = array(
     '#type' => 'radios',
-    '#title' => t("Time Format"),
+    '#title' => t('Time Format'),
     '#default_value' => isset($currfield['extra']['hourformat']) ? $currfield['extra']['hourformat'] : '12-hour',
     '#description' => t('Format the display of the time in 12 or 24 hours.'),
     '#options' => array('12-hour' => '12-hour (am/pm)', '24-hour' => '24-hour'),
@@ -74,15 +79,15 @@ $edit_fields['extra']['check_daylight_sa
  * @return An array of a form item to be displayed on the client-side webform
  */
 function _webform_render_time($component) {
-  if (strlen($component['value']) > 0) {
+  if (drupal_strlen($component['value']) > 0) {
     // Calculate the timestamp in GMT.
     $timestamp = strtotime($component['value']);
-    if ($component['extra']['timezone'] == "user") {
+    if ($component['extra']['timezone'] == 'user') {
       // Use the users timezone.
       global $user;
       $timestamp += (int)$user->timezone;
     }
-    elseif ($component['extra']['timezone'] == "gmt") {
+    elseif ($component['extra']['timezone'] == 'gmt') {
       // Use GMT.
       $timestamp += 0;
     }
@@ -92,7 +97,7 @@ function _webform_render_time($component
     }
 
     // Check for daylight savings time.
-    if ($component['extra']['check_daylight_savings'] && date("I")) {
+    if ($component['extra']['check_daylight_savings'] && date('I')) {
       $timestamp += 3600;
     }
   }
@@ -108,15 +113,15 @@ function _webform_render_time($component
     $hour_format = 'G';
   }
 
-  if (strlen($component['value']) > 0) {
+  if (drupal_strlen($component['value']) > 0) {
     $hour = gmdate($hour_format, $timestamp);
     $minute = gmdate('i', $timestamp);
     $am_pm = gmdate('a', $timestamp);
   }
 
   // Generate the choices for drop-down selects.
-  $hours[""] = t("hour");
-  $minutes[""] = t("minute");
+  $hours[''] = t('hour');
+  $minutes[''] = t('minute');
   for ($i = $first_hour; $i <= $last_hour; $i++) $hours[$i] = $i;
   for ($i = 0; $i <= 59; $i++) $minutes[$i < 10 ? "0$i" : $i] = $i < 10 ? "0$i" : $i;
   $am_pms = array('am' => t('am'), 'pm' => t('pm'));
@@ -163,15 +168,15 @@ function webform_validate_time($form_ite
   // Check if the user filled the required fields.
   foreach ($form_item['#webform_component'] == '12-hour' ? array('hour', 'minute', 'ampm') : array('hour', 'minute') as $field_type) {
     if (!is_numeric($form_item[$field_type]['#value']) && $form_item['#required']) {
-      form_set_error($form_key, t("%field field is required.", array('%field' => $name)));
+      form_set_error($form_key, t('%field field is required.', array('%field' => $name)));
       return;
     }
   }
 
   // Check for a valid time.
-  if ($form_item['hour']['#value'] !== "" || $form_item['minute']['#value'] !== "" || (isset($form_item['ampm']) && $form_item['ampm']['#value'] !== "")) {
-    if (!is_numeric($form_item['hour']['#value']) || !is_numeric($form_item['minute']['#value']) || (isset($form_item['ampm']) && $form_item['ampm']['#value'] === "")) {
-      form_set_error($form_key, t("Entered %name is not a valid time.", array('%name' => $name)));
+  if ($form_item['hour']['#value'] !== '' || $form_item['minute']['#value'] !== '' || (isset($form_item['ampm']) && $form_item['ampm']['#value'] !== '')) {
+    if (!is_numeric($form_item['hour']['#value']) || !is_numeric($form_item['minute']['#value']) || (isset($form_item['ampm']) && $form_item['ampm']['#value'] === '')) {
+      form_set_error($form_key, t('Entered %name is not a valid time.', array('%name' => $name)));
       return;
     }
   }
@@ -200,12 +205,12 @@ function _webform_submission_display_tim
 
   // Match the hourly data to the hour format.
   if ($data['value']['1']) {
-    $timestamp = strtotime($data['value']['0'] .":". $data['value']['1'] . (isset($data['value']['2']) ? $data['value']['2'] : ''));
-    if ($component['extra']['hourformat'] == "24-hour") {
-      $form_item['hour']['#default_value'] = date("H", $timestamp);
+    $timestamp = strtotime($data['value']['0'] .':'. $data['value']['1'] . (isset($data['value']['2']) ? $data['value']['2'] : ''));
+    if ($component['extra']['hourformat'] == '24-hour') {
+      $form_item['hour']['#default_value'] = date('H', $timestamp);
     }
     else {
-      $form_item['hour']['#default_value'] = date("g", $timestamp);
+      $form_item['hour']['#default_value'] = date('g', $timestamp);
       $form_item['ampm']['#default_value'] = $data['value']['2'];
     }
   }
@@ -224,30 +229,30 @@ function _webform_submission_display_tim
  *   Textual output to be included in the email.
  */
 function theme_webform_mail_time($data, $component) {
-  $output = $component['name'] .":";
+  $output = $component['name'] .':';
   if ($data['hour'] && $data['minute']) {
-    if ($component['extra']['hourformat'] == "24-hour") {
-      $output .= " ". $data['hour'] .":". $data['minute'];
+    if ($component['extra']['hourformat'] == '24-hour') {
+      $output .= ' '. $data['hour'] .':'. $data['minute'];
     }
     else {
-      $output .= " ". $data['hour'] .":". $data['minute'] ." ". $data['ampm'];
+      $output .= ' '. $data['hour'] .':'. $data['minute'] .' '. $data['ampm'];
     }
   }
   return $output;
 }
 
 /**
- * Module specific instance of hook_help
+ * Implementation of hook_help().
  */
 function _webform_help_time($section) {
   switch ($section) {
     case 'admin/settings/webform#time_description':
-      return t("Presents the user with hour and minute fields. Optional am/pm fields.");
+      return t('Presents the user with hour and minute fields. Optional am/pm fields.');
   }
 }
 
 /**
- * Module specific instance of hook_theme().
+ * Implementation of hook_theme().
  */
 function _webform_theme_time() {
   return array(
@@ -293,13 +298,13 @@ function _webform_analysis_rows_time($co
             if ($row['no'] == '2') {
               $ampm = $row['data'];
               // Build the full timestamp.
-              if (strlen($hour) > 0 && strlen($minute) > 0 ) {
-                $timestamps[] = strtotime($hour .":". $minute .' '. $ampm);
+              if (drupal_strlen($hour) > 0 && drupal_strlen($minute) > 0 ) {
+                $timestamps[] = strtotime($hour .':'. $minute .' '. $ampm);
               }
             }
             else {
               // Build military time.
-              $timestamps[] = strtotime($hour .":". $minute);
+              $timestamps[] = strtotime($hour .':'. $minute);
             }
           }
         }
@@ -325,17 +330,17 @@ function _webform_analysis_rows_time($co
  *   Textual output formatted for human reading.
  */
 function _webform_table_data_time($data, $component) {
-  if (strlen($data['value']['0']) > 0 && strlen($data['value']['1']) > 0) {
-    $timestamp = strtotime($data['value']['0'] .":". $data['value']['1'] . $data['value']['2']);
+  if (drupal_strlen($data['value']['0']) > 0 && drupal_strlen($data['value']['1']) > 0) {
+    $timestamp = strtotime($data['value']['0'] .':'. $data['value']['1'] . $data['value']['2']);
     if ($component['extra']['hourformat'] == '24-hour') {
-      return check_plain(date("H:i", $timestamp));
+      return check_plain(date('H:i', $timestamp));
     }
     else {
-      return check_plain(date("g:i a", $timestamp));
+      return check_plain(date('g:i a', $timestamp));
     }
   }
   else {
-    return "";
+    return '';
   }
 }
 
@@ -370,17 +375,17 @@ function _webform_csv_headers_time($comp
  *   commas.
  */
 function _webform_csv_data_time($data, $component) {
-  if (strlen($data['value']['0']) > 0 && strlen($data['value']['1']) > 0) {
-    $timestamp = strtotime($data['value']['0'] .":". $data['value']['1'] . $data['value']['2']);
+  if (drupal_strlen($data['value']['0']) > 0 && drupal_strlen($data['value']['1']) > 0) {
+    $timestamp = strtotime($data['value']['0'] .':'. $data['value']['1'] . $data['value']['2']);
     if ($component['extra']['hourformat'] == '24-hour') {
-      return date("H:i", $timestamp);
+      return date('H:i', $timestamp);
     }
     else {
-      return date("g:i a", $timestamp);
+      return date('g:i a', $timestamp);
     }
   }
   else {
-    return "";
+    return '';
   }
 }
 
diff -upr webform-orig/tests/components.test webform/tests/components.test
--- webform-orig/tests/components.test	2008-10-08 21:51:40.000000000 +0200
+++ webform/tests/components.test	2008-11-21 23:10:03.000000000 +0100
@@ -1,6 +1,11 @@
 <?php
 // $Id$
 
+/**
+ * @file
+ * Webform module component tests.
+ */
+
 include_once(dirname(__FILE__) .'/webform.test');
 
 class WebformComponentsTestCase extends WebformTestCase {
diff -upr webform-orig/tests/permissions.test webform/tests/permissions.test
--- webform-orig/tests/permissions.test	2008-10-08 21:51:40.000000000 +0200
+++ webform/tests/permissions.test	2008-11-21 23:10:03.000000000 +0100
@@ -1,6 +1,11 @@
 <?php
 // $Id$
 
+/**
+ * @file
+ * Webform module permission tests.
+ */
+
 include_once(dirname(__FILE__) .'/webform.test');
 
 class WebformPermissionsTestCase extends WebformTestCase {
@@ -26,7 +31,7 @@ class WebformPermissionsTestCase extends
    * Implementation of tearDown().
    */
   function tearDown() {
-     parent::tearDown();
+    parent::tearDown();
   }
 
   /**
diff -upr webform-orig/tests/submission.test webform/tests/submission.test
--- webform-orig/tests/submission.test	2008-09-06 05:12:37.000000000 +0200
+++ webform/tests/submission.test	2008-11-21 23:10:04.000000000 +0100
@@ -1,6 +1,11 @@
 <?php
 // $Id$
 
+/**
+ * @file
+ * Webform module submission tests.
+ */
+
 include_once(dirname(__FILE__) .'/webform.test');
 
 class WebformSubmissionTestCase extends WebformTestCase {
@@ -84,7 +89,7 @@ class WebformSubmissionTestCase extends 
       $actual_value = $actual_submission['data'][$cid]['value'];
       $success = $this->assertEqual($stable_value, $actual_value, t('[webform] Component @form_key data integrity check', array('@form_key' => $component['form_key'])));
       if (!$success) {
-        $this->fail(t('Expected !expected', array('!expected' => print_r($stable_value, TRUE))) . "\n\n" . t('Recieved !recieved', array('!recieved' => print_r($actual_value, TRUE))));
+        $this->fail(t('Expected !expected', array('!expected' => print_r($stable_value, TRUE))) ."\n\n". t('Recieved !recieved', array('!recieved' => print_r($actual_value, TRUE))));
       }
     }
   }
diff -upr webform-orig/tests/webform.test webform/tests/webform.test
--- webform-orig/tests/webform.test	2008-10-21 07:21:35.000000000 +0200
+++ webform/tests/webform.test	2008-11-21 23:10:03.000000000 +0100
@@ -1,6 +1,11 @@
 <?php
 // $Id$
 
+/**
+ * @file
+ * Webform module tests.
+ */
+
 class WebformTestCase extends DrupalTestCase {
   private $_webform_node;
   private $_webform_components;
@@ -59,8 +64,8 @@ class WebformTestCase extends DrupalTest
 
       $ua = array();
       $ua['name']   = $this->randomName();
-      $ua['mail']   = $ua['name'] . '@localhost';
-      $ua['roles']  = array($rid=>$rid);
+      $ua['mail']   = $ua['name'] .'@localhost';
+      $ua['roles']  = array($rid => $rid);
       $ua['pass']   = user_password();
       $ua['status'] = 1;
       // Add a sample profile field for testing %profile values.
@@ -80,7 +85,7 @@ class WebformTestCase extends DrupalTest
     // Delete the webform admin and any created nodes.
     foreach ($this->webform_users as $user) {
       $uid = $user->uid;
-      $result = db_query("SELECT nid FROM {node} WHERE uid = %d", $uid);
+      $result = db_query('SELECT nid FROM {node} WHERE uid = %d', $uid);
       while ($node = db_fetch_array($result)) {
         node_delete($node['nid']);
       }
diff -upr webform-orig/webform_components.inc webform/webform_components.inc
--- webform-orig/webform_components.inc	2008-10-30 23:48:08.000000000 +0100
+++ webform/webform_components.inc	2008-11-21 23:10:00.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: webform_components.inc,v 1.9.2.22 2008/10/30 22:48:08 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module components handling.
+ */
+
+/**
  * Provides interface and database handling for editing components of a webform.
  *
  * @author Nathan Haug <nate@lullabot.com>
@@ -36,18 +41,18 @@ function webform_components_form($form_s
     $form['components'][$cid]['weight'] = array(
       '#type' => 'weight',
       '#delta' => count($node->webform['components']) > 10 ? count($node->webform['components']) : 10,
-      '#title' => t("Weight"),
+      '#title' => t('Weight'),
       '#default_value' => $component['weight'],
     );
     $form['components'][$cid]['mandatory'] = array(
       '#type' => 'checkbox',
-      '#title' => t("Mandatory"),
+      '#title' => t('Mandatory'),
       '#default_value' => $component['mandatory'],
       '#access' => !in_array($component['type'], array('markup', 'fieldset', 'pagebreak')),
     );
     $form['components'][$cid]['email'] = array(
       '#type' => 'checkbox',
-      '#title' => t("E-mail"),
+      '#title' => t('E-mail'),
       '#default_value' => $component['email'],
       '#access' => !in_array($component['type'], array('markup', 'fieldset', 'pagebreak')),
     );
@@ -157,9 +162,9 @@ function theme_webform_components_form($
     // Build the table rows.
     function _webform_components_form_rows($node, $cid, $component, $level, &$form, &$rows, &$add_form) {
       // Create presentable values.
-      if (strlen($component['value']) > 30) {
-        $component['value'] = substr($component['value'], 0, 30);
-        $component['value'] .= "...";
+      if (drupal_strlen($component['value']) > 30) {
+        $component['value'] = drupal_substr($component['value'], 0, 30);
+        $component['value'] .= '...';
       }
       $component['value'] = check_plain($component['value']);
 
@@ -184,7 +189,7 @@ function theme_webform_components_form($
       $row_data = array(
         $indents . $component['name'],
         $component['type'],
-        ($component['value'] == "") ? "-" : $component['value'],
+        ($component['value'] == '') ? '-' : $component['value'],
         drupal_render($form['components'][$cid]['mandatory']),
         drupal_render($form['components'][$cid]['email']),
         drupal_render($form['components'][$cid]['cid']) . drupal_render($form['components'][$cid]['pid']) . drupal_render($form['components'][$cid]['weight']),
@@ -192,7 +197,7 @@ function theme_webform_components_form($
         l(t('Clone'), 'node/'. $node->nid .'/edit/components/'. $cid .'/clone'),
         l(t('Delete'), 'node/'. $node->nid .'/edit/components/'. $cid .'/delete'),
       );
-      $row_class = 'draggable' . ($component['type'] != 'fieldset' ? ' tabledrag-leaf' : '');
+      $row_class = 'draggable'. ($component['type'] != 'fieldset' ? ' tabledrag-leaf' : '');
       $rows[] = array('data' => $row_data, 'class' => $row_class);
       if (isset($component['children']) && is_array($component['children'])) {
         foreach ($component['children'] as $cid => $component) {
@@ -212,7 +217,7 @@ function theme_webform_components_form($
     }
   }
   else {
-    $rows[] = array(array('data' => t("No Components, add a component below."), 'colspan' => 9));
+    $rows[] = array(array('data' => t('No Components, add a component below.'), 'colspan' => 9));
   }
 
   // Append the add form if not already printed.
@@ -227,7 +232,7 @@ function theme_webform_components_form($
 }
 
 function webform_components_form_validate($form, &$form_state) {
-  if (isset($_POST['op']) && $_POST['op'] == t('Add') && strlen(trim($form_state['values']['add']['name'])) <= 0) {
+  if (isset($_POST['op']) && $_POST['op'] == t('Add') && drupal_strlen(trim($form_state['values']['add']['name'])) <= 0) {
     form_set_error('add][name', t('When adding a new component, the name field is required.'));
   }
 }
@@ -263,7 +268,7 @@ function webform_components_form_submit(
 }
 
 function webform_component_edit_form($form_state, &$node, $component, $clone = FALSE) {
-  drupal_set_title(t("Edit component: @name (@type)", array('@name' => $component['name'], '@type' => t($component['type']))));
+  drupal_set_title(t('Edit component: @name (@type)', array('@name' => $component['name'], '@type' => t($component['type']))));
 
   // Print the correct field type specification.
   // We always need: name and description.
@@ -289,7 +294,7 @@ function webform_component_edit_form($fo
   $form['name'] = array(
     '#type' => 'textfield',
     '#default_value' => $component['name'],
-    '#title' => t("Label"),
+    '#title' => t('Label'),
     '#description' => t('This is used as a descriptive label when displaying this form element.'),
     '#required' => TRUE,
     '#weight' => -2,
@@ -298,7 +303,7 @@ function webform_component_edit_form($fo
   $form['extra']['description'] = array(
     '#type' => 'textarea',
     '#default_value' => isset($component['extra']['description']) ? $component['extra']['description'] : '',
-    '#title' => t("Description"),
+    '#title' => t('Description'),
     '#description' => t('A short description of the field used as help for the user when he/she uses the form.') . theme('webform_token_help'),
     '#weight' => -1,
   );
@@ -321,7 +326,7 @@ function webform_component_edit_form($fo
   );
   $form['advanced']['mandatory'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Mandatory"),
+    '#title' => t('Mandatory'),
     '#default_value' => ($component['mandatory'] == '1' ? TRUE : FALSE),
     '#description' => t('Check this option if the user must enter a value.'),
     '#weight' => 2,
@@ -329,14 +334,14 @@ function webform_component_edit_form($fo
   );
   $form['advanced']['email'] = array(
     '#type' => 'checkbox',
-    '#title' => t("Include in e-mails"),
+    '#title' => t('Include in e-mails'),
     '#default_value' => ($component['email'] == '1' ? TRUE : FALSE),
     '#description' => t('If checked, submitted values from this component will be included in e-mails.'),
     '#weight' => 2,
     '#access' => !in_array($component['type'], array('pagebreak', 'fieldset')),
   );
 
-  if (variable_get('webform_enable_fieldset', true) && is_array($node->webform['components'])) {
+  if (variable_get('webform_enable_fieldset', TRUE) && is_array($node->webform['components'])) {
     $options = array('0' => t('Root'));
     foreach ($node->webform['components'] as $existing_cid => $value) {
       if ($value['type'] == 'fieldset' && (!isset($component['cid']) || $existing_cid != $component['cid'])) {
@@ -345,7 +350,7 @@ function webform_component_edit_form($fo
     }
     $form['advanced']['pid'] = array(
       '#type' => 'select',
-      '#title' => t("Parent Fieldset"),
+      '#title' => t('Parent Fieldset'),
       '#default_value' => $component['pid'],
       '#description' => t('Optional. You may organize your form by placing this component inside another fieldset.'),
       '#options' => $options,
@@ -356,7 +361,7 @@ function webform_component_edit_form($fo
   $form['advanced']['weight'] = array(
     '#type' => 'weight',
     '#delta' => count($node->webform['components']) > 10 ? count($node->webform['components']) : 10,
-    '#title' => t("Weight"),
+    '#title' => t('Weight'),
     '#default_value' => $component['weight'],
     '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
     '#weight' => 4,
@@ -364,13 +369,13 @@ function webform_component_edit_form($fo
 
   // Add the fields specific to this component type:
   webform_load_components(); // Load all component types.
-  $edit_function = "_webform_edit_". $component['type'];
+  $edit_function = '_webform_edit_'. $component['type'];
   $additional_form_elements = array();
   if (function_exists($edit_function)) {
     $additional_form_elements = $edit_function($component); // Call the component render function.
   }
   else {
-    drupal_set_message(t("The webform component of type @type does not have an edit function defined.", array('@type' => $component['type'])));
+    drupal_set_message(t('The webform component of type @type does not have an edit function defined.', array('@type' => $component['type'])));
   }
 
   // Merge the additional fields with the current fields:
diff -upr webform-orig/webform-confirmation.tpl.php webform/webform-confirmation.tpl.php
--- webform-orig/webform-confirmation.tpl.php	2008-10-08 21:51:40.000000000 +0200
+++ webform/webform-confirmation.tpl.php	2008-11-21 23:10:00.000000000 +0100
@@ -2,7 +2,7 @@
 // $Id: webform-confirmation.tpl.php,v 1.1.2.2 2008/10/08 19:51:40 quicksketch Exp $
 
 /**
- * @file webform-confirmation.tpl.php
+ * @file
  * Customize confirmation screen after successful submission.
  *
  * This file may be renamed "webform-confirmation-[nid].tpl.php" to target a
diff -upr webform-orig/webform_export.inc webform/webform_export.inc
--- webform-orig/webform_export.inc	2008-10-08 21:51:40.000000000 +0200
+++ webform/webform_export.inc	2008-11-21 23:09:59.000000000 +0100
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_webform_exporters()
+ * Implementation of hook_webform_exporters().
  *
  * Defines the exporters this module implements.
  *
@@ -82,7 +82,7 @@ class webform_exporter {
   }
 
   function set_headers($filename) {
-    drupal_set_header("Content-Type: application/force-download");
+    drupal_set_header('Content-Type: application/force-download');
   }
 
   function bof(&$file_handle) {
@@ -119,7 +119,7 @@ class webform_exporter_delimited extends
       // Escape inner quotes and wrap all contents in new quotes.
       $data[$key] = '"'. str_replace('"', '""', $value) .'"';
     }
-    $row = implode($this->delimiter, $data) . "\n";
+    $row = implode($this->delimiter, $data) ."\n";
 
     if (function_exists('mb_convert_encoding')) {
       $row = mb_convert_encoding($row, 'UTF-16LE', 'UTF-8');
@@ -158,7 +158,7 @@ class webform_exporter_excel extends web
   }
 
   function set_headers($filename) {
-    drupal_set_header("Content-Type: application/x-msexcel");
+    drupal_set_header('Content-Type: application/x-msexcel');
     drupal_set_header("Content-Disposition: attachment; filename=$filename.xls");
   }
 }
diff -upr webform-orig/webform-form.tpl.php webform/webform-form.tpl.php
--- webform-orig/webform-form.tpl.php	2008-10-08 21:51:40.000000000 +0200
+++ webform/webform-form.tpl.php	2008-11-21 23:10:00.000000000 +0100
@@ -2,7 +2,7 @@
 // $Id: webform-form.tpl.php,v 1.1.2.2 2008/10/08 19:51:40 quicksketch Exp $
 
 /**
- * @file webform-form.tpl.php
+ * @file
  * Customize the display of a complete webform.
  *
  * This file may be renamed "webform-form-[nid].tpl.php" to target a specific
diff -upr webform-orig/webform.install webform/webform.install
--- webform-orig/webform.install	2008-11-03 17:57:37.000000000 +0100
+++ webform/webform.install	2008-11-21 23:10:00.000000000 +0100
@@ -2,6 +2,11 @@
 // $Id: webform.install,v 1.22.2.14 2008/11/03 16:57:37 quicksketch Exp $
 
 /**
+ * @file
+ *   Webform module install/schema hooks.
+ */
+
+/**
  * Implementation of hook_schema().
  */
 function webform_schema() {
@@ -277,7 +282,7 @@ function webform_schema() {
 }
 
 /**
- * Implementation fo hook_install().
+ * Implementation of hook_install().
  */
 function webform_install() {
   db_query("UPDATE {system} SET weight = -1 WHERE name='webform' AND type='module'");
@@ -285,7 +290,7 @@ function webform_install() {
 }
 
 /**
- * Implmentation of hook_uninstall().
+ * Implementation of hook_uninstall().
  */
 function webform_uninstall() {
   // Unset webform variables.
@@ -298,7 +303,7 @@ function webform_uninstall() {
   variable_del('webform_csv_delimiter');
 
   $component_list = array();
-  $path = drupal_get_path('module', 'webform') ."/components";
+  $path = drupal_get_path('module', 'webform') .'/components';
   $files = file_scan_directory($path, '^.*\.inc$');
   foreach ($files as $filename => $file) {
     variable_del('webform_enable_'. $file->name, 1);
@@ -321,40 +326,40 @@ function webform_update_1() {
   $ret = array();
 
   // Start the normal update.
-  $ret[] = update_sql("CREATE TABLE {webform_tmp} ( ".
-                      "  nid int(10) unsigned NOT NULL default '0', ".
-                      "  sid int(10) unsigned NOT NULL default '0', ".
-                      "  cid int(10) unsigned NOT NULL default '0', ".
-                      "  no int(10) unsigned NOT NULL default '0', ".
-                      "  data longtext, ".
-                      " PRIMARY KEY  (nid,sid,cid,no) ".
-                      " ) ");
-  $result = db_query("SELECT ws.nid, ws.sid, wc.cid, ws.name, ws.data ".
-                     " FROM {webform_submitted_data} ws, {webform_component} wc ".
-                     " WHERE ws.nid = wc.nid ".
-                     " AND ws.name = wc.name ");
+  $ret[] = update_sql('CREATE TABLE {webform_tmp} ( '.
+                      " nid int(10) unsigned NOT NULL default '0', ".
+                      " sid int(10) unsigned NOT NULL default '0', ".
+                      " cid int(10) unsigned NOT NULL default '0', ".
+                      " no int(10) unsigned NOT NULL default '0', ".
+                      ' data longtext, '.
+                      ' PRIMARY KEY  (nid, sid, cid, no) '.
+                      ')');
+  $result = db_query('SELECT ws.nid, ws.sid, wc.cid, ws.name, ws.data '.
+                     ' FROM {webform_submitted_data} ws, {webform_component} wc '.
+                     ' WHERE ws.nid = wc.nid '.
+                     ' AND ws.name = wc.name ');
 
   while ($row = db_fetch_object($result)) {
     $data = unserialize($row->data);
     if ( is_array($data) ) {
       foreach ($data as $k => $v) {
-        db_query("INSERT INTO {webform_tmp} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $row->nid, $row->sid, $row->cid, $k, $v);
+        $ret[] = update_sql("INSERT INTO {webform_tmp} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $row->nid, $row->sid, $row->cid, $k, $v);
       }
     }
     else {
-      db_query("INSERT INTO {webform_tmp} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $row->nid, $row->sid, $row->cid, 0, $row->data);
+      $ret[] = update_sql("INSERT INTO {webform_tmp} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $row->nid, $row->sid, $row->cid, 0, $row->data);
     }
   }
 
-  $ret[] = update_sql("DROP TABLE {webform_submitted_data}");
-  $ret[] = update_sql("ALTER TABLE {webform_tmp} RENAME TO {webform_submitted_data}");
+  $ret[] = update_sql('DROP TABLE {webform_submitted_data}');
+  $ret[] = update_sql('ALTER TABLE {webform_tmp} RENAME TO {webform_submitted_data}');
 
-  $ret[] = update_sql("CREATE TABLE {webform_submissions} ( ".
+  $ret[] = update_sql('CREATE TABLE {webform_submissions} ( '.
                       " nid int(10) unsigned NOT NULL default '0', ".
                       " sid int(10) unsigned NOT NULL default '0', ".
-                      " submitted int(11)  NOT NULL default '0', ".
-                      " PRIMARY KEY  (nid, sid) ".
-                      ")" );
+                      " submitted int(11) NOT NULL default '0', ".
+                      ' PRIMARY KEY (nid, sid) '.
+                      ')');
 
   return $ret;
 }
@@ -394,18 +399,18 @@ function webform_update_3() {
  * Change 'maintain webforms' permission into two seperate perms: 'edit webforms', 'access webform results'
  */
 function webform_update_4() {
-  $ret[] = update_sql("DROP TABLE if exists {webform_role_node}");
-  $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD user varchar(128) AFTER submitted");
-  $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD remote_addr varchar(128) AFTER user");
+  $ret[] = update_sql('DROP TABLE if exists {webform_role_node}');
+  $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD user varchar(128) AFTER submitted');
+  $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD remote_addr varchar(128) AFTER user');
   $ret[] = update_sql("ALTER TABLE {webform} ADD submit_limit int(2) NOT NULL DEFAULT '-1' AFTER redirect_post");
   $ret[] = update_sql("ALTER TABLE {webform} ADD submit_interval int(10) NOT NULL DEFAULT '157784630' AFTER submit_limit"); // 5 years in seconds.
 
   // Split 'maintain webforms' permissions into both 'edit webforms' and 'access webform results'.
-  $result = db_query("SELECT rid,perm FROM {permission}");
+  $result = db_query('SELECT rid, perm FROM {permission}');
   while ($row = db_fetch_object($result)) {
-    if (strpos($row->perm, "maintain webforms") !== false) {
-      $updated_perm = str_replace("maintain webforms", "edit webforms, access webform results", $row->perm);
-      db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $updated_perm, $row->rid);
+    if (strpos($row->perm, 'maintain webforms') !== FALSE) {
+      $updated_perm = str_replace('maintain webforms', 'edit webforms, access webform results', $row->perm);
+      $ret[] = update_sql("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $updated_perm, $row->rid);
     }
   }
   return $ret;
@@ -441,7 +446,7 @@ function webform_update_6() {
       break;
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform_component} ADD pid int(10) NOT NULL DEFAULT 0 AFTER cid");
+      $ret[] = update_sql('ALTER TABLE {webform_component} ADD pid int(10) NOT NULL DEFAULT 0 AFTER cid');
       break;
   }
 
@@ -456,11 +461,11 @@ function webform_update_7() {
 
   switch ($GLOBALS['db_type']) {
     case 'pgsql':
-      db_change_column($ret, 'webform_component', 'value', 'value', 'TEXT', array('not null' => FALSE, 'default' => "NULL"));
+      db_change_column($ret, 'webform_component', 'value', 'value', 'TEXT', array('not null' => FALSE, 'default' => 'NULL'));
       break;
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform_component} CHANGE value value TEXT NULL DEFAULT NULL");
+      $ret[] = update_sql('ALTER TABLE {webform_component} CHANGE value value TEXT NULL DEFAULT NULL');
       break;
   }
 
@@ -475,13 +480,13 @@ function webform_update_8() {
 
   switch ($GLOBALS['db_type']) {
     case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {webform} ADD additional_validate text DEFAULT NULL");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD additional_submit text DEFAULT NULL");
+      $ret[] = update_sql('ALTER TABLE {webform} ADD additional_validate text DEFAULT NULL');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD additional_submit text DEFAULT NULL');
       break;
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform} ADD additional_validate text DEFAULT NULL AFTER email_subject");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD additional_submit text DEFAULT NULL AFTER additional_validate");
+      $ret[] = update_sql('ALTER TABLE {webform} ADD additional_validate text DEFAULT NULL AFTER email_subject');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD additional_submit text DEFAULT NULL AFTER additional_validate');
       break;
   }
 
@@ -499,13 +504,13 @@ function webform_update_9() {
 
   switch ($GLOBALS['db_type']) {
     case 'pgsql':
-      db_change_column($ret, 'webform', 'email_from', 'email_from_address', 'varchar(255)', array('not null' => FALSE, 'default' => "NULL"));
-      $ret[] = update_sql("ALTER TABLE {webform} ADD email_from_name varchar(255) NULL DEFAULT NULL");
+      db_change_column($ret, 'webform', 'email_from', 'email_from_address', 'varchar(255)', array('not null' => FALSE, 'default' => 'NULL'));
+      $ret[] = update_sql('ALTER TABLE {webform} ADD email_from_name varchar(255) NULL DEFAULT NULL');
       break;
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform} CHANGE email_from email_from_address varchar(255) NULL DEFAULT NULL");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD email_from_name varchar(255) NULL DEFAULT NULL AFTER email");
+      $ret[] = update_sql('ALTER TABLE {webform} CHANGE email_from email_from_address varchar(255) NULL DEFAULT NULL');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD email_from_name varchar(255) NULL DEFAULT NULL AFTER email');
       break;
   }
 
@@ -520,12 +525,12 @@ function webform_update_10() {
 
   switch ($GLOBALS['db_type']) {
     case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {webform_component} ADD form_key varchar(128) NULL DEFAULT NULL");
+      $ret[] = update_sql('ALTER TABLE {webform_component} ADD form_key varchar(128) NULL DEFAULT NULL');
       break;
 
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform_component} ADD form_key varchar(128) NULL DEFAULT NULL AFTER pid");
+      $ret[] = update_sql('ALTER TABLE {webform_component} ADD form_key varchar(128) NULL DEFAULT NULL AFTER pid');
       break;
   }
 
@@ -541,12 +546,12 @@ function webform_update_11() {
   switch ($GLOBALS['db_type']) {
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD INDEX sid (sid)");
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} ADD INDEX sid (sid)");
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD INDEX sid (sid)');
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} ADD INDEX sid (sid)');
       break;
     case 'pgsql':
-      $ret[] = update_sql("CREATE INDEX {webform_submissions}_sid_idx ON {webform_submissions} (sid)");
-      $ret[] = update_sql("CREATE INDEX {webform_submitted_data}_sid_idx ON {webform_submitted_data} (sid)");
+      $ret[] = update_sql('CREATE INDEX {webform_submissions}_sid_idx ON {webform_submissions} (sid)');
+      $ret[] = update_sql('CREATE INDEX {webform_submitted_data}_sid_idx ON {webform_submitted_data} (sid)');
       break;
   }
 
@@ -562,14 +567,14 @@ function webform_update_12() {
   switch ($GLOBALS['db_type']) {
     case 'mysql':
     case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD uid int(10) NOT NULL DEFAULT 0 AFTER sid");
-      $ret[] = update_sql("UPDATE {webform_submissions} ws set uid = (SELECT uid FROM {users} u WHERE u.name = ws.user)");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} DROP user");
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD uid int(10) NOT NULL DEFAULT 0 AFTER sid');
+      $ret[] = update_sql('UPDATE {webform_submissions} ws set uid = (SELECT uid FROM {users} u WHERE u.name = ws.user)');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} DROP user');
       break;
     case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD uid integer NOT NULL DEFAULT 0");
-      $ret[] = update_sql("UPDATE {webform_submissions} ws set uid = (SELECT uid FROM {users} u WHERE u.name = ws.user)");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} DROP user");
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD uid integer NOT NULL DEFAULT 0');
+      $ret[] = update_sql('UPDATE {webform_submissions} ws set uid = (SELECT uid FROM {users} u WHERE u.name = ws.user)');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} DROP user');
       break;
   }
 
@@ -592,22 +597,22 @@ function webform_update_13() {
   $ret[] = update_sql("DELETE FROM {webform_component} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')");
   $ret[] = update_sql("DELETE FROM {webform_submissions} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')");
   $ret[] = update_sql("DELETE FROM {webform_submitted_data} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')");
-  $result = db_query("SELECT nid FROM {webform}");
+  $result = db_query('SELECT nid FROM {webform}');
   while ($row = db_fetch_object($result)) {
-    db_query("DELETE FROM {webform_submitted_data} WHERE nid = %d AND cid NOT IN (SELECT cid FROM {webform_component} c WHERE c.nid = %d)", $row->nid, $row->nid);
+    $ret[] = update_sql('DELETE FROM {webform_submitted_data} WHERE nid = %d AND cid NOT IN (SELECT cid FROM {webform_component} c WHERE c.nid = %d)', $row->nid, $row->nid);
   }
 
   // Convert timestamp-based cids to small integers starting at 1 for each node.
-  $result = db_query("SELECT nid, cid FROM {webform_component} ORDER BY nid ASC, cid ASC");
+  $result = db_query('SELECT nid, cid FROM {webform_component} ORDER BY nid ASC, cid ASC');
   $nid = 0;
   while ($component = db_fetch_array($result)) {
     if ($component['nid'] != $nid) {
       $nid = $component['nid'];
       $cid = 1;
     }
-    $ret[] = update_sql("UPDATE {webform_component} SET cid = ". $cid ." WHERE nid = ". $nid ." AND cid = ". $component['cid']);
-    $ret[] = update_sql("UPDATE {webform_component} SET pid = ". $cid ." WHERE nid = ". $nid ." AND pid = ". $component['cid']);
-    $ret[] = update_sql("UPDATE {webform_submitted_data} SET cid = ". $cid ." WHERE nid = ". $nid ." AND cid = ". $component['cid']);
+    $ret[] = update_sql('UPDATE {webform_component} SET cid = '. $cid .' WHERE nid = '. $nid .' AND cid = '. $component['cid']);
+    $ret[] = update_sql('UPDATE {webform_component} SET pid = '. $cid .' WHERE nid = '. $nid .' AND pid = '. $component['cid']);
+    $ret[] = update_sql('UPDATE {webform_submitted_data} SET cid = '. $cid .' WHERE nid = '. $nid .' AND cid = '. $component['cid']);
     $cid++;
   }
 
@@ -657,7 +662,7 @@ function webform_update_15() {
       unset($extra['carboncopy']);
     }
     $value = $row['value'] == 'user email' ? '%useremail' : '';
-    db_query("UPDATE {webform_component} SET extra = '%s', value = '%s' WHERE nid = %d and cid = %d", serialize($extra), $value, $row['nid'], $row['cid']);
+    $ret[] = update_sql("UPDATE {webform_component} SET extra = '%s', value = '%s' WHERE nid = %d and cid = %d", serialize($extra), $value, $row['nid'], $row['cid']);
   }
 
   $result = db_query("SELECT nid, cid, extra FROM {webform_component} WHERE type IN ('email', 'textfield', 'textarea')");
@@ -666,7 +671,7 @@ function webform_update_15() {
     if ($extra['attributes']['disabled']) {
       $extra['disabled'] = 1;
       unset($extra['attributes']['disabled']);
-      db_query("UPDATE {webform_component} SET extra = '%s' WHERE nid = %d and cid = %d", serialize($extra), $row['nid'], $row['cid']);
+      $ret[] = update_sql("UPDATE {webform_component} SET extra = '%s' WHERE nid = %d and cid = %d", serialize($extra), $row['nid'], $row['cid']);
     }
   }
   return $ret;
@@ -681,14 +686,14 @@ function webform_update_16() {
   switch ($GLOBALS['db_type']) {
     case 'mysqli':
     case 'mysql':
-      $ret[] = update_sql("ALTER TABLE {webform} DROP redirect_post");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD teaser tinyint NOT NULL DEFAULT 0 AFTER confirmation");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD submit_text varchar(255) NULL DEFAULT NULL AFTER teaser");
+      $ret[] = update_sql('ALTER TABLE {webform} DROP redirect_post');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD teaser tinyint NOT NULL DEFAULT 0 AFTER confirmation');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD submit_text varchar(255) NULL DEFAULT NULL AFTER teaser');
       break;
     case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {webform} DROP redirect_post");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD teaser smallint NOT NULL DEFAULT 0");
-      $ret[] = update_sql("ALTER TABLE {webform} ADD submit_text varchar(255) NULL DEFAULT NULL");
+      $ret[] = update_sql('ALTER TABLE {webform} DROP redirect_post');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD teaser smallint NOT NULL DEFAULT 0');
+      $ret[] = update_sql('ALTER TABLE {webform} ADD submit_text varchar(255) NULL DEFAULT NULL');
       break;
   }
 
@@ -700,7 +705,7 @@ function webform_update_16() {
  */
 function webform_update_17() {
   $ret = array();
-  $ret[] = update_sql("UPDATE {webform} SET submit_interval = -1 WHERE submit_interval = 157784630");
+  $ret[] = update_sql('UPDATE {webform} SET submit_interval = -1 WHERE submit_interval = 157784630');
   return $ret;
 }
 
@@ -709,16 +714,16 @@ function webform_update_17() {
  */
 function webform_update_18() {
   $ret = array();
-  $result = db_query("SELECT * FROM {webform}");
+  $result = db_query('SELECT * FROM {webform}');
   while ($webform = db_fetch_object($result)) {
     foreach (array('email_from_name', 'email_from_address', 'email_subject') as $key) {
       if ($webform->{$key} == 'Automatic' || $webform->{$key} == 'Default') {
-        $ret[] = update_sql("UPDATE {webform} SET ". $key ." = 'default' WHERE nid = ". $webform->nid);
+        $ret[] = update_sql('UPDATE {webform} SET '. $key ." = 'default' WHERE nid = ". $webform->nid);
       }
       elseif (!is_numeric($webform->{$key})) {
         $cid = db_result(db_query("SELECT cid FROM {webform_component} WHERE name = '%s' AND nid = %d", $webform->{$key}, $webform->nid));
         if ($cid) {
-          $ret[] = update_sql("UPDATE {webform} SET ". $key ." = '". $cid ."' WHERE nid = ". $webform->nid);
+          $ret[] = update_sql('UPDATE {webform} SET '. $key ." = '". $cid ."' WHERE nid = ". $webform->nid);
         }
       }
     }
@@ -753,7 +758,7 @@ function webform_update_19() {
 
   $result = db_query("SELECT nid, cid FROM {webform_component} WHERE type = 'captcha'");
   while ($component = db_fetch_object($result)) {
-    $ret[] = update_sql("DELETE FROM {webform_component} WHERE cid = ". $component->cid ." AND nid = ". $component->nid);
+    $ret[] = update_sql('DELETE FROM {webform_component} WHERE cid = '. $component->cid .' AND nid = '. $component->nid);
     if ($captcha_exists) {
       $added = db_result(db_query("SELECT form_id FROM {captcha_points} WHERE form_id = 'webform_client_form_". $component->nid ."'"));
       if (!$added) {
@@ -773,33 +778,33 @@ function webform_update_20() {
     case 'mysqli':
     case 'mysql':
       // Update the webform_submissions table with sid primary key instead of nid, sid.
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} DROP INDEX sid");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} DROP PRIMARY KEY");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD UNIQUE INDEX sid_nid (sid, nid)");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD PRIMARY KEY (sid)");
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} DROP INDEX sid');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} DROP PRIMARY KEY');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD UNIQUE INDEX sid_nid (sid, nid)');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD PRIMARY KEY (sid)');
 
       // Update webform_submitted_data table removing nid from the primary key.
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} DROP PRIMARY KEY");
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} DROP INDEX sid");
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} DROP PRIMARY KEY');
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} DROP INDEX sid');
       // While we've got these keys removed, decrease the size of the 'no' column.
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} CHANGE no no tinyint NOT NULL DEFAULT 0");
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} ADD PRIMARY KEY (sid, cid, no)");
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} ADD INDEX nid (nid)");
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} ADD INDEX sid_nid (sid, nid)");
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} CHANGE no no tinyint NOT NULL DEFAULT 0');
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} ADD PRIMARY KEY (sid, cid, no)');
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} ADD INDEX nid (nid)');
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} ADD INDEX sid_nid (sid, nid)');
       break;
     case 'pgsql':
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} DROP CONSTRAINT {webform_submissions}_pkey");
-      $ret[] = update_sql("DROP INDEX {webform_submissions}_sid_idx");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD PRIMARY KEY (sid)");
-      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD CONSTRAINT {webform_submissions}_sid_nid_key UNIQUE (sid, nid)");
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} DROP CONSTRAINT {webform_submissions}_pkey');
+      $ret[] = update_sql('DROP INDEX {webform_submissions}_sid_idx');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD PRIMARY KEY (sid)');
+      $ret[] = update_sql('ALTER TABLE {webform_submissions} ADD CONSTRAINT {webform_submissions}_sid_nid_key UNIQUE (sid, nid)');
 
-      $ret[] = update_sql("DROP INDEX {webform_submitted_data}_sid_idx");
+      $ret[] = update_sql('DROP INDEX {webform_submitted_data}_sid_idx');
       db_change_column($ret, 'webform_submitted_data', 'no', 'no', 'smallint', array('not null' => TRUE, 'default' => '0'));
-      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} ADD PRIMARY KEY (sid, cid, no)");
-      $ret[] = update_sql("CREATE INDEX {webform_submitted_data}_nid_idx ON {webform_submitted_data} (nid)");
-      $ret[] = update_sql("CREATE INDEX {webform_submitted_data}_sid_nid_idx ON {webform_submitted_data} (sid, nid)");
+      $ret[] = update_sql('ALTER TABLE {webform_submitted_data} ADD PRIMARY KEY (sid, cid, no)');
+      $ret[] = update_sql('CREATE INDEX {webform_submitted_data}_nid_idx ON {webform_submitted_data} (nid)');
+      $ret[] = update_sql('CREATE INDEX {webform_submitted_data}_sid_nid_idx ON {webform_submitted_data} (sid, nid)');
 
-      $ret[] = update_sql("ALTER TABLE {webform_component} ADD PRIMARY KEY (nid, cid)");
+      $ret[] = update_sql('ALTER TABLE {webform_component} ADD PRIMARY KEY (nid, cid)');
       break;
   }
   return $ret;
@@ -829,7 +834,7 @@ function webform_update_6001() {
  */
 function webform_update_6200() {
   $ret = array();
-  db_change_field($ret, 'webform_component', 'name', 'name', array('type' => 'varchar', 'length' => 255, 'default' => "NULL"));
+  db_change_field($ret, 'webform_component', 'name', 'name', array('type' => 'varchar', 'length' => 255, 'default' => 'NULL'));
   return $ret;
 }
 
@@ -845,7 +850,7 @@ function webform_update_6201() {
   }
 
   db_add_field($ret, 'webform_component', 'email', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0));
-  $ret[] = update_sql("UPDATE {webform_component} SET email = 1");
+  $ret[] = update_sql('UPDATE {webform_component} SET email = 1');
 
   return $ret;
 }
@@ -884,8 +889,8 @@ function webform_update_6202() {
 
   $result = db_query("SELECT nid FROM {node} WHERE type = 'webform'");
   while ($node = db_fetch_object($result)) {
-    db_query("INSERT INTO {webform_roles} (nid, rid) VALUES (%d, 1)", $node->nid);
-    db_query("INSERT INTO {webform_roles} (nid, rid) VALUES (%d, 2)", $node->nid);
+    $ret[] = update_sql('INSERT INTO {webform_roles} (nid, rid) VALUES (%d, 1)', $node->nid);
+    $ret[] = update_sql('INSERT INTO {webform_roles} (nid, rid) VALUES (%d, 2)', $node->nid);
   }
 
   return $ret;
@@ -931,14 +936,14 @@ function webform_update_6203() {
     // Additional types.
     $additional_extensions = explode(',', $extra['filtering']['addextensions']);
     foreach ($additional_extensions as $extension) {
-      $clean_extension = strtolower(trim($extension));
+      $clean_extension = drupal_strtolower(trim($extension));
       if (!empty($clean_extension) && !in_array($clean_extension, $extensions)) {
         $extensions[] = $clean_extension;
       }
     }
 
     $extra['filtering']['types'] = $extensions;
-    db_query("UPDATE {webform_component} SET extra = '%s' WHERE nid = %d AND cid = %d", serialize($extra), $component->nid, $component->cid);
+    $ret[] = update_sql("UPDATE {webform_component} SET extra = '%s' WHERE nid = %d AND cid = %d", serialize($extra), $component->nid, $component->cid);
   }
 
   return $ret;
@@ -964,12 +969,12 @@ function webform_update_6204() {
  */
 function _webform_recursive_delete($path) {
   if ($path) {
-    $listing = $path ."/*";
+    $listing = $path .'/*';
     foreach (glob($listing) as $file) {
-      if (is_file($file) === true) {
+      if (is_file($file) === TRUE) {
         @unlink($file);
       }
-      elseif (is_dir($file) === true) {
+      elseif (is_dir($file) === TRUE) {
         _webform_recursive_delete($file);
       }
     }
diff -upr webform-orig/webform-mail.tpl.php webform/webform-mail.tpl.php
--- webform-orig/webform-mail.tpl.php	2008-07-13 01:01:00.000000000 +0200
+++ webform/webform-mail.tpl.php	2008-11-21 23:10:00.000000000 +0100
@@ -2,7 +2,7 @@
 // $Id: webform-mail.tpl.php,v 1.1.2.2 2008/07/12 23:01:00 quicksketch Exp $
 
 /**
- * @file webform-mail-message.tpl.php
+ * @file
  * Customize the e-mails sent by Webform after successful submission.
  *
  * This file may be renamed "webform-mail-[nid].tpl.php" to target a
@@ -31,10 +31,7 @@
 <?php print t('Submitted by anonymous user: [@ip_address]', array('@ip_address' => $ip_address)) ?>
 <?php endif; ?>
 
-
 <?php print t('Submitted values are') ?>
-
-
 <?php
   // Print out all the Webform fields. This is purposely a theme function call
   // so that you may remove items from the submitted tree if you so choose.
@@ -42,9 +39,5 @@
   print theme('webform_mail_fields', 0, $form_values['submitted_tree'], $node);
 ?>
 
-
-
-
-<?php print t("The results of this submission may be viewed at:") ?>
-
-<?php print url('node/'. $node->nid ."/submission/". $sid, array('absolute' => TRUE)) ?>
+<?php print t('The results of this submission may be viewed at:') ?>
+<?php print url('node/'. $node->nid .'/submission/'. $sid, array('absolute' => TRUE)) ?>
diff -upr webform-orig/webform.module webform/webform.module
--- webform-orig/webform.module	2008-11-03 17:59:43.000000000 +0100
+++ webform/webform.module	2008-11-21 23:09:59.000000000 +0100
@@ -15,13 +15,13 @@
 /**
  * Implementation of hook_help().
  */
-function webform_help($section = "admin/help#webform", $arg = NULL) {
-  $output =  "";
+function webform_help($section = 'admin/help#webform', $arg = NULL) {
+  $output = '';
   switch ($section) {
-    case 'admin/settings/webform' :
+    case 'admin/settings/webform':
       $output = t('Webforms are forms and questionnaires. To add one, select <a href="!url">Create content -&gt; Webform</a>.', array('!url' => url('node/add/webform')));
       break;
-    case 'admin/help#webform' :
+    case 'admin/help#webform':
       $output = t("<p>This module lets you create forms or questionnaires and define their content. Submissions from these forms are stored in the database and optionally also sent by e-mail to a predefined address.</p>
       <p>Here is how to create one:</p>
       <ul>
@@ -37,8 +37,8 @@ function webform_help($section = "admin/
       <p>The content of submitted forms is stored in the database table <i>webform_submitted_data</i> as key-value pairs.</p>
       ");
       break;
-    case 'node/add#webform' :
-      $output = t("A webform can be a questionnaires, contact or request forms. It can be used to let visitors make contact, register for a event or to enable a complex survey.");
+    case 'node/add#webform':
+      $output = t('A webform can be a questionnaires, contact or request forms. It can be used to let visitors make contact, register for a event or to enable a complex survey.');
       break;
     case 'node/%/edit/components':
       $output .= '<p>'. t('This page displays all the components currently configured for this webform node. You may add any number of components to the form, even multiple of the same type. To add a new component, fill in a name and select a type from the fields at the bottom of the table. Submit the form to create the new component or update any changed form values.') .'</p>';
@@ -49,7 +49,7 @@ function webform_help($section = "admin/
     // Call help hooks in plugins:
     $components = webform_load_components(TRUE);
     foreach ($components as $key => $component) {
-      $help_function = "_webform_help_". $key;
+      $help_function = '_webform_help_'. $key;
       if (function_exists($help_function)) {
         $output .= $help_function($section);
       }
@@ -315,7 +315,7 @@ function webform_submission_access($node
  * Implementation of hook_perm().
  */
 function webform_perm() {
-  return array("create webforms", "edit own webforms", "edit webforms", "access webform results", "clear webform results", "access own webform submissions", "edit own webform submissions", "edit webform submissions", "use PHP for additional processing");
+  return array('create webforms', 'edit own webforms', 'edit webforms', 'access webform results', 'clear webform results', 'access own webform submissions', 'edit own webform submissions', 'edit webform submissions', 'use PHP for additional processing');
 }
 
 /**
@@ -391,7 +391,7 @@ function webform_theme() {
   // Theme functions in all components.
   $components = webform_load_components(TRUE);
   foreach ($components as $key => $component) {
-    $theme_hook = "_webform_theme_". $key;
+    $theme_hook = '_webform_theme_'. $key;
     if (function_exists($theme_hook)) {
       $theme = array_merge($theme, $theme_hook());
     }
@@ -417,11 +417,11 @@ function webform_node_info() {
  */
 function webform_access($op, $node, $account) {
   switch ($op) {
-    case "create":
-      return user_access("create webforms", $account);
-    case "update":
-    case "delete":
-      if (user_access("edit webforms", $account) || (user_access("edit own webforms", $account) && ($account->uid == $node->uid))) {
+    case 'create':
+      return user_access('create webforms', $account);
+    case 'update':
+    case 'delete':
+      if (user_access('edit webforms', $account) || (user_access('edit own webforms', $account) && ($account->uid == $node->uid))) {
         return TRUE;
       }
   }
@@ -476,7 +476,7 @@ function webform_insert($node) {
 
   // Set the per-role submission access control.
   foreach (array_filter($node->webform['roles']) as $rid) {
-    db_query("INSERT INTO {webform_roles} (nid, rid) VALUES (%d, %d)", $node->nid, $rid);
+    db_query('INSERT INTO {webform_roles} (nid, rid) VALUES (%d, %d)', $node->nid, $rid);
   }
 }
 
@@ -485,8 +485,8 @@ function webform_insert($node) {
  */
 function webform_update($node) {
   // Update the webform by deleting existing data and replacing with the new.
-  db_query("DELETE FROM {webform} WHERE nid = %d", $node->nid);
-  db_query("DELETE FROM {webform_component} WHERE nid = %d", $node->nid);
+  db_query('DELETE FROM {webform} WHERE nid = %d', $node->nid);
+  db_query('DELETE FROM {webform_component} WHERE nid = %d', $node->nid);
   db_query('DELETE FROM {webform_roles} WHERE nid = %d', $node->nid);
   webform_insert($node);
 }
@@ -502,8 +502,8 @@ function webform_delete(&$node) {
   }
 
   // Remove any trace of webform data from the database.
-  db_query("DELETE FROM {webform} WHERE nid = %d", $node->nid);
-  db_query("DELETE FROM {webform_component} WHERE nid = %d", $node->nid);
+  db_query('DELETE FROM {webform} WHERE nid = %d', $node->nid);
+  db_query('DELETE FROM {webform_component} WHERE nid = %d', $node->nid);
   db_query('DELETE FROM {webform_roles} WHERE nid = %d', $node->nid);
   db_query('DELETE FROM {webform_submissions} WHERE nid = %d', $node->nid);
   db_query('DELETE FROM {webform_submitted_data} WHERE nid = %d', $node->nid);
@@ -516,11 +516,11 @@ function webform_load($node) {
   module_load_include('inc', 'webform', 'webform_components');
   $additions = new stdClass();
 
-  if ($webform = db_fetch_array(db_query("SELECT * FROM {webform} WHERE nid = %d", $node->nid))) {
+  if ($webform = db_fetch_array(db_query('SELECT * FROM {webform} WHERE nid = %d', $node->nid))) {
     $additions->webform = $webform;
 
     $additions->webform['roles'] = array();
-    $result = db_query("SELECT rid FROM {webform_roles} WHERE nid = %d", $node->nid);
+    $result = db_query('SELECT rid FROM {webform_roles} WHERE nid = %d', $node->nid);
     while ($role = db_fetch_object($result)) {
       $additions->webform['roles'][] = $role->rid;
     }
@@ -585,7 +585,7 @@ function webform_link($type, $node = NUL
     if ($teaser && !$node->webform['teaser']) {
       $links['webform_goto'] = array(
         'title' => t('Go to form'),
-        'href' => "node/$node->nid",
+        'href' => 'node/'. $node->nid,
         'attributes' => array('title' => t('View this form.'), 'class' => 'read-more')
       );
     }
@@ -594,7 +594,7 @@ function webform_link($type, $node = NUL
 }
 
 /**
- * Implementation of hook_form()
+ * Implementation of hook_form().
  * Creates the standard form for editing or creating a webform.
  */
 function webform_form(&$node, &$param) {
@@ -648,8 +648,8 @@ function webform_form(&$node, &$param) {
 
   $form['webform']['settings']['confirmation'] = array(
     '#type' => 'textarea',
-    '#title' => t("Confirmation message or redirect URL"),
-    '#description' => t("Message to be shown upon successful submission or a path to a redirect page. Redirect pages must start with <em>http://</em> for external sites or <em>internal:</em> for an internal path. i.e. <em>http://www.example.com</em> or <em>internal:node/10</em>"),
+    '#title' => t('Confirmation message or redirect URL'),
+    '#description' => t('Message to be shown upon successful submission or a path to a redirect page. Redirect pages must start with <em>http://</em> for external sites or <em>internal:</em> for an internal path. i.e. <em>http://www.example.com</em> or <em>internal:node/10</em>'),
     '#default_value' => $node->webform['confirmation'],
     '#cols' => 40,
     '#rows' => 10,
@@ -691,7 +691,7 @@ function webform_form(&$node, &$param) {
 
   $form['webform']['mail_settings']['email'] = array(
     '#type' => 'textfield',
-    '#title' => t("E-mail to address"),
+    '#title' => t('E-mail to address'),
     '#default_value' => $node->webform['email'],
     '#description' => t('Form submissions will be e-mailed to this address. Leave blank for none. Multiple e-mail addresses may be separated by commas.'),
   );
@@ -799,7 +799,7 @@ function webform_form(&$node, &$param) {
     '#type' => 'textfield',
     '#maxlength' => 2,
     '#size' => 2,
-    '#default_value' => $node->webform['submit_limit'] != -1 ? $node->webform['submit_limit'] : "",
+    '#default_value' => $node->webform['submit_limit'] != -1 ? $node->webform['submit_limit'] : '',
     '#parents' => array('webform', 'submit_limit'),
   );
   $form['webform']['advanced']['submit_limit']['submit_interval'] = array(
@@ -1039,13 +1039,14 @@ function webform_view(&$node, $teaser = 
   }
 
   $submission = array();
+  $submission_count = 0;
   $enabled = TRUE;
   $preview = FALSE;
   $logging_in = FALSE;
   $limit_exceeded = FALSE;
 
   if ($node->build_mode == NODE_BUILD_PREVIEW) {
-    $preview = true;
+    $preview = TRUE;
     $additions = webform_load($node);
     $node->webform['components'] = $additions->webform['components'];
   }
@@ -1077,7 +1078,7 @@ function webform_view(&$node, $teaser = 
 
   // Get a count of previous submissions by this user.
   if ($user->uid && (user_access('access own webform submissions') || user_access('access webform results') || user_access('access webform submissions'))) {
-    $submission_count = db_result(db_query("SELECT count(*) FROM {webform_submissions} WHERE nid = %d AND uid = %d", $node->nid, $user->uid));
+    $submission_count = db_result(db_query('SELECT count(*) FROM {webform_submissions} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
   }
 
   // Render the form and generate the output.
@@ -1165,13 +1166,13 @@ function theme_webform_view_messages($no
   // If the user has exceeded the limit of submissions, explain the limit.
   if ($limit_exceeded) {
     if ($node->webform['submit_interval'] == -1 && $node->webform['submit_limit'] > 1) {
-      $message = t("You have submitted this form the maximum number of times (@count).", array('@count' => $node->webform['submit_limit']));
+      $message = t('You have submitted this form the maximum number of times (@count).', array('@count' => $node->webform['submit_limit']));
     }
     elseif ($node->webform['submit_interval'] == -1 && $node->webform['submit_limit'] == 1) {
-      $message = t("You have already submitted this form.");
+      $message = t('You have already submitted this form.');
     }
     else {
-      $message = t("You may not submit another entry at this time.");
+      $message = t('You may not submit another entry at this time.');
     }
     $type = 'error';
   }
@@ -1235,21 +1236,21 @@ function webform_admin_settings() {
 
   $form['email']['webform_default_from_address']  = array(
     '#type' => 'textfield',
-    '#title' => t("From address"),
+    '#title' => t('From address'),
     '#default_value' => variable_get('webform_default_from_address', variable_get('site_mail', ini_get('sendmail_from'))),
     '#description' => t('The default sender address for emailed webform results; often the e-mail address of the maintainer of your forms.'),
   );
 
   $form['email']['webform_default_from_name']  = array(
     '#type' => 'textfield',
-    '#title' => t("From name"),
+    '#title' => t('From name'),
     '#default_value' => variable_get('webform_default_from_name', variable_get('site_name', '')),
     '#description' => t('The default sender name which is used along with the default from address.'),
   );
 
   $form['email']['webform_default_subject']  = array(
     '#type' => 'textfield',
-    '#title' => t("Default subject"),
+    '#title' => t('Default subject'),
     '#default_value' => variable_get('webform_default_subject', t('Form submission from: %title')),
     '#description' => t('The default subject line of any e-mailed results.'),
   );
@@ -1264,8 +1265,8 @@ function webform_admin_settings() {
   $form['advanced']['webform_use_cookies']  = array(
     '#type' => 'checkbox',
     '#checked_value' => 1,
-    '#title' => t("Allow cookies for tracking submissions"),
-    '#default_value' => variable_get("webform_use_cookies", 0),
+    '#title' => t('Allow cookies for tracking submissions'),
+    '#default_value' => variable_get('webform_use_cookies', 0),
     '#description' => t('<a href="http://www.wikipedia.org/wiki/HTTP_cookie">Cookies</a> can be used to help prevent the same user from repeatedly submitting a webform. This feature is not needed for limiting submissions per user, though it can increase accuracy in some situations. Besides cookies, Webform also uses IP addresses and site usernames to prevent repeated submissions.'),
   );
 
@@ -1294,9 +1295,9 @@ function webform_admin_settings() {
 
   $form['advanced']['webform_debug']  = array(
     '#type' => 'select',
-    '#title' => t("Webforms debug"),
-    '#default_value' => variable_get("webform_debug", 0),
-    '#options' => array(0 => t("Off"), 1 => t("Log submissions"), 2 => t("Full debug")),
+    '#title' => t('Webforms debug'),
+    '#default_value' => variable_get('webform_debug', 0),
+    '#options' => array(0 => t('Off'), 1 => t('Log submissions'), 2 => t('Full debug')),
     '#description' => t('Set to "Log submissions" to log all submissions in the watchdog. Set to "Full debug" to print debug info on submission.')
   );
 
@@ -1426,7 +1427,7 @@ function webform_client_form($form_state
       '#tree' => TRUE
     );
     $form['details'] = array(
-      '#tree' => true,
+      '#tree' => TRUE,
     );
 
     // Put the components into a tree structure.
@@ -1477,7 +1478,7 @@ function webform_client_form($form_state
             '#weight' => 1001,
           );
         }
-        else if ($page_num < $page_count) {
+        elseif ($page_num < $page_count) {
           $form['next'] = array(
             '#type' => 'submit',
             '#value' => $next_page,
@@ -1535,11 +1536,11 @@ function webform_client_form($form_state
   return $form;
 }
 
-function _webform_client_form_add_component($cid, $component, $component_value, &$parent_fieldset, &$form, $submission, $page_num, $enabled = false) {
+function _webform_client_form_add_component($cid, $component, $component_value, &$parent_fieldset, &$form, $submission, $page_num, $enabled = FALSE) {
   // Load with submission information if necessary.
   if (!$enabled) {
     // This component is display only.
-    $display_function = "_webform_submission_display_". $component['type'];
+    $display_function = '_webform_submission_display_'. $component['type'];
     if (function_exists($display_function)) {
       $parent_fieldset[$component['form_key']] = $display_function(empty($submission->data[$cid]) ? NULL : $submission->data[$cid], $component, $enabled);
     }
@@ -1547,13 +1548,13 @@ function _webform_client_form_add_compon
   elseif ($component['page_num'] == $page_num) {
     // Add this user-defined field to the form (with all the values that are always available).
     if (isset($submission->data)) {
-      $display_function = "_webform_submission_display_". $component['type'];
+      $display_function = '_webform_submission_display_'. $component['type'];
       if (function_exists($display_function)) {
         $parent_fieldset[$component['form_key']] = $display_function($submission->data[$cid], $component, $enabled);
       }
     }
     else {
-      $render_function = "_webform_render_". $component['type'];
+      $render_function = '_webform_render_'. $component['type'];
       if (function_exists($render_function)) {
         $parent_fieldset[$component['form_key']] = $render_function($component); // Call the component render function.
 
@@ -1570,7 +1571,7 @@ function _webform_client_form_add_compon
         }
       }
       else {
-        drupal_set_message(t("The webform component @type is not able to be displayed", array('@type' => $component['type'])));
+        drupal_set_message(t('The webform component @type is not able to be displayed', array('@type' => $component['type'])));
       }
     }
   }
@@ -1596,7 +1597,7 @@ function webform_client_form_validate($f
     // Support for Drupal 5 validation code.
     $form_values =& $form_state['values'];
     // We use eval here (rather than drupal_eval) because the user needs access to local variables.
-    eval("?>". $node->webform['additional_validate']);
+    eval('?>'. $node->webform['additional_validate']);
   }
 }
 
@@ -1678,7 +1679,7 @@ function webform_client_form_submit($for
     // Support for Drupal 5 validation code.
     $form_values =& $form_state['values'];
     // We use eval here (rather than drupal_eval) because the user needs access to local variables.
-    eval("?>". $node->webform['additional_submit']);
+    eval('?>'. $node->webform['additional_submit']);
   }
 
   // Save the submission to the database.
@@ -1689,10 +1690,10 @@ function webform_client_form_submit($for
 
     // Set a cookie including the server's submission time.
     // The cookie expires in the length of the interval plus a day to compensate for different timezones.
-    if (variable_get("webform_use_cookies", 0)) {
+    if (variable_get('webform_use_cookies', 0)) {
       $cookie_name = 'webform-'. $node->nid;
       $time = time();
-      setcookie($cookie_name ."[". $time ."]", $time, $time + $node->webform['submit_interval'] + 86400);
+      setcookie($cookie_name .'['. $time .']', $time, $time + $node->webform['submit_interval'] + 86400);
     }
   }
   else {
@@ -1738,7 +1739,7 @@ function webform_client_form_submit($for
         $froms[$cid] = $headers[$cid]['From'];
         unset($headers[$cid]['From']);
       }
-      elseif (strlen($email_from_name) > 0) {
+      elseif (drupal_strlen($email_from_name) > 0) {
         $froms[$cid] = '"'. mime_header_encode($email_from_name) .'" <'. $email_from_address .'>';
       }
       else {
@@ -1764,8 +1765,8 @@ function webform_client_form_submit($for
     // Verify that this submission is not attempting to send any spam hacks.
     if (_webform_submission_spam_check($emails['default'], $subjects['default'], $froms['default'], $headers['default'])) {
       watchdog('webform', 'Possible spam attempt from @remote_addr'."<br />\n". nl2br(htmlentities($messages['default'])), array('@remote_add' => ip_address()), WATCHDOG_WARNING);
-      drupal_set_message(t("Illegal information. Data not submitted."), 'error');
-      return false;
+      drupal_set_message(t('Illegal information. Data not submitted.'), 'error');
+      return FALSE;
     }
 
     // Mail the webform results.
@@ -1778,7 +1779,7 @@ function webform_client_form_submit($for
 
           // Debugging output for email.
           if (variable_get('webform_debug', 0) >= 2) {
-            drupal_set_message("E-mail Headers: <pre>". htmlentities(print_r($headers[$cid], true)) ."</pre>To: ". $single_address ."<br />From: ". htmlentities($froms[$cid]) ."<br />Subject: ". $subjects[$cid] ."<br />E-mail Body: <pre>". $messages[$cid] ."</pre>");
+            drupal_set_message('E-mail Headers: <pre>'. htmlentities(print_r($headers[$cid], TRUE)) .'</pre>To: '. $single_address .'<br />From: '. htmlentities($froms[$cid]) .'<br />Subject: '. $subjects[$cid] .'<br />E-mail Body: <pre>'. $messages[$cid] .'</pre>');
           }
         }
       }
@@ -1787,7 +1788,7 @@ function webform_client_form_submit($for
 
         // Debugging output for email.
         if (variable_get('webform_debug', 0) >= 2) {
-          drupal_set_message("E-mail Headers: <pre>". htmlentities(print_r($headers[$cid], true)) ."</pre>To: ". $address ."<br />From: ". htmlentities($froms[$cid]) ."<br />Subject: ". $subjects[$cid] ."<br />E-mail Body: <pre>". $messages[$cid] ."</pre>");
+          drupal_set_message('E-mail Headers: <pre>'. htmlentities(print_r($headers[$cid], TRUE)) .'</pre>To: '. $address .'<br />From: '. htmlentities($froms[$cid]) .'<br />Subject: '. $subjects[$cid] .'<br />E-mail Body: <pre>'. $messages[$cid] .'</pre>');
         }
       }
     }
@@ -1795,14 +1796,14 @@ function webform_client_form_submit($for
 
   // More debugging output.
   if (variable_get('webform_debug', 0) >= 2) {
-    drupal_set_message('$form_state is: <pre>'. htmlentities(print_r($form_state, true)) .'</pre>');
-    drupal_set_message('$_SERVER is: <pre>'. htmlentities(print_r($_SERVER, true)) .'</pre>');
-    drupal_set_message('$_POST is: <pre>'. htmlentities(print_r($_POST, true)) .'</pre>');
+    drupal_set_message('$form_state is: <pre>'. htmlentities(print_r($form_state, TRUE)) .'</pre>');
+    drupal_set_message('$_SERVER is: <pre>'. htmlentities(print_r($_SERVER, TRUE)) .'</pre>');
+    drupal_set_message('$_POST is: <pre>'. htmlentities(print_r($_POST, TRUE)) .'</pre>');
   }
 
   // Log to watchdog if normal debug is on.
   if (variable_get('webform_debug', 0) >= 1) {
-    watchdog('webform', 'Submission posted to %title. <a href="!url">Results</a>. !details', array('%title' => $node->title, '!url' => url('node/'. $node->nid .'/submission/'. $sid), '!results' => "<br />\n<pre>". htmlentities(print_r($form_state['values'], TRUE)) ."</pre>"), WATCHDOG_NOTICE);
+    watchdog('webform', 'Submission posted to %title. <a href="!url">Results</a>. !details', array('%title' => $node->title, '!url' => url('node/'. $node->nid .'/submission/'. $sid), '!results' => "<br />\n<pre>". htmlentities(print_r($form_state['values'], TRUE)) .'</pre>'), WATCHDOG_NOTICE);
   }
 
   // Check confirmation field to see if redirect should be to another node or a message.
@@ -1810,7 +1811,7 @@ function webform_client_form_submit($for
     drupal_set_message(t('Submission updated.'));
     $redirect = NULL;
   }
-  elseif (valid_url(trim($node->webform['confirmation']), true)) {
+  elseif (valid_url(trim($node->webform['confirmation']), TRUE)) {
     $redirect = trim($node->webform['confirmation']);
   }
   elseif (preg_match('/^internal:/', $node->webform['confirmation'])) {
@@ -1835,7 +1836,7 @@ function _webform_client_form_submit_pro
       }
 
       $component = $node->webform['components'][$cid];
-      $submit_function = "_webform_submit_". $component['type'];
+      $submit_function = '_webform_submit_'. $component['type'];
       if (function_exists($submit_function)) {
         // Call the component process submission function.
         $submit_function($form_values[$component['form_key']], $component);
@@ -1927,7 +1928,7 @@ function template_preprocess_webform_mai
  * @param $indent
  *   The current amount of indentation being applied to printed components.
  */
-function theme_webform_mail_fields($cid, $value, $node, $indent = "") {
+function theme_webform_mail_fields($cid, $value, $node, $indent = '') {
   $component = $node->webform['components'][$cid];
 
   // Check if this component needs to be included in the email at all.
@@ -1936,7 +1937,7 @@ function theme_webform_mail_fields($cid,
   }
 
   // First check for component-level themes.
-  $themed_output = theme("webform_mail_". $component['type'], $value, $component);
+  $themed_output = theme('webform_mail_'. $component['type'], $value, $component);
 
   if ($themed_output) {
     // Indent the output and add to message.
@@ -1950,8 +1951,8 @@ function theme_webform_mail_fields($cid,
     // Note that newlines cannot be preceeded by spaces to display properly in some clients.
     if ($component['name']) {
       // If text is more than 60 characters, put it on a new line with space after.
-      $long = (strlen($indent . $component['name'] . $value)) > 60;
-      $message .= $indent . $component['name'] .":". (empty($value) ? "\n" : ($long ? "\n$value\n\n" : " $value\n"));
+      $long = (drupal_strlen($indent . $component['name'] . $value)) > 60;
+      $message .= $indent . $component['name'] .':'. (empty($value) ? "\n" : ($long ? "\n$value\n\n" : " $value\n"));
     }
   }
   // Else use a generic output for arrays.
@@ -1966,7 +1967,7 @@ function theme_webform_mail_fields($cid,
           break;
         }
       }
-      $message .= theme('webform_mail_fields', $form_key, $v, $node, $indent ."  ");
+      $message .= theme('webform_mail_fields', $form_key, $v, $node, $indent .'  ');
     }
   }
 
@@ -2011,8 +2012,8 @@ function _webform_filter_values($string,
   global $user;
 
   // Setup default token replacements.
-  $find = array('%username', '%useremail', '%site', '%date');
-  $replace = array($user->name, $user->mail, variable_get('site_name', 'drupal'), format_date(time(), 'large'));
+  $find = array('%site', '%date');
+  $replace = array(variable_get('site_name', 'drupal'), format_date(time(), 'large'));
 
   // Node replacements.
   if (isset($node)) {
@@ -2028,9 +2029,15 @@ function _webform_filter_values($string,
     }
   }
 
-  // Load the user profile.
-  if ($user->uid && module_exists('profile')) {
-    profile_load_profile($user);
+  // User replacements.
+  if ($user->uid) {
+    $find[] = '%username';
+    $find[] = '%useremail';
+    $replace[] = $user->name;
+    $replace[] = $user->mail;
+    if (module_exists('profile')) {
+      profile_load_profile($user);
+    }
   }
 
   // Provide a list of candidates for token replacement.
@@ -2067,12 +2074,7 @@ function _webform_filter_values($string,
     $string = preg_replace('/\\'. $token .'\[\w+\]/', '', $string);
   }
 
-  if ($strict) {
-    return filter_xss($string);
-  }
-  else {
-    return $string;
-  }
+  return $strict ? filter_xss($string) : $string;
 }
 
 /**
@@ -2287,11 +2289,12 @@ function _webform_components_sort($a, $b
  */
 function _webform_components_tree_sort($tree) {
   if (isset($tree['children']) && is_array($tree['children'])) {
-    uasort($tree['children'], "_webform_components_sort");
+    $children = array();
+    uasort($tree['children'], '_webform_components_sort');
     foreach ($tree['children'] as $cid => $component) {
-      $return[$cid] = _webform_components_tree_sort($component);
+      $children[$cid] = _webform_components_tree_sort($component);
     }
-    $tree['children'] = $return;
+    $tree['children'] = $children;
   }
   return $tree;
 }
@@ -2305,7 +2308,7 @@ function webform_load_components($return
   if (!isset($component_list) || $reset) {
     $component_list = array();
     $enabled_list = array();
-    $path = drupal_get_path('module', 'webform') ."/components";
+    $path = drupal_get_path('module', 'webform') .'/components';
     $files = file_scan_directory($path, '^.*\.inc$');
     foreach ($files as $filename => $file) {
       $enabled = variable_get('webform_enable_'. $file->name, 1);
diff -upr webform-orig/webform_report.inc webform/webform_report.inc
--- webform-orig/webform_report.inc	2008-10-08 21:51:40.000000000 +0200
+++ webform/webform_report.inc	2008-11-21 23:10:00.000000000 +0100
@@ -2,6 +2,7 @@
 // $Id: webform_report.inc,v 1.17.2.9 2008/10/08 19:51:40 quicksketch Exp $
 
 /**
+ * @file
  * This file includes helper functions for creating reports for webform.module
  *
  * @author Nathan Haug <nate@lullabot.com>
@@ -40,7 +41,7 @@ function theme_webform_results_submissio
     array('data' => t('#'), 'field' => 'sid', 'sort' => 'asc'),
     array('data' => t('Submitted'), 'field' => 'submitted'),
   );
-  if (user_access("access webform results")) {
+  if (user_access('access webform results')) {
     $columns[] = array('data' => t('User'), 'field' => 'name');
     $columns[] = array('data' => t('IP Address'), 'field' => 'remote_addr');
   }
@@ -74,7 +75,7 @@ function theme_webform_results_submissio
       $row[] = $submission->remote_addr;
     }
     $row[] = l(t('View'), "node/$node->nid/submission/$sid");
-    if ((user_access("edit own webform submissions") && ($user->uid == $submission->uid)) || user_access("edit webform submissions")) {
+    if ((user_access('edit own webform submissions') && ($user->uid == $submission->uid)) || user_access('edit webform submissions')) {
       $row[] = l(t('Edit'), "node/$node->nid/submission/$sid/edit");
       $row[] = l(t('Delete'), "node/$node->nid/submission/$sid/delete", array('query' => drupal_get_destination()));
     }
@@ -140,14 +141,14 @@ function theme_webform_results_table($no
   // Generate a row for each submission.
   foreach ($submissions as $sid => $submission) {
     $cell[] = l($sid, 'node/'. $node->nid .'/submission/'. $sid);
-    $cell[] = format_date($submission->submitted, "small");
+    $cell[] = format_date($submission->submitted, 'small');
     $cell[] = theme('username', $submission);
     $cell[] = $submission->remote_addr;
     $component_headers = array();
 
     // Generate a cell for each component.
     foreach ($node->webform['components'] as $component) {
-      $table_function = "_webform_table_data_". $component['type'];
+      $table_function = '_webform_table_data_'. $component['type'];
       if (function_exists($table_function)) {
         $submission_output = $table_function($submission->data[$component['cid']], $component);
         if ($submission_output !== NULL) {
@@ -192,11 +193,11 @@ function webform_results_clear($nid) {
  *   ID of node for which to clear submissions.
  */
 function webform_results_clear_form($form_state, $node) {
-  drupal_set_title(t("Clear Form Submissions"));
+  drupal_set_title(t('Clear Form Submissions'));
 
   $form = array();
   $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
-  $question = t("Are you sure you want to delete all submissions for this form?");
+  $question = t('Are you sure you want to delete all submissions for this form?');
 
   return confirm_form($form, $question, 'node/'. $node->nid .'/webform-results', NULL, t('Clear'), t('Cancel'));
 }
@@ -310,13 +311,13 @@ function webform_results_download($node,
   $exporter->bof($handle);
 
   $header[0] = array($node->title, '', '', '', '', '');
-  $header[1] = array(t("Submission Details"), '', '', '', '', '');
+  $header[1] = array(t('Submission Details'), '', '', '', '', '');
   $header[2] = array(t('Serial'), t('SID'), t('Time'), t('IP Address'), t('UID'), t('Username'));
 
   // Compile header information.
   webform_load_components(); // Load all components.
   foreach ($node->webform['components'] as $cid => $component) {
-    $csv_header_function = "_webform_csv_headers_". $component['type'];
+    $csv_header_function = '_webform_csv_headers_'. $component['type'];
     if (function_exists($csv_header_function)) {
       // Let each component determine its headers.
       $component_header = $csv_header_function($component);
@@ -345,7 +346,7 @@ function webform_results_download($node,
     $row[] = $submission->uid;
     $row[] = $submission->name;
     foreach ($node->webform['components'] as $cid => $component) {
-      $csv_data_function   = "_webform_csv_data_". $component['type'];
+      $csv_data_function   = '_webform_csv_data_'. $component['type'];
       if (function_exists($csv_data_function)) {
         // Let each component add its data.
         $data = $csv_data_function($submission->data[$cid], $component);
@@ -391,7 +392,7 @@ function webform_results_analysis($node)
     $question_number++;
 
     // Do component specific call.
-    $analysis_function = "_webform_analysis_rows_". $component['type'];
+    $analysis_function = '_webform_analysis_rows_'. $component['type'];
     if (function_exists($analysis_function)) {
       $crows = $analysis_function($component);
       if (is_array($crows)) {
diff -upr webform-orig/webform_submissions.inc webform/webform_submissions.inc
--- webform-orig/webform_submissions.inc	2008-10-08 21:51:40.000000000 +0200
+++ webform/webform_submissions.inc	2008-11-21 23:09:59.000000000 +0100
@@ -11,7 +11,7 @@
 
 function webform_submission_update($node, $sid, $submitted) {
   // Update the submission data by first removing all this submissions data.
-  db_query("DELETE FROM {webform_submitted_data} WHERE sid = %d", $sid);
+  db_query('DELETE FROM {webform_submitted_data} WHERE sid = %d', $sid);
   // Then re-add it to the database.
   foreach ($submitted as $cid => $value) {
     // Don't save pagebreaks as submitted data.
@@ -22,12 +22,12 @@ function webform_submission_update($node
     if (is_array($value)) {
       $delta = 0;
       foreach ($value as $k => $v) {
-        db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) "."VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, $delta, $v);
+        db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, $delta, $v);
         $delta++;
       }
     }
     else {
-      db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) "."VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, 0, $value);
+      db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, 0, $value);
     }
   }
 
@@ -37,7 +37,7 @@ function webform_submission_update($node
 function webform_submission_insert($node, $submitted) {
   global $user;
 
-  $result = db_query("INSERT INTO {webform_submissions} (nid, uid, submitted, remote_addr) "." VALUES (%d, %d, %d, '%s')", $node->nid, $user->uid, time(), ip_address());
+  $result = db_query("INSERT INTO {webform_submissions} (nid, uid, submitted, remote_addr) VALUES (%d, %d, %d, '%s')", $node->nid, $user->uid, time(), ip_address());
 
   $sid = db_last_insert_id('webform_submissions', 'sid');
 
@@ -50,12 +50,12 @@ function webform_submission_insert($node
     if (is_array($value)) {
       $delta = 0;
       foreach ($value as $k => $v) {
-        db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) "."VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, $delta, $v);
+        db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, $delta, $v);
         $delta++;
       }
     }
     else {
-      db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) "."VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, 0, $value);
+      db_query("INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) VALUES (%d, %d, %d, %d, '%s')", $node->nid, $sid, $cid, 0, $value);
     }
   }
 
@@ -95,19 +95,19 @@ function webform_submission_delete($node
  *   The submission to be deleted (from webform_submitted_data).
  */
 function webform_submission_delete_form($form_state, $node, $submission) {
-  drupal_set_title(t("Delete Form Submission"));
+  drupal_set_title(t('Delete Form Submission'));
 
   $form = array();
   $form['node'] = array('#type' => 'value', '#value' => $node);
   $form['submission'] = array('#type' => 'value', '#value' => $submission);
-  $question = t("Are you sure you want to delete this submission?");
+  $question = t('Are you sure you want to delete this submission?');
 
   return confirm_form($form, $question, isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid .'/webform-results', NULL, t('Delete'), t('Cancel'));
 }
 
 function webform_submission_delete_form_submit($form, &$form_state) {
   webform_submission_delete($form_state['values']['node'], $form_state['values']['submission']);
-  drupal_set_message(t("Submission deleted."));
+  drupal_set_message(t('Submission deleted.'));
 
   $form_state['redirect'] = 'node/'. $form_state['values']['node']->nid .'/webform-results';
 }
@@ -206,9 +206,9 @@ function _webform_submission_spam_check(
   $headers = implode('\n', (array)$headers);
   // Check if they are attempting to spam using a bcc or content type hack.
   if (preg_match('/(b?cc\s?:)|(content\-type:)/i', $to ."\n". $subject ."\n". $from ."\n". $headers)) {
-    return true; // Possible spam attempt.
+    return TRUE; // Possible spam attempt.
   }
-  return false; // Not spam.
+  return FALSE; // Not spam.
 }
 
 /**
@@ -228,24 +228,24 @@ function _webform_submission_limit_check
   }
 
   // Retrieve submission data for this IP address or username from the database.
-  $query = "SELECT count(*) ".
-           "FROM {webform_submissions} ".
+  $query = 'SELECT count(*) '.
+           'FROM {webform_submissions} '.
            "WHERE (( 0 = %d AND remote_addr = '%s') OR (uid > 0 AND uid = %d)) ".
-           "AND submitted > %d AND nid = %d";
+           'AND submitted > %d AND nid = %d';
 
   // Fetch all the entries from the database within the submit interval with this username and IP.
   $num_submissions_database = db_result(db_query($query, $user->uid, ip_address(), $user->uid, ($node->webform['submit_interval'] != -1) ? (time() - $node->webform['submit_interval']) : $node->webform['submit_interval'], $node->nid));
 
   // Double check the submission history from the users machine using cookies.
   $num_submissions_cookie = 0;
-  if ($user->uid == 0 && variable_get("webform_use_cookies", 0)) {
+  if ($user->uid == 0 && variable_get('webform_use_cookies', 0)) {
     $cookie_name = 'webform-'. $node->nid;
 
     if (isset($_COOKIE[$cookie_name]) && is_array($_COOKIE[$cookie_name])) {
       foreach ($_COOKIE[$cookie_name] as $key => $timestamp) {
         if ($timestamp <= time() - $node->webform['submit_interval']) {
           // Remove the cookie if past the required time interval.
-          setcookie($cookie_name ."[". $key ."]", "", 0);
+          setcookie($cookie_name .'['. $key .']', '', 0);
         }
       }
       // Count the number of submissions recorded in cookies.
