=== modified file 'fuzzysearch/fuzzysearch.info'
--- fuzzysearch/fuzzysearch.info	2008-11-05 23:11:25 +0000
+++ fuzzysearch/fuzzysearch.info	2008-11-05 23:12:12 +0000
@@ -7,4 +7,4 @@
 version = "5.x-1.x-dev"
 project = "fuzzysearch"
 datestamp = "1214654641"
-
+core = 6.x

=== modified file 'fuzzysearch/fuzzysearch.install'
--- fuzzysearch/fuzzysearch.install	2008-11-05 23:11:25 +0000
+++ fuzzysearch/fuzzysearch.install	2008-11-05 23:12:12 +0000
@@ -49,4 +49,4 @@
       break;
   }
   drupal_set_message('Fuzzy Search Module successfully removed');
-}
\ No newline at end of file
+}

=== modified file 'fuzzysearch/fuzzysearch.module'
--- fuzzysearch/fuzzysearch.module	2008-11-05 23:11:25 +0000
+++ fuzzysearch/fuzzysearch.module	2008-11-05 23:12:12 +0000
@@ -56,26 +56,20 @@
 /**
  * hook_menu
  */
-function fuzzysearch_menu($may_cache) {
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/fuzzysearch',
-      'title' => t('Fuzzy Search Settings'),
-      'description' => 'Fuzzy Search Settings allow you to index certain node data',
-      'callback' => 'fuzzysearch_admin',
-      'access' => user_access('administer fuzzysearch'),
-      'type' => MENU_NORMAL_ITEM,
-    );
-  }
-  else {
-    $items[] = array(
-      'path' => 'fuzzysearch/results',
-      'title' => t('Search'),
-      'callback' => 'fuzzysearch_show_results',
-      'access' => user_access('fuzzysearch content'),
-      'type' => MENU_DYNAMIC_ITEM,
-    );
-  }
+function fuzzysearch_menu() {
+  $items['admin/settings/fuzzysearch'] = array(
+    'title' => 'Fuzzy Search Settings',
+    'description' => 'Fuzzy Search Settings allow you to index certain node data',
+    'page callback' => 'fuzzysearch_admin',
+    'access arguments' => array('administer fuzzysearch'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+  $items['fuzzysearch/results'] = array(
+    'title' => 'Search',
+    'page callback' => 'fuzzysearch_show_results',
+    'access arguments' => array('fuzzysearch content'),
+    'type' => MENU_DYNAMIC_ITEM,
+  );
   return $items;
 }
 
@@ -85,6 +79,35 @@
 function fuzzysearch_perm() {
   return array('administer fuzzysearch', 'fuzzysearch content');
 }
+
+/**
+ * Implementation of hook_theme().
+ */
+function fuzzysearch_theme() {
+  return array(
+    'fuzzysearch_box_form' => array(
+      'args' => array(
+        'form' => NULL,
+      ),
+    ),
+    'fuzzysearch_form' => array(
+      'args' => array(
+        'form' => NULL,
+      ),
+    ),
+    'fuzzysearch_show_results' => array(
+      'args' => array(
+        'results' => NULL,
+      ),
+    ),
+    'fuzzysearch_results' => array(
+      'args' => array(
+        'results' => NULL,
+      ),
+    ),
+  );
+}
+
 /**
  * Build the administration settings panel
  */
@@ -136,8 +159,8 @@
   return $form;  
 }
 
-function fuzzysearch_admin_form_submit($form_id, $form_values) {
-  if ($form_values['reindex']) {
+function fuzzysearch_admin_form_submit($form, &$form_state) {
+  if ($form_state['values']['reindex']) {
     // Delete all nodes to be queued so we can read all of them
     db_query("DELETE FROM {search_index_queue}");
     
@@ -147,8 +170,8 @@
     }
     drupal_set_message('Nodes ready for reindexing, please run cron to update the index.');
   }
-  variable_set('search_min_completeness', $form_values['completeness']);
-  variable_set('search_debug_score', $form_values['debug_score']);
+  variable_set('search_min_completeness', $form_state['values']['completeness']);
+  variable_set('search_debug_score', $form_state['values']['debug_score']);
 }
 
 
@@ -226,8 +249,8 @@
  * Save the score modifiers as set in the administrative form.
  */
 
-function fuzzysearch_scoring_submit($form_id, $form_values) {
-  foreach ($form_values as $key => $value) {
+function fuzzysearch_scoring_submit($form, &$form_state) {
+  foreach ($form_state['values'] as $key => $value) {
     if ($key != 'op' || $key != 'submit' || $key != 'form_token' || $key != 'form_id') {
       variable_set('search_scoring_'. $key, $value);
     }
@@ -376,7 +399,7 @@
   foreach ($index_words as $key => $word) {
     // ensure that as each word is indexed it receives a unique id 
     // independent of the node it is in.
-    $word_id = db_next_id("{search_fuzzy_index}_word_id");
+    $word_id = db_last_insert_id('search_fuzzy_index', 'word_id');
     fuzzysearch_index_insert($word, $word_id, $nid, $index_scores[$key], $hook_score);
   }
 
@@ -452,7 +475,6 @@
  * Form to search the index
  */
 function fuzzysearch_box_form() {
-  $form['#base'] = 'fuzzysearch_form';
   $form['keys'] = array(
     '#type' => 'textfield',
     '#size' => 15,
@@ -462,6 +484,7 @@
     '#type' => 'submit',
     '#value' => t('Search'),
   );
+  $form['#submit'][] = 'fuzzysearch_form_submit';
   return $form;
 }
 
@@ -492,7 +515,7 @@
 /**
  * Form to search the index
  */
-function fuzzysearch_form($keys = '') {
+function fuzzysearch_form($form_state, $keys = '') {
   $form['keys'] = array(
     '#title' => t('Enter search phrase'),
     '#type' => 'textfield',
@@ -511,8 +534,8 @@
  * provide the keys as part of the path so that the search
  * can be linked to.
  */
-function fuzzysearch_form_submit($form_id, $form_values) {
-  drupal_goto('fuzzysearch/results/'. check_plain(trim($form_values['keys'])));
+function fuzzysearch_form_submit($form, &$form_state) {
+  $form_state['redirect'] = 'fuzzysearch/results/'. check_plain(trim($form_state['values']['keys']));
 }
 
 /**
@@ -603,7 +626,7 @@
  */
 function fuzzysearch_show_results($keys = '') {
   drupal_set_title(check_plain($keys));
-  drupal_add_css($base_path . drupal_get_path('module', 'fuzzysearch') .'/fuzzysearch.css', 'module');
+  drupal_add_css(drupal_get_path('module', 'fuzzysearch') .'/fuzzysearch.css', 'module');
   $output .= '<div class="clear-block">';
   $output .= drupal_get_form('fuzzysearch_form', $keys);
   $output .= '</div>';
@@ -631,4 +654,4 @@
   }
   $output .= '</dl></div>';
   return $output;
-}
\ No newline at end of file
+}

