Index: image_fupload.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload.install,v
retrieving revision 1.9
diff -u -p -r1.9 image_fupload.install
--- image_fupload.install	21 Mar 2009 19:10:14 -0000	1.9
+++ image_fupload.install	1 May 2009 01:16:35 -0000
@@ -2,6 +2,10 @@
 // $Id: image_fupload.install,v 1.9 2009/03/21 19:10:14 grandcat Exp $
 
 /**
+ * @file
+ */
+
+/**
  * Implementation of hook_install().
  */
 function image_fupload_install() {
@@ -17,7 +21,7 @@ function image_fupload_install() {
     );
     variable_set('image_node_types', $image_node_types);
   }
-  
+
   // create table for temporary images for image preview list
   drupal_install_schema('image_fupload');
 }
@@ -28,15 +32,15 @@ function image_fupload_install() {
 function image_fupload_uninstall() {
   // remove all used variables
   $variables = array(
-    'fupload_title_replacements', 
-    'fupload_previewlist_img_attributes', 
+    'fupload_title_replacements',
+    'fupload_previewlist_img_attributes',
     'fupload_previewlist_field_settings',
     'image_node_types',
   );
   for ($i = 0; $i < count($variables); $i++) {
     variable_del($variables[$i]);
   }
-  
+
   // drop our image preview table
   drupal_uninstall_schema('image_fupload');
 }
@@ -46,26 +50,26 @@ function image_fupload_uninstall() {
  */
 function image_fupload_requirements($phase) {
   $requirements = array();
-  
+
   if ($phase == 'runtime') {
     // Make sure that swfUpload Files which aren't bundled with this module, are located in swfupload directory
     $path = drupal_get_path('module', 'image_fupload') .'/swfupload/';
     if (!file_exists($path .'swfupload.js') || !file_exists($path .'swfupload.queue.js') || !file_exists($path .'swfupload.swf')) {
       // One or more needed files are missing; give an error
-       $requirements['image_fupload'] = array(
-         'title' => t('Image FUpload'),
-         'value' => t('Missing or wrong files in subdirectory "swfupload"'),
-         'description' => t('Some needed files which are not bundled with this module, are missing or out-of-date! This can be either "swfupload.swf", "swfupload.js" or "swfupload.queue.js" which should be located in "%path". These files can be downloaded from !page. <em>Note:</em> Version 2.2.0 or higher is needed.', array('%path' => $path, '!page' => l(t('SWFUploads project page'), 'http://code.google.com/p/swfupload/'))),
-         'severity' => REQUIREMENT_ERROR,
-       ); 
+      $requirements['image_fupload'] = array(
+        'title' => t('Image FUpload'),
+        'value' => t('Missing or wrong files in subdirectory "swfupload"'),
+        'description' => t('Some needed files which are not bundled with this module, are missing or out-of-date! This can be either "swfupload.swf", "swfupload.js" or "swfupload.queue.js" which should be located in "%path". These files can be downloaded from !page. <em>Note:</em> Version 2.2.0 or higher is needed.', array('%path' => $path, '!page' => l(t('SWFUploads project page'), 'http://code.google.com/p/swfupload/'))),
+        'severity' => REQUIREMENT_ERROR,
+      );
     }
   }
-  
+
   return $requirements;
 }
 
 /**
- * Implementation of hook_schemea
+ * Implementation of hook_schema().
  */
 function image_fupload_schema() {
   // Currently, schema 1 is the only schema we have. As we make updates,
@@ -124,13 +128,12 @@ function image_fupload_schema_1() {
     'indexes' => array('fieldname' => array('fieldname'), 'uid' => array('uid')),
     'primary key' => array('fid'),
   );
-  
+
   return $schema;
 }
 
-
 /**
- * Implementation of hook_update_N()
+ * Implementation of hook_update_N().
  */
 function image_fupload_update_6100() {
   $ret = array();
@@ -162,39 +165,39 @@ function image_fupload_update_6110() {
 }
 
 function image_fupload_update_6300() {
-  $ret = array();  
-  
-  // create our image preview list table  
+  $ret = array();
+
+  // create our image preview list table
   $schema = image_fupload_schema_1();
   _drupal_initialize_schema('image_fupload', $schema);
 
   foreach ($schema as $name => $table) {
     db_create_table($ret, $name, $table);
   }
-  
+
   return $ret;
 }
 
 /**
-* Update from 3.0 alpha 1 to alpha 2
-*/
-function image_fupload_update_6301() {  
+ * Update from 3.0 alpha 1 to alpha 2
+ */
+function image_fupload_update_6301() {
   $ret = array();
-  
+
   // it's not really an update, but we have to force the user to run update.php
   // because some theme related things changed
-  
+
   return $ret;
 }
 
 /**
-* Update from 3.0 alpha 3 to alpha 4
-*/
-function image_fupload_update_6304() {  
+ * Update from 3.0 alpha 3 to alpha 4
+ */
+function image_fupload_update_6304() {
   $ret = array();
-  
+
   // it's not really an update, but we have to force the user to run update.php
   // because some theme related things changed
-  
+
   return $ret;
 }
\ No newline at end of file
Index: image_fupload.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload.module,v
retrieving revision 1.33
diff -u -p -r1.33 image_fupload.module
--- image_fupload.module	6 Apr 2009 21:15:41 -0000	1.33
+++ image_fupload.module	1 May 2009 01:16:37 -0000
@@ -21,15 +21,15 @@ function image_fupload_menu() {
   $items['fupload/js/deletequeue/%'] = array(
     'title' => 'Image FUpload',
     'page callback' => 'fupload_empty_queue',
-    'page arguments' => array(3), 
+    'page arguments' => array(3),
     'access arguments' => array('mass upload images'),
-    'type' => MENU_CALLBACK,    
-  );  
+    'type' => MENU_CALLBACK,
+  );
   $items['node/add/%image_node_type/list_images'] = array(
     'title' => 'Edit Captions',
     'access arguments' => array('edit captions'),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('fupload_list_images_image', 2),    
+    'page arguments' => array('fupload_list_images_image', 2),
     'type' => MENU_CALLBACK,
     'file' => 'includes/images.previewlist.image.inc',
   );
@@ -37,7 +37,7 @@ function image_fupload_menu() {
     'title' => 'Edit Captions',
     'access arguments' => array('edit captions'),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('fupload_list_images_imagefield', 2),    
+    'page arguments' => array('fupload_list_images_imagefield', 2),
     'type' => MENU_CALLBACK,
     'file' => 'includes/images.previewlist.imagefield.inc',
   );
@@ -45,39 +45,43 @@ function image_fupload_menu() {
 }
 
 /**
-* Menu callback; loads a image node type object
-*/
+ * Menu callback; loads a image node type object
+ */
 function image_node_type_load($node_type, $simple_check = FALSE) {
   $image_node_types = variable_get('image_node_types', array());
   // test if given node type is image (field) node type
   $node_type = str_replace("-", "_", $node_type);
   // simple check without checking url arguments
-  if ($simple_check && isset($image_node_types[$node_type]))
+  if ($simple_check && isset($image_node_types[$node_type])) {
     return $node_type;
-    
+  }
+
   if (isset($image_node_types[$node_type])) {
     if (arg(3) == "list_imagefields" && $image_node_types[$node_type]['type'] == "cck") {
       return $node_type;
-    } elseif (arg(3) == "list_images" && $image_node_types[$node_type]['type'] == "image") {
+    }
+    elseif (arg(3) == "list_images" && $image_node_types[$node_type]['type'] == "image") {
       return $node_type;
-    } else {
+    }
+    else {
       return FALSE;
     }
-  } else {
+  }
+  else {
     return FALSE;
   }
 }
 
 /**
-* returns a identifier for images so that their status (current step) can easily be set
-*/
+ * returns a identifier for images so that their status (current step) can easily be set
+ */
 function image_fupload_image_status($field_name, $status = IMAGE_UNMACHINED) {
-  switch ($status) {  
+  switch ($status) {
     case IMAGE_NOT_COMPLETED:
-      return "<!--" .$field_name ."/" .IMAGE_NOT_COMPLETED ."-->";
+      return "<!--". $field_name ."/". IMAGE_NOT_COMPLETED ."-->";
       break;
     default:
-      return $field_name ."/" .$status;
+      return $field_name ."/". $status;
       break;
   }
 }
@@ -90,14 +94,14 @@ function image_fupload_perm() {
 }
 
 /**
- * Implementation of hook_help
+ * Implementation of hook_help().
  */
 function image_fupload_help($path, $arg) {
   switch ($path) {
       case 'admin/help#image_fupload':
       $output = '<p>'. t("The Image FUpload module is used to provide an alternate upload form to image module itself.") .'</p>';
       $output .= '<p>'. t("This is a great advantage because multiple images can be selected with one click which are automatically uploaded and processed without any further user interaction. Additionally, this module fully integrates in image module. Consequently, all settings made by image module are observed (thumb creation, file size limit etc.).") .'</p>';
-      $output .= '<p>' .t("Image FUpload administration allows to define some characters which are replaced in the node title by a whitespace. In addition to that, the option can be selected to show a link to the original upload form to those users whose browser doesn't support this Flash / JS solution.") . '</p>';
+      $output .= '<p>'. t("Image FUpload administration allows to define some characters which are replaced in the node title by a whitespace. In addition to that, the option can be selected to show a link to the original upload form to those users whose browser doesn't support this Flash / JS solution.") .'</p>';
       $output .= t('<p>You can</p>
 <ul>
 <li>create images using F(lash)Upload at <a href="!node-create-image">node &gt;&gt; create &gt;&gt; image</a>.</li>
@@ -115,7 +119,7 @@ function image_fupload_theme() {
   return array(
     'swfupload_settings' => array(
       'template' => 'swfupload-settings',
-      'arguments' => array('modulepath' => NULL, 'uploadpath' => NULL, 'maxfilesize' => NULL, 'fileextensions' => NULL, 'sessionid' => NULL, 'uploadlimit' => NULL, 'nodetype' => NULL, 'fieldname' => NULL, 'field_required' => NULL, 'storage_mode' => NULL, 'redirect_url' => NULL),      
+      'arguments' => array('modulepath' => NULL, 'uploadpath' => NULL, 'maxfilesize' => NULL, 'fileextensions' => NULL, 'sessionid' => NULL, 'uploadlimit' => NULL, 'nodetype' => NULL, 'fieldname' => NULL, 'field_required' => NULL, 'storage_mode' => NULL, 'redirect_url' => NULL),
     ),
     'fupload_create_filename' => array(
       'arguments' => array('image' => NULL, 'replacements' => NULL),
@@ -132,14 +136,14 @@ function fupload_filetransfer() {
   global $user;
   $sid = $_POST['PHPSESSID'];
   $node_type = check_plain($_POST['nodetype']);
-  $field_name = check_plain($_POST['fieldname']);  
-  
+  $field_name = check_plain($_POST['fieldname']);
+
   // validate given session id
   $result = db_query("SELECT * FROM {sessions} WHERE sid = '%s' AND hostname = '%s' LIMIT 1", $sid, ip_address());
   $upload_user = db_fetch_object($result);
   // Get users profile
   $user = user_load(array('uid' => $upload_user->uid));
-  
+
   // Do some checks before upload
   $field_access = FALSE;
   if (!empty($upload_user) && !empty($node_type) && !empty($field_name)) { // user valid? node_type & field_name received?
@@ -149,7 +153,7 @@ function fupload_filetransfer() {
         // image node type
         if ($field_name == "images") {
           $field_access = node_access('create', $node_type, $user);
-          
+
           // get suitable validators for our upload: image module
           $validators = array(
             'file_validate_is_image' => array(),
@@ -162,7 +166,7 @@ function fupload_filetransfer() {
         if (module_exists('content')) {
           if (image_node_type_load($node_type, TRUE) && ($field = content_fields($field_name, $node_type))) {
             $field_access = node_access('create', $node_type, $user);
-          
+
             // also get suitable validators for our upload: cck imagefield module
             $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field));
           }
@@ -170,7 +174,7 @@ function fupload_filetransfer() {
         break;
     }
   }
-  
+
   if (user_access('mass upload images', $user) && $field_access) {
     // Adapt to drupal files structure
     $_FILES['files']['name']['image'] = $_FILES['Filedata']['name'];
@@ -178,16 +182,16 @@ function fupload_filetransfer() {
     $_FILES['files']['tmp_name']['image'] = $_FILES['Filedata']['tmp_name'];
     $_FILES['files']['error']['image'] = $_FILES['Filedata']['error'];
     $_FILES['files']['size']['image'] = $_FILES['Filedata']['size'];
-    
+
     // do some checks via transliteration module if available
     if (module_exists('transliteration')) {
       require_once(drupal_get_path('module', 'transliteration') .'/transliteration.inc');
       $_FILES['files']['name']['image'] = transliteration_clean_filename($_FILES['Filedata']['name']);
     }
-    
+
     if ($file = file_save_upload('image', $validators)) {
       $image = image_get_info($file->filepath); // Get real mime-type
-      if(!db_query("UPDATE {files} SET filename = '%s', filemime = '%s' WHERE fid = %d", image_fupload_image_status($field_name, IMAGE_UNMACHINED), $image['mime_type'], $file->fid)) {
+      if (!db_query("UPDATE {files} SET filename = '%s', filemime = '%s' WHERE fid = %d", image_fupload_image_status($field_name, IMAGE_UNMACHINED), $image['mime_type'], $file->fid)) {
         drupal_json(array('status' => FALSE, 'data' => t('A database related problem appeared during upload. Please inform the site administrator if this is a permanent problem.')));
         exit;
       }
@@ -195,23 +199,25 @@ function fupload_filetransfer() {
       // Get all status messages and add them to server message for swfUpload --> inform client
       $messages = drupal_get_messages('status');
       drupal_json(array('status' => TRUE, 'data' => t('Complete. !messages', array('!messages' => (!empty($messages['status']) ? implode(' ', $messages['status']) : ''))))); // Reply a status message to satisfy swfUpload
-    } else {
+    }
+    else {
       // Get responsible error messages and send it to swfUpload
       $messages = form_get_errors();
       drupal_json(array('status' => FALSE, 'data' => t('Upload failed: !errors', array('!errors' => implode(' ', $messages)))));
-    } 
-    
-  } else {
+    }
+
+  }
+  else {
     drupal_access_denied();
   }
 }
 
 function fupload_empty_queue($field_name) {
   global $user;
-  
+
   // Set "processed" flag so that these images aren't processed again; images are deleted later by cron (--> temporary files)
   db_query("UPDATE {files} SET filename = '%s' WHERE uid = %d AND status = %d AND filename = '%s'", image_fupload_image_status(check_plain($field_name), IMAGE_PROCESSED), $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status(check_plain($field_name), IMAGE_UNMACHINED));
-  
+
   // Output message to user via AJAX
   drupal_set_message();
   drupal_set_message(t('All queued images were deleted.'), 'warning');
@@ -221,22 +227,23 @@ function fupload_empty_queue($field_name
 function theme_fupload_create_filename($image, $replacements = NULL) {
   // Get filename out of filepath
   $filename = trim(basename($image->filepath), ' ');
-  $length1 = strlen(strrchr($filename, '.'));
-  $length2 = strlen($filename);
-  $image_name = ucfirst(substr($filename, 0, ($length2 - $length1)));
-        
+  $length1 = drupal_strlen(strrchr($filename, '.'));
+  $length2 = drupal_strlen($filename);
+  $image_name = drupal_ucfirst(drupal_substr($filename, 0, ($length2 - $length1)));
+
   // Remove some given (userdefined) elements
-  if (is_null($replacements))
-    $replacements = variable_get('fupload_title_replacements', '_;{;}'); 
+  if (is_null($replacements)) {
+    $replacements = variable_get('fupload_title_replacements', '_;{;}');
+  }
   $image_name = str_replace(explode(';', $replacements), ' ', $image_name);
-  
+
   return $image_name;
 }
 
 /**
-* Helper function which emulates "node_form_validate" of node.pages.inc
-* Need this because body causes validation error with some settings, but I don't need a body field, later yes =)
-*/
+ * Helper function which emulates "node_form_validate" of node.pages.inc
+ * Need this because body causes validation error with some settings, but I don't need a body field, later yes =)
+ */
 function fupload_node_form_validate($form, &$form_state) {
   $node = (object)$form_state['values'];
   $node->body = NULL; // Little Hack to disable body validation
@@ -255,7 +262,7 @@ function fupload_node_form_validate($for
 function file_validate($file, $validators = array()) {
   // Call the validation functions.
   $errors = array();
-   foreach ($validators as $function => $args) {
+  foreach ($validators as $function => $args) {
     array_unshift($args, $file);
     $errors = array_merge($errors, call_user_func_array($function, $args));
   }
@@ -265,112 +272,114 @@ function file_validate($file, $validator
     $message = t('The selected file %name could not be uploaded.', array('%name' => $file->filename));
     if (count($errors) > 1) {
       $message .= '<ul><li>'. implode('</li><li>', $errors) .'</li></ul>';
-    } else {
+    }
+    else {
       $message .= ' '. array_pop($errors);
     }
     form_set_error($source, $message);
     return FALSE;
-  } else {
+  }
+  else {
     // Validation successful =)
     return TRUE;
   }
 }
 
 /**
-* This helper function lists/read/write/delete special settings for the image previewlist 
-* depending on the node type
-*
-* @param string $op
-* @param string $node_type
-* @param array $data_write
-* @return array or NULL
-*/
-
+ * This helper function lists/read/write/delete special settings for the image previewlist
+ * depending on the node type
+ *
+ * @param string $op
+ * @param string $node_type
+ * @param array $data_write
+ * @return array or NULL
+ */
 function _fupload_imagepreview_settings($op, $node_type, $data_write = NULL) {
   // switch to the right operation: what's up?
-  switch($op) {
+  switch ($op) {
     case 'list':
       // generate a list of available presets for image_preview: image module or/and imagecache
       $preview_presets_list = array();
-      
+
       // image module presets
       if (module_exists('image') && $node_type == "image") {
         $image_sizes = image_get_sizes();
-        
+
         foreach ($image_sizes as $key => $size) {
-          $preview_presets_list['image']['0_' .$key] = t('Image size') .': ' .$size['label'];
+          $preview_presets_list['image']['0_'. $key] = t('Image size') .': '. $size['label'];
         }
       }
-      
+
       // imagecache module presets
       if (module_exists('imagecache')) {
         $image_sizes = imagecache_presets();
-        
+
         foreach ($image_sizes as $key => $size) {
-          $preview_presets_list['imagecache']['1_' .$size['presetname']] = t('Image size') .': ' .$size['presetname'];
+          $preview_presets_list['imagecache']['1_'. $size['presetname']] = t('Image size') .': '. $size['presetname'];
         }
       }
-      
+
       //output list
       return $preview_presets_list;
-      
-      break;   
-      
+      break;
+
     case 'read':
       // read actual setting for this node type
       $image_node_types = variable_get('image_node_types', array());
-      
-      switch($node_type) {
+
+      switch ($node_type) {
         case 'image':
           // image node type
           if (!empty($image_node_types['image']['image_selection'])) {
             // image module preset
-            return '0_' .$image_node_types['image']['image_selection'];
-          
-          } elseif (!empty($image_node_types['image']['imagecache_preset'])) {
+            return '0_'. $image_node_types['image']['image_selection'];
+
+          }
+          elseif (!empty($image_node_types['image']['imagecache_preset'])) {
             // imagecache module preset
-            return '1_' .$image_node_types['image']['imagecache_preset'];
-          
-          } else {
+            return '1_'. $image_node_types['image']['imagecache_preset'];
+
+          }
+          else {
             // no setting saved yet?
             return '';
           }
           break;
         default:
           // node type with CCK ImageField
-          
+
           // return imagecache preset
-          return '1_' .$image_node_types[$node_type]['imagecache_preset'];
+          return '1_'. $image_node_types[$node_type]['imagecache_preset'];
           break;
       }
       break;
-      
+
     case 'write':
       if (isset($data_write)) { // is some data available?
       // write input data to database
       $image_node_types  = variable_get('image_node_types', array());
-      
-      // prepare type of image preview before writing into db 
-      $preview_preset = explode('_', $data_write['preview_preset'], 2);  
-      switch($preview_preset[0]) {
-        case '0':    
+
+      // prepare type of image preview before writing into db
+      $preview_preset = explode('_', $data_write['preview_preset'], 2);
+      switch ($preview_preset[0]) {
+        case '0':
           // image module preset
-          $preview_preset_image = $preview_preset[1];    
-          break;    
+          $preview_preset_image = $preview_preset[1];
+          break;
         case '1':
           // imagecache module preset
           $preview_preset_imagecache = $preview_preset[1];
-          break;    
+          break;
       }
-            
-      switch($node_type) {
+
+      switch ($node_type) {
         case 'image':
           // image node type
-          $image_node_types['image'] = array('type' => 'image', 'fieldname' => 'images', 'image_selection' => $preview_preset_image, 'imagecache_preset' => $preview_preset_imagecache);          
+          $image_node_types['image'] = array('type' => 'image', 'fieldname' => 'images', 'image_selection' => $preview_preset_image, 'imagecache_preset' => $preview_preset_imagecache);
           break;
-          
+
         default:
-          // node type with CCK ImageField            
+          // node type with CCK ImageField
           $image_node_types[$node_type] = array('type' => 'cck', 'fieldname' => $data_write['fieldname'], 'image_selection' => $preview_preset_image, 'imagecache_preset' => $preview_preset_imagecache);
           break;
       }
@@ -378,7 +387,7 @@ function _fupload_imagepreview_settings(
       variable_set('image_node_types', $image_node_types);
       }
       break;
-    
+
     case 'delete':
       // delete an entry from settings variable
       $image_node_types  = variable_get('image_node_types', array());
@@ -386,6 +395,6 @@ function _fupload_imagepreview_settings(
       // write data to database
       variable_set('image_node_types', $image_node_types);
       break;
-    
+
   }
 }
\ No newline at end of file
Index: swfupload-settings.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/swfupload-settings.tpl.php,v
retrieving revision 1.17
diff -u -p -r1.17 swfupload-settings.tpl.php
--- swfupload-settings.tpl.php	21 Mar 2009 08:32:50 -0000	1.17
+++ swfupload-settings.tpl.php	1 May 2009 01:16:39 -0000
@@ -1,123 +1,127 @@
 <?php
 // $Id: swfupload-settings.tpl.php,v 1.17 2009/03/21 08:32:50 grandcat Exp $
+
+/**
+ * @file
+ */
 ?>
-        var swfu;
-        var jsTimer = false;
-        var error_send = false; // Indicates whether swfUpload has already been stopped because of a form error        
-        var upload_complete = false; // All queued files uploaded?
-        var queue_complete = 0; // contains number of queued and successfully uploaded images
-        var count_failed_uploads = 0; // Number of failed uploads
-
-		window.onload = function() {
-			var settings = {
-				flash_url : "<?php print $modulepath; ?>/swfupload/swfupload.swf",
-				upload_url: "<?php print $uploadpath; ?>",	// Relative to the SWF file
-        post_params: {"PHPSESSID" : "<?php print $sessionid; ?>" , "nodetype" : "<?php print $nodetype; ?>", "fieldname" : "<?php print $fieldname; ?>"},
-        file_post_name: "Filedata",
-				file_size_limit : "<?php print $maxfilesize; ?>",
-				file_types : "<?php print $fileextensions; ?>",
-				file_types_description : "Only images",
-				file_upload_limit : "<?php print $uploadlimit; ?>",
-				file_queue_limit : "0",
-				custom_settings : {
-					progressTarget : "fsUploadProgress",
-					cancelButtonId : "btnCancel"
-				},
-				debug: false,
-        
-        // Button settings				
-				button_width: "36",
-				button_height: "37",
-				button_placeholder_id: "spanUploadButton",
-        button_image_url: "<?php print $modulepath; ?>/swfupload/select_images.png",	// Relative to the Flash file
-        button_cursor: SWFUpload.CURSOR.HAND,
-
-				// The event handler functions are defined in handlers.js
-        file_queued_handler : fileQueued,
-				file_queue_error_handler : fileQueueError,
-				file_dialog_complete_handler : fileDialogComplete,
-				upload_start_handler : uploadStart,
-				upload_progress_handler : uploadProgress,
-				upload_error_handler : uploadError,
-				upload_success_handler : uploadSuccess,
-				upload_complete_handler : uploadComplete,
-				queue_complete_handler : queueComplete	// Queue plugin event
-			};            
-			swfu = new SWFUpload(settings);	     
-          
-    };
-         
-         function startUploadProcess() {
-           var redirect_url = "<?php print $redirect_url; ?>";
-           var imagefield_required = <?php print $field_required; ?>;
-           
-             if (!upload_complete) {  
-                // Reset all variables and indicators
-                error_send = false;
-                count_failed_uploads = 0;
-                if (isNaN(document.getElementById('form_errors')))
-                    document.getElementById('form_errors').value = '0';
-                if (isNaN(document.getElementById('num_queued_images')))
-                    document.getElementById('num_queued_images').value = '1'; // Pretend that there's at least one image in queue so that it works               
-            
-                // return warning if no images has been selected yet
-                if (swfu.getStats().files_queued == 0) {                  
-                  // only create gallery node without any images, if field is not required
-                  if (!imagefield_required) {
-                    // new node
-                    result = confirm(Drupal.t('No images have been selected yet.') + ' ' + Drupal.t('If you continue (OK), a node without any images will be created.\n If you want to add some images to queue, click "Cancel" and use the icon on the left to queue some images.'));
-                  } else {
-                    // node is edited
-                    result = false;
-                    alert(Drupal.t('No images have been selected yet.') + ' ' + Drupal.t('Please click the icon on the left to queue some images.'));
-                  }
-                  // user wants to create a node without any images ... ok =)
-                  if (result && !jsTimer)
-                    document.getElementById('edit-submit').click();
-                }
-                
-                // hey, let's go =)
-                swfu.startUpload();  
-             }            
-         }
-         
-         function UploadComplete(numFilesUploaded) {
-             // Provide a second step to be able to edit captions of image if supported             
-             var redirect_url_main = "<?php print $redirect_url; ?>";
-             var redirect_url_updated = "";
-             if (isNaN(document.getElementById('redirect_url'))) {
-               // updated redirect url
-               redirect_url_updated = document.getElementById('redirect_url').value;
-             }
-             
-             // user is allowed to enter preview page
-             if (redirect_url_main != "" && numFilesUploaded > 0) {
-                 upload_complete = true;
-                 // Disable Select button
-                 swfu.setButtonDisabled(true);
-                 
-                 // if available, update our redirect url
-                 if (redirect_url_updated != "")
-                   redirect_url_main = redirect_url_updated;
-                                  
-                 try {
-                   var url_next = '<a href="' + redirect_url_main + '">' + Drupal.t('next step') + '</a>';
-                   document.getElementById('startuploadbutton').value = Drupal.t('Next step');
-                   document.getElementById('startuploadbutton').onclick = function() {fupload_redirect(redirect_url_main);};
-                   document.getElementById('divStatus').innerHTML = (Drupal.formatPlural(numFilesUploaded, '1 file uploaded in queue.', '@count files uploaded in queue.') + ' ' + Drupal.t('Enter the !link to be able to edit all captions.', { '!link': url_next }));
-                   document.getElementById('imagepreviewlistbutton').style.visibility = 'visible';
-                   document.getElementById('imagepreviewlistbutton').onclick = function() {fupload_redirect(redirect_url_main);};
-                   
-                   // if node is edited, change save button to "next step" button and remove other buttons
-                   //document.getElementById('edit-submit').value = Drupal.t('Next step');
-                 }
-                 catch(err) {
-                   // not interesting in this case
-                 }
-             }
-             
-             // no access to preview page: redirect directly to newly created nodeName
-             if (redirect_url_main == "" && numFilesUploaded > 0)
-               fupload_redirect();
-             
-         }
\ No newline at end of file
+var swfu;
+var jsTimer = false;
+var error_send = false; // Indicates whether swfUpload has already been stopped because of a form error
+var upload_complete = false; // All queued files uploaded?
+var queue_complete = 0; // contains number of queued and successfully uploaded images
+var count_failed_uploads = 0; // Number of failed uploads
+
+window.onload = function() {
+  var settings = {
+    flash_url : "<?php print $modulepath; ?>/swfupload/swfupload.swf",
+    upload_url: "<?php print $uploadpath; ?>",  // Relative to the SWF file
+    post_params: {"PHPSESSID" : "<?php print $sessionid; ?>" , "nodetype" : "<?php print $nodetype; ?>", "fieldname" : "<?php print $fieldname; ?>"},
+    file_post_name: "Filedata",
+    file_size_limit : "<?php print $maxfilesize; ?>",
+    file_types : "<?php print $fileextensions; ?>",
+    file_types_description : "Only images",
+    file_upload_limit : "<?php print $uploadlimit; ?>",
+    file_queue_limit : "0",
+    custom_settings : {
+      progressTarget : "fsUploadProgress",
+      cancelButtonId : "btnCancel"
+    },
+    debug: false,
+
+    // Button settings
+    button_width: "36",
+    button_height: "37",
+    button_placeholder_id: "spanUploadButton",
+    button_image_url: "<?php print $modulepath; ?>/swfupload/select_images.png",  // Relative to the Flash file
+    button_cursor: SWFUpload.CURSOR.HAND,
+
+    // The event handler functions are defined in handlers.js
+    file_queued_handler : fileQueued,
+    file_queue_error_handler : fileQueueError,
+    file_dialog_complete_handler : fileDialogComplete,
+    upload_start_handler : uploadStart,
+    upload_progress_handler : uploadProgress,
+    upload_error_handler : uploadError,
+    upload_success_handler : uploadSuccess,
+    upload_complete_handler : uploadComplete,
+    queue_complete_handler : queueComplete  // Queue plugin event
+  };
+  swfu = new SWFUpload(settings);
+
+};
+
+function startUploadProcess() {
+  var redirect_url = "<?php print $redirect_url; ?>";
+  var imagefield_required = <?php print $field_required; ?>;
+
+  if (!upload_complete) {
+    // Reset all variables and indicators
+    error_send = false;
+    count_failed_uploads = 0;
+    if (isNaN(document.getElementById('form_errors')))
+      document.getElementById('form_errors').value = '0';
+    if (isNaN(document.getElementById('num_queued_images')))
+      document.getElementById('num_queued_images').value = '1'; // Pretend that there's at least one image in queue so that it works
+
+    // return warning if no images has been selected yet
+    if (swfu.getStats().files_queued == 0) {
+      // only create gallery node without any images, if field is not required
+      if (!imagefield_required) {
+        // new node
+        result = confirm(Drupal.t('No images have been selected yet.') + ' ' + Drupal.t('If you continue (OK), a node without any images will be created.\n If you want to add some images to queue, click "Cancel" and use the icon on the left to queue some images.'));
+      } else {
+        // node is edited
+        result = false;
+        alert(Drupal.t('No images have been selected yet.') + ' ' + Drupal.t('Please click the icon on the left to queue some images.'));
+      }
+      // user wants to create a node without any images ... ok =)
+      if (result && !jsTimer)
+        document.getElementById('edit-submit').click();
+    }
+
+    // hey, let's go =)
+    swfu.startUpload();
+  }
+}
+
+function UploadComplete(numFilesUploaded) {
+  // Provide a second step to be able to edit captions of image if supported
+  var redirect_url_main = "<?php print $redirect_url; ?>";
+  var redirect_url_updated = "";
+  if (isNaN(document.getElementById('redirect_url'))) {
+    // updated redirect url
+    redirect_url_updated = document.getElementById('redirect_url').value;
+  }
+
+  // user is allowed to enter preview page
+  if (redirect_url_main != "" && numFilesUploaded > 0) {
+    upload_complete = true;
+    // Disable Select button
+    swfu.setButtonDisabled(true);
+
+    // if available, update our redirect url
+    if (redirect_url_updated != "")
+      redirect_url_main = redirect_url_updated;
+
+    try {
+      var url_next = '<a href="' + redirect_url_main + '">' + Drupal.t('next step') + '</a>';
+      document.getElementById('startuploadbutton').value = Drupal.t('Next step');
+      document.getElementById('startuploadbutton').onclick = function() {fupload_redirect(redirect_url_main);};
+      document.getElementById('divStatus').innerHTML = (Drupal.formatPlural(numFilesUploaded, '1 file uploaded in queue.', '@count files uploaded in queue.') + ' ' + Drupal.t('Enter the !link to be able to edit all captions.', { '!link': url_next }));
+      document.getElementById('imagepreviewlistbutton').style.visibility = 'visible';
+      document.getElementById('imagepreviewlistbutton').onclick = function() {fupload_redirect(redirect_url_main);};
+
+      // if node is edited, change save button to "next step" button and remove other buttons
+      //document.getElementById('edit-submit').value = Drupal.t('Next step');
+    }
+    catch(err) {
+      // not interesting in this case
+    }
+  }
+
+  // no access to preview page: redirect directly to newly created nodeName
+  if (redirect_url_main == "" && numFilesUploaded > 0)
+    fupload_redirect();
+
+}
\ No newline at end of file
Index: image_fupload_image/image_fupload_image.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload_image/image_fupload_image.admin.inc,v
retrieving revision 1.7
diff -u -p -r1.7 image_fupload_image.admin.inc
--- image_fupload_image/image_fupload_image.admin.inc	31 Jan 2009 00:13:38 -0000	1.7
+++ image_fupload_image/image_fupload_image.admin.inc	1 May 2009 01:16:40 -0000
@@ -1,6 +1,10 @@
 <?php
 // $Id: image_fupload_image.admin.inc,v 1.7 2009/01/31 00:13:38 grandcat Exp $
 
+/**
+ * @file
+ */
+
 function image_fupload_image_admin() {
   $form['info'] = array(
     '#value' => t('To be able to mass upload images using image_fupload, the corresponding permissions have to be set per !admin-permissions. To provide a preview page of all uploaded images and the ability to edit its fields (title and body), have a look at the category "Images preview list".', array('!admin-permissions' => l(t('user role'), 'admin/user/permissions'))),
@@ -36,14 +40,14 @@ function image_fupload_image_admin() {
   $form['previewlist']['field_settings']['fupload_previewlist_field_settings'] = array(
     '#type' => 'checkboxes',
     '#title' => t('Editable fields'),
-    '#description' => t('Choose the fields which should be editable by the uploader.') .'<p>'.t('<strong>Important information:</strong><br /> If the body is not editable by the user, <em>"minimum number of words"</em> !setting for the body field has to be <strong>0</strong>.', array('!setting' => l(t('setting'), 'admin/content/node-type/image'))).'</p>',
+    '#description' => t('Choose the fields which should be editable by the uploader.') .'<p>'. t('<strong>Important information:</strong><br /> If the body is not editable by the user, <em>"minimum number of words"</em> !setting for the body field has to be <strong>0</strong>.', array('!setting' => l(t('setting'), 'admin/content/node-type/image'))) .'</p>',
     '#options' => array(
       'title' => t('Title'),
-      'body' => t('Body'),    
+      'body' => t('Body'),
     ),
     '#default_value' => variable_get('fupload_previewlist_field_settings', array('title', 'body')),
   );
-  
+
   $form['fupload_title_replacements'] = array(
     '#type' => 'textfield',
     '#title' => t('Image Title Processor'),
@@ -59,5 +63,5 @@ function image_fupload_image_admin() {
 }
 
 function image_fupload_image_admin_submit($form, &$form_state) {
-  _fupload_imagepreview_settings('write', 'image', array('preview_preset' => $form_state['values']['fupload_previewlist_img']));     
+  _fupload_imagepreview_settings('write', 'image', array('preview_preset' => $form_state['values']['fupload_previewlist_img']));
 }
\ No newline at end of file
Index: image_fupload_image/image_fupload_image.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload_image/image_fupload_image.install,v
retrieving revision 1.3
diff -u -p -r1.3 image_fupload_image.install
--- image_fupload_image/image_fupload_image.install	11 Aug 2008 21:12:10 -0000	1.3
+++ image_fupload_image/image_fupload_image.install	1 May 2009 01:16:40 -0000
@@ -2,6 +2,10 @@
 // $Id: image_fupload_image.install,v 1.3 2008/08/11 21:12:10 grandcat Exp $
 
 /**
+ * @file
+ */
+
+/**
  * Implementation of hook_install().
  */
 function image_fupload_image_install() {
Index: image_fupload_image/image_fupload_image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload_image/image_fupload_image.module,v
retrieving revision 1.35
diff -u -p -r1.35 image_fupload_image.module
--- image_fupload_image/image_fupload_image.module	21 Mar 2009 08:42:57 -0000	1.35
+++ image_fupload_image/image_fupload_image.module	1 May 2009 01:16:43 -0000
@@ -21,7 +21,7 @@ function image_fupload_image_menu() {
     'type' => MENU_CALLBACK,
     'file' => 'node.pages.inc',
     'file path' => drupal_get_path('module', 'node'),
-  );  
+  );
   return $items;
 }
 
@@ -29,67 +29,68 @@ function image_fupload_image_menu() {
  * Implementation of hook_form_alter() registry.
  */
 function image_fupload_image_form_alter(&$form, $form_state, $form_id) {
-  global $user;  
+  global $user;
   // examine whether it's a new image type & the user wants to have flash
-  if ($form_id == "image_node_form" && !isset($form['#node']->nid) && arg(0) != 'img_assist' && arg(3) != "noflash" && arg(3) != "list_images" && user_access('mass upload images')) {    
+  if ($form_id == "image_node_form" && !isset($form['#node']->nid) && arg(0) != 'img_assist' && arg(3) != "noflash" && arg(3) != "list_images" && user_access('mass upload images')) {
     // Some needed JS & CSS - Files to be included
     $module_path = drupal_get_path('module', 'image_fupload');
-	  drupal_add_js($module_path .'/swfupload/swfupload.js', 'module');
-	  drupal_add_js($module_path .'/swfupload/swfupload.queue.js', 'module');
-	  drupal_add_js($module_path .'/swfupload/fileprogress.js', 'module');
-	  drupal_add_js($module_path .'/swfupload/handlers.js', 'module');
+    drupal_add_js($module_path .'/swfupload/swfupload.js', 'module');
+    drupal_add_js($module_path .'/swfupload/swfupload.queue.js', 'module');
+    drupal_add_js($module_path .'/swfupload/fileprogress.js', 'module');
+    drupal_add_js($module_path .'/swfupload/handlers.js', 'module');
     /* Check if another step with editing options is provided  for this user*/
     $redirect_url = '';
-    if (user_access('edit captions'))
+    if (user_access('edit captions')) {
       $redirect_url = url('node/add/image/list_images');
+    }
     /* Check END */
-	  drupal_add_js(theme('swfupload_settings', base_path() . $module_path, url('fupload/flash'), round(variable_get('image_max_upload_size', 800)), '*.jpg; *.jpeg; *.png; *.gif', (!empty($user->sid) ? $user->sid : session_id()), 100, 'image', 'images', 'true', '', $redirect_url), 'inline');
+    drupal_add_js(theme('swfupload_settings', base_path() . $module_path, url('fupload/flash'), round(variable_get('image_max_upload_size', 800)), '*.jpg; *.jpeg; *.png; *.gif', (!empty($user->sid) ? $user->sid : session_id()), 100, 'image', 'images', 'true', '', $redirect_url), 'inline');
     drupal_add_css($module_path .'/image_fupload-style.css', 'module', 'all', FALSE);  // Style of swfUpload
-        
+
     unset($form['title'], $form['rebuild_images'], $form['buttons']); //don't need this, title will be generated later using filepath
-    
-    isset($form['taxonomy']) ? $form['taxonomy']['#weight'] = -8 : ""; //adds ablility to sort better in this case    
-	
+
+    isset($form['taxonomy']) ? $form['taxonomy']['#weight'] = -8 : ""; //adds ablility to sort better in this case
+
     // if user is allowed to mass edit captions, so let's prepare the form to be able to perform further steps later
     if (user_access('edit captions')) {
       $form['body_field']['body']['#disabled'] = TRUE; // not accessable when editing done by caption list
-      $form['body_field']['#prefix'] = '<div class="body-field-wrapper" style="display: none;">';  
+      $form['body_field']['#prefix'] = '<div class="body-field-wrapper" style="display: none;">';
       // Little Hack: Validation fails if body is hidden and wordcount > 0 ==> little hack, look at function "fupload_node_form_validate"
       $form['#validate'][0] = 'fupload_node_form_validate';
-    
+
       $form['options']['status']['#disabled'] = TRUE;
       $form['options']['status']['#default_value'] = 0;
-    }    
-    
+    }
+
     $form['message'] = array(
       '#value' => '<div id="jsstatus"></div>',
       '#weight' => -7,
     );
     $form['image'] = array(
-	  '#type' => 'fieldset',
-	  '#title' => t('Images'),
-    '#value' => '<span style="font-style:italic;">' .t('Click the "Select Images" icon on the left below to begin.') .'</span>',
-	  '#weight' => -6,
+    '#type' => 'fieldset',
+    '#title' => t('Images'),
+    '#value' => '<span style="font-style:italic;">'. t('Click the "Select Images" icon on the left below to begin.') .'</span>',
+    '#weight' => -6,
     '#attributes' => array('class' => 'flash', 'id' => 'fsUploadProgress'),
-	  '#collapsible' => FALSE,
-	  '#collapsed' => FALSE,
-	  );
+    '#collapsible' => FALSE,
+    '#collapsed' => FALSE,
+    );
     $form['upload_info'] = array(
-	  '#value' => t('0 Files uploaded.'),
-	  '#prefix' => '<div id="divStatus">',
-	  '#suffix' => '</div>',
-	  '#weight' => -5,
-	  );
-	  // Drupal 6 Bug: can't use "normal" buttons, only submit buttons are possible => workaround
+    '#value' => t('0 Files uploaded.'),
+    '#prefix' => '<div id="divStatus">',
+    '#suffix' => '</div>',
+    '#weight' => -5,
+    );
+    // Drupal 6 Bug: can't use "normal" buttons, only submit buttons are possible => workaround
     // Select Button has no real function, but Flash Player (swfUpload) overlays it with an transparent effect handler
-	  $form['upload_buttons'] = array(
-	    '#prefix' => '<div>',
-	    '#value' => '<span id="spanUploadButton"></span> <input id="btnCancel" type="button" value="'.t('Cancel All Uploads').'" onclick="swfu.cancelQueue();" disabled="disabled" /> ',	
-	    '#suffix' => '</div>',
-	    '#weight' => -4,
-	  );
+    $form['upload_buttons'] = array(
+      '#prefix' => '<div>',
+      '#value' => '<span id="spanUploadButton"></span> <input id="btnCancel" type="button" value="'. t('Cancel All Uploads') .'" onclick="swfu.cancelQueue();" disabled="disabled" /> ',
+      '#suffix' => '</div>',
+      '#weight' => -4,
+    );
     $form['upload_buttons']['node_create'] = array(
-	  '#type' => 'submit',
+    '#type' => 'submit',
       '#value' => t('Process queued images'),
       '#weight' => -3,
       '#ahah' => array(
@@ -99,9 +100,9 @@ function image_fupload_image_form_alter(
         'wrapper' => 'jsstatus',
         'progress' => array('type' => 'bar', 'message' => t('Images in queue are processed...')),
       ),
-	  );
+    );
     $form['upload_buttons']['delete_queue'] = array(
-	  '#type' => 'submit',
+    '#type' => 'submit',
       '#value' => t('Delete queued images'),
       '#weight' => -2,
       '#ahah' => array(
@@ -110,14 +111,14 @@ function image_fupload_image_form_alter(
         'method' => 'append',
         'wrapper' => 'jsstatus',
       ),
-	  );
+    );
 
     $form['upload_buttons']['submit'] = array(
-      '#value' => '<input type="button" value="'.t('Save').'" id="startuploadbutton" onclick="startUploadProcess()" />',
+      '#value' => '<input type="button" value="'. t('Save') .'" id="startuploadbutton" onclick="startUploadProcess()" />',
       '#weight' => -1,
       '#submit' => array('node_form_submit'),
-    );    
-    
+    );
+
     $form['#redirect'] = FALSE; // Important that $_POST is not empty after browser submit
     $form['#submit'][0] = '_image_node_form_submit'; // use our emulated version instead of original one in image.module
   }
@@ -126,18 +127,18 @@ function image_fupload_image_form_alter(
 function image_fupload_image_node_create() {
   global $user;
   global $file_cache;
-  
+
   // Remove images which couldn't be processed completly (--> mostly because of memory excaustion) --> real removal done by cron
   db_query("UPDATE {files} SET filename = '%s' WHERE uid = %d AND status = %d AND filename = '%s'", image_fupload_image_status('images', IMAGE_PROCESSED), $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status('images', IMAGE_HALFPROCESSED));
-    
+
   // Get some POST Variables
   $form_build_id = $_POST['form_build_id'];
   $form_id = $_POST['form_id'];
-  
+
   if (isset($form_build_id) && isset($form_id)) {
     $form_error = 0;
     $message = '';
-    
+
     // Load the form from the Form API cache and check if valid
     $form_state = array('rebuild' => TRUE, 'values' => $_POST); // rebuild option needed to prevent that "_image_node_form_submit" gets executed by drupal_process_form
     if (!($form = form_get_cache($form_build_id, $form_state))) {
@@ -147,40 +148,41 @@ function image_fupload_image_node_create
       drupal_json(array('status' => TRUE, 'data' => $output));
       exit();
     }
-    
+
     // Some form manipulations
     $form['#post'] = $_POST;
     // Default Value; Title will be overwritten in the next steps
     $form['#post']['title'] = 'Image';
     $form['#post']['form_id'] = $form['form_id']['#value'];
-    
+
     // New generated fields
     $form['title'] = array('#type' => 'textfield', '#title' => 'Image', '#default_value' => ''); // Needed that validation is successful
     // for preview list: body will be replaced
-    if (user_access('edit captions'))
+    if (user_access('edit captions')) {
       $form['body_field']['body'] = array('#type' => 'textarea', '#title' => 'Body', '#default_value' => image_fupload_image_status('images', IMAGE_NOT_COMPLETED));
-    
+    }
+
     drupal_process_form($form_id, $form, $form_state); // Only validate input data
     if (!form_get_errors()) {
       $result = db_query_range("SELECT * FROM {files} WHERE uid = %d AND status = %d AND filename = '%s'", $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status('images', IMAGE_UNMACHINED), 0, 3);
       while ($image = db_fetch_object($result)) {
         // ahh.. first image to process
         $file_cache['image'] = $image; // Add image to cache for image.module
-        
+
         // Set status flag on image (work on picture can begin); if there are problems with this image, it will be kicked next time
         db_query("UPDATE {files} SET filename = '%s' WHERE fid = %d", image_fupload_image_status('images', IMAGE_HALFPROCESSED), $image->fid);
-        
+
         // check the file against all validators a 2. second time because Flash could eventuelly be bypassed
         $validators = array(
           'file_validate_is_image' => array(),
           'file_validate_size' => array(variable_get('image_max_upload_size', 800) * 1024),
-        );  
-        // Validation code taken from Drupal's function "file_save_upload" (D6 24/08/2008)        
+        );
+        // Validation code taken from Drupal's function "file_save_upload" (D6 24/08/2008)
         // Call the validation functions.
         file_validate($image, $validators);
-                
+
         // no errors during validation, let's continue
-        if (!form_get_errors()) {        
+        if (!form_get_errors()) {
           // Create a filename out of the given image information; used a theme function so that it can be customised; mapping new title
           $form['title']['#value'] = theme('fupload_create_filename', $image);
           $form_state['values']['title'] = $form['title']['#value'];
@@ -190,48 +192,50 @@ function image_fupload_image_node_create
             $form['body']['#value'] = image_fupload_image_status('images', IMAGE_NOT_COMPLETED);
             $form_state['values']['body'] = image_fupload_image_status('images', IMAGE_NOT_COMPLETED);
           }
-        
+
           node_form_submit($form, $form_state); // Submit form --> Save it
-        
+
           // Prevent that same image is processed twice; deleted later by cron
           db_query("UPDATE {files} SET filename = '%s' WHERE fid = %d", image_fupload_image_status('images', IMAGE_PROCESSED), $image->fid);
         }
-      } 
+      }
       // no files in cache, so no files have been processed yet because of empty queue
-      if(empty($file_cache['image']) && !form_get_errors())
-        drupal_set_message(t('No images yet in queue.'));      
-      
+      if (empty($file_cache['image']) && !form_get_errors()) {
+        drupal_set_message(t('No images yet in queue.'));
+      }
+
       // Examine how many images are left in queue and inform JS by sending a hidden element
       $result = db_fetch_object(db_query("SELECT COUNT(*) AS img_count FROM {files} WHERE uid = %d AND status = %d AND filename = '%s'", $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status('images', IMAGE_UNMACHINED)));
-      $message .= '<input type="hidden" name="num_queued_images" id="num_queued_images" value="' . $result->img_count . '" />';    
+      $message .= '<input type="hidden" name="num_queued_images" id="num_queued_images" value="'. $result->img_count .'" />';
     }
     if (form_get_errors()) {
       // Error in received form (for example a required field was not filled) or during validation; inform JS => user
       $form_error = 1;
       $message .= '<input type="hidden" name="num_queued_images" id="num_queued_images" value="0" />';
     }
-    
+
     // Inform JS about errors
-    $message .= '<input type="hidden" name="form_errors" id="form_errors" value="' . $form_error . '"  />';
+    $message .= '<input type="hidden" name="form_errors" id="form_errors" value="'. $form_error .'"  />';
     $message .= theme('status_messages'); // Theme all messages
-    
+
     drupal_json(array('status' => TRUE, 'data' => $message));
-  
-  } else {
+
+  }
+  else {
     drupal_json(array('status' => FALSE, 'data' => t('Error: No or wrong POST Data')));
-  }  
+  }
 }
 
 /*
-* Helper function which emulates "image_node_form_submit" of image.module v 1.274 2008/06/16 18:45:58 drewish
-* Need this because the static variable "$upload_cache" doesn't seem to persist after execution of "form_execute_handlers" function
-*/
+ * Helper function which emulates "image_node_form_submit" of image.module v 1.274 2008/06/16 18:45:58 drewish
+ * Need this because the static variable "$upload_cache" doesn't seem to persist after execution of "form_execute_handlers" function
+ */
 function _image_node_form_submit($form, &$form_state) {
   global $file_cache;
-    
-  $nid = 'new_node'; // in this case, we can define it permanentelly  
+
+  $nid = 'new_node'; // in this case, we can define it permanentelly
   $file = $file_cache['image']; // fill our object with picture information
-    
+
   // Code from image.module v 1.274 2008/06/16 18:45:58 drewish (line 199++)
   $image_info = image_get_info($file->filepath);
   $aspect_ratio = $image_info['height'] / $image_info['width'];
@@ -244,16 +248,16 @@ function _image_node_form_submit($form, 
       drupal_set_message(t('The original image was resized to fit within the maximum allowed resolution of %width x %height pixels.', array('%width' => $original_size['width'], '%height' => $original_size['height'])));
     }
   }
-  
+
   // We're good to go.
   $form_state['values']['images'][IMAGE_ORIGINAL] = $file->filepath;
   $form_state['values']['rebuild_images'] = FALSE;
   $form_state['values']['new_file'] = TRUE;
-  
+
   // Call hook to allow other modules to modify the original image.
   module_invoke_all('image_alter', $form_state['values'], $file->filepath, IMAGE_ORIGINAL);
   $form_state['values']['images'] = _image_build_derivatives((object) $form_state['values'], TRUE);
-  
+
   // Store the new file into the session.
-  $_SESSION['image_new_files'][$nid] = $form_state['values']['images'];  
+  $_SESSION['image_new_files'][$nid] = $form_state['values']['images'];
 }
\ No newline at end of file
Index: image_fupload_imagefield/image_fupload_imagefield.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload_imagefield/image_fupload_imagefield.module,v
retrieving revision 1.33
diff -u -p -r1.33 image_fupload_imagefield.module
--- image_fupload_imagefield/image_fupload_imagefield.module	8 Apr 2009 12:44:42 -0000	1.33
+++ image_fupload_imagefield/image_fupload_imagefield.module	1 May 2009 01:16:52 -0000
@@ -2,7 +2,11 @@
 // $Id: image_fupload_imagefield.module,v 1.33 2009/04/08 12:44:42 grandcat Exp $
 
 /**
- * Implementation of hook_help
+ * @file
+ */
+
+/**
+ * Implementation of hook_help().
  */
 function image_fupload_imagefield_help($path, $arg) {
 // will come later...
@@ -19,11 +23,11 @@ function image_fupload_imagefield_menu()
     'type' => MENU_CALLBACK,
     'file' => 'field_file.inc',
     'file path' => drupal_get_path('module', 'filefield'),
-  );  
-  return $items;  
+  );
+  return $items;
 }
 
-function image_fupload_imagefield_theme() {  
+function image_fupload_imagefield_theme() {
   return array(
     // imagefield_widget form element type theme function.
     'image_fupload_imagefield_widget' => array(
@@ -49,13 +53,13 @@ function image_fupload_imagefield_theme(
 
 /**
  * Implementation of hook_form_alter() registry.
- **/
+ */
 function image_fupload_imagefield_form_alter(&$form, $form_state, $form_id) {
-  global $user;  
+  global $user;
   // load available image node types & field information
   $image_node_types = variable_get('image_node_types', array());
-  $node_type = substr($form_id, 0, (strlen($form_id) - 10)); // get node type  
-  
+  $node_type = drupal_substr($form_id, 0, (drupal_strlen($form_id) - 10)); // get node type
+
   // examine whether this node type is configured as image fupload handler (basic check = performance)
   if (image_node_type_load($node_type, TRUE)) {
     // get field information
@@ -69,13 +73,13 @@ function image_fupload_imagefield_form_a
       drupal_add_js($module_path .'/swfupload/swfupload.queue.js', 'module');
       drupal_add_js($module_path .'/swfupload/fileprogress.js', 'module');
       drupal_add_js($module_path .'/swfupload/handlers.js', 'module');
-      
+
       // provide a link for further steps (preview list with editing) if permitted
       $redirect_url = '';
       if (user_access('edit captions')) {
-        $redirect_url = url('node/add/' .str_replace("_", "-", $node_type) .'/list_imagefields');
+        $redirect_url = url('node/add/'. str_replace("_", "-", $node_type) .'/list_imagefields');
       }
-      
+
       // number of images allowed to be uploaded
       switch ($field['multiple']) {
         case "1":
@@ -88,69 +92,75 @@ function image_fupload_imagefield_form_a
           $upload_limit_count = $field['multiple'];
       }
       // don't observe number of fields in single storage mode
-      if ($field['widget']['fupload_mode'] == "single")
+      if ($field['widget']['fupload_mode'] == "single") {
         $upload_limit_count = 100; // unlimited
-      
+      }
+
       $fupload_widget_weight = $field['widget']['weight'];
-      $file_max_size = parse_size($field['widget']['max_filesize_per_file']); // maximal allowed file size (bytes)  
-      drupal_add_js(theme('swfupload_settings', base_path() . $module_path, url('fupload/flash'), round($file_max_size/1024), ("*." .str_replace(" ", "; *.", $field['widget']['file_extensions'])), (!empty($user->sid) ? $user->sid : session_id()), $upload_limit_count, $node_type, $field_name, (!empty($field['required']) ? "true" : "false"), $field['widget']['fupload_mode'], $redirect_url), 'inline');
+      $file_max_size = parse_size($field['widget']['max_filesize_per_file']); // maximal allowed file size (bytes)
+      drupal_add_js(theme('swfupload_settings', base_path() . $module_path, url('fupload/flash'), round($file_max_size/1024), ("*.". str_replace(" ", "; *.", $field['widget']['file_extensions'])), (!empty($user->sid) ? $user->sid : session_id()), $upload_limit_count, $node_type, $field_name, (!empty($field['required']) ? "true" : "false"), $field['widget']['fupload_mode'], $redirect_url), 'inline');
       drupal_add_css($module_path .'/image_fupload-style.css', 'module', 'all', FALSE);
-      
+
       // unvisible elements, will be written in cache
       $form['node_type'] = array('#type' => 'value', '#value' => $node_type);
       $form['field_name'] = array('#type' => 'value', '#value' => $field_name);
-      
+
       // is it a new node?
       if (!isset($form['#node']->nid)) {
         // new node; remove our imagefield and its validation, also in cache
         unset($form[$field_name], $form['#field_info'][$field_name], $form['#validate'][array_search('filefield_node_form_validate', $form['#validate'])]);
         // hide submit button; will be clicked via JS if needed
         $form['buttons']['submit']['#attributes'] = array('style' => 'display:none;');
-        
+
         // we have to split up storage modes
         if ($field['widget']['fupload_mode'] == "single") {
-          // one node per image - mode 
-          
+          // one node per image - mode
+
           if (user_access('edit captions')) { // user allowed to use preview list?
             // delete fields which will be shown later in preview list; cache this
             form_fields_destroy($form, $field['widget']['fupload_previewlist_field_settings']);
             form_set_cache($form['form_build_id'], $form, $form_state); // save changed data in cache, include removed fields for image preview list --> no validation
             unset($form['buttons']['preview']);
-          } else {
+          }
+          else {
             // basic form manipulations (normal mode)
             unset($form['title']);
             form_set_cache($form['form_build_id'], $form, $form_state); // save data in cache, don't include some unsets
-            unset($form['buttons']['preview']); // only make them unvisible            
-          }            
-          
-        } else {
+            unset($form['buttons']['preview']); // only make them unvisible
+          }
+
+        }
+        else {
           // multiple images per node - mode ...puhh...
           if (user_access('edit captions')) { // user allowed to use preview list?
             // delete fields which will be shown later in preview list; cache this
             form_fields_destroy($form, $field['widget']['fupload_previewlist_field_settings']);
             form_set_cache($form['form_build_id'], $form, $form_state); // save changed data in cache, include removed fields for image preview list --> no validation
             unset($form['buttons']['preview']);
-          } else {
+          }
+          else {
             // basic form manipulations (normal mode)
             form_set_cache($form['form_build_id'], $form, $form_state); // save data in cache, don't include some unsets
-            unset($form['buttons']['preview']); // only make them unvisible            
+            unset($form['buttons']['preview']); // only make them unvisible
           }
         }
-        
-      } else {
+
+      }
+      else {
         // edit already existing node
-        
+
         // ... already done by following form manipulations
       }
-      
+
       // standard image fupload form; will be shown in the most cases (not for existing node in single mode)
       if (isset($form['#node']->nid) && $field['widget']['fupload_mode'] == "single") {
         // don't create fupload form
-      } else {
+      }
+      else {
         $form['fupload'] = array(
           '#weight' => $fupload_widget_weight - 0.1,
         );
-    
+
         $form['fupload']['message'] = array(
           '#value' => '<div id="jsstatus"></div>',
           '#prefix' => '<div id="uploadform" style="visibility:hidden;"></div>', // needed to scroll to error and status messages
@@ -159,14 +169,14 @@ function image_fupload_imagefield_form_a
         $form['fupload']['image'] = array(
           '#type' => 'fieldset',
           '#title' => t('Images'),
-          '#value' => '<span style="font-style:italic;">' .t('Click the "Select Images" icon on the left below to begin.') .'</span>',
+          '#value' => '<span style="font-style:italic;">'. t('Click the "Select Images" icon on the left below to begin.') .'</span>',
           '#weight' => -6,
-          '#attributes' => array('class' => 'flash', 'id' => 'fsUploadProgress'),          
+          '#attributes' => array('class' => 'flash', 'id' => 'fsUploadProgress'),
           '#collapsible' => FALSE,
           '#collapsed' => FALSE,
         );
         $form['fupload']['upload_info'] = array(
-          '#value' => t('0 files uploaded.') . ' ',
+          '#value' => t('0 files uploaded.') .' ',
           '#prefix' => '<div id="divStatus">',
           '#suffix' => '</div>',
           '#weight' => -5,
@@ -174,7 +184,7 @@ function image_fupload_imagefield_form_a
         // Drupal 6 Bug: can't use "normal" buttons, only submit buttons are possible => workaround
         $form['fupload']['upload_buttons'] = array(
           '#prefix' => '<div>',
-          '#value' => '<span id="spanUploadButton"></span> <input id="btnCancel" type="button" value="'.t('Cancel All Uploads').'" onclick="swfu.cancelQueue();" disabled="disabled" /> ',	
+          '#value' => '<span id="spanUploadButton"></span> <input id="btnCancel" type="button" value="'. t('Cancel All Uploads') .'" onclick="swfu.cancelQueue();" disabled="disabled" /> ',
           '#suffix' => '</div>',
           '#weight' => -4,
         );
@@ -195,37 +205,41 @@ function image_fupload_imagefield_form_a
           '#value' => t('Delete queued images'),
           '#weight' => -2,
           '#ahah' => array(
-            'path' => 'fupload/js/deletequeue/' .$field_name,
+            'path' => 'fupload/js/deletequeue/'. $field_name,
             'event' => 'click',
             'method' => 'append',
             'wrapper' => 'jsstatus',
           ),
         );
         if (user_access('edit captions') && !isset($form['#node']->nid)) {
+          // TODO - This should be a button, not markup - http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6#button
           $form['fupload']['upload_buttons']['next_step'] = array(
-            '#value' => '<input type="button" value="'.t('Next step').'" id="imagepreviewlistbutton" style="visibility:hidden" />',
+            '#value' => '<input type="button" value="'. t('Next step') .'" id="imagepreviewlistbutton" style="visibility:hidden" />',
             '#weight' => -1,
-          ); 
+          );
         }
-        
+
         if (isset($form['#node']->nid)) {
           $form['fupload']['upload_info']['#value'] .= t('Queued files will be uploaded by clicking the "Upload images" button.');
+          // TODO - This should be a button, not markup - http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6#button
           $form['fupload']['upload_buttons']['submit'] = array(
-            '#value' => '<input type="button" value="'.t('Upload images').'" id="startuploadbutton" onclick="startUploadProcess();window.location.href=\'#uploadform\'" />',
+            '#value' => '<input type="button" value="'. t('Upload images') .'" id="startuploadbutton" onclick="startUploadProcess();window.location.href=\'#uploadform\'" />',
             '#weight' => -2,
           );
-        } else {
+        }
+        else {
           $form['fupload']['upload_info']['#value'] .=  t('Queued files will be uploaded by clicking the "Save" button at the bottom of this page.');
+          // TODO - This should be a button, not markup - http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6#button
           $form['buttons']['fupload_submit'] = array(
-            '#value' => '<input type="button" value="'.t('Save').'" id="startuploadbutton" onclick="startUploadProcess();window.location.href=\'#uploadform\'" />',
+            '#value' => '<input type="button" value="'. t('Save') .'" id="startuploadbutton" onclick="startUploadProcess();window.location.href=\'#uploadform\'" />',
             '#weight' => 19,
             '#submit' => array('node_form_submit'),
-          ); 
+          );
         }
-        
+
         //it seems we don't need it any more, but before, some testing
         //if (!isset($form['#node']->nid) && !isset($form_state['redirect']))
-        //$form['#redirect'] = FALSE; // Important that $_POST is not empty after browser submit           
+        //$form['#redirect'] = FALSE; // Important that $_POST is not empty after browser submit
       }
     }
   }
@@ -233,16 +247,16 @@ function image_fupload_imagefield_form_a
 
 function image_fupload_imagefield_node_create() {
   global $user;
-  
+
   // Get some POST Variables
   $form_build_id = $_POST['form_build_id'];
   $form_id = $_POST['form_id'];
-  
+
   if (isset($form_build_id) && isset($form_id)) {
     $form_error = 0;
     $message = ''; // message which will be returned to the user via JavaScript
     $redirect_url = ''; // updated redirect url
-    
+
     // Load the form from the Form API cache and check if valid
     $form_state = array('rebuild' => TRUE, 'values' => $_POST); // rebuild option needed to prevent that "_image_node_form_submit" gets executed by drupal_process_form
     if (!($form = form_get_cache($form_build_id, $form_state))) {
@@ -252,46 +266,46 @@ function image_fupload_imagefield_node_c
       drupal_json(array('status' => TRUE, 'data' => $output));
       exit();
     }
-    
+
     // some basic variables
     $field_name = $form['field_name']['#value']; // name of imagefield
     $node_type = $form['node_type']['#value']; // image node type
     $field = content_fields($field_name, $node_type); // imagefield widget
     // include node.pages.inc for some needed functions (node_form_submit_build_node)
     module_load_include('inc', 'node', 'node.pages');
-    
+
     // Remove images which couldn't be processed completly (--> mostly because of memory excaustion) --> physical removal done by cron
     db_query("UPDATE {files} SET filename = '%s' WHERE uid = %d AND status = %d AND filename = '%s'", image_fupload_image_status($field_name, IMAGE_PROCESSED), $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status($field_name, IMAGE_HALFPROCESSED));
-    
+
     // Some form manipulations, if some fields are not sent
     $form['#post'] = $_POST;
-    $form['#post']['form_id'] = $form['form_id']['#value']; 
-    if (!isset($form['title'])) {      
+    $form['#post']['form_id'] = $form['form_id']['#value'];
+    if (!isset($form['title'])) {
       // Default Value; Title will be overwritten in the next steps
-      $form['#post']['title'] = 'Image';         
+      $form['#post']['title'] = 'Image';
       // New generated fields
       $form['title'] = array('#type' => 'textfield', '#title' => 'title2change', '#default_value' => ''); // Needed that validation is successful
     }
-    
+
     // if we are editing already existing node, remove nid to prevent errors because node was changed before
     if (isset($form['nid']['#value'])) {
       $form['gallery_nid']['#value'] = $form['nid']['#value'];
       unset($form['nid']['#value'], $form_state['values']['nid']);
     }
-    
+
     // Form validation
     drupal_process_form($form_id, $form, $form_state);
     if (!form_get_errors()) {
       // prepare array for queuing images for imagefield (multiple images per node)
       $imagefield_files = array();
-    
+
       // validation passed
       $result = db_query_range("SELECT * FROM {files} WHERE uid = %d AND status = %d AND filename = '%s'", $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status($field_name, IMAGE_UNMACHINED), 0, 3);
       while ($image = db_fetch_object($result)) {
         $img_cache[] = $image; // cache our images
         // Set status flag on image (work on picture can begin); if there are problems with this image, it will be kicked next time
         db_query("UPDATE {files} SET filename = '%s' WHERE fid = %d", image_fupload_image_status($field_name, IMAGE_HALFPROCESSED), $image->fid);
-        
+
         // Create a filename out of the given image information; used a theme function so that it can be customised; mapping new title only if title field is disabled for preview list
         if ($form['title']['#title'] == "title2change") {
           $form['title']['#value'] = theme('fupload_create_filename', $image, $field['widget']['fupload_title_replacements']);
@@ -301,19 +315,19 @@ function image_fupload_imagefield_node_c
         $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field));
         $files_path = _fupload_import_widget_files_directory($field);
         //drupal_set_message($files_path);
-        
+
         // split up storage modes
         if ($field['widget']['fupload_mode'] == "single") {
-          // one node per image - mode     
+          // one node per image - mode
           if ($file = field_file_save_file($image->filepath, $validators, $files_path)) {
             // prepare node; code partially taken from function "node_form_submit" (D6 24/08/2008 node.pages.inc)
             $node = node_form_submit_build_node($form, $form_state);
             $insert = empty($node->nid);
             // add new files to node
-            $node->$field_name = array(0 => $file);  
+            $node->$field_name = array(0 => $file);
             // save node
             node_save($node);
-          
+
             // report to watchdog
             $node_link = l(t('view'), 'node/'. $node->nid);
             $watchdog_args = array('@type' => $node->type, '%title' => $node->title);
@@ -329,106 +343,116 @@ function image_fupload_imagefield_node_c
             }
             if ($node->nid) {
               $form_state['nid'] = $node->nid;
-              
+
               // file inserting successful =) Prevent that same image is processed twice; deleted later by cron
               db_query("UPDATE {files} SET filename = '%s' WHERE fid = %d", image_fupload_image_status($field_name, IMAGE_PROCESSED), $image->fid);
               // mark file for preview list if necessary
-              if (user_access('edit captions'))
+              if (user_access('edit captions')) {
                 db_query("INSERT INTO {fupload_previewlist} (fieldname, uid, nid, fid, created) VALUES ('%s', %d, %d, %d, %d)", $field_name, $user->uid, $node->nid, $file['fid'], time());
-              
-            } else {
+              }
+
+            }
+            else {
               // In the unlikely case something went wrong on save, the node will be
               // rebuilt and node form redisplayed the same way as in preview.
               drupal_set_message(t('The post could not be saved.'), 'error');
-            } 
-          }         
-          
-        } else {
-          // multiple images per node - mode          
-          
+            }
+          }
+
+        }
+        else {
+          // multiple images per node - mode
+
           // create gallery node if it doesn't exist
           if (!isset($form['gallery_nid']['#value'])) {
-            $node = _fupload_node_save($form, $form_state, $form_build_id);            
-          } else {
+            $node = _fupload_node_save($form, $form_state, $form_build_id);
+          }
+          else {
             $node->nid = $form['gallery_nid']['#value'];
             // add removed node specific; in case that form is cached again
             $form['nid']['#value'] = $node->nid;
             $form_state['values']['nid'] = $node->nid;
-          }          
-          
-          // add images to node 
+          }
+
+          // add images to node
 
           // add validation to check if some space is left for the file in our node
-          $validators['image_fupload_validate_total_filesize'] = array($node->nid, $field_name, parse_size($field['widget']['max_filesize_per_node'])); 
-                    
+          $validators['image_fupload_validate_total_filesize'] = array($node->nid, $field_name, parse_size($field['widget']['max_filesize_per_node']));
+
           if ($file = field_file_save_file($image->filepath, $validators, $files_path)) {
             // add images to queue to be merged into one node later --> better performance
             $imagefield_files[] = $file;
             drupal_set_message(t('Image %title added.', array('%title' => $file['filename'])));
-            
+
             // file inserting successful =) Prevent that same image is processed twice; deleted later by cron
             db_query("UPDATE {files} SET filename = '%s' WHERE fid = %d", image_fupload_image_status($field_name, IMAGE_PROCESSED), $image->fid);
             // mark file for preview list if necessary
-            if (user_access('edit captions'))
+            if (user_access('edit captions')) {
               db_query("INSERT INTO {fupload_previewlist} (fieldname, uid, nid, fid, created) VALUES ('%s', %d, %d, %d, %d)", $field_name, $user->uid, $node->nid, $file['fid'], time());
-          
-          } else {
+            }
+
+          }
+          else {
             // some validators couldn't be satisfied --> empty queue
             $form_error = 2;
           }
         }
-        
+
       }
       // add queued images to node gallery (multiple storage mode)
       if (count($imagefield_files)) {
         $node = node_load($node->nid);
-        
-        // add files to node       
+
+        // add files to node
         //$node->$field_name = array_merge((is_array($node->$field_name) ? $node->$field_name : array()), $imagefield_files);
         $node->$field_name = array_merge($node->$field_name, $imagefield_files);
-        
+
         node_save($node);
-      }  
-      
+      }
+
       // build redirect url: multiple mode and no access to preview page
-      if (isset($form['gallery_nid']['#value']) && !user_access('edit captions')) {         
-         $redirect_url = 'node/' .$form['gallery_nid']['#value'];
+      if (isset($form['gallery_nid']['#value']) && !user_access('edit captions')) {
+        $redirect_url = 'node/'. $form['gallery_nid']['#value'];
       }
 
       // if alternative redirect url is provided, replace existing one
-      if (!empty($field['widget']['fupload_previewlist_redirecturl']) && !user_access('edit captions'))
+      if (!empty($field['widget']['fupload_previewlist_redirecturl']) && !user_access('edit captions')) {
         $redirect_url = $field['widget']['fupload_previewlist_redirecturl'];
-      
+      }
+
       // send updated redirect url via json_decode
-      if (!empty($redirect_url) && $form_error == 0)
-        $message .= '<input type="hidden" name="redirect_url" id="redirect_url" value="' .url($redirect_url) .'" />';
-        
+      if (!empty($redirect_url) && $form_error == 0) {
+        $message .= '<input type="hidden" name="redirect_url" id="redirect_url" value="'. url($redirect_url) .'" />';
+      }
+
       // examine how many images are left in queue and inform JS by sending a hidden element
       $result = db_fetch_object(db_query("SELECT COUNT(*) AS img_count FROM {files} WHERE uid = %d AND status = %d AND filename = '%s'", $user->uid, FILE_STATUS_TEMPORARY, image_fupload_image_status($field_name, IMAGE_UNMACHINED)));
-      $message .= '<input type="hidden" name="num_queued_images" id="num_queued_images" value="' . $result->img_count . '" />';      
-      
-    } else {
+      $message .= '<input type="hidden" name="num_queued_images" id="num_queued_images" value="'. $result->img_count .'" />';
+
+    }
+    else {
       // error in received form (for example a required field was not filled) or during process; inform JS => user
       if ($form_error != 2) // special case: some validators of imagefield weren't satisfied
         $form_error = 1;
       $message .= '<input type="hidden" name="num_queued_images" id="num_queued_images" value="0" />';
-    }    
-    
+    }
+
     // Inform JS about errors
-    $message .= '<input type="hidden" name="form_errors" id="form_errors" value="' . $form_error . '"  />';
+    $message .= '<input type="hidden" name="form_errors" id="form_errors" value="'. $form_error .'"  />';
     $message .= theme('status_messages'); // Theme all messages
-    
+
     drupal_json(array('status' => TRUE, 'data' => $message));
-    
-  } else {
+
+  }
+  else {
     drupal_json(array('status' => FALSE, 'data' => t('Error: No or wrong POST Data')));
-  }     
+  }
 }
 
 /**
  * CCK related stuff
  */
- 
+
 /**
  * Implementation of hook_elements().
  */
@@ -436,7 +460,7 @@ function image_fupload_imagefield_elemen
   $elements = array();
   $elements_imagefield = module_invoke('imagefield', 'elements');
   $elements['image_fupload_imagefield_widget'] = $elements_imagefield['imagefield_widget'];
-  
+
   return $elements;
 }
 
@@ -449,7 +473,7 @@ function image_fupload_imagefield_widget
       'label' => t('Image FUpload'),
       'field types' => array('image', 'filefield'),
       'multiple values' => CONTENT_HANDLE_CORE,
-      'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),      
+      'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
       'description' => t('An edit widget for image files being uploaded via Image FUpload, including a preview of the image and editing options.'),
     ),
   );
@@ -489,8 +513,9 @@ function image_fupload_imagefield_conten
   switch ($op) {
     case "delete instance":
       // check if a image fupload related field is deleted
-      if ($image_node_types[$field['type_name']]['fieldname'] == $field['field_name'])
-        _fupload_imagepreview_settings('delete', $field['type_name']); // remove settings in variable image_node_types      
+      if ($image_node_types[$field['type_name']]['fieldname'] == $field['field_name']) {
+        _fupload_imagepreview_settings('delete', $field['type_name']); // remove settings in variable image_node_types
+      }
       break;
   }
 }
@@ -501,7 +526,7 @@ function image_fupload_imagefield_conten
  */
 
 function form_fields_destroy(&$form, $fields_to_remove = array()) {
-  // collect information about fields being used by image preview list, if needed  
+  // collect information about fields being used by image preview list, if needed
   $fields = array();
   foreach ($fields_to_remove as $key) {
     $elements = explode("_", $key, 2);
@@ -510,36 +535,41 @@ function form_fields_destroy(&$form, $fi
     if ($fields_to_remove[$key] != FALSE)
       array_push($fields[$elements[0]], $elements[1]);
   }
-  
+
   // any node specific fields which should be removed ..argg
   if (isset($fields['node'])) {
-    if (in_array("title", $fields['node']))
+    if (in_array("title", $fields['node'])) {
       unset($form['title']);
-    if (in_array("description", $fields['node']))
+    }
+    if (in_array("description", $fields['node'])) {
       unset($form['body_field']);
+    }
   }
-  
+
   if (isset($fields['taxonomy'])) {
     // remove taxonomy items if necessary
     for ($i = 0; $i < count($fields['taxonomy']); $i++) {
-        unset($form['taxonomy'][$fields['taxonomy'][$i]]);
-        unset($form['taxonomy']['tags'][$fields['taxonomy'][$i]]);
-      if (!count($form['taxonomy']['tags']))
-        unset($form['taxonomy']['tags']);      
+      unset($form['taxonomy'][$fields['taxonomy'][$i]]);
+      unset($form['taxonomy']['tags'][$fields['taxonomy'][$i]]);
+      if (!count($form['taxonomy']['tags'])) {
+        unset($form['taxonomy']['tags']);
+      }
     }
     // still anything left to render?
-    if (count(taxonomy_get_vocabularies($form['#node']->type)) == count($fields['taxonomy']))
-        unset($form['taxonomy']);
+    if (count(taxonomy_get_vocabularies($form['#node']->type)) == count($fields['taxonomy'])) {
+      unset($form['taxonomy']);
+    }
   }
-  
+
   if (isset($fields['cck'])) {
     // remove cck fields if necessary
     for ($i = 0; $i < count($fields['cck']);$i++) {
       unset($form[$fields['cck'][$i]]);
       unset($form['#field_info'][$fields['cck'][$i]]);
     }
-    if (!count($form['#field_info']))
+    if (!count($form['#field_info'])) {
       unset($form['#field_info']);
+    }
   }
 }
 
@@ -560,11 +590,11 @@ function theme_image_fupload_imagefield_
 }
 
 /**
-* Determine the widget's files directory [#292904] (great thanks to drewish)
-*
-* @param $field CCK field
-* @return files directory path.
-*/
+ * Determine the widget's files directory [#292904] (great thanks to drewish)
+ *
+ * @param $field CCK field
+ * @return files directory path.
+ */
 function _fupload_import_widget_files_directory($field) {
   $widget_file_path = $field['widget']['file_path'];
   if (module_exists('token')) {
@@ -575,14 +605,14 @@ function _fupload_import_widget_files_di
 }
 
 /*
-* Build a node from $form and save it to database
-*/
+ * Build a node from $form and save it to database
+ */
 function _fupload_node_save(&$form, $form_state, $form_build_id) {
   $node = node_form_submit_build_node($form, $form_state);
   $insert = empty($node->nid);
   // save node
   node_save($node);
-          
+
   // report to watchdog
   $node_link = l(t('view'), 'node/'. $node->nid);
   $watchdog_args = array('@type' => $node->type, '%title' => $node->title);
@@ -594,14 +624,15 @@ function _fupload_node_save(&$form, $for
   }
   if ($node->nid) {
     // will be saved in cache so that only one gallery node will be created
-    $form['gallery_nid']['#value'] = $node->nid; 
+    $form['gallery_nid']['#value'] = $node->nid;
     $form_state['values']['gallery_nid'] = $node->nid;
-              
+
     // save form to cache
-    form_set_cache($form_build_id, $form, $form_state);               
+    form_set_cache($form_build_id, $form, $form_state);
     return $node;
-    
-  } else {
+
+  }
+  else {
     // In the unlikely case something went wrong on save, the node will be
     // rebuilt and node form redisplayed the same way as in preview.
     drupal_set_message(t('The post could not be saved.'), 'error');
@@ -610,22 +641,23 @@ function _fupload_node_save(&$form, $for
 }
 
 /*
-* Validation function
-* Checkes if filesize sum of node doesn't exceed the limits
-*/
+ * Validation function
+ * Checkes if filesize sum of node doesn't exceed the limits
+ */
 
 function image_fupload_validate_total_filesize($file, $nid, $field_name, $node_size = 0) {
   global $user;
   $errors = array();
   $total_size = 0;
-  
+
   if ($node_size && $user->uid != 1) {
     $result = db_query("SELECT f.filesize FROM {content_%s} AS t JOIN {files} AS f ON t.%s_fid = f.fid WHERE t.nid = %d", $field_name, $field_name, $nid);
     while ($image = db_fetch_object($result)) {
       $total_size += $image->filesize;
-    }    
-    if (($total_size + $file->filesize) > $node_size)
+    }
+    if (($total_size + $file->filesize) > $node_size) {
       $errors[] = t('The new total filesize of this node, %tsize, would exceed field settings of %msize.', array('%tsize' => format_size($total_size + $file->filesize), '%msize' => format_size($node_size)));
+    }
   }
   return $errors;
 }
\ No newline at end of file
Index: image_fupload_imagefield/image_fupload_imagefield_widget.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/image_fupload_imagefield/image_fupload_imagefield_widget.inc,v
retrieving revision 1.12
diff -u -p -r1.12 image_fupload_imagefield_widget.inc
--- image_fupload_imagefield/image_fupload_imagefield_widget.inc	9 Apr 2009 09:08:51 -0000	1.12
+++ image_fupload_imagefield/image_fupload_imagefield_widget.inc	1 May 2009 01:16:55 -0000
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 
 /**
  * @file
@@ -10,7 +11,7 @@
  *
  * This file is mainly based on imagefield_widget.inc (D6 3.0-rc1)
  */
- 
+
 module_load_include('inc', 'imagefield', 'imagefield_widget');
 
 /**
@@ -19,11 +20,12 @@ module_load_include('inc', 'imagefield',
 function image_fupload_imagefield_widget_settings_form($widget) {
   $form = module_invoke('imagefield', 'widget_settings_form', $widget);
   $node_type = str_replace("-", "_", arg(3));
-  
-  // warn user to only use this widget once per node type  
-  if (!isset($widget['fupload_mode']))
+
+  // warn user to only use this widget once per node type
+  if (!isset($widget['fupload_mode'])) {
     drupal_set_message(t("Image FUpload widget can only be used <u>once</u> per node type.<br />If this is a second field using image fupload based on the same node type, it's adviced to delete this field, reconfigure the other one and create a new one without image fupload widget."), 'warning');
-    
+  }
+
   $form['fupload_mode'] = array(
     '#type' => 'radios',
     '#title' => t('Storage mode'),
@@ -33,7 +35,7 @@ function image_fupload_imagefield_widget
     '#weight' => -10,
     '#required' => TRUE,
   );
-  
+
   $form['fupload_previewlist'] = array(
     '#type' => 'fieldset',
     '#title' => t('Images preview list'),
@@ -64,8 +66,8 @@ function image_fupload_imagefield_widget
   $form['fupload_previewlist']['field_settings']['fupload_previewlist_field_settings'] = array(
     '#type' => 'checkboxes',
     '#title' => t('Editable fields'),
-    '#description' => t('Choose the fields which should be editable by the uploader. Note that depending on the storage mode, it is not possible to choose some fields.') .'<p>'.t('<strong>Important information:</strong><br /> If the body is not editable by the user, <em>"minimum number of words"</em> !setting for the body field has to be <strong>0</strong>.', array('!setting' => l(t('setting'), 'admin/content/node-type/image'))).'</p>',
-    '#options' => _image_fupload_previewlist_captions($node_type, arg(5)), 
+    '#description' => t('Choose the fields which should be editable by the uploader. Note that depending on the storage mode, it is not possible to choose some fields.') .'<p>'. t('<strong>Important information:</strong><br /> If the body is not editable by the user, <em>"minimum number of words"</em> !setting for the body field has to be <strong>0</strong>.', array('!setting' => l(t('setting'), 'admin/content/node-type/image'))) .'</p>',
+    '#options' => _image_fupload_previewlist_captions($node_type, arg(5)),
     '#default_value' => !empty($widget['fupload_previewlist_field_settings']) ? $widget['fupload_previewlist_field_settings'] : array(),
   );
   $form['fupload_previewlist_redirecturl'] = array(
@@ -82,8 +84,8 @@ function image_fupload_imagefield_widget
     '#default_value' => !empty($widget['fupload_title_replacements']) ? $widget['fupload_title_replacements'] : '_;{;};-',
     '#weight' => 3,
     '#required' => TRUE,
-  ); 
-  
+  );
+
   return $form;
 }
 
@@ -94,12 +96,12 @@ function image_fupload_imagefield_widget
   // elements which should be saved for this field (settings)
   $settings = array('fupload_mode', 'fupload_previewlist_img_attributes', 'fupload_title_replacements', 'fupload_previewlist_field_settings', 'fupload_previewlist_redirecturl');
   _fupload_imagepreview_settings('write', $widget['type_name'], array('fieldname' => $widget['field_name'], 'preview_preset' => $widget['fupload_previewlist_img']));
-  
-  return array_merge(module_invoke('imagefield', 'widget_settings_save', $widget), $settings);  
+
+  return array_merge(module_invoke('imagefield', 'widget_settings_save', $widget), $settings);
 }
 
 /**
-* Implementation of hook_widget_settings($op = 'validate').
+ * Implementation of hook_widget_settings_validate().
  */
 function image_fupload_imagefield_widget_settings_validate($widget) {
   module_invoke('imagefield', 'widget_settings_validate', $widget);
@@ -107,10 +109,11 @@ function image_fupload_imagefield_widget
   if (isset($widget['fupload_mode']) && $widget['fupload_mode'] == "multiple") {
     $allowed_fields = array('imagefield_title', 'imagefield_alt', 'imagefield_description');
     foreach ($widget['fupload_previewlist_field_settings'] as $key) {
-      if (!in_array($key, $allowed_fields))
-        form_set_error('fupload_previewlist_field_settings_' .$key, t('It is not possible to support a "@field" field (Field settings) in current storage mode. Disable this checkbox in order to continue.', array('@field' => $widget['fupload_previewlist_field_settings'][$key])));
+      if (!in_array($key, $allowed_fields)) {
+        form_set_error('fupload_previewlist_field_settings_'. $key, t('It is not possible to support a "@field" field (Field settings) in current storage mode. Disable this checkbox in order to continue.', array('@field' => $widget['fupload_previewlist_field_settings'][$key])));
+      }
     }
-  } 
+  }
   return array();
 }
 
@@ -119,26 +122,27 @@ function image_fupload_imagefield_widget
  */
 
 /**
-* Helper function
-* Creates a list of CCK fields depending on node type
-*/
- 
+ * Helper function
+ * Creates a list of CCK fields depending on node type
+ */
 function _image_fupload_previewlist_captions($node_type, $field_name) {
   $options = array('node_title' => t('Title (Node)'), 'node_description' => t('Description (Node)'), 'imagefield_title' => t('Title (ImageField)'), 'imagefield_alt' => t('Alt (ImageField)'), 'imagefield_description' => t('Description (ImageField)'));
   if (module_exists('taxonomy')) {
     // also include taxonomy in list
-    foreach (taxonomy_get_vocabularies($node_type) as $term)    
-      $options['taxonomy_' .$term->vid] = $term->name .' (Taxonomy)';
+    foreach (taxonomy_get_vocabularies($node_type) as $term) {
+      $options['taxonomy_'. $term->vid] = $term->name .' (Taxonomy)';
+    }
   }
-  
-  $fields = content_types($node_type);  
+
+  $fields = content_types($node_type);
   foreach ($fields['fields'] as $field) {
-    if ($field['field_name'] != $field_name)
-      $options['cck_' .$field['field_name']] = $field['widget']['label'] .' (CCK)';
+    if ($field['field_name'] != $field_name) {
+      $options['cck_'. $field['field_name']] = $field['widget']['label'] .' (CCK)';
+    }
   }
   return $options;
 }
- 
+
 /**
  * FormAPI theme function. Theme the output of an image field.
  */
Index: includes/images.previewlist.image.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/includes/images.previewlist.image.inc,v
retrieving revision 1.3
diff -u -p -r1.3 images.previewlist.image.inc
--- includes/images.previewlist.image.inc	14 Mar 2009 10:26:19 -0000	1.3
+++ includes/images.previewlist.image.inc	1 May 2009 01:16:57 -0000
@@ -1,29 +1,33 @@
 <?php
 // $Id: images.previewlist.image.inc,v 1.3 2009/03/14 10:26:19 grandcat Exp $
 
+/**
+ * @file
+ */
+
 /*
-* Provide a list (queue) of uploaded images; all captions can be edited at the same time
-*/
+ * Provide a list (queue) of uploaded images; all captions can be edited at the same time
+ */
 function fupload_list_images_image(&$form_state, $node_type) {
   global $user;
-  $count = 0;  
-  
+  $count = 0;
+
   $node_type = str_replace("-", "_", $node_type);
   $image_node_types = variable_get('image_node_types', array());
   $type = node_get_types('type', $node_type);
   $field_name = $image_node_types[$node_type]['fieldname'];
   $field_settings = variable_get('fupload_previewlist_field_settings', array('title' => 'Title', 'body' => 'Body'));
-  
+
   $result = db_query("SELECT nid, title FROM {node} WHERE type = '%s' AND uid = %d AND status = '0' AND created > %d", $node_type, $user->uid, time() - 86400); // only entries which are one day or newer
   while ($node = db_fetch_object($result)) {
     $count += 1;
     // Get all node infos, also image paths
     $node_image = node_load($node->nid);
-    
+
     // only use this image node if it was produced by image_fupload
     if ($node_image->body == image_fupload_image_status($field_name, IMAGE_NOT_COMPLETED)) {
       $image_nodes[] = $node_image->nid;
-    
+
       $form[$node_image->nid] = array(
         '#type' => 'fieldset',
         '#title' => t('Image @count', array('@count' => $count)),
@@ -34,49 +38,53 @@ function fupload_list_images_image(&$for
         '#prefix' => '<div class="image_fupload_preview">',
         '#value' => _fupload_imagepreview($node_image, $node_type),
         '#suffix' => '</div>',
-        '#weight' => 1,        
-      );      
-      $form[$node_image->nid]['title_' .$node_image->nid] = array(
+        '#weight' => 1,
+      );
+      $form[$node_image->nid]['title_'. $node_image->nid] = array(
         '#type' => 'textfield',
         '#title' => check_plain($type->title_label),
-        '#default_value' => isset($form_state['values']['title_' .$node_image->nid]) ? $form_state['values']['title_' .$node_image->nid] : $node_image->title,
+        '#default_value' => isset($form_state['values']['title_'. $node_image->nid]) ? $form_state['values']['title_'. $node_image->nid] : $node_image->title,
         '#size' => 60,
         '#required' => $field_settings['title'], // disabled fields don't send any data via form_state [#227966] =/
         '#disabled' => !$field_settings['title'],
         '#weight' => 3,
       );
       if ($type->has_body) {
-        $form[$node_image->nid]['body_' .$node_image->nid] = array(
+        $form[$node_image->nid]['body_'. $node_image->nid] = array(
           '#type' => 'textarea',
           '#title' => check_plain($type->body_label),
-          '#default_value' => isset($form_state['values']['body_' .$node_image->nid]) ? $form_state['values']['body_' .$node_image->nid] : '',
-          '#rows' => 5,           
+          '#default_value' => isset($form_state['values']['body_'. $node_image->nid]) ? $form_state['values']['body_'. $node_image->nid] : '',
+          '#rows' => 5,
           //'#required' => ($type->min_word_count > 0),
           // will be checked later via validation hook
           '#disabled' => !$field_settings['body'],
           '#weight' => 5,
         );
-        $form[$node_image->nid]['format_' .$node_image->nid] = filter_form($node_image->format, NULL, array('format_' .$node_image->nid));
-        $form[$node_image->nid]['format_' .$node_image->nid]['#weight'] = 6;
+        $form[$node_image->nid]['format_'. $node_image->nid] = filter_form($node_image->format, NULL, array('format_'. $node_image->nid));
+        $form[$node_image->nid]['format_'. $node_image->nid]['#weight'] = 6;
       }
     }
   }
-  
+
   if (!empty($image_nodes)) {
     // are there any images to edit?
     $form['text'] = array('#value' => t('In this step, you can edit the captions of all uploaded images. To complete this task, click the button "Done Editing" at the bottom of this page.'), '#weight' => -19);
-    $form['#redirect'] = 'node/add/' .arg(2); // redirect to first upload page again
+    $form['#redirect'] = 'node/add/'. arg(2); // redirect to first upload page again
     $form['field_name'] = array('#type' => 'value', '#value' => $field_name);
     $form['image_nodes'] = array('#type' => 'value', '#value' => implode(';', $image_nodes));
     $form['#validate'][] = 'fupload_list_images_image_validate'; // some additonal validation of body field
     $form['submit'] = array('#type' => 'submit', '#value' => t('Done Editing'));
-  } else {
+  }
+  else {
     // no images in queue
-    $form['text'] = array('#value' => t('No images yet in queue.'), '#weight' => -19);
-    drupal_set_message(t('No images have been found in queue, probably no images have been uploaded yet. Please return to !upload_page if you want to upload some images.', array('!upload_page' => l(t('image upload page'), 'node/add/' .arg(2)))), 'warning');
+    $form['text'] = array(
+      '#value' => t('No images yet in queue.'),
+      '#weight' => -19
+    );
+    drupal_set_message(t('No images have been found in queue, probably no images have been uploaded yet. Please return to !upload_page if you want to upload some images.', array('!upload_page' => l(t('image upload page'), 'node/add/'. arg(2)))), 'warning');
   }
-  
-  // variable_set('image_node_types', array('imagefield_bild' => array('title' => 'ImageField', 'fieldname' => 'field_imagefile', 'image_selection' => '', 'imagecache_preset' => 'fupload_preview', 'image_dimension' => '127x200')));  
+
+  // variable_set('image_node_types', array('imagefield_bild' => array('title' => 'ImageField', 'fieldname' => 'field_imagefile', 'image_selection' => '', 'imagecache_preset' => 'fupload_preview', 'image_dimension' => '127x200')));
   return $form;
 }
 
@@ -85,77 +93,78 @@ function fupload_list_images_image_valid
   // get nids of images and start batch process (validation)
   $type = node_get_types('type', str_replace("-", "_", check_plain(arg(2))));
   $image_nids = explode(';', $form_state['values']['image_nodes']);
-  
-  for ($i = 0; $i < count($image_nids); $i++) {  
-    if (!empty($type->min_word_count) && isset($form_state['values']['body_' .$image_nids[$i]]) && count(explode(' ', $form_state['values']['body_' .$image_nids[$i]])) < $type->min_word_count) {
-      form_set_error('body_' .$image_nids[$i], t('The body of the @img_number. image is too short. You need at least %words words.', array('%words' => $type->min_word_count, '@img_number' => $i + 1)));
-    }  
-  } 
+
+  for ($i = 0; $i < count($image_nids); $i++) {
+    if (!empty($type->min_word_count) && isset($form_state['values']['body_'. $image_nids[$i]]) && count(explode(' ', $form_state['values']['body_'. $image_nids[$i]])) < $type->min_word_count) {
+      form_set_error('body_'. $image_nids[$i], t('The body of the @img_number. image is too short. You need at least %words words.', array('%words' => $type->min_word_count, '@img_number' => $i + 1)));
+    }
+  }
 }
 
-function fupload_list_images_image_submit($form, &$form_state) {  
+function fupload_list_images_image_submit($form, &$form_state) {
   // get nids of images and start batch process (saving)
-  $image_nids = explode(';', $form_state['values']['image_nodes']); 
+  $image_nids = explode(';', $form_state['values']['image_nodes']);
   // name of image field
   $field_name = $form_state['values']['field_name'];
-  for ($i = 0; $i < count($image_nids); $i++) { 
-    // load full node object  
-    $node = node_load($image_nids[$i]);    
+  for ($i = 0; $i < count($image_nids); $i++) {
+    // load full node object
+    $node = node_load($image_nids[$i]);
     // new changes to node object
     $node->status = 1; // publish node
-    $node->title = !empty($form_state['values']['title_' .$image_nids[$i]]) ? $form_state['values']['title_' .$image_nids[$i]] : $node->title; // work around [#227966]
-    $node->body = $form_state['values']['body_' .$image_nids[$i]];
-    if ($node->body == image_fupload_image_status($field_name, IMAGE_NOT_COMPLETED) || !isset($form_state['values']['body_' .$image_nids[$i]])) // nothing changed ==> empty body field
+    $node->title = !empty($form_state['values']['title_'. $image_nids[$i]]) ? $form_state['values']['title_'. $image_nids[$i]] : $node->title; // work around [#227966]
+    $node->body = $form_state['values']['body_'. $image_nids[$i]];
+    if ($node->body == image_fupload_image_status($field_name, IMAGE_NOT_COMPLETED) || !isset($form_state['values']['body_'. $image_nids[$i]])) { // nothing changed ==> empty body field
       $node->body = "";
-    $node->teaser = node_teaser($node->body, $form_state['values']['format_' .$image_nids[$i]]);    
-    $node->format = $form_state['values']['format_' .$image_nids[$i]];    
+    }
+    $node->teaser = node_teaser($node->body, $form_state['values']['format_'. $image_nids[$i]]);
+    $node->format = $form_state['values']['format_'. $image_nids[$i]];
     // save new node object
     node_save($node);
   }
   drupal_set_message(t('All images have been saved and published.'));
   drupal_set_message(t('Additonal images can be selected and uploaded now.'));
-  drupal_redirect_form($form);  
+  drupal_redirect_form($form);
 }
 
 function _fupload_imagepreview($node_image, $node_type) {
   $image_node_types = variable_get('image_node_types', array());
   $attributes = variable_get('fupload_previewlist_img_attributes', '');
-  /** need to split image module and other cck related imagemodules to be able to provide the right
-     *     preview handling 
-     */
-  switch ($node_type) {    
-	case 'image':
+  // need to split image module and other cck related imagemodules to be able to provide the right
+  // preview handling
+  switch ($node_type) {
+    case 'image':
       // image module
       if (!empty($image_node_types['image']['imagecache_preset'])) {
         // using ImageCache
         $content = theme('imagecache', $image_node_types['image']['imagecache_preset'], $node_image->images['_original'], $node_image->title, $node_image->title, $attributes);
-      } else {
+      }
+      else {
         // using a ready-to-use Image size of Image module
         $image = $node_image->images[$image_node_types['image']['image_selection']];
         $content = theme('fupload_imagepreview_image', $image, image_get_info($image), $node_image, $attributes);
       }
       break;
-    
+
     default:
       // imagefield cck module
       if (!empty($image_node_types[$node_type]['imagecache_preset'])) {
         // using ImageCache
         $field_name = $image_node_types[$node_type]['fieldname'];
         $image = $node_image->$field_name;
-        
+
         $content = theme('imagecache', $image_node_types[$node_type]['imagecache_preset'], $image[0]['filepath'], $node_image->title, $node_image->title, $attributes);
       }
       break;
   }
-  
+
   return $content;
 }
 
 /**
-* Custom theme for preview image (not imagecache image)
-**/
-
+ * Custom theme for preview image (not imagecache image)
+ */
 function theme_fupload_imagepreview_image($image, $image_info, $node_image, $attributes) {
-  $content = '<img src="' .file_create_url(file_create_path($image)). '" width="' .$image_info['width']. '" height="' .$image_info['height']. '" title="' .$node_image->title. '" alt="' .$node_image->title. '" class="image_fupload_preview_image"' .(!empty($attributes) ? (" " .$attributes) : "").' />';
+  // TODO - Use theme('image') - http://api.drupal.org/api/function/theme_image/6
+  $content = '<img src="'. file_create_url(file_create_path($image)) .'" width="'. $image_info['width'] .'" height="'. $image_info['height'] .'" title="'. $node_image->title .'" alt="'. $node_image->title .'" class="image_fupload_preview_image"'. (!empty($attributes) ? (" ". $attributes) : "") .' />';
   return $content;
 }
\ No newline at end of file
Index: includes/images.previewlist.imagefield.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_fupload/includes/images.previewlist.imagefield.inc,v
retrieving revision 1.6
diff -u -p -r1.6 images.previewlist.imagefield.inc
--- includes/images.previewlist.imagefield.inc	15 Mar 2009 21:54:57 -0000	1.6
+++ includes/images.previewlist.imagefield.inc	1 May 2009 01:17:01 -0000
@@ -1,20 +1,24 @@
 <?php
 // $Id: images.previewlist.imagefield.inc,v 1.6 2009/03/15 21:54:57 grandcat Exp $
 
+/**
+ * @file
+ */
+
 /*
-* Provide a list (queue) of uploaded images for CCK ImageField; all captions can be edited at the same time
-*/
+ * Provide a list (queue) of uploaded images for CCK ImageField; all captions can be edited at the same time
+ */
 function fupload_list_images_imagefield(&$form_state, $node_type) {
   global $user;
   $count = 0;
-  
+
   $node_type = str_replace("-", "_", $node_type);
   $image_node_types = variable_get('image_node_types', array());
   // get some infos about all fields of this content type and, of course, of our imagefield (e.x. estrictions)
   $field_name = $image_node_types[$node_type]['fieldname'];
   $fields = content_types($node_type);
   $field_image = $fields['fields'][$field_name];
-  
+
   // form a more useful list of fields which should be displayed in preview list
   $fields_preview_list = array('node' => array(), 'imagefield' => array(), 'taxonomy' => array(), 'cck' => array());
   foreach ($field_image['widget']['fupload_previewlist_field_settings'] as $key) {
@@ -22,18 +26,18 @@ function fupload_list_images_imagefield(
     if ($field_image['widget']['fupload_previewlist_field_settings'][$key] != FALSE)
       array_push($fields_preview_list[$elements[0]], $elements[1]);
   }
-  
+
   // checks which fields should be displayed (not for all fields)
-  
+
   // prepare token
   $token_installed = module_exists("token");
-  
+
   // prepare taxonomy
   $form_taxonomy = array();
   if (module_exists("taxonomy") && count($fields_preview_list['taxonomy'])) {
     $form_taxonomy = array('type' => array('#value' => $node_type), '#node' => (object) array('type' => $node_type));
     taxonomy_form_alter($form_taxonomy, array(), $node_type .'_node_form');
-    
+
     // delete all elements without the ones we need
     foreach ($form_taxonomy['taxonomy'] as $key => $value) {
       // taxonomy normal
@@ -43,98 +47,102 @@ function fupload_list_images_imagefield(
     }
     foreach ($form_taxonomy['taxonomy']['tags'] as $key => $value) {
       // taxonomy tags
-      if (!in_array($key, $fields_preview_list['taxonomy'])) {        
+      if (!in_array($key, $fields_preview_list['taxonomy'])) {
         unset($form_taxonomy['taxonomy']['tags'][$key]);
       }
     }
   }
-  
+
   // get our preview images
   $result = db_query("SELECT p.nid, p.fid, f.filename, f.filepath FROM {fupload_previewlist} AS p JOIN {files} AS f ON p.fid = f.fid WHERE p.fieldname = '%s' AND p.uid = %d", $field_name, $user->uid);
   while ($image = db_fetch_object($result)) {
     $count += 1;
     $image_items[$image->fid] = $image->nid;
-    
+
     // get title and body fields contents if available and storage mode is single
     if ($field_image['widget']['fupload_mode'] == "single") {
       $node = db_query("SELECT title, body FROM {node_revisions} WHERE nid = %d", $image->nid);
       $node = db_fetch_object($node);
     }
-            
+
     $form[$image->fid] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Image @count', array('@count' => $count)),
-        '#collapsible' => FALSE,
-        '#collapsed' => FALSE,
+      '#type' => 'fieldset',
+      '#title' => t('Image @count', array('@count' => $count)),
+      '#collapsible' => FALSE,
+      '#collapsed' => FALSE,
     );
     $form[$image->fid]['preview_image'] = array(
-        '#prefix' => '<div class="image_fupload_preview">',
-        '#value' => theme('imagecache', $image_node_types[$node_type]['imagecache_preset'], $image->filepath, check_plain($image->filename), check_plain($image->filename), $field_image['widget']['fupload_previewlist_img_attributes']),
-        '#suffix' => '</div>',
-        '#weight' => -16,        
+      '#prefix' => '<div class="image_fupload_preview">',
+      '#value' => theme('imagecache', $image_node_types[$node_type]['imagecache_preset'], $image->filepath, check_plain($image->filename), check_plain($image->filename), $field_image['widget']['fupload_previewlist_img_attributes']),
+      '#suffix' => '</div>',
+      '#weight' => -16,
     );
-    
+
     // node title field
     if (in_array("title", $fields_preview_list['node'])) {
-      $form[$image->fid]['node_title_' .$image->fid] = array(
+      $form[$image->fid]['node_title_'. $image->fid] = array(
         '#type' => 'textfield',
         '#title' => check_plain($fields['title_label']),
-        '#default_value' => isset($form_state['values']['node_title_' .$image->fid]) ? $form_state['values']['node_title_' .$image->fid] : $node->title,
+        '#default_value' => isset($form_state['values']['node_title_'. $image->fid]) ? $form_state['values']['node_title_'. $image->fid] : $node->title,
         '#size' => 60,
         '#required' => TRUE,
         '#disabled' => FALSE,
         '#weight' => $fields['extra']['title']['weight'],
       );
     }
-    
+
     // filefield / imageField fields
     if (in_array("title", $fields_preview_list['imagefield']) && $field_image['widget']['custom_title']) {
       if ($token_installed && !empty($field_image['widget']['title'])) {
         $default_value = token_replace($field_image['widget']['title']);
-      } else {
+      }
+      else {
         if (!empty($field_image['widget']['title'])) {
           $default_value = $field_image['widget']['title'];
-        } else {
+        }
+        else {
           $default_value = $image->filename;
-        }        
-      }        
-      
-      $form[$image->fid]['imagefield_title_' .$image->fid] = array(
+        }
+      }
+
+      $form[$image->fid]['imagefield_title_'. $image->fid] = array(
         '#type' => 'textfield',
-        '#title' => $field_image['widget']['label'] .' ' .t('title'),
-        '#default_value' => isset($form_state['values']['imagefield_title_' .$image->fid]) ? $form_state['values']['imagefield_title_' .$image->fid] : $default_value,
+        '#title' => $field_image['widget']['label'] .' '. t('title'),
+        '#default_value' => isset($form_state['values']['imagefield_title_'. $image->fid]) ? $form_state['values']['imagefield_title_'. $image->fid] : $default_value,
         '#size' => 60,
         '#required' => FALSE,
         '#disabled' => FALSE,
         '#weight' => $field_image['widget']['weight'],
       );
-    }    
+    }
     if (in_array("alt", $fields_preview_list['imagefield']) && $field_image['widget']['custom_alt']) {
       if ($token_installed && !empty($field_image['widget']['alt'])) {
         $default_value = token_replace($field_image['widget']['alt']);
-      } else {
+      }
+      else {
         if (!empty($field_image['widget']['alt'])) {
           $default_value = $field_image['widget']['alt'];
-        } else {
+        }
+        else {
           $default_value = $image->filename;
-        }        
-      }        
-      
-      $form[$image->fid]['imagefield_alt_' .$image->fid] = array(
+        }
+      }
+
+      $form[$image->fid]['imagefield_alt_'. $image->fid] = array(
         '#type' => 'textfield',
-        '#title' => $field_image['widget']['label'] .' ' .t('alt'),
-        '#default_value' => isset($form_state['values']['imagefield_alt_' .$image->fid]) ? $form_state['values']['imagefield_alt_' .$image->fid] : $default_value,
+        '#title' => $field_image['widget']['label'] .' '. t('alt'),
+        '#default_value' => isset($form_state['values']['imagefield_alt_'. $image->fid]) ? $form_state['values']['imagefield_alt_'. $image->fid] : $default_value,
         '#size' => 60,
         '#required' => FALSE,
         '#disabled' => FALSE,
         '#weight' => $field_image['widget']['weight'] + 0.3,
       );
-    }    
-    if (in_array("description", $fields_preview_list['imagefield'])) {    
-      $form[$image->fid]['imagefield_description_' .$image->fid] = array(
+    }
+    if (in_array("description", $fields_preview_list['imagefield'])) {
+      $form[$image->fid]['imagefield_description_'. $image->fid] = array(
         '#type' => 'textfield',
-        '#title' => $field_image['widget']['label'] .' ' .t('description'),
-        '#default_value' => $form_state['values']['imagefield_description_' .$image->fid],
+        '#title' => $field_image['widget']['label'] .' '. t('description'),
+        '#default_value' => $form_state['values']['imagefield_description_'. $image->fid],
         '#size' => 60,
         '#required' => FALSE,
         '#disabled' => FALSE,
@@ -143,166 +151,198 @@ function fupload_list_images_imagefield(
     }
 
     // node body field
-    if (in_array("description", $fields_preview_list['node'])) {    
-      $form[$image->fid]['node_body_' .$image->fid] = array(
+    if (in_array("description", $fields_preview_list['node'])) {
+      $form[$image->fid]['node_body_'. $image->fid] = array(
         '#type' => 'textarea',
         '#title' => check_plain($fields['extra']['body_field']['label']),
-        '#default_value' => isset($form_state['values']['node_body_' .$image->fid]) ? $form_state['values']['node_body_' .$image->fid] : '',
-        '#rows' => 5,           
+        '#default_value' => isset($form_state['values']['node_body_'. $image->fid]) ? $form_state['values']['node_body_'. $image->fid] : '',
+        '#rows' => 5,
         //'#required' => ($type->min_word_count > 0),
         // will be checked later via validation hook
         '#disabled' => FALSE,
         '#weight' => $fields['extra']['body_field']['weight'],
       );
-      $form[$image->fid]['format_' .$image->fid] = filter_form(FILTER_FORMAT_DEFAULT, $fields['extra']['body_field']['weight'], array('format_' .$image->fid));
-      $form[$image->fid]['format_' .$image->fid]['#weight'] = $fields['extra']['body_field']['weight'] + 0.1;
+      $form[$image->fid]['format_'. $image->fid] = filter_form(FILTER_FORMAT_DEFAULT, $fields['extra']['body_field']['weight'], array('format_'. $image->fid));
+      $form[$image->fid]['format_'. $image->fid]['#weight'] = $fields['extra']['body_field']['weight'] + 0.1;
     }
-    
+
     // taxonomy field
     if (count($form_taxonomy)) {
       $form_taxonomy['taxonomy']['#weight'] = $fields['extra']['taxonomy']['weight'];
-      $form[$image->fid]['taxonomy_' .$image->fid] = $form_taxonomy['taxonomy'];
+      $form[$image->fid]['taxonomy_'. $image->fid] = $form_taxonomy['taxonomy'];
     }
 
     // ckk fields here ... in a future version
-    
+
   }
-  
+
   // any images uploaded
   if ($count) {
     // some images in queue
-    $form['text'] = array('#value' => t('In this step, you can edit the captions of all uploaded images. To complete this task, click the button "Done Editing" at the bottom of this page.'), '#weight' => -19);    
-    $form['node_type'] = array('#type' => 'value', '#value' => $node_type);
-    $form['field_name'] = array('#type' => 'value', '#value' => $field_name);
-    $form['storage_mode'] = array('#type' => 'value', '#value' => $field_image['widget']['fupload_mode']);
-    $form['image_items'] = array('#type' => 'value', '#value' => $image_items);
+    $form['text'] = array(
+      '#value' => t('In this step, you can edit the captions of all uploaded images. To complete this task, click the button "Done Editing" at the bottom of this page.'),
+      '#weight' => -19
+    );
+    $form['node_type'] = array(
+      '#type' => 'value',
+      '#value' => $node_type
+    );
+    $form['field_name'] = array(
+      '#type' => 'value',
+      '#value' => $field_name
+    );
+    $form['storage_mode'] = array(
+      '#type' => 'value',
+      '#value' => $field_image['widget']['fupload_mode']
+    );
+    $form['image_items'] = array(
+      '#type' => 'value',
+      '#value' => $image_items
+    );
     $form['#validate'][] = 'fupload_list_images_imagefield_validate'; // some additonal validation of body field and cck
-    $form['submit'] = array('#type' => 'submit', '#value' => t('Done Editing'));
-    
-    // set redirect url 
+    $form['submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Done Editing')
+    );
+
+    // set redirect url
     if ($field_image['widget']['fupload_previewlist_redirecturl']) {
       // alternative redirect url provided
       $form['#redirect'] = $field_image['widget']['fupload_previewlist_redirecturl'];
-    } else {
+    }
+    else {
       if ($field_image['widget']['fupload_mode'] == "multiple") {
-        $form['#redirect'] = 'node/' .array_pop($image_items); // redirect to updated node
-      } else {
-        $form['#redirect'] = 'node/add/' .str_replace("_", "-", $node_type); // redirect to first upload page again
-      }      
+        $form['#redirect'] = 'node/'. array_pop($image_items); // redirect to updated node
+      }
+      else {
+        $form['#redirect'] = 'node/add/'. str_replace("_", "-", $node_type); // redirect to first upload page again
+      }
     }
-    
-  } else {
+
+  }
+  else {
     // no images in queue
-    $form['text'] = array('#value' => t('No images yet in queue.'), '#weight' => -19);
-    drupal_set_message(t('No images have been found in queue, probably no images have been uploaded yet. Please return to !upload_page if you want to upload some images.', array('!upload_page' => l(t('image upload page'), 'node/add/' .str_replace("_", "-", $node_type)))), 'warning');
+    $form['text'] = array(
+      '#value' => t('No images yet in queue.'),
+      '#weight' => -19
+    );
+    drupal_set_message(t('No images have been found in queue, probably no images have been uploaded yet. Please return to !upload_page if you want to upload some images.', array('!upload_page' => l(t('image upload page'), 'node/add/'. str_replace("_", "-", $node_type)))), 'warning');
   }
-  
+
   return $form;
 }
 
 function fupload_list_images_imagefield_validate($form, &$form_state) {
-  // validation of some special parts  
-  $i = 0;  
+  // validation of some special parts
+  $i = 0;
   $storage_mode = $form_state['values']['storage_mode'];
   $type = node_get_types('type', $form_state['values']['node_type']);
-  
+
   foreach ($form_state['values']['image_items'] as $fid => $nid) {
     $i++;
-    // load saved node(s) 
-    if ($storage_mode == "multiple" && empty($node))
+    // load saved node(s)
+    if (($storage_mode == "multiple" && empty($node)) || $storage_mode == "single") {
       $node = node_load($nid);
-    if ($storage_mode == "single")
-      $node = node_load($nid);   
-    
+    }
+
     // map some data to our $node to be able to do validation
     // taxonomy
-    $node->taxonomy = $form_state['values']['taxonomy_' .$fid];
+    $node->taxonomy = $form_state['values']['taxonomy_'. $fid];
 
-    // body field: if min_word_count set, check reality    
-    if (!empty($type->min_word_count) && isset($form_state['values']['node_body_' .$fid]) && count(explode(' ', $form_state['values']['node_body_' .$fid])) < $type->min_word_count) {
-      form_set_error('node_body_' .$fid, t('The field %body_label of the @img_number. image is too short. You need at least %words words.', array('%body_label' => $type->body_label, '@img_number' => $i, '%words' => $type->min_word_count)));
+    // body field: if min_word_count set, check reality
+    if (!empty($type->min_word_count) && isset($form_state['values']['node_body_'. $fid]) && count(explode(' ', $form_state['values']['node_body_'. $fid])) < $type->min_word_count) {
+      form_set_error('node_body_'. $fid, t('The field %body_label of the @img_number. image is too short. You need at least %words words.', array('%body_label' => $type->body_label, '@img_number' => $i, '%words' => $type->min_word_count)));
     }
-    
-    // little hack: prevent that body field will be checked again 
+
+    // little hack: prevent that body field will be checked again
     unset($node->body);
     // call hook_validation
     node_validate($node);
   }
-  
+
 }
 
-function fupload_list_images_imagefield_submit($form, &$form_state) { 
+function fupload_list_images_imagefield_submit($form, &$form_state) {
   global $user;
   // define some basic variables
   $imagefield_fields = array("title", "description", "alt");
   $storage_mode = $form_state['values']['storage_mode'];
-  
-  // get fids (--> nids) of images and start batch process (saving) 
-  foreach ($form_state['values']['image_items'] as $fid => $nid) {    
+
+  // get fids (--> nids) of images and start batch process (saving)
+  foreach ($form_state['values']['image_items'] as $fid => $nid) {
     // split up storage modes to provide a better handling
     // storage mode: multiple images per node
     if ($storage_mode == "multiple") {
       // only load node once
-      if (!isset($node))
-        $node = node_load($nid);      
-      
+      if (!isset($node)) {
+        $node = node_load($nid);
+      }
+
       $image_field = $node->$form_state['values']['field_name'];
       for ($x = 0; $x < count($image_field); $x++) {
         if ($image_field[$x]['fid'] == $fid) {
-          // found our image to be edited          
+          // found our image to be edited
           foreach ($imagefield_fields as $key => $value) {
-            if (isset($form_state['values']['imagefield_' .$value .'_' .$fid]))
-              $image_field[$x]['data'][$value] = $form_state['values']['imagefield_' .$value .'_' .$fid];
+            if (isset($form_state['values']['imagefield_'. $value .'_'. $fid])) {
+              $image_field[$x]['data'][$value] = $form_state['values']['imagefield_'. $value .'_'. $fid];
+            }
           }
-                    
+
           break;
         }
       }
       // map our data to $node
-      $node->$form_state['values']['field_name'] = $image_field;      
+      $node->$form_state['values']['field_name'] = $image_field;
     }
-    
+
     // storage mode: single image per node
     if ($storage_mode == "single") {
       $node = node_load($nid);
-      
+
       // new changes to node object
       // basic fields (core modules of drupal)
-      if (isset($form_state['values']['node_title_' .$fid]))
-        $node->title = !empty($form_state['values']['node_title_' .$fid]) ? $form_state['values']['node_title_' .$fid] : $node->title; // work around [#227966]
-      if (isset($form_state['values']['node_body_' .$fid]))
-        $node->body = !empty($form_state['values']['node_body_' .$fid]) ? $form_state['values']['node_body_' .$fid] : $node->body;
-      $node->teaser = node_teaser($node->body, $form_state['values']['format_' .$fid]);
-      if (isset($form_state['values']['format_' .$fid]))
-        $node->format = isset($form_state['values']['format_' .$fid]) ? $form_state['values']['format_' .$fid] : $node->format;      
-      if (isset($form_state['values']['taxonomy_' .$fid]))
-        $node->taxonomy = isset($form_state['values']['taxonomy_' .$fid]) ? array_merge($form_state['values']['taxonomy_' .$fid], $node->taxonomy) : $node->taxonomy;
-      
+      if (isset($form_state['values']['node_title_'. $fid])) {
+        $node->title = !empty($form_state['values']['node_title_'. $fid]) ? $form_state['values']['node_title_'. $fid] : $node->title; // work around [#227966]
+      }
+      if (isset($form_state['values']['node_body_'. $fid])) {
+        $node->body = !empty($form_state['values']['node_body_'. $fid]) ? $form_state['values']['node_body_'. $fid] : $node->body;
+      }
+      $node->teaser = node_teaser($node->body, $form_state['values']['format_'. $fid]);
+      if (isset($form_state['values']['format_'. $fid])) {
+        $node->format = isset($form_state['values']['format_'. $fid]) ? $form_state['values']['format_'. $fid] : $node->format;
+      }
+      if (isset($form_state['values']['taxonomy_'. $fid])) {
+        $node->taxonomy = isset($form_state['values']['taxonomy_'. $fid]) ? array_merge($form_state['values']['taxonomy_'. $fid], $node->taxonomy) : $node->taxonomy;
+      }
+
       // imagefield (cck)
-      $image_field = $node->$form_state['values']['field_name'];        
+      $image_field = $node->$form_state['values']['field_name'];
       foreach ($imagefield_fields as $key => $value) {
-        if (isset($form_state['values']['imagefield_' .$value .'_' .$fid]))
-          $image_field[0]['data'][$value] = $form_state['values']['imagefield_' .$value .'_' .$fid];
+        if (isset($form_state['values']['imagefield_'. $value .'_'. $fid])) {
+          $image_field[0]['data'][$value] = $form_state['values']['imagefield_'. $value .'_'. $fid];
+        }
       }
       $node->$form_state['values']['field_name'] = $image_field;
-      
+
       // cck fields (contributed module)
       // ... will follow in future version
-      
+
       // save changes to node
       node_save($node);
     }
   }
-  
+
   // multiple mode: map our new data into node
-  if ($storage_mode == "multiple")
+  if ($storage_mode == "multiple") {
     node_save($node);
-  
+  }
+
   // delete preview image list for this user
-  if (!form_get_errors())
+  if (!form_get_errors()) {
     db_query("DELETE FROM {fupload_previewlist} WHERE fieldname = '%s' AND uid = %d", $form_state['values']['field_name'], $user->uid);
-  
+  }
+
   // show message and redirect user to upload page
   drupal_set_message(t('All images have been saved and published.'));
-  drupal_redirect_form($form); 
+  drupal_redirect_form($form);
 }
\ No newline at end of file
