diff -up encl_remote_orig/encl_remote.info encl_remote/encl_remote.info
--- encl_remote_orig/encl_remote.info	2011-01-27 03:39:07.000000000 -0800
+++ encl_remote/encl_remote.info	2011-01-27 02:45:23.000000000 -0800
@@ -4,6 +4,7 @@ description = "Allows RSS feeds to inclu
 
 package = "Syndication"
 core = "6.x"
+dependencies[] = content
 
 ; Information added by drupal.org packaging script on 2009-04-30
 version = "6.x-1.0"
diff -up encl_remote_orig/encl_remote.install encl_remote/encl_remote.install
--- encl_remote_orig/encl_remote.install	2011-01-27 03:39:08.000000000 -0800
+++ encl_remote/encl_remote.install	2011-01-27 03:29:21.000000000 -0800
@@ -1,5 +1,11 @@
 <?php
-// $Id $
+// $Id$
+
+/**
+ * @file
+ * Schema hooks for RSS Remote Enclosures (encl_remote) module
+ *
+ */
 
 /**
  * Implementation of hook_install().
@@ -8,19 +14,20 @@ function encl_remote_install() {
   // Create tables.
   drupal_install_schema('encl_remotes');
 
-  $encl_remote_mime_type_extensions= array(
-  	'mp3' => 'audio/mpeg',
-  	'wmv' => 'video/x-ms-wmv',
-  	'mov' => 'video/quicktime',
-  	'mpg' => 'video/mpeg',
-	'torrent' => 'application/x-bittorrent');
-  	
+  $encl_remote_mime_type_extensions = array(
+    'mp3' => 'audio/mpeg',
+    'wmv' => 'video/x-ms-wmv',
+    'mov' => 'video/quicktime',
+    'mpg' => 'video/mpeg',
+    'torrent' => 'application/x-bittorrent'
+  );
+
   variable_set('encl_remote_mime_type_extensions', $encl_remote_mime_type_extensions);
 }
 
 /**
-* Implementation of hook_schema().
-*/
+ * Implementation of hook_schema().
+ */
 function encl_remotes_schema() {
   $schema['encl_remotes'] = array(
     'fields' => array(
diff -up encl_remote_orig/encl_remote.module encl_remote/encl_remote.module
--- encl_remote_orig/encl_remote.module	2011-01-27 03:39:08.000000000 -0800
+++ encl_remote/encl_remote.module	2011-01-27 03:36:48.000000000 -0800
@@ -1,5 +1,5 @@
 <?php
-// $Id $
+// $Id$
 /**
  * encl_remote.module -- RSS Remote Enclosures
  * Copyright (c) 2007 Eric Lloyd.
@@ -41,21 +41,21 @@ function encl_remote_menu() {
 }
 
 function encl_remote_form_admin($edit = array()) {
-	if (!_encl_remote_autosize_supported()) {
-		$form['autosize_warning'] = array(
-			'#type' => 'fieldset',
-			'#prefix' => '<strong style="color: red;">',
-			'#title' => t('Important Note'),
-			'#suffix' => '</strong>'
-		);
-		$form['autosize_warning']['message'] = array(
-			'#value' => t(
-				"Automatic enclosure size detection relies on features not found in PHP 4. ".
-				"Your users will have to enter the size of the files they're attaching by hand.<br/>".
-				"One more great reason to upgrade to PHP 5 - talk to your hosting provider today!")
-		);
-	}
-	$form[ENCL_REMOTE_NODETYPES] = array(
+  if ( ! _encl_remote_autosize_supported()) {
+    $form['autosize_warning'] = array(
+      '#type' => 'fieldset',
+      '#prefix' => '<strong style="color: red;">',
+      '#title' => t('Important Note'),
+      '#suffix' => '</strong>'
+    );
+    $form['autosize_warning']['message'] = array(
+      '#value' => t(
+        "Automatic enclosure size detection relies on features not found in PHP 4. ".
+        "Your users will have to enter the size of the files they're attaching by hand.<br/>".
+        "One more great reason to upgrade to PHP 5 - talk to your hosting provider today!")
+    );
+  }
+  $form[ENCL_REMOTE_NODETYPES] = array(
     '#type' => 'checkboxes',
     '#title' => t('Allowed Node Types'),
     '#default_value' => variable_get(ENCL_REMOTE_NODETYPES, array()),
@@ -65,34 +65,34 @@ function encl_remote_form_admin($edit = 
   $form[ENCL_REMOTE_RSS_LINK] = array(
     '#type' => 'checkbox',
     '#title' => t('Include Link in Feed'),
-    '#default_value' => variable_get(ENCL_REMOTE_RSS_LINK, false),
+    '#default_value' => variable_get(ENCL_REMOTE_RSS_LINK, FALSE),
     '#description' => t('Check to include the link in the text of the feed item.')
   );
   $mime_types_only_legend = 'Restrict to registered MIME types only';
   $form[ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY] = array(
-  	'#type' => 'checkbox',
-  	'#title' => t($mime_types_only_legend),
-  	'#default_value' => variable_get(ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY, true),
-  	'#description' => t('Check to restrict the MIME type field to one of the listed MIME types.')
+    '#type' => 'checkbox',
+    '#title' => t($mime_types_only_legend),
+    '#default_value' => variable_get(ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY, TRUE),
+    '#description' => t('Check to restrict the MIME type field to one of the listed MIME types.')
   );
   $form[ENCL_REMOTE_REGISTERED_MIME_TYPES_LIST] = array(
-  	'#type' => 'fieldset',
-  	'#collapsible' => true,
-  	'#title' => t("Registered MIME Types"),
-  	'#description' => t("These are the MIME types that are currently registered with RSS Remote Enclosures. If the \"$mime_types_only_legend\" option is set, these are the only MIME types allowed.")
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#title' => t("Registered MIME Types"),
+    '#description' => t("These are the MIME types that are currently registered with RSS Remote Enclosures. If the \"$mime_types_only_legend\" option is set, these are the only MIME types allowed.")
+  );
+  $form[ENCL_REMOTE_REGISTERED_MIME_TYPES_LIST]['types'] = array(
+    '#prefix' => '<div><ul><li>',
+    '#value' => implode('</li><li>', variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, NULL)),
+    '#suffix' => '</li></ul></div>'
+  );
+  $form[ENCL_REMOTE_WEIGHT] = array(
+    '#type' => 'weight',
+    '#title' => t('Weight'),
+    '#delta' => '100',
+    '#default_value' => variable_get(ENCL_REMOTE_WEIGHT, 30),
+    '#description' => t('Default position for the RSS Remote Enclosures section relative to the rest of the node edit form.')
   );
-	$form[ENCL_REMOTE_REGISTERED_MIME_TYPES_LIST]['types'] = array(
-		'#prefix' => '<div><ul><li>',
-		'#value' => implode('</li><li>', variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, null)),
-		'#suffix' => '</li></ul></div>'
-	);
-	$form[ENCL_REMOTE_WEIGHT] = array(
-		'#type' => 'weight',
-		'#title' => t('Weight'),
-		'#delta' => '100',
-		'#default_value' => variable_get(ENCL_REMOTE_WEIGHT, 30),
-		'#description' => t('Positions the RSS Remote Enclosures section relative to the rest of the node edit form.')
-	);
   return system_settings_form($form);
 }
 
@@ -106,81 +106,86 @@ function encl_remote_form_admin_submit($
 }
 
 function encl_remote_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  if (!_encl_remote_is_nodetype_allowed($node->type)) { return; }
+  if ( ! _encl_remote_is_nodetype_allowed($node->type)) {
+    return;
+  }
   $encl_remote = $node->encl_remote;
-  
+
   switch ($op) {
   case 'delete':
     db_query('DELETE FROM {encl_remotes} WHERE nid = %d', $node->nid);
     break;
 
   case 'load':
-    $encl_remote = db_fetch_object(db_query('SELECT * FROM {encl_remotes} er WHERE er.nid = %d LIMIT 1', $node->nid));
+    $encl_remote = db_fetch_object(db_query_range('SELECT * FROM {encl_remotes} er WHERE er.nid = %d', $node->nid, 0, 1));
     return array(ENCL_REMOTE => $encl_remote);
     break;
 
   case 'validate':
     $post = $teaser['#post'];
-    if (!$post['url']) { return; }
+    if (!$post['url']) {
+      return;
+    }
     if ($post['size']) {
       if (!is_numeric($post['size'])) {
         form_set_error('size', 'Size must be either numeric or blank.');
       }
     }
     else {
-    	if (!_encl_remote_size($post['url'], $post['size'])) {
-    		form_set_error('size', 'File size could not be automatically determined. Please specify file size.');
-    	}
+      if (!_encl_remote_size($post['url'], $post['size'])) {
+        form_set_error('size', 'File size could not be automatically determined. Please specify file size.');
+      }
     }
     if ($post['mime_type']) {
-    	$mime_type = $post['mime_type'];
-    	if (!variable_get(ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY, true)) {
-				if (!preg_match(ENCL_REMOTE_AD_HOC_MIME_TYPE_REGEX, $mime_type)) {
-					form_set_error('mime_type', "'$mime_type' is not a valid MIME type.");
-				}
-    	}
-    	else {
-	      $types = variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, null);
-	      if (!($types && in_array($post['mime_type'], $types))) {
-	      	$type_names = implode(', ', $types);
-	      	form_set_error('mime_type', "MIME type must be one of $type_names.");
-	      }
-    	}
+      $mime_type = $post['mime_type'];
+      if (!variable_get(ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY, TRUE)) {
+        if (!preg_match(ENCL_REMOTE_AD_HOC_MIME_TYPE_REGEX, $mime_type)) {
+          form_set_error('mime_type', "'$mime_type' is not a valid MIME type.");
+        }
+      }
+      else {
+        $types = variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, NULL);
+        if (!($types && in_array($post['mime_type'], $types))) {
+          $type_names = implode(', ', $types);
+          form_set_error('mime_type', "MIME type must be one of $type_names.");
+        }
+      }
     }
     break;
-    
+
   case 'presave':
     $node->encl_remote = (object)array(
-      'url' => $node->url, 
-      'link_text' => $node->link_text, 
-      'size' => $node->size, 
-      'mime_type' => $node->mime_type);
+      'url' => $node->url,
+      'link_text' => $node->link_text,
+      'size' => $node->size,
+      'mime_type' => $node->mime_type
+    );
     break;
-    
+
   case 'update':
   case 'insert':
     db_query('DELETE FROM {encl_remotes} WHERE nid = %d', $node->nid);
     if ($encl_remote->url) {
       db_query("INSERT INTO {encl_remotes} (nid, url, mime_type, size, link_text) VALUES (%d, '%s', '%s', %d, '%s')",
-        $node->nid, 
-        $encl_remote->url, 
-        _encl_remote_mime_type($encl_remote->url, $encl_remote->mime_type), 
-        _encl_remote_size($encl_remote->url, $encl_remote->size), 
+        $node->nid,
+        $encl_remote->url,
+        _encl_remote_mime_type($encl_remote->url, $encl_remote->mime_type),
+        _encl_remote_size($encl_remote->url, $encl_remote->size),
         $encl_remote->link_text);
     }
     break;
 
   case 'view':
-     if (variable_get(ENCL_REMOTE_RSS_LINK, false)) {
-       if ($teaser) {
-         $node->content['teaser']['#value'] .= _encl_remote_encl_link($encl_remote);
-       }
-       else {
-         $node->content['body']['#value'] .= _encl_remote_encl_link($encl_remote);
-       }
-     }
-    break;
-    
+    if (variable_get(ENCL_REMOTE_RSS_LINK, FALSE)) {
+      if ($teaser) {
+        $node->content['teaser']['#value'] .= _encl_remote_encl_link($encl_remote);
+      }
+      else {
+        $node->content['body']['#value'] .= _encl_remote_encl_link($encl_remote);
+      }
+    }
+  break;
+
   case 'rss item':
     if ($encl_remote->url) {
       // RSS 2.0 only allows one enclosure per item
@@ -199,27 +204,27 @@ function encl_remote_nodeapi(&$node, $op
   }
 }
 
-function encl_remote_link($type, $node = null, $teaser = FALSE) {
-  if ($type != 'node') { return; }
-  if (!_encl_remote_is_nodetype_allowed($node->type)) { return; }
-  if (!$node->encl_remote->link_text) { return; }
-  
+function encl_remote_link($type, $node = NULL, $teaser = FALSE) {
+  if ($type != 'node' OR ! _encl_remote_is_nodetype_allowed($node->type) OR empty($node->encl_remote->link_text)) {
+    return;
+  }
+
   $encl_remote = $node->encl_remote;
-  
+
   $ret = array();
   $ret[ENCL_REMOTE] = array(
-      'title' => $encl_remote->link_text, 
-      'href' => check_url($encl_remote->url), 
-      'attributes' => array('title' => 'Access the attached file')); 
+      'title' => $encl_remote->link_text,
+      'href' => check_url($encl_remote->url),
+      'attributes' => array('title' => 'Access the attached file'));
   return $ret;
 }
 
 function encl_remote_elements() {
-  return null;
+  return NULL;
 }
 
 function _encl_remote_registered_mime_types_csv() {
-	return implode(', ', variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, null));
+  return implode(', ', variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, NULL));
 }
 
 // returns a fully-formed link to the remote resource:
@@ -230,30 +235,38 @@ function _encl_remote_encl_link($encl_re
 }
 
 function encl_remote_form_alter(&$form, $form_state, $form_id) {
+
   // TODO: Alter the system_rss_feeds_settings form,
   // instead of maintaining a discrete configuration surface
-  if (!isset($form['type'])) { return; }
+  if ( ! isset($form['type']) OR ! _encl_remote_is_nodetype_allowed($form['type']['#value'])) {
+    return;
+  }
+
   $form_type = $form['type']['#value'];
-  if (!_encl_remote_is_nodetype_allowed($form_type)) { return; }
-  if ($form_type .'_node_form' == $form_id) {
-    $rss_link_text = variable_get(ENCL_REMOTE_RSS_LINK, false)? ", as well as a link in the text of the RSS feed": "";
+
+  if ($form_type . '_node_form' == $form_id) {
+    $rss_link_text = variable_get(ENCL_REMOTE_RSS_LINK, FALSE)? ", as well as a link in the text of the RSS feed": "";
     $node = $form['#node'];
     $encl_remote = $node->encl_remote;
+
+    $remote_content_form_weight = content_extra_field_weight($node->type, ENCL_REMOTE);
+
     $form[ENCL_REMOTE] = array(
       '#type' => 'fieldset',
-      '#title' => t('RSS Remote Enclosure settings'),
-      '#collapsible' => true,
+      '#title' => t('RSS Remote Enclosure module form.'),
+      '#collapsible' => TRUE,
       '#collapsed' => empty($encl_remote->url),
       '#access' => user_access(ENCL_REMOTE_PERM_SET),
-      '#weight' => variable_get(ENCL_REMOTE_WEIGHT, 30),
+      '#weight' => ($remote_content_form_weight === NULL) ? variable_get(ENCL_REMOTE_WEIGHT, 30) : $remote_content_form_weight,
     );
+
     $form[ENCL_REMOTE]['url'] = array(
       '#type' => 'textfield',
       '#title' => t('URL'),
       '#default_value' => $encl_remote->url,
       '#maxlength' => 255,
-      '#collapsible' => true,
-      '#collapsed' => true,
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
       '#description' => t("Specify the URL of a remote media resource that you would like added to this node's RSS item as an enclosure."),
     );
     $form[ENCL_REMOTE]['link_text'] = array(
@@ -261,63 +274,90 @@ function encl_remote_form_alter(&$form, 
       '#title' => t('Link Text'),
       '#default_value' => $encl_remote->link_text,
       '#maxlength' => 255,
-      '#collapsible' => true,
-      '#collapsed' => true,
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
       '#description' => t("Text that appears here will appear below the body of the $form_type as a link to the remote file$rss_link_text. Leave blank to skip."),
     );
-    $size_message = _encl_remote_autosize_supported()? 
-    	t("Optionally specify the size of the remote media resource. If you don't enter a value here, the remote server will be queried for the file size."):
-    	t("You <strong>must</strong> specify the size of the remote media resource.");
+    $size_message = _encl_remote_autosize_supported()?
+      t("Optionally specify the size of the remote media resource. If you don't enter a value here, the remote server will be queried for the file size."):
+      t("You <strong>must</strong> specify the size of the remote media resource.");
     $form[ENCL_REMOTE]['size'] = array(
       '#type' => 'textfield',
       '#title' => t('Size'),
       '#default_value' => $encl_remote->size,
       '#maxlength' => 15,
-      '#collapsible' => true,
-      '#collapsed' => true,
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
       '#description' => $size_message,
     );
-    	$types = _encl_remote_registered_mime_types_csv();
-    	$mime_explanation = variable_get(ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY, true)?
-    		t("The only supported MIME types are $types."):
-    		t("This field may be filled in automatically for some file types.");
+      $types = _encl_remote_registered_mime_types_csv();
+      $mime_explanation = variable_get(ENCL_REMOTE_REGISTERED_MIME_TYPES_ONLY, TRUE)?
+        t("The only supported MIME types are $types."):
+        t("This field may be filled in automatically for some file types.");
       $form[ENCL_REMOTE]['mime_type'] = array(
       '#type' => 'textfield',
       '#title' => t('MIME Type'),
       '#default_value' => $encl_remote->mime_type,
       '#maxlength' => 30,
-      '#collapsible' => true,
-      '#collapsed' => true,
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
       '#description' => t("Specify the MIME type of the remote media resource. $mime_explanation"),
     );
   }
 }
 
+/**
+ * Implement hook_content_extra_fields
+ */
+function encl_remote_content_extra_fields($type_name) {
+
+  $extras = array();
+
+  if (_encl_remote_is_nodetype_allowed($type_name)) {
+    $extras[ENCL_REMOTE] = array(
+      'description' => t('RSS Remote Enclosure settings'),
+      'label' => t('Remote Enclosure'),
+      'weight' => variable_get(ENCL_REMOTE_WEIGHT, 30),
+    );
+  }
+
+  return $extras;
+}
+
+
 function _encl_remote_is_nodetype_allowed($nodetype) {
   $types = variable_get(ENCL_REMOTE_NODETYPES, array());
-  return isset($types[$nodetype]);
+  return ! empty($types[$nodetype]);
 }
 
 function _encl_remote_mime_type($url, $default) {
   preg_match('/\.(\w*)$/', $url, $m);
   $encl_types = variable_get(ENCL_REMOTE_MIME_TYPE_EXTENSIONS, array());
-  return $default? $default: $encl_types[$m[1]];  
+  return $default? $default: $encl_types[$m[1]];
 }
 
 function _encl_remote_size($url, $default) {
-	if ($default) { return $default; }
-	if (!_encl_remote_autosize_supported()) { return 0; }
-  // Kudos to Josh Finlay (josh at glamourcastle dot com) in his post here:
-  // http://www.php.net/manual/en/function.filesize.php#54358
-  // I've stripped out the FTP support (may be restored if needed, but I'm a bit rushed):
-  $parsed = parse_url($url);
-  if (($parsed['scheme'] != "http") && ($parsed['scheme'] != "https")) { return 0; }
-  $headers = get_headers($url, 1);
-  return (array_key_exists("Content-Length", $headers))? $headers["Content-Length"]: 0;
+  if ($default) {
+    return $default;
+  }
+  elseif (!_encl_remote_autosize_supported()) {
+    return 0;
+  }
+  else {
+    // Kudos to Josh Finlay (josh at glamourcastle dot com) in his post here:
+    // http://www.php.net/manual/en/function.filesize.php#54358
+    // I've stripped out the FTP support (may be restored if needed, but I'm a bit rushed):
+    $parsed = parse_url($url);
+    if (($parsed['scheme'] != "http") && ($parsed['scheme'] != "https")) {
+      return 0;
+    }
+    else {
+      $headers = get_headers($url, 1);
+      return (array_key_exists("Content-Length", $headers))? $headers["Content-Length"]: 0;
+    }
+  }
 }
 
 function _encl_remote_autosize_supported() {
-	return function_exists('get_headers');
-}
-
-?>
\ No newline at end of file
+  return function_exists('get_headers');
+}
\ No newline at end of file
