diff -urp /home/bpocanada/Desktop/taxonomy_fields/taxonomy_fields.info /var/www/html/kosansh/sites/all/modules/taxonomy_fields/taxonomy_fields.info
--- /home/bpocanada/Desktop/taxonomy_fields/taxonomy_fields.info	2008-08-23 14:25:24.000000000 +0530
+++ /var/www/html/kosansh/sites/all/modules/taxonomy_fields/taxonomy_fields.info	2009-01-09 12:39:48.000000000 +0530
@@ -3,7 +3,8 @@ name = Taxonomy Fields
 description = Allows administrators to assign CCK fields to categories.
 version = "5.x-1.2"
 package = CCK
-dependencies = content taxonomy
+dependencies[] = content
+dependencies[] = taxonomy
 
 
 
@@ -19,3 +20,5 @@ version = "5.x-1.8"
 project = "taxonomy_fields"
 datestamp = "1219481724"
 
+
+core = 6.x
\ No newline at end of file
diff -urp /home/bpocanada/Desktop/taxonomy_fields/taxonomy_fields.install /var/www/html/kosansh/sites/all/modules/taxonomy_fields/taxonomy_fields.install
--- /home/bpocanada/Desktop/taxonomy_fields/taxonomy_fields.install	2008-08-23 14:02:43.000000000 +0530
+++ /var/www/html/kosansh/sites/all/modules/taxonomy_fields/taxonomy_fields.install	2009-01-09 12:42:54.000000000 +0530
@@ -2,44 +2,76 @@
 // $Id: taxonomy_fields.install,v 1.6dev 2008/03/12 boneless Exp $
 
 /**
+ * Implementation of hook_schema().
+ */
+function taxonomy_fields_schema() {
+  $schema['taxonomy_fields'] = array(
+    'description' => t('TODO'),
+    'fields' => array(
+      'field_name' => array(
+        'description' => t('TODO'),
+        'type' => 'varchar',
+        'length' => 32,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'tid' => array(
+        'description' => t('TODO'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'field_value' => array(
+        'description' => t('TODO'),
+        'type' => 'text',
+        'size' => 'big',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'delta' => array(
+        'description' => t('TODO'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'universal' => array(
+        'description' => t('TODO'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('field_name', 'tid', 'delta'),
+  );
+
+  $schema['taxonomy_fields_ancestors'] = array(
+    'description' => t('TODO'),
+    'fields' => array(
+      'tid' => array(
+        'description' => t('TODO'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'ancestors' => array(
+        'description' => t('TODO'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('tid'),
+  );
+
+  return $schema;
+}
+
+/**
  * Implementation of hook_install().
  */
 function taxonomy_fields_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {taxonomy_fields} (
-          field_name varchar(32) NOT NULL default '',
-          tid integer NOT NULL default '0',
-          field_value longtext NOT NULL default '',
-          delta integer NOT NULL default '0',
-          universal integer NOT NULL default '0',
-          PRIMARY KEY (field_name,tid,delta)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      
-      db_query("CREATE TABLE {taxonomy_fields_ancestors} (
-          tid integer NOT NULL default '0',
-          ancestors integer NOT NULL default '0',
-          PRIMARY KEY (tid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-    break;
-
-    case 'pgsql':
-      db_query("CREATE TABLE {taxonomy_fields} (
-          field_name varchar(32) NOT NULL default '',
-          tid integer NOT NULL default '0',
-          field_value longtext NOT NULL default '',
-          delta integer NOT NULL default '0',
-          universal integer NOT NULL default '0',
-          PRIMARY KEY (field_name,tid,delta)
-        )");
-       db_query("CREATE TABLE {taxonomy_fields_ancestors} (
-          tid integer NOT NULL default '0',
-          ancestors integer NOT NULL default '0',
-          PRIMARY KEY (tid)
-        )");
-    break;
-  }
+  // Create tables.
+  drupal_install_schema('taxonomy_fields');
   db_query("UPDATE {system} SET weight = 10 WHERE name = 'taxonomy_fields'");
 }
 
@@ -47,16 +79,11 @@ function taxonomy_fields_install() {
 * Implementation of hook_uninstall().
 */
 function taxonomy_fields_uninstall() {
-  db_query('DROP TABLE {taxonomy_fields}');
-  db_query('DROP TABLE {taxonomy_fields_ancestors}');
+  // Remove tables.
+  drupal_uninstall_schema('taxonomy_fields');
+
 }
 
 /*
  * Increases module weight, so it is executed after fieldgroup
  */
-function taxonomy_fields_update_1() {
-  $ret = array();
-  $ret[] = update_sql("UPDATE {system} SET weight = 10 WHERE name = 'taxonomy_fields'");
-  return $ret;
-}
-?>
\ No newline at end of file
diff -urp /home/bpocanada/Desktop/taxonomy_fields/taxonomy_fields.module /var/www/html/kosansh/sites/all/modules/taxonomy_fields/taxonomy_fields.module
--- /home/bpocanada/Desktop/taxonomy_fields/taxonomy_fields.module	2008-08-23 14:02:42.000000000 +0530
+++ /var/www/html/kosansh/sites/all/modules/taxonomy_fields/taxonomy_fields.module	2009-01-09 15:57:43.000000000 +0530
@@ -14,13 +14,13 @@ define('CONTENT_CALLBACK_NONE', 0x0001);
 define('CONTENT_CALLBACK_DEFAULT', 0x0002);
 define('CONTENT_CALLBACK_CUSTOM', 0x0004);
 
-include_once(drupal_get_path('module', 'content').'/content_admin.inc');
+include_once(drupal_get_path('module', 'content').'/includes/content.admin.inc');
 
 /**
  * Implementation of hook_help().
  */
-function taxonomy_fields_help($section) {
-  switch ($section) {
+function taxonomy_fields_help($path, $arg) {
+  switch ($path) {
   	case 'admin/help#taxonomy_fields':
   		$output.='<p>'.t('The taxonomy_fields module brings two important modules together: CCK and taxonomy. As CCK can assign fields to content types, taxonomy_fields can assign CCK fields to categories. By doing this, content types are not limited to the same range of fields anymore.
   			Nodes of the same content type can now contain absolutely different fields. Simply assign a field to a term and every node in this category will now contain this field. When choosing a new term for a node, the field-form will appear next time on the edit-page.').'</p>';
@@ -55,115 +55,91 @@ function taxonomy_fields_perm() {
 /**
  * Implementation of hook_menu().
  */
-function taxonomy_fields_menu($may_cache) {
-
-	$items = array();
-   	$access = user_access('administer taxonomy_fields');
-
-   	if ($may_cache) {
-	    $items[] = array(
-	      'path' => 'admin/content/taxonomy_fields',
-	      'title' => t('Taxonomy fields'),
-	      'callback' => '_taxonomy_fields_list',
-	      'access' => $access,
-	      'description' => t("Assign CCK fields to categories."),
-	    );
-	    $items[] = array(
-	      'path' => 'admin/content/taxonomy_fields/manage_taxonomy_fields',
-	      'title' => t('List'),
-	      'type' => MENU_DEFAULT_LOCAL_TASK,
-	      'weight' => -10,
-	    );
-        $items[] = array(
-          'path' => 'admin/content/taxonomy_fields/manage_fields',
-          'title' => t('Manage fields'),
-          'type' => MENU_LOCAL_TASK,
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('taxonomy_fields_field_overview_form'),
-          'access' => $access,
-        );	      
-
-        $items[] = array(
-          'path' => 'admin/content/taxonomy_fields/manage_taxonomy',
-          'title' => t('Manage taxonomy'),
-          'type' => MENU_LOCAL_TASK,
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('_taxonomy_fields_manage_taxonomy_form'),
-          'access' => $access,
-        );      
-	    $items[] = array(
-	      'path' => 'admin/content/taxonomy_fields/add_existing',
-	      'title' => t('Add existing field'),
-	      'type' => MENU_LOCAL_TASK,
-	      'callback' => '_taxonomy_fields_term_field_relation_add_existing',
-	      'access' => $access,
-	    );
-	    $items[] = array(
-	      'path' => 'admin/content/taxonomy_fields/add_new',
-	      'title' => t('Add new field'),
-	      'type' => MENU_LOCAL_TASK,
-	      'callback' => '_taxonomy_fields_term_field_relation_add_new',
-	      'access' => $access,
-	    );
-   	}
-   	else {
-   	    $items[] = array(
-              'path' => 'admin/content/taxonomy_fields/ajax',
-              'title' => t('AJAX'),
-              'callback' => '_taxonomy_fields_ajax',                   
-              'access' => 1,
-              'type' => MENU_CALLBACK,
-          ); 
-   	  
-   		
-       if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'taxonomy_fields' && is_numeric(arg(3))) {
-    	
-    	  $term = taxonomy_fields_terms(arg(3));
-          $items[] = array(
-		      'path' => 'admin/content/taxonomy_fields/'. arg(3),
-		      'title' => t($term['name']),
-              'callback' => 'drupal_get_form',        
-              'callback arguments' => array('taxonomy_fields_display_overview_form'),
-		      'access' => $access,
-		      'type' => MENU_CALLBACK,
-		  ); 
-		  $items[] = array(
-		      'path' => 'admin/content/taxonomy_fields/'. arg(3).'/fields',
-		      'title' => t('Display settings'),
-		      'type' => MENU_DEFAULT_LOCAL_TASK,
-		  );
-          if(module_invoke('taxonomy','get_parents',$term)){  
-            $items[] = array(
-              'path' => 'admin/content/taxonomy_fields/'. arg(3).'/edit',
-              'title' => t('Term settings'),
-              'type' => MENU_LOCAL_TASK,
-              'access' => $access,
-              'callback' => 'drupal_get_form',
-              'callback arguments' => array('_taxonomy_fields_term'),
-            ); 
-          }     
-       
-          if (arg(4) == 'fields' && arg(5) && isset($term['fields'][arg(5)])) {           	 	
-	          $items[] = array(
-	            'path' => 'admin/content/taxonomy_fields/'. arg(3) .'/fields/'. arg(5),
-	            'title' => t($term['fields'][arg(5)]['widget']['label']),
-	            'callback' => 'drupal_get_form',
-	            'access' => $access,
-	            'callback arguments' => array('_taxonomy_fields_edit_field',arg(3), arg(5)),
-	            'type' => MENU_CALLBACK,
-	          );
-	          $items[] = array(
-	            'path' => 'admin/content/taxonomy_fields/'. arg(3) .'/fields/'. arg(5) .'/remove',
-	            'title' => t('remove field'),
-	            'callback' => 'drupal_get_form',
-	            'access' => $access,
-	            'callback arguments' => array('_taxonomy_fields_edit_field_remove',arg(3), arg(5)),
-	            'type' => MENU_CALLBACK,
-	          );       
-          }
-       }
-   	}
-   	return $items;
+function taxonomy_fields_menu() {
+  $items = array();
+  $items['admin/content/taxonomy_fields'] = array(
+    'title' => 'Taxonomy fields',
+    'page callback' => '_taxonomy_fields_list',
+    'access arguments' => array('administer taxonomy_fields'),
+    'description' => "Assign CCK fields to categories.",
+  );
+  $items['admin/content/taxonomy_fields/manage_taxonomy_fields'] = array(
+    'title' => 'List',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -10,
+  );
+  $items['admin/content/taxonomy_fields/manage_fields'] = array(
+    'title' => 'Manage fields',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('taxonomy_fields_field_overview_form'),
+    'access arguments' => array('administer taxonomy_fields'),
+  );	      
+  $items['admin/content/taxonomy_fields/manage_taxonomy'] = array(
+    'title' => 'Manage taxonomy',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('_taxonomy_fields_manage_taxonomy_form'),
+    'access arguments' => array('administer taxonomy_fields'),
+  );      
+  $items['admin/content/taxonomy_fields/add_existing'] = array(
+    'title' => 'Add existing field',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => '_taxonomy_fields_term_field_relation_add_existing',
+    'access arguments' => array('administer taxonomy_fields'),
+  );
+  $items['admin/content/taxonomy_fields/add_new'] = array(
+    'title' => 'Add new field',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => '_taxonomy_fields_term_field_relation_add_new',
+    'access arguments' => array('administer taxonomy_fields'),
+  );
+  $items['admin/content/taxonomy_fields/ajax'] = array(
+    'title' => 'AJAX',
+    'page callback' => '_taxonomy_fields_ajax',                   
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+  ); 
+  if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'taxonomy_fields' && is_numeric(arg(3))) {
+    $term = taxonomy_fields_terms(arg(3));
+    $items['admin/content/taxonomy_fields/'. arg(3)] = array(
+      'title' => $term['name'],
+      'page callback' => 'drupal_get_form',        
+      'page arguments' => array('taxonomy_fields_display_overview_form'),
+      'access arguments' => array('administer taxonomy_fields'),
+      'type' => MENU_CALLBACK,
+    ); 
+    $items['admin/content/taxonomy_fields/'. arg(3).'/fields'] = array(
+      'title' => 'Display settings',
+      'type' => MENU_DEFAULT_LOCAL_TASK,
+    );
+    if(module_invoke('taxonomy','get_parents',$term)){  
+      $items['admin/content/taxonomy_fields/'. arg(3).'/edit'] = array(
+        'title' => 'Term settings',
+        'type' => MENU_LOCAL_TASK,
+        'access arguments' => array('administer taxonomy_fields'),
+        'page callback' => 'drupal_get_form',
+        'page arguments' => array('_taxonomy_fields_term'),
+      ); 
+    }     
+    if (arg(4) == 'fields' && arg(5) && isset($term['fields'][arg(5)])) {           	 	
+      $items['admin/content/taxonomy_fields/'. arg(3) .'/fields/'. arg(5)] = array(
+        'title' => $term['fields'][arg(5)]['widget']['label'],
+        'callback' => 'drupal_get_form',
+        'access arguments' => array('administer taxonomy_fields'),
+        'page arguments' => array('_taxonomy_fields_edit_field',arg(3), arg(5)),
+        'type' => MENU_CALLBACK,
+      );
+      $items['admin/content/taxonomy_fields/'. arg(3) .'/fields/'. arg(5) .'/remove'] = array(
+	'title' => 'remove field',
+	'callback' => 'drupal_get_form',
+        'access arguments' => array('administer taxonomy_fields'),
+	'page arguments' => array('_taxonomy_fields_edit_field_remove',arg(3), arg(5)),
+	'type' => MENU_CALLBACK,
+      );       
+    }
+  }
+  return $items;
 }
 
 function _taxonomy_fields_ajax(){
@@ -261,12 +237,12 @@ function _taxonomy_fields_list(){
 	//output of all existing term-field-relations
 	//$query=db_query("SELECT SUBSTRING(nfi.type_name,14) AS tid, tfa.ancestors, tf.universal, td.name, nfi.field_name, nfi.type_name, nfi.label, nfi.widget_type, nfi.weight, nf.type 
 	$query = db_query("SELECT SUBSTRING(nfi.type_name,14) AS tid, tf.universal, tfa.ancestors, td.vid, td.name, td.weight AS t_weight, th.parent, nfi.field_name, nfi.type_name, nfi.label, nfi.widget_type, nfi.weight, nf.type
-	FROM {node_field_instance} nfi 
+	FROM {content_node_field_instance} nfi 
 		LEFT JOIN {taxonomy_fields} tf ON nfi.field_name = tf.field_name AND SUBSTRING(nfi.type_name,14) = tf.tid 
 		LEFT JOIN {taxonomy_fields_ancestors} tfa ON SUBSTRING(nfi.type_name,14) = tfa.tid
 		LEFT JOIN {term_data} td ON SUBSTRING(nfi.type_name,14) = td.tid
 		LEFT JOIN {term_hierarchy} th ON SUBSTRING(nfi.type_name,14) = th.tid 
-		LEFT JOIN {node_field} nf ON nf.field_name = nfi.field_name
+		LEFT JOIN {content_node_field} nf ON nf.field_name = nfi.field_name
 		LEFT JOIN {variable} v ON td.vid = SUBSTRING(v.name,16)
 		WHERE nfi.type_name LIKE 'term_related_%%' AND v.name LIKE 'tax_fields_voc_%%' AND v.value = 's:1:\"1\";' AND ((tf.delta IS NULL OR tf.delta = 0 ) OR (tf.delta = 1 AND tf.delta != 0))		
 		ORDER BY td.vid, t_weight, td.name, nfi.weight");
@@ -392,9 +368,9 @@ function _taxonomy_fields_manage_taxonom
 
 }
 
-function _taxonomy_fields_manage_taxonomy_form_submit($form_id, $form_values){
-	$vid = $form_values['voc_sel'];
-	$voc_enable = $form_values['voc_enable'];
+function _taxonomy_fields_manage_taxonomy_form_submit($form, &$form_state){
+	$vid = $form_state['values']['voc_sel'];
+	$voc_enable = $form_state['values']['voc_enable'];
 	if($vid){
 	  variable_set('tax_fields_voc_'.$vid, $voc_enable);
 	  $voc = module_invoke('taxonomy', 'get_vocabulary', $vid);
@@ -457,9 +433,9 @@ function _taxonomy_fields_term(){
 	return $form;
 }
 
-function _taxonomy_fields_term_submit($form_id, $form_values){
-	db_query("DELETE FROM {taxonomy_fields_ancestors} WHERE tid = %d", $form_values['tid']);
-	db_query("INSERT INTO {taxonomy_fields_ancestors} SET ancestors = %d, tid = %d", $form_values['ancestors'], $form_values['tid']);
+function _taxonomy_fields_term_submit($form, &$form_state){
+	db_query("DELETE FROM {taxonomy_fields_ancestors} WHERE tid = %d", $form_state['values']['tid']);
+	db_query("INSERT INTO {taxonomy_fields_ancestors} SET ancestors = %d, tid = %d", $form_state['values']['ancestors'], $form_state['values']['tid']);
 	drupal_set_message(t('The term was updated.'));
 }
 
@@ -551,12 +527,12 @@ function _taxonomy_fields_term_field_rel
     return $form;
 }
 
-function _taxonomy_fields_term_field_relation_add_new_form_validate($form_id, $form_values) {
+function _taxonomy_fields_term_field_relation_add_new_form_validate($form, &$form_state) {
   	$term_selected = FALSE; 	
-	foreach ($form_values as $key => $value){
+	foreach ($form_state['values'] as $key => $value){
 		if (is_numeric($key)){
-			if (is_array($form_values[$key])){
-				foreach ($form_values[$key] as $key2 => $value2){
+			if (is_array($form_state['values'][$key])){
+				foreach ($form_state['values'][$key] as $key2 => $value2){
 					if($value2){
 						$term_selected=TRUE;
 					}
@@ -575,12 +551,12 @@ function _taxonomy_fields_term_field_rel
 	}
 }
 
-function _taxonomy_fields_term_field_relation_add_new_form_submit($form_id, $form_values) {
+function _taxonomy_fields_term_field_relation_add_new_form_submit($form, &$form_state) {
   // Find a valid, computer-friendly field name.
 
   $fields = taxonomy_fields_fields();
 
-  $field_name = trim($form_values['label']);
+  $field_name = trim($form_state['values']['label']);
   $field_name = drupal_strtolower($field_name);
   $field_name = str_replace(array(' ', '-'), '_', $field_name);
   $field_name = preg_replace('/[^a-z0-9_]/', '', $field_name);
@@ -594,16 +570,16 @@ function _taxonomy_fields_term_field_rel
     $field_name = $new_name;
   }
 	
-  $widget_type = explode('-',$form_values['field_widget_type']);
+  $widget_type = explode('-',$form_state['values']['field_widget_type']);
   $terms = array();
-  foreach ($form_values as $key => $value){
+  foreach ($form_state['values'] as $key => $value){
 		if (is_numeric($key)){
-			if (is_array($form_values[$key])){
-				foreach ($form_values[$key] as $key2 => $value2){
+			if (is_array($form_state['values'][$key])){
+				foreach ($form_state['values'][$key] as $key2 => $value2){
 					if($value2){						
 						$terms[] = $value2;
 						_taxonomy_fields_create_term_table($value2);
-						db_query("INSERT INTO {node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $field_name, 'term_related_'.$value2, 0, $form_values['label'], $widget_type[1], serialize(array()), '');						
+						db_query("INSERT INTO {content_node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $field_name, 'term_related_'.$value2, 0, $form_state['values']['label'], $widget_type[1], serialize(array()), '');						
 					}
 				}
 			}
@@ -611,13 +587,13 @@ function _taxonomy_fields_term_field_rel
 				if($value){
 					$terms[] = $value;
 					_taxonomy_fields_create_term_table($value);
-					db_query("INSERT INTO {node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $field_name, 'term_related_'.$value, 0, $form_values['label'], $widget_type[1], serialize(array()), '');				
+					db_query("INSERT INTO {content_node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $field_name, 'term_related_'.$value, 0, $form_state['values']['label'], $widget_type[1], serialize(array()), '');				
 				}
 			}
 		}
 	} 
 	if(empty($terms)){
-		return 'admin/content/taxonomy_fields/add_new';
+          $form_state['redirect'] = 'admin/content/taxonomy_fields/add_new';
 	}
 	
 	if(count($terms)>1){
@@ -627,8 +603,8 @@ function _taxonomy_fields_term_field_rel
 		$db_storage = CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
 	}
   
-  $field_widget_type = explode('-', $form_values['field_widget_type']);
-  db_query("INSERT INTO {node_field} (field_name, type, global_settings, required, multiple, db_storage) VALUES ('%s', '%s', '%s', %d, %d, %d)", $field_name, $field_widget_type[0], serialize(array()), 0, 0, $db_storage);
+  $field_widget_type = explode('-', $form_state['values']['field_widget_type']);
+  db_query("INSERT INTO {content_node_field} (field_name, type, global_settings, required, multiple, db_storage) VALUES ('%s', '%s', '%s', %d, %d, %d)", $field_name, $field_widget_type[0], serialize(array()), 0, 0, $db_storage);
 
   taxonomy_fields_clear_terms_cache();
   
@@ -642,7 +618,7 @@ function _taxonomy_fields_term_field_rel
   	content_alter_db_field(array(), array(), $field, $columns);
   }
 
-  drupal_set_message(t('Created field %label.', array('%label' =>  $form_values['label'])));
+  drupal_set_message(t('Created field %label.', array('%label' =>  $form_state['values']['label'])));
   return 'admin/content/taxonomy_fields/'.$terms[0].'/fields/'.$field_name;
 }
 
@@ -720,21 +696,21 @@ function _taxonomy_fields_term_field_rel
 
 }
 
-function _taxonomy_fields_term_field_relation_add_existing_form_validate($form_id, $form_values){
+function _taxonomy_fields_term_field_relation_add_existing_form_validate($form, &$form_state){
 	
 	$term_selected = FALSE;
 	$relation_double_up = FALSE;
 	$terms=taxonomy_fields_terms();
 	
-	foreach ($form_values as $key => $value){
+	foreach ($form_state['values'] as $key => $value){
 		if (is_numeric($key)){
-			if (is_array($form_values[$key])){
+			if (is_array($form_state['values'][$key])){
 				//term from multiple select vocabulary
-				foreach ($form_values[$key] as $value2){
+				foreach ($form_state['values'][$key] as $value2){
 					if($value2){
 						$term_selected = TRUE;
 					}
-					if(!empty($terms['term_related_'.$value2]['fields'][$form_values['field_name']])){
+					if(!empty($terms['term_related_'.$value2]['fields'][$form_state['values']['field_name']])){
 						$relation_double_up = TRUE;
 					}
 				}
@@ -742,7 +718,7 @@ function _taxonomy_fields_term_field_rel
 			elseif ($value){
 				//term from single select vocabulary
 				$term_selected = TRUE;
-				if(!empty($terms['term_related_'.$value]['fields'][$form_values['field_name']])){
+				if(!empty($terms['term_related_'.$value]['fields'][$form_state['values']['field_name']])){
 					$relation_double_up = TRUE;
 				}
 			}
@@ -756,41 +732,41 @@ function _taxonomy_fields_term_field_rel
 	}
 }
 
-function _taxonomy_fields_term_field_relation_add_existing_form_submit($form_id, $form_values){
+function _taxonomy_fields_term_field_relation_add_existing_form_submit($form, &$form_state){
 	$change = FALSE;
 	$terms = taxonomy_fields_terms();
-	$prior_instance = db_fetch_array(db_query("SELECT weight, label, widget_type, widget_settings, description FROM {node_field_instance} WHERE field_name = '%s'", $form_values['field_name']));
+	$prior_instance = db_fetch_array(db_query("SELECT weight, label, widget_type, widget_settings, description FROM {content_node_field_instance} WHERE field_name = '%s'", $form_state['values']['field_name']));
 	if (!$prior_instance) {
 	    $prior_instance = array();
 	    $prior_instance['weight'] = 0;
-	    $prior_instance['label'] = $form_values['field_name'];
+	    $prior_instance['label'] = $form_state['values']['field_name'];
 	    $prior_instance['widget_type'] = '';
 	    $prior_instance['widget_settings'] = '';
 	    $prior_instance['description'] = '';
 	}
 	  
-	foreach ($form_values as $key => $value){
+	foreach ($form_state['values'] as $key => $value){
 		if (is_numeric($key)){
-			if (is_array($form_values[$key])){
+			if (is_array($form_state['values'][$key])){
 				//term from multiple select vocabulary
-				foreach ($form_values[$key] as $value2){
-					if($value2 && empty($terms['term_related_'.$value2]['fields'][$form_values['field_name']])){
+				foreach ($form_state['values'][$key] as $value2){
+					if($value2 && empty($terms['term_related_'.$value2]['fields'][$form_state['values']['field_name']])){
 						$change = TRUE;
 						_taxonomy_fields_create_term_table($value2);
-						db_query("INSERT INTO {node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $form_values['field_name'], 'term_related_'.$value2, $prior_instance['weight'], $prior_instance['label'], $prior_instance['widget_type'], $prior_instance['widget_settings'], $prior_instance['description']);		
+						db_query("INSERT INTO {content_node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $form_state['values']['field_name'], 'term_related_'.$value2, $prior_instance['weight'], $prior_instance['label'], $prior_instance['widget_type'], $prior_instance['widget_settings'], $prior_instance['description']);		
 					}
 				}
 			}
-			elseif ($value && empty($terms['term_related_'.$value]['fields'][$form_values['field_name']])){
+			elseif ($value && empty($terms['term_related_'.$value]['fields'][$form_state['values']['field_name']])){
 				//term from single select vocabulary
 				$change = TRUE;
 				_taxonomy_fields_create_term_table($value);
-				db_query("INSERT INTO {node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $form_values['field_name'], 'term_related_'.$value, $prior_instance['weight'], $prior_instance['label'], $prior_instance['widget_type'], $prior_instance['widget_settings'], $prior_instance['description']);			
+				db_query("INSERT INTO {content_node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s')", $form_state['values']['field_name'], 'term_related_'.$value, $prior_instance['weight'], $prior_instance['label'], $prior_instance['widget_type'], $prior_instance['widget_settings'], $prior_instance['description']);			
 			}
 		}
 	}
 	if($change){
-		$field = taxonomy_fields_fields($form_values['field_name']);
+		$field = taxonomy_fields_fields($form_state['values']['field_name']);
 	  	$field_types = _taxonomy_fields_field_types();
 	  	$field_type = $field_types[$field['type']];
 		$columns = module_invoke($field_type['module'], 'field_settings', 'database columns', $field);
@@ -799,15 +775,15 @@ function _taxonomy_fields_term_field_rel
 			if ($field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE) {
 				$new_field = $field;
 				$new_field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD;
-				db_query("UPDATE {node_field} SET db_storage = %d WHERE field_name = '%s'", CONTENT_DB_STORAGE_PER_FIELD, $form_values['field_name']);
+				db_query("UPDATE {cotent_node_field} SET db_storage = %d WHERE field_name = '%s'", CONTENT_DB_STORAGE_PER_FIELD, $form_state['values']['field_name']);
 				content_alter_db_field($field, $columns, $new_field, $columns);
 			}
 		}	
 	 	taxonomy_fields_clear_terms_cache();
-		return 'admin/content/taxonomy_fields';
+                $form_state['redirect'] = 'admin/content/taxonomy_fields';
 	}
 	else{
-		return 'admin/content/taxonomy_fields/add_existing';
+                $form_state['redirect'] = 'admin/content/taxonomy_fields/add_existing';
 	}			
 }
 
@@ -840,7 +816,7 @@ function _taxonomy_fields_create_term_ta
 /**
  *  Implementation of hook_form_alter().
  */
-function taxonomy_fields_form_alter($form_id, &$form) {
+function taxonomy_fields_form_alter(&$form, $form_state, $form_id) {
    
   switch ($form_id) {
     case 'node_type_form':
@@ -961,7 +937,7 @@ function taxonomy_fields_form_alter($for
     	  $widget_types = taxonomy_fields_widget_types();		
     	  $fields = taxonomy_fields_get_node_info($node);
 
-          $query = db_query("SELECT nfi.field_name, nfi.weight, td.tid FROM {node_field_instance} nfi
+          $query = db_query("SELECT nfi.field_name, nfi.weight, td.tid FROM {content_node_field_instance} nfi
                 LEFT JOIN {term_data} td ON SUBSTRING(nfi.type_name,14) = td.tid  
                 LEFT JOIN {variable} v ON td.vid = SUBSTRING(v.name,16)
                 WHERE nfi.type_name LIKE 'term_related_%%' AND v.name LIKE 'tax_fields_voc_%%' AND v.value = 's:1:\"1\";' 
@@ -1036,8 +1012,8 @@ function taxonomy_fields_form_alter($for
         $form = array_merge($form, $return);  	      	
       	//fieldgroups
       	if(module_exists('fieldgroup')){
-      	  $query = db_query('SELECT nfi.*, ngf.group_name FROM {node_group_fields} ngf 
-                          LEFT JOIN {node_field_instance} nfi ON nfi.field_name = ngf.field_name
+      	  $query = db_query('SELECT nfi.*, ngf.group_name FROM {content_group_fields} ngf 
+                          LEFT JOIN {content_node_field_instance} nfi ON nfi.field_name = ngf.field_name
                           WHERE ngf.type_name = "taxonomy_fields" AND nfi.type_name LIKE "term_related_%%"');
           while ($group = db_fetch_array($query)){         
             if(empty($form[$group['group_name']])){
@@ -1883,7 +1859,7 @@ function taxonomy_fields_nodeapi(&$node,
     	
     	break;
     
-      case 'submit':
+      case 'presave':
         $fields = array();
         if(!empty($node->taxonomy)){
           foreach($node->taxonomy as $taxonomy){
@@ -2152,9 +2128,9 @@ function taxonomy_fields_field_overview_
     // Remove fields that are used in groups from the form, the group will handle them.
     if (module_exists('fieldgroup')) {
       $field_groups = module_invoke('fieldgroup','groups');
-      $query = db_query('SELECT nfi.*, ngf.group_name, nf.type FROM {node_group_fields} ngf 
-                        LEFT JOIN {node_field_instance} nfi ON nfi.field_name = ngf.field_name
-                        LEFT JOIN {node_field} nf ON nf.field_name = ngf.field_name
+      $query = db_query('SELECT nfi.*, ngf.group_name, nf.type FROM {content_group_fields} ngf 
+                        LEFT JOIN {content_node_field_instance} nfi ON nfi.field_name = ngf.field_name
+                        LEFT JOIN {content_node_field} nf ON nf.field_name = ngf.field_name
                         WHERE ngf.type_name = "taxonomy_fields" AND nfi.type_name LIKE "term_related_%%"');
       while ($result = db_fetch_array($query)){
         $taxonomy_fields[$result['group_name']]['fields'][$result['field_name']] = $result;
@@ -2389,28 +2365,28 @@ function theme_taxonomy_fields_field_ove
 
 }
 
-function taxonomy_fields_field_overview_form_submit($form_id, $form_values) {
+function taxonomy_fields_field_overview_form_submit($form, &$form_state) {
 
-  variable_set('tax_dynamic_fields_loading', $form_values['loading']);
-  variable_set('tax_dynamic_fields_hide', $form_values['hide']);
+  variable_set('tax_dynamic_fields_loading', $form_state['values']['loading']);
+  variable_set('tax_dynamic_fields_hide', $form_state['values']['hide']);
   drupal_set_message(t('Updated taxonomy fields settings.'));
   
   $msg = FALSE;
-  foreach ((array) $form_values['field-groups'] as $key => $value) {
-    if ($key && !in_array($key, unserialize($form_values['disabled']))) {
+  foreach ((array) $form_state['values']['field-groups'] as $key => $value) {
+    if ($key && !in_array($key, unserialize($form_state['values']['disabled']))) {
       $values  = array('field_name' => $key, 'group' => $value, 'type_name' => 'taxonomy_fields');
-      $default = $form_values['field-groups-defaults'][$key];      
+      $default = $form_state['values']['field-groups-defaults'][$key];      
       if ($default != $values['group']) {
         if ($values['group'] && !$default) {
-          db_query("INSERT INTO {node_group_fields} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')",
+          db_query("INSERT INTO {content_group_fields} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')",
                     'taxonomy_fields', $values['group'], $values['field_name']);
         }
         else if ($values['group']) {
-          db_query("UPDATE {node_group_fields} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'",
+          db_query("UPDATE {content_group_fields} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'",
                     $values['group'], 'taxonomy_fields', $values['field_name']);
         }
         else {
-          db_query("DELETE FROM {node_group_fields} WHERE type_name = '%s' AND field_name = '%s'", 'taxonomy_fields', $values['field_name']);
+          db_query("DELETE FROM {content_group_fields} WHERE type_name = '%s' AND field_name = '%s'", 'taxonomy_fields', $values['field_name']);
         }
         if(module_exists('fieldgroup')){
           cache_clear_all('fieldgroup_data', 'cache_content');
@@ -2423,9 +2399,9 @@ function taxonomy_fields_field_overview_
     drupal_set_message(t('Updated field groups.'));
   }
   $msg = FALSE;
-  foreach ((array) $form_values['field-weights'] as $key => $value) {
-    if ($key && !in_array($key, unserialize($form_values['disabled']))) {      
-      db_query("UPDATE {node_field_instance} SET weight = %d WHERE type_name LIKE 'term_related_%%' AND field_name = '%s'",
+  foreach ((array) $form_state['values']['field-weights'] as $key => $value) {
+    if ($key && !in_array($key, unserialize($form_state['values']['disabled']))) {      
+      db_query("UPDATE {content_node_field_instance} SET weight = %d WHERE type_name LIKE 'term_related_%%' AND field_name = '%s'",
         $value, $key);
       $msg = TRUE;
     }
@@ -2473,14 +2449,14 @@ function _taxonomy_fields_edit_field_rem
 /**
  * Remove a field from a term.
  */
-function _taxonomy_fields_edit_field_remove_submit($form_id, $form_values) {
-  $type = taxonomy_fields_terms($form_values['tid']);
-  $field = $type['fields'][$form_values['field_name']];
+function _taxonomy_fields_edit_field_remove_submit($form, &$form_state) {
+  $type = taxonomy_fields_terms($form_state['values']['tid']);
+  $field = $type['fields'][$form_state['values']['field_name']];
 
-  if ($type && $field && $form_values['confirm']) {
-    taxonomy_fields_field_instance_delete($form_values);
+  if ($type && $field && $form_state['values']['confirm']) {
+    taxonomy_fields_field_instance_delete($form_state['values']);
     drupal_set_message(t('Removed field %field from %type.', array('%field' => $field['widget']['label'], '%type' => $type['name'])));
-    return 'admin/content/taxonomy_fields';
+    $form_state['redirect'] = 'admin/content/taxonomy_fields';
   }
 }
 
@@ -2493,7 +2469,7 @@ function _taxonomy_fields_edit_field_rem
  *   - 'field_name' - The name of the field whose instance is to be deleted.
  */
 function taxonomy_fields_field_instance_delete($instance) {
-  db_query("DELETE FROM {node_field_instance} WHERE type_name = '%s' AND field_name = '%s'", 'term_related_'.$instance['tid'], $instance['field_name']); 
+  db_query("DELETE FROM {content_node_field_instance} WHERE type_name = '%s' AND field_name = '%s'", 'term_related_'.$instance['tid'], $instance['field_name']); 
   db_query("DELETE FROM {taxonomy_fields} WHERE tid = %d AND field_name = '%s'", $instance['tid'], $instance['field_name']);
 
   $type = taxonomy_fields_terms($instance['tid']);
@@ -2502,7 +2478,7 @@ function taxonomy_fields_field_instance_
   $field_type = $field_types[$field['type']];
   $columns = module_invoke($field_type['module'], 'field_settings', 'database columns', $field);
 
-  $instances = db_result(db_query("SELECT COUNT(*) FROM {node_field_instance} WHERE field_name = '%s'", $instance['field_name']));
+  $instances = db_result(db_query("SELECT COUNT(*) FROM {content_node_field_instance} WHERE field_name = '%s'", $instance['field_name']));
   // If only one instance remains, we may need to change the database
   // representation for this field.
   if ($instances == 1) {
@@ -2511,7 +2487,7 @@ function taxonomy_fields_field_instance_
       if (is_array($columns) && count($columns)) {
         $new_field = $field;
         $new_field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
-        db_query("UPDATE {node_field} SET db_storage = %d WHERE field_name = '%s'", CONTENT_DB_STORAGE_PER_CONTENT_TYPE, $instance['field_name']);
+        db_query("UPDATE {content_node_field} SET db_storage = %d WHERE field_name = '%s'", CONTENT_DB_STORAGE_PER_CONTENT_TYPE, $instance['field_name']);
         content_alter_db_field($field, $columns, $new_field, $columns);
       }
     }
@@ -2522,11 +2498,11 @@ function taxonomy_fields_field_instance_
     if (is_array($columns) && count($columns)) {
       content_alter_db_field($field, $columns, array(), array());
     }
-    db_query("DELETE FROM {node_field} WHERE field_name = '%s'", $instance['field_name']);
+    db_query("DELETE FROM {content_node_field} WHERE field_name = '%s'", $instance['field_name']);
   }
   
   //if this was the only field assigned to this term, delete the term table
-  $result=db_result(db_query("SELECT COUNT(*) FROM {node_field_instance} WHERE type_name = '%s'", 'term_related_'.$instance['tid'] ));
+  $result=db_result(db_query("SELECT COUNT(*) FROM {content_node_field_instance} WHERE type_name = '%s'", 'term_related_'.$instance['tid'] ));
   if($result==0){
   	db_query('DROP TABLE {content_type_term_related_'.$instance['tid'].'}');
   }
@@ -2727,10 +2703,10 @@ function _taxonomy_fields_edit_field($ti
 /**
  * Validate a field's settings.
  */
-function _taxonomy_fields_edit_field_validate($form_id, $form_values) {
+function _taxonomy_fields_edit_field_validate($form, &$form_state) {
 	
-  $type = taxonomy_fields_terms($form_values['tax_tid']);
-  $field = $type['fields'][$form_values['field_name']];
+  $type = taxonomy_fields_terms($form_state['values']['tax_tid']);
+  $field = $type['fields'][$form_state['values']['field_name']];
   $field_types = _taxonomy_fields_field_types();
   $field_type = $field_types[$field['type']];
   $widget_types = taxonomy_fields_widget_types();
@@ -2739,14 +2715,14 @@ function _taxonomy_fields_edit_field_val
   $field_function = $field_type['module'] .'_field';
   $widget_function = $widget_type['module'] .'_widget';
 	
-	if($form_values['universal']){
+	if($form_state['values']['universal']){
 		
-		$uni_value=$form_values[$form_values['field_name'].'_'];
+		$uni_value=$form_state['values'][$form_state['values']['field_name'].'_'];
 
 		if (function_exists($widget_function)) {
 		   	$widget_function('validate', $node, $field, $uni_value);
 		   	$widget_function('process form values', $node, $field, $uni_value);
-		   	form_set_value(array('#parents' => array($form_values['field_name'].'_')), $uni_value);		   	
+		   	form_set_value(array('#parents' => array($form_state['values']['field_name'].'_')), $uni_value);		   	
 		}
 		
 		if (function_exists($field_function)) {
@@ -2755,27 +2731,27 @@ function _taxonomy_fields_edit_field_val
 		
 		$form=form_get_errors();
 		if (!empty($form)){
-			return 'admin/content/taxonomy_fields/'.$form_values['tax_tid'].'/fields/'.$form_values['field_name'];
+			return 'admin/content/taxonomy_fields/'.$form_state['values']['tax_tid'].'/fields/'.$form_state['values']['field_name'];
 		}
 		//validate number fields because number.module does not validate on value-format
-		elseif($form_values['widget_type']=='number'){
+		elseif($form_state['values']['widget_type']=='number'){
 			foreach ($uni_value as $key =>$value){
 				if($value['value'] && !is_numeric($value['value'])){
 					$uni_value[$key]['value']=0;
 				}
 			}
-			form_set_value(array('#parents' => array($form_values['field_name'].'_')), $uni_value);
+			form_set_value(array('#parents' => array($form_state['values']['field_name'].'_')), $uni_value);
 		}
 	}
 
-  module_invoke($widget_type['module'], 'widget_settings', 'validate', array_merge($field, $form_values));
-  module_invoke($field_type['module'], 'field_settings', 'validate', array_merge($field, $form_values));
+  module_invoke($widget_type['module'], 'widget_settings', 'validate', array_merge($field, $form_state['values']));
+  module_invoke($field_type['module'], 'field_settings', 'validate', array_merge($field, $form_state['values']));
 
   // If content.module is handling the default value,
   // validate the result using the field validation.
   $handle = module_invoke('content','handle','widget', 'default value', $field);
   if ($handle == CONTENT_CALLBACK_DEFAULT) {
-    if (isset($form_values['default_value_php']) && ($php = trim($form_values['default_value_php']))) {
+    if (isset($form_state['values']['default_value_php']) && ($php = trim($form_state['values']['default_value_php']))) {
       ob_start();
       $return = eval($php);
       ob_end_clean();
@@ -2808,14 +2784,14 @@ function _taxonomy_fields_edit_field_val
       }
     }
     else {
-      $default_value = $form_values['default_value_widget'][$field['field_name']];
+      $default_value = $form_state['values']['default_value_widget'][$field['field_name']];
       $is_code = FALSE;
       form_set_value(array('#parents' => array('default_value_php')), '');
       form_set_value(array('#parents' => array('default_value')), $default_value);
     }
     if (isset($default_value)) {
       $node = array();
-      $node[$form_values['field_name']] = $default_value;
+      $node[$form_state['values']['field_name']] = $default_value;
       $field['required'] = FALSE;
 
       // If default_value is created from php code, don't run it through widget processing.
@@ -2832,7 +2808,7 @@ function _taxonomy_fields_edit_field_val
       }
       // The field validation routine won't set an error on the right field, so set it here.
       if (form_get_errors()) {
-        if (trim($form_values['default_value_php'])) {
+        if (trim($form_state['values']['default_value_php'])) {
           form_set_error('default_value_php', t('The default value php code created @value which is invalid.', array('@value' => print_r($default_value, true))));
         }
         else {
@@ -2846,60 +2822,60 @@ function _taxonomy_fields_edit_field_val
 /**
  * Save a field's settings after editing.
  */
-function _taxonomy_fields_edit_field_submit($form_id, $form_values) {
+function _taxonomy_fields_edit_field_submit($form, &$form_state) {
 	
-	$term = taxonomy_fields_terms($form_values['tax_tid']);
-	$field = $term['fields'][$form_values['field_name']];
+	$term = taxonomy_fields_terms($form_state['values']['tax_tid']);
+	$field = $term['fields'][$form_state['values']['field_name']];
 	$field_types = _taxonomy_fields_field_types();
 	$field_type = $field_types[$field['type']];
 	$widget_types = taxonomy_fields_widget_types();
-	$widget_type = $widget_types[$form_values['widget_type']];
+	$widget_type = $widget_types[$form_state['values']['widget_type']];
 	$widget_settings = array();
 	  // If content.module is handling the default value,
 	  // initialize $widget_settings with default values,
 	  $handle = module_invoke('content','handle','widget', 'default value', $field);
 	  if ($handle == CONTENT_CALLBACK_DEFAULT) {
 	    $widget_settings = array(
-	      'default_value' => $form_values['default_value'],
-	      'default_value_php' => $form_values['default_value_php'],
+	      'default_value' => $form_state['values']['default_value'],
+	      'default_value_php' => $form_state['values']['default_value_php'],
 	      );
 	  }
 		
 	$setting_names = module_invoke($widget_type['module'], 'widget_settings', 'save', $field);
 	if (is_array($setting_names)) {
 		foreach ($setting_names as $setting) {
-		  $widget_settings[$setting] = $form_values[$setting];
+		  $widget_settings[$setting] = $form_state['values'][$setting];
 		}
 	}
 	$field_settings = array();
 	$setting_names = module_invoke($field_type['module'], 'field_settings', 'save', $field);
 	if (is_array($setting_names)) {
 		foreach ($setting_names as $setting) {
-		  $field_settings[$setting] = $form_values[$setting];
+		  $field_settings[$setting] = $form_state['values'][$setting];
 		}
 	}
 	
 	$prev_field = $field;
 	$prev_columns = module_invoke($field_type['module'], 'field_settings', 'database columns', $field);
 	
-	db_query("UPDATE {node_field_instance} SET label = '%s', widget_type = '%s', widget_settings = '%s', description = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['label'], $form_values['widget_type'], serialize($widget_settings), $form_values['description'], 'term_related_'.$form_values['tax_tid'], $form_values['field_name']);
+	db_query("UPDATE {content_node_field_instance} SET label = '%s', widget_type = '%s', widget_settings = '%s', description = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_state['values']['label'], $form_state['values']['widget_type'], serialize($widget_settings), $form_state['values']['description'], 'term_related_'.$form_state['values']['tax_tid'], $form_state['values']['field_name']);
 	
-	if ($form_values['multiple']) {
+	if ($form_state['values']['multiple']) {
 		$field['db_storage'] = 0;
 	}
 	else {
-		$instances = db_result(db_query("SELECT COUNT(*) FROM {node_field_instance} WHERE field_name = '%s'", $form_values['field_name']));
+		$instances = db_result(db_query("SELECT COUNT(*) FROM {content_node_field_instance} WHERE field_name = '%s'", $form_state['values']['field_name']));
 		if ($instances == 1) {
 		  $field['db_storage'] = 1;
 		}
 	}
-	db_query("UPDATE {node_field} SET required = %d, multiple = %d, global_settings = '%s', db_storage = %d WHERE field_name = '%s'", $form_values['required'], $form_values['multiple'], serialize($field_settings), $field['db_storage'], $form_values['field_name']);
+	db_query("UPDATE {content_node_field} SET required = %d, multiple = %d, global_settings = '%s', db_storage = %d WHERE field_name = '%s'", $form_state['values']['required'], $form_state['values']['multiple'], serialize($field_settings), $field['db_storage'], $form_state['values']['field_name']);
 	
-	drupal_set_message(t('Saved field %field assigned to the %term term.', array('%field' => $form_values['label'], '%term' => $term['name'])));
+	drupal_set_message(t('Saved field %field assigned to the %term term.', array('%field' => $form_state['values']['label'], '%term' => $term['name'])));
 
 	taxonomy_fields_clear_terms_cache();
 	
-	$new_field = taxonomy_fields_fields($form_values['field_name']);
+	$new_field = taxonomy_fields_fields($form_state['values']['field_name']);
 	$new_columns = module_invoke($field_type['module'], 'field_settings', 'database columns', $new_field);
 	
 	if (!isset($prev_columns)) {
@@ -2911,19 +2887,19 @@ function _taxonomy_fields_edit_field_sub
 
 	content_alter_db_field($prev_field, $prev_columns, $new_field, $new_columns);
 	
-	if($form_values['universal'] && is_array($form_values[$form_values['field_name'].'_'])){
-		db_query('DELETE FROM {taxonomy_fields} WHERE field_name="%s" AND tid=%d', $form_values['field_name'], $form_values['tax_tid']);
-		foreach ($form_values[$form_values['field_name'].'_'] as $key => $value){
-			db_query('INSERT INTO {taxonomy_fields}(field_name, field_value, tid, delta, universal) VALUES ("%s","%s",%d,%d,%d)', $form_values['field_name'], $value ? serialize($value) : '', $form_values['tax_tid'], $key, 1);
+	if($form_state['values']['universal'] && is_array($form_state['values'][$form_state['values']['field_name'].'_'])){
+		db_query('DELETE FROM {taxonomy_fields} WHERE field_name="%s" AND tid=%d', $form_state['values']['field_name'], $form_state['values']['tax_tid']);
+		foreach ($form_state['values'][$form_state['values']['field_name'].'_'] as $key => $value){
+			db_query('INSERT INTO {taxonomy_fields}(field_name, field_value, tid, delta, universal) VALUES ("%s","%s",%d,%d,%d)', $form_state['values']['field_name'], $value ? serialize($value) : '', $form_state['values']['tax_tid'], $key, 1);
 		}
 	}
 	else {
-	  	db_query('DELETE FROM {taxonomy_fields} WHERE field_name="%s" AND tid=%d', $form_values['field_name'], $form_values['tax_tid']);	
-		db_query('INSERT INTO {taxonomy_fields}(field_name, field_value, tid, delta, universal) VALUES ("%s","%s",%d,%d,%d)', $form_values['field_name'], '', $form_values['tax_tid'], 0, 0);
+	  	db_query('DELETE FROM {taxonomy_fields} WHERE field_name="%s" AND tid=%d', $form_state['values']['field_name'], $form_state['values']['tax_tid']);	
+		db_query('INSERT INTO {taxonomy_fields}(field_name, field_value, tid, delta, universal) VALUES ("%s","%s",%d,%d,%d)', $form_state['values']['field_name'], '', $form_state['values']['tax_tid'], 0, 0);
 	}
 
 	taxonomy_fields_clear_terms_cache();
-  	return 'admin/content/taxonomy_fields';
+        $form_state['redirect'] = 'admin/content/taxonomy_fields';
 }
 
 /**
@@ -2978,18 +2954,18 @@ function _taxonomy_fields_term_info($res
         }
       }
 
-      $field_result = db_query('SELECT * FROM {node_field} nf');
+      $field_result = db_query('SELECT * FROM {content_node_field} nf');
       while ($field = db_fetch_array($field_result)) {
         $global_settings = $field['global_settings'] ? unserialize($field['global_settings']) : array();
         unset($field['global_settings']);
         $field = array_merge($field, $global_settings);
-        $instance_info = db_fetch_array(db_query("SELECT type_name, label, widget_type, weight FROM {node_field_instance} WHERE field_name = '%s'", $field['field_name']));
+        $instance_info = db_fetch_array(db_query("SELECT type_name, label, widget_type, weight FROM {content_node_field_instance} WHERE field_name = '%s'", $field['field_name']));
         $field['widget']['label'] = $instance_info['label'];
         $field['type_name'] = $instance_info['type_name'];
         $field['widget_type'] = $instance_info['widget_type'];
         $field['#weight'] = $instance_info['weight'];
         $field['weight'] = $instance_info['weight'];
-        $result = db_fetch_object(db_query('SELECT group_name FROM {node_group_fields} WHERE type_name = "%s" AND field_name = "%s"', 'taxonomy_fields', $field['field_name']));
+        $result = db_fetch_object(db_query('SELECT group_name FROM {content_group_fields} WHERE type_name = "%s" AND field_name = "%s"', 'taxonomy_fields', $field['field_name']));
         if($result->group_name){
           $field['group'] = $result->group_name;
         }
@@ -3008,7 +2984,7 @@ function _taxonomy_fields_term_info($res
           $term['fields'] = array();
           
           $field_result = db_query("SELECT v.value, nfi.field_name, nfi.weight, nfi.label, nfi.widget_type, nfi.widget_settings, nfi.display_settings, nfi.description 
-                                    FROM {node_field_instance} nfi 
+                                    FROM {content_node_field_instance} nfi 
                                     LEFT JOIN {variable} v ON v.name = '%s'
                                     WHERE nfi.type_name = '%s' AND v.value = '%s'  
                                     ORDER BY nfi.weight ASC, nfi.label ASC", 'tax_fields_voc_'.$term['vid'], 'term_related_'.$term['tid'], 's:1:"1";');
@@ -3030,7 +3006,7 @@ function _taxonomy_fields_term_info($res
             $field['display_settings'] = $field['display_settings'] ? unserialize($field['display_settings']) : array();
             $result = db_fetch_object(db_query('SELECT tf.universal FROM {taxonomy_fields} tf WHERE tf.tid = %d AND tf.field_name = "%s"', $term['tid'], $field['field_name']));
   	        $field['universal'] = $result->universal;
-            $result = db_fetch_object(db_query('SELECT group_name FROM {node_group_fields} WHERE type_name = "%s" AND field_name = "%s"', 'taxonomy_fields', $field['field_name']));
+            $result = db_fetch_object(db_query('SELECT group_name FROM {content_group_fields} WHERE type_name = "%s" AND field_name = "%s"', 'taxonomy_fields', $field['field_name']));
   	        if($result->group_name){
   	          $field['group'] = $result->group_name;
   	        }
@@ -3040,7 +3016,7 @@ function _taxonomy_fields_term_info($res
           $info['terms']['term_related_'.$term['tid']] = $term;
         }
       }     
-      cache_set('taxonomy_fields_term_info', 'cache_content', serialize($info));
+      cache_set('taxonomy_fields_term_info', serialize($info));
     }
   }
   return $info;
@@ -3138,15 +3114,15 @@ function taxonomy_fields_display_overvie
   return  $form;
 }
 
-function taxonomy_fields_display_overview_form_submit($form_id, $form_values) {
-	$tid = $form_values['tid'];
+function taxonomy_fields_display_overview_form_submit($form, &$form_state) {
+	$tid = $form_state['values']['tid'];
   
-  foreach ($form_values['fields'] as $field_name => $field_values) {
+  foreach ($form_state['values']['fields'] as $field_name => $field_values) {
     $display_settings = array();
     foreach ($field_values as $key => $value) {
       $display_settings[$key] = $value;
     }
-    db_query("UPDATE {node_field_instance} SET display_settings = '%s' WHERE type_name = '%s' AND field_name = '%s'",
+    db_query("UPDATE {content_node_field_instance} SET display_settings = '%s' WHERE type_name = '%s' AND field_name = '%s'",
       serialize($display_settings), 'term_related_'.$tid, $field_name);
   }
   drupal_set_message(t('Your settings have been saved.'));
@@ -3210,7 +3186,7 @@ function theme_taxonomy_fields_list_outp
     }
   }
   foreach ($root_terms as $vid => $terms) {
-    $voc = taxonomy_get_vocabulary($vid);
+    $voc = taxonomy_vocabulary_load($vid);
     $output .= '<h2 class="title">'. $voc->name ."</h2>\n";
     $link = array(
       array(
@@ -3274,7 +3250,6 @@ function theme_taxonomy_fields_list_term
   return $output;
 }
 
-
 function theme_taxonomy_fields_field_add_new_field_widget_type($form) {
   $field_types = _taxonomy_fields_field_types();
   $widget_types = taxonomy_fields_widget_types();
@@ -3293,4 +3268,22 @@ function theme_taxonomy_fields_field_add
 
   return $output;
 }
-?>
\ No newline at end of file
+
+function taxonomy_fields_theme() {
+  return array(
+    'taxonomy_fields_field_add_new_field_widget_type' => array(
+      'arguments'  =>  array('form' => NULL),
+    ),
+    'taxonomy_fields_field_overview_form'  =>  array(
+      'arguments'  =>  array('form' => NULL),
+    ),
+    'taxonomy_fields_list_output' => array(
+      'arguments' => array('field_output' => NULL),
+    ),
+     'taxonomy_fields_list_term' => array(
+      'arguments' => array('field_output' => NULL , 'tid' => NULL),
+    ),
+  );
+}
+
+
Only in /var/www/html/kosansh/sites/all/modules/taxonomy_fields: taxonomy_fields.module~
