Index: taxonomy_redirect.info
===================================================================
--- taxonomy_redirect.info	(revision 130)
+++ taxonomy_redirect.info	(working copy)
@@ -1,10 +1,12 @@
 ; $Id$
 name = Taxonomy redirect
 description = Allows the admin to override where taxonomy term links go.
-dependencies = taxonomy
+dependencies[] = taxonomy
+core = 6.x
 
+
 ; Information added by drupal.org packaging script on 2007-11-19
-version = "5.x-1.1"
+version = "6.x-1.x"
 project = "taxonomy_redirect"
 datestamp = "1195457706"
 
Index: taxonomy_redirect.module
===================================================================
--- taxonomy_redirect.module	(revision 130)
+++ taxonomy_redirect.module	(working copy)
@@ -2,9 +2,17 @@
 // $Id$
 
 function taxonomy_redirect_term_path($term) {
-  $path = db_result(db_query("SELECT path FROM {taxonomy_redirect} WHERE vid='%d'", $term->vid));
+  static $paths = array();
+  if (isset($paths[$term->vid])) {
+    $path = $paths[$term->vid];
+  }
+  else {
+    $path = db_result(db_query("SELECT path FROM {taxonomy_redirect} WHERE vid='%d'", $term->vid));
+    $paths[$term->vid] = $path;
+  }
+  
   if (is_null($path))
-    return 'taxonomy/term/' . $term->tid;
+    return 'taxonomy/term/'. $term->tid;
 
   if (function_exists('taxonomy_redirect_custom_term_path'))
     return taxonomy_redirect_custom_term_path($term, $path);
@@ -16,25 +24,22 @@
   return t($path, array('!tid' => $term->tid, '!name' => $term->name));
 }
 
-function taxonomy_redirect_help($section) { 
-  switch ($section) {
+function taxonomy_redirect_help($path, $arg) { 
+  switch ($path) {
     case 'admin/build/taxonomy_redirect':
       return t('On this form you may tell Drupal where taxonomy terms should link to. By default, modules handled by the taxonomy modules link to <b>taxonomy/term/!tid</b>; however, there are many instances where a user may want to override this behavior and provide custom content. Include the variables !tid and !name to include the term id and name in the path.');
   }
 }
 
-function taxonomy_redirect_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array('path' => 'admin/build/taxonomy_redirect', 
-      'title' => t('Taxonomy redirect'),
-      'description' => t('Override the default url paths for taxonomy terms.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('taxonomy_redirect_admin'),
-      'access' => user_access('administer taxonomy'),
-      'type' => MENU_NORMAL_ITEM);
-  }
+function taxonomy_redirect_menu() {
+  $items['admin/build/taxonomy_redirect'] = array(
+    'title' => 'Taxonomy redirect',
+    'description' => 'Override the default url paths for taxonomy terms.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('taxonomy_redirect_admin'),
+    'access arguments' => array('administer taxonomy'),
+    'type' => MENU_NORMAL_ITEM,
+  );
   return $items;
 }
 
@@ -114,6 +119,15 @@
   return $form;
 }
 
+
+function taxonomy_redirect_theme($existing, $type, $theme, $path) {
+  return array(
+    'taxonomy_redirect_admin' => array(
+      'arguments' => array('$form' => NULL),
+    ),
+  );
+}
+
 function theme_taxonomy_redirect_admin($form) {
   foreach ($form['voc'] as $i => $voc) {
     if (is_numeric($i)) {
@@ -135,18 +149,18 @@
   return $output;
 }
 
-function taxonomy_redirect_admin_validate($formid, $form) {
-  if ($form['action'] != 'revert' && !$form['path']) {
+function taxonomy_redirect_admin_validate($form, &$form_state) {
+  if ($form_state['values']['action'] != 'revert' && !$form_state['values']['path']) {
     form_set_error('destination', t("Path cannot be blank if overriding paths!"));
   }
 }
 
-function taxonomy_redirect_admin_submit($formid, $form) {
-  if ($form['action'] == 'revert') {
-    foreach($form['voc'] as $vid => $voc) {
+function taxonomy_redirect_admin_submit($form, &$form_state) {
+  if ($form_state['values']['action'] == 'revert') {
+    foreach ($form_state['values']['voc'] as $vid => $voc) {
       if ($voc['override']) {
         $orig = isset($voc['orig']) ? $voc['orig'] : 'taxonomy';
-        $vocab = taxonomy_get_vocabulary($vid);
+        $vocab = taxonomy_vocabulary_load($vid);
         db_query("UPDATE {vocabulary} SET module='%s' WHERE vid='%d'", $voc['orig'], $vid);
         db_query("DELETE FROM {taxonomy_redirect} WHERE vid='%d'", $vid);
         drupal_set_message(t("Reverting taxonomy/term for $vocab->name to control by @s", array('@s' => $voc['orig'])));
@@ -154,9 +168,9 @@
     }
   }
   else {
-    foreach($form['voc'] as $vid => $voc) {
+    foreach ($form_state['values']['voc'] as $vid => $voc) {
       if ($voc['override']) {
-        $vocab = taxonomy_get_vocabulary($vid);
+        $vocab = taxonomy_vocabulary_load($vid);
         $orig = $vocab->module;
 
         $vocab->module = 'taxonomy_redirect';
@@ -164,15 +178,15 @@
 
         if ($orig == 'taxonomy_redirect') {
           // already in database, so we can update
-          db_query("UPDATE {taxonomy_redirect} SET path='%s' WHERE vid='%d'", $form['path'], $vid);
+          db_query("UPDATE {taxonomy_redirect} SET path='%s' WHERE vid='%d'", $form_state['values']['path'], $vid);
         }
         else {
           db_query("INSERT INTO {taxonomy_redirect} (vid, module, path) VALUES ('%d', '%s', '%s')",
-            $vid, $orig, $form['path']);
+            $vid, $orig, $form_state['values']['path']);
         }
-        drupal_set_message(t("Overriding taxonomy/term for $vocab->name to @s", array('@s' => $form['path'])));
+        drupal_set_message(t("Overriding taxonomy/term for $vocab->name to @s", array('@s' => $form_state['values']['path'])));
       }
     }
   }
-  return 'admin/build/taxonomy_redirect';
+  $form_state['redirect'] = 'admin/build/taxonomy_redirect';
 }
