diff -urp auto_expire_old/auto_expire.info auto_expire/auto_expire.info
--- auto_expire_old/auto_expire.info	2009-04-16 16:01:18.000000000 -0500
+++ auto_expire/auto_expire.info	2009-04-16 15:59:53.000000000 -0500
@@ -3,8 +3,7 @@
 name = Auto Expire
 description = "An auto expire system for nodes"
 
-; Information added by drupal.org packaging script on 2008-01-14
-version = "5.x-1.0"
-project = "auto_expire"
-datestamp = "1200285602"
+version = "6.x-1.0"
 
+
+core = 6.x
diff -urp auto_expire_old/auto_expire.install auto_expire/auto_expire.install
--- auto_expire_old/auto_expire.install	2009-04-16 16:01:32.000000000 -0500
+++ auto_expire/auto_expire.install	2009-04-16 16:00:04.000000000 -0500
@@ -1,63 +1,59 @@
 <?php
 // $Id: auto_expire.install,v 1.4 2007/09/19 06:31:17 mariuss Exp $
 
+
+/**
+ * Implementation of hook_schema().
+ */
+function auto_expire_schema() {
+  $schema['auto_expire'] = array(
+    'description' => 'Auto expire module: track node expirations',
+    'fields' => array(
+      'nid' => array(
+        'description' => 'node id: primary key',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'warned' => array(
+        'description' => 'warned flag: whether email has been sent out',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'expire' => array(
+        'description' => 'expire date: Unix timestamp',
+        'type' => 'int',
+        'not null' => TRUE,
+      ),
+      'extended' => array(
+        'description' => 'number of times the node expiry has been extended',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('nid'),
+  );
+
+  return $schema;
+}
+
 require 'auto_expire.inc';
 
 // hook_install
 function auto_expire_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $result = db_query("CREATE TABLE {auto_expire} (
-        nid int(10) unsigned NOT NULL,
-        warned int(1) unsigned NOT NULL DEFAULT 0,
-        expire int(11) NOT NULL,
-        extended int(3) unsigned NOT NULL DEFAULT 0,
-        primary key (nid)
-        );
-      ");
-        
-      if ($result)
-        drupal_set_message('Auto Expire module mysql table {auto_expire} created successfully.');
-      else
-        drupal_set_message('Auto Expire module mysql table {auto_expire} creation failed!', 'error');
-        
-      break;
-    
-    case 'pgsql':
-      drupal_set_message('PostgresSQL not supported', 'error');
-      break;
-  }
+  // Create tables.
+  drupal_install_schema('auto_expire');
 }
 
 // hook_update_N
-function auto_expire_update_1() {
-  foreach(node_get_types() as $type => $name) {
-    $code_old = 'auto_expire_node_type_' . $type;
-    $code_new = AUTO_EXPIRE_NODE_TYPE . $type;
-    
-    $expire = variable_get($code_old . '_expire', 0);
-    $days   = variable_get($code_old . '_days', AUTO_EXPIRE_DAYS);
-    $warn   = variable_get($code_old . '_warn', AUTO_EXPIRE_WARN);
-    $purge  = variable_get($code_old . '_purge', AUTO_EXPIRE_PURGE);
-    
-    variable_set($code_new . '_e', $expire);
-    variable_set($code_new . '_d', $days);
-    variable_set($code_new . '_w', $warn);
-    variable_set($code_new . '_p', $purge);
-    
-    variable_del($code_old . '_expire');
-    variable_del($code_old . '_days');
-    variable_del($code_old . '_warn');
-    variable_del($code_old . '_purge');
-  }
-  
-  return array();
-}
-
-// hook_uninstall
 function auto_expire_uninstall() {
-  db_query('DROP TABLE {auto_expire}');
+  // Remove tables.
+  drupal_uninstall_schema('auto_expire');
+
 
   foreach(node_get_types() as $type => $name) {
     $code = AUTO_EXPIRE_NODE_TYPE . $type;
diff -urp auto_expire_old/auto_expire.module auto_expire/auto_expire.module
--- auto_expire_old/auto_expire.module	2009-04-16 16:01:48.000000000 -0500
+++ auto_expire/auto_expire.module	2009-04-16 16:00:32.000000000 -0500
@@ -1,7 +1,7 @@
 <?php
 // $Id: auto_expire.module,v 1.10 2008/01/14 02:42:40 mariuss Exp $
 
-require_once 'auto_expire.inc';
+module_load_include('inc', 'auto_expire', 'auto_expire');
 
 // hook_perm
 function auto_expire_perm() {
@@ -9,8 +9,8 @@ function auto_expire_perm() {
 }
 
 // hook_help
-function auto_expire_help($section) {
-  switch($section)     {
+function auto_expire_help($path, $arg) {
+  switch($path)     {
     case 'admin/help#auto_expire':
     case 'admin/modules#description':
       return t('Expires nodes automatically.');
@@ -19,40 +19,29 @@ function auto_expire_help($section) {
 }
 
 // hook_menu
-function auto_expire_menu($may_cache) {
+function auto_expire_menu() {
   $items = array();
-  
-  if ($may_cache) {
-  }
-  else {
-    $items[] = array(
-      'path' => 'admin/settings/auto_expire',
-      'title' => t('Auto Expire'),
-      'description' => t('Set node types that auto expire.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => '_auto_expire_admin_settings',
-      'access' => user_access(ADMINISTER_AUTO_EXPIRE),
+
+    $items['admin/settings/auto_expire'] = array(
+      'title' => 'Auto Expire',
+      'description' => 'Set node types that auto expire.',
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array('_auto_expire_admin_settings'),
+      'access arguments' => array(ADMINISTER_AUTO_EXPIRE),
       'type' => MENU_NORMAL_ITEM,
     );
     
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      $node = node_load(arg(1));
-      
-      if (_auto_expire_is_expiring_node($node)) {
-        $items[] = array(
-          'path' => 'node/' . $node->nid . '/expiry',
-          'title' => t('Extend'),
-          'description' => t('See and extend the expiry period.'),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('_auto_expire_expiry', $node->nid),
-          'access' => _auto_expire_can_user_extend($node),
-          'type' => MENU_LOCAL_TASK,
-          'weight' => 10,
-        );
-      }
-    }
-  }
-  
+	$items['node/%/expiry'] = array(
+	  'title' => 'Extend',
+	  'description' => 'See and extend the expiry period.',
+	  'page callback' => 'drupal_get_form',
+	  'page arguments' => array('_auto_expire_expiry', 1),
+	  'access callback' => '_auto_expire_can_user_extend',
+	  'access arguments' => array(1),
+	  'type' => MENU_LOCAL_TASK,
+	  'weight' => 10,
+	);
+
   return $items;
 }
 
@@ -60,13 +49,22 @@ function _auto_expire_is_expiring_node($
   return variable_get(AUTO_EXPIRE_NODE_TYPE . $node->type . '_e', 0);
 }
 
-function _auto_expire_can_user_extend($node) {
+function _auto_expire_can_user_extend($nid) {
   global $user;
   
+  $node = node_load($nid);
+  
+  $will_expire = _auto_expire_is_expiring_node($node);
+  
+  if($will_expire) {
   return user_access(EXTEND_AUTO_EXPIRE_ALL) || (user_access(EXTEND_AUTO_EXPIRE_OWN) && $user->uid > 0 && $node->uid == $user->uid);
+  }
+  else {
+  return FALSE;
+  }
 }
 
-function _auto_expire_expiry($nid) {
+function _auto_expire_expiry(&$form_state, $nid) {
   $node = node_load($nid);
   
   drupal_set_title(check_plain($node->title));
@@ -101,6 +99,7 @@ function _auto_expire_expiry($nid) {
     $form['extend'] = array(
       '#type' => 'submit',
       '#value' => t('Extend'),
+	  '#submit' => array('_auto_expire_expiry_submit'),
     );
   } else {
     $form['extendwhen'] = array(
@@ -115,22 +114,16 @@ function _auto_expire_expiry($nid) {
   return $form;
 }
 
-function _auto_expire_expiry_submit($form_id, $form_values) {
-  $op = $form_values['op'];
-  $node = node_load($form_values['nid']);
+function _auto_expire_expiry_submit($form, &$form_state) {
+  $node = node_load($form_state['values']['nid']);
   
-  switch($op) {
-    case t('Extend'):
       $days = variable_get(AUTO_EXPIRE_NODE_TYPE . $node->type . '_d', AUTO_EXPIRE_DAYS);
       db_query('UPDATE {auto_expire} SET expire = expire + %d, extended = extended + 1, warned = 0 WHERE nid = %d', $days * 24 * 60 * 60, $node->nid);
       
-      watchdog('auto_expire', "Extended node $node->nid by $days days", WATCHDOG_NOTICE);
+      watchdog('auto_expire', "Extended node %node by @days days", array('%node' => $node->nid, '@days' => $days), WATCHDOG_NOTICE);
       drupal_set_message(t('Extended for !days more days', array('!days' => $days)));
-      
-      break;
-  }
   
-  return "node/$node->nid/expiry";
+  $form_state['redirect'] = "node/$node->nid/expiry";
 }
 
 function _auto_expire_admin_settings() {
@@ -260,7 +253,7 @@ function auto_expire_cron() {
           
           db_query('UPDATE {auto_expire} SET warned = 1 WHERE nid = %d', $node->nid);
           
-         // watchdog('auto_expire', 'Auto expire warning for node ' . $node->nid, WATCHDOG_NOTICE);
+         watchdog('auto_expire', 'Auto expire warning for node %node', array('%node' => $node->nid), WATCHDOG_NOTICE);
         }
       }
       
@@ -275,7 +268,7 @@ function auto_expire_cron() {
         
         _auto_expire_notify_expired($node->nid, $node->title, $name->type, $subject, $body);
         
-      // watchdog('auto_expire', 'Unpublishing node ' . $node->nid, WATCHDOG_NOTICE);
+      watchdog('auto_expire', 'Unpublishing node %node', array('%node' => $node->nid), WATCHDOG_NOTICE);
       }
       
       // Purge
@@ -301,7 +294,7 @@ function auto_expire_cron() {
           }
           /* end of copy */
           
-         // watchdog('auto_expire', "Auto expire purged node: $nid", WATCHDOG_NOTICE);
+         watchdog('auto_expire', "Auto expire purged node: %node", array('%node' => $nid), WATCHDOG_NOTICE);
           
           $cntPurged++;
         }
@@ -310,7 +303,7 @@ function auto_expire_cron() {
           // Clear the cache so an anonymous poster can see the node being deleted.
           cache_clear_all();
           
-          watchdog('auto_expire', "Auto expire purged $cntPurged node(s).", WATCHDOG_NOTICE);
+          watchdog('auto_expire', "Auto expire purged %num_purged node(s).", array('%num_purged' => $cntPurged), WATCHDOG_NOTICE);
         }
       }
     }
@@ -381,12 +374,12 @@ function _auto_expire_notify_warning($ni
   $args = array(
     '!type' => $type,
     '!title' => $title,
-    '!url' => url('node/' . $nid, NULL, NULL, TRUE),
+    '!url' => url('node/' . $nid, array('absolute' => TRUE)),
     '!days' => $days,
 	'!date' => format_date(_auto_expire_get_expire($nid)),
 	'!interval' => format_interval(_auto_expire_get_expire($nid) - time()),
     '!site' => variable_get('site_name', ''),
-    '!siteurl' => url('<front>', NULL, NULL, TRUE),
+    '!siteurl' => url('<front>', array('absolute' => TRUE)),
   );
   
   _auto_expire_notify($nid, 'auto_expire_warning', $subject, $body, $args);
@@ -397,7 +390,7 @@ function _auto_expire_notify_expired($ni
     '!type' => $type,
     '!title' => $title,
     '!site' => variable_get('site_name', ''),
-    '!siteurl' => url('<front>', NULL, NULL, TRUE),
+    '!siteurl' => url('<front>', array('absolute' => TRUE)),
   );
   
   _auto_expire_notify($nid, 'auto_expire_expired', $subject, $body, $args);
@@ -413,85 +406,41 @@ function _auto_expire_notify($nid, $mail
       if ($userEmail) {
         $subject = t($subject, $args);
         $body    = t($body, $args);
+		$params = array('subject' => $subject, 'body' => $body);
         
         $bcc = trim(variable_get(AUTO_EXPIRE_EMAIL . 'bcc', ''));
         
         if($bcc == '') {
-          $sent = drupal_mail($mailkey, $userEmail, $subject, $body);
+		  $sent = drupal_mail('auto_expire', $mailkey, $userEmail, language_default(), $params);
         } else {
-          $headers['Bcc'] = $bcc;
-          
-          $sent = drupal_mail($mailkey, $userEmail, $subject, $body, NULL, $headers);
+          $params['bcc'] = $bcc;
+		  $sent = drupal_mail('auto_expire', $mailkey . '_bcc', $userEmail, language_default(), $params);
         }
         
         if (!$sent) {
-          watchdog('auto_expire', 'Could not send notification email to: ' . $userEmail, WATCHDOG_ERROR);
+          watchdog('auto_expire', 'Could not send notification email to: %user_email', array('%user_email' => $userEmail, WATCHDOG_ERROR));
         }
       }
     }
   }
 }
 
+// hook_mail (TODO: come up with a cleaner implementation of this)
+function auto_expire_mail($key, &$message, $params) {
+	switch($key) {
+	case 'auto_expire_warning_bcc':
+	case 'auto_expire_expired_bcc':
+			$message['headers']['bcc'] = $params['bcc'];
+	case 'auto_expire_warning':
+	case 'auto_expire_expired':
+		$message['subject'] = $params['subject'];
+		$message['body'][] = $params['body'];
+		break;
+	}
+}		
+
 function _auto_expire_get_expire($nid) {
   return db_result(db_query('SELECT expire FROM {auto_expire} WHERE nid = %d', $nid));
 }
 
-/*Views integration, implementation of hook_views_tables*/
-function auto_expire_views_tables() {
-  $tables['auto_expire'] = array(
-    'name' => 'auto_expire',
-    'join' => array(
-      'left' => array(
-        'table' => 'node',
-        'field' => 'nid'
-      ),
-      'right' => array(
-        'field' => 'nid'
-      ),
-    ),
-    'fields' => array(
-      'expire' => array(
-        'name' => t('Auto Expire: Expiration Date'),
-        'sortable' => TRUE,
-        'handler' => views_handler_field_dates(),
-        'help' => t('Date the node will expire'),
-        'option' => 'integer'
-      ),
-      'warned'=> array(
-        'name' => t('Auto Expire: Warning Sent?'),
-        'help' => t('Has the warning already been sent?'),
-	'field' => 'warned',
-	'option' => 'integer',
-      ),
-    ),
-    'filters' => array(
-      'expire' => array(
-        'field' => 'expire',
-        'name' => t('Auto Expire: Expiration Date'),
-        'help' => t('Date the node will expire. This filter allows nodes to be filtered by their expiration date. The "Value" can either be a date in the format: CCYY-MM-DD HH:MM:SS or the word "now" to use the current time. You may enter a positive or negative number in the "Option" field that will represent the amount of seconds that will be added or substracted to the time; this is most useful when combined with "now". If you have the jscalendar module from jstools installed, you can use a popup date picker here.'),
-	'operator' => 'views_handler_operator_gtlt',
-        'value' => views_handler_filter_date_value_form(),
-        'option' => 'string',
-        'handler' => 'views_handler_filter_timestamp',
-      ),
-      'warned'=> array(
-        'name' => t('Auto Expire: Warning Sent?'),
-        'help' => t('Has the warning already been sent?'),
-	'field' => 'warned',
-	'operator' => 'views_handler_operator_eqneq',
-      ),
-    ),
-    'sorts' => array(
-      'expire' => array(
-        'name' => t('Auto Expire: Date'),
-        'help' => t('Sort by date'),
-        'handler' => 'views_handler_sort_date',
-        'option' => views_handler_sort_date_options(),
-      )
-    ),
-    
-  );
-  
-  return $tables;
-}
 ?>
