=== added file 'NOTES-Drupal-7.txt'
--- NOTES-Drupal-7.txt	1970-01-01 00:00:00 +0000
+++ NOTES-Drupal-7.txt	2011-01-26 21:43:56 +0000
@@ -0,0 +1,8 @@
+
+Notes on the Drupal 7 version:
+=============================
+
+ * The 'cck' module is still needed (even though most of it is now in core) because it adds
+   the ability to use "Allowed values PHP code" for select fields.  (At the time of this writing
+   there has been no official release, so you have to get 7.x-2.x-dev)
+

=== modified file 'README.txt'
--- README.txt	2011-01-25 12:53:16 +0000
+++ README.txt	2011-01-26 22:33:54 +0000
@@ -4,19 +4,18 @@
 ------------------------
 
 To install, place the entire dictionary folder into your modules directory.
-Go to Administer -> Site building -> Modules and enable the Dictionary module.
-
-First go to Administer -> User management -> Permissions and set administer and
-access permissions as required.
-
-Now go to Administer -> Content management -> Dictionary. Create at least one
-language and at least one item. Then test by adding a translation for the items
-into the languages.
-
-Next go to Create content -> Dictionary term. Create a node for one of your
+On the admin toolbar, go to Modules and enable the Dictionary module.
+
+Then go to People -> Permissions and set administer and access
+permissions as required.
+
+Now go to Content -> Dictionary. Create at least one language and at least one item.
+Then test by adding a translation for the items into the languages.
+
+Next go to Create -> Add Content -> Dictionary term. Create a node for one of your
 dictionary items.
 
-Finally go to Administer -> Menu -> Navigation and enable the Dictionary menu item.
+Finally go to Structure -> Menus -> Navigation and enable the Dictionary menu item.
 Now visit the dictionary page.
 
 You will see a search box, in which you can search for terms. Note that you can only
@@ -37,4 +36,4 @@
 Sara Adams (http://www.sara-adams.de)
 
 The Dictionary is currently being maintained by:
-Sara Adams
\ No newline at end of file
+Sara Adams

=== added file 'REVIEW-Drupal-7.txt'
--- REVIEW-Drupal-7.txt	1970-01-01 00:00:00 +0000
+++ REVIEW-Drupal-7.txt	2011-01-25 14:46:43 +0000
@@ -0,0 +1,40 @@
++++++++++++++++++++++++++++++
+dictionary-7.x-1.1/dictionary.install
+Summary
+minor: 0, normal: 0, critical: 0, ignored: 0
+Details
+
++++++++++++++++++++++++++++++
+dictionary-7.x-1.1/dictionary.tpl.php
+Summary
++-1: [normal] @file block missing
+Details
+Summary
+minor: 0, normal: 1, critical: 0, ignored: 0
+Details
+
++++++++++++++++++++++++++++++
+dictionary-7.x-1.1/dictionary.admin.inc
+Summary
+minor: 0, normal: 0, critical: 0, ignored: 0
+Details
+
++++++++++++++++++++++++++++++
+dictionary-7.x-1.1/node-dictionary_term.tpl.php
+Summary
+minor: 0, normal: 2, critical: 0, ignored: 0
+Details
++-1: [normal] @file block missing
++14: [normal] The control statement should use ":" syntax instead of curly braces.
+
++++++++++++++++++++++++++++++
+dictionary-7.x-1.1/dictionary.module
+Summary
+minor: 0, normal: 0, critical: 5, ignored: 0
+Details
++598: [critical] db_rewrite_sql replaced with hook_query_alter
++736: [critical] db_rewrite_sql replaced with hook_query_alter
++786: [critical] db_rewrite_sql replaced with hook_query_alter
++788: [critical] db_rewrite_sql replaced with hook_query_alter
++865: [critical] $node->build_mode property removed.
+

=== modified file 'dictionary.admin.inc'
--- dictionary.admin.inc	2011-01-25 13:13:06 +0000
+++ dictionary.admin.inc	2011-01-26 22:42:34 +0000
@@ -14,16 +14,16 @@
   $items = dictionary_get_items();
   $rows = array();
   foreach ($items as $item) {
-    $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = %d AND iid = %d', $language->lid, $item->iid);
+    $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = :lid AND iid = :iid', array(':lid' => $language->lid, ':iid' => $item->iid));
     $count = 0;
-    while ($translation = db_fetch_object($result)) {
+    foreach ($result as $translation) {
       $count++;
       $rows[] = array(
         'item' => l($item->name, "admin/content/dictionary/item/$item->iid"),
         'translation' => check_plain($translation->name),
         'edit' => l(t('edit'), "admin/content/dictionary/edit_translation/language/$translation->tid"),
         'add' => l(t('add'), "admin/content/dictionary/add_translation/language/$item->iid/$language->lid")
-      );        
+      );
     }
     if ($count == 0) {
       $rows[] = array(
@@ -39,7 +39,7 @@
   }
   $header = array(t('Item'), t('Translation'), array('data' => t('Operations'), 'colspan' => '2'));
 
-  return theme('table', $header, $rows, array('id' => 'dictionary'));
+  return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'dictionary')));
 }
 
 /**
@@ -50,9 +50,9 @@
   $languages = dictionary_get_languages();
   $rows = array();
   foreach ($languages as $language) {
-    $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = %d AND iid = %d', $language->lid, $item->iid);
+    $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = :lid AND iid = :iid', array(':lid' => $language->lid, ':iid' => $item->iid));
     $count = 0;
-    while ($translation = db_fetch_object($result)) {
+    foreach ($result as $translation) {
       $count++;
       $rows[] = array(
         'item' => l($language->name, "admin/content/dictionary/language/$language->lid"),
@@ -75,7 +75,7 @@
   }
   $header = array(t('Language'), t('Translation'), array('data' => t('Operations'), 'colspan' => '2'));
 
-  return theme('table', $header, $rows, array('id' => 'dictionary'));
+  return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'dictionary')));
 }
 
 /**
@@ -88,10 +88,10 @@
   $items = dictionary_get_items();
   $data = array();
   foreach ($items as $item) {
-    $data[$item->iid]['#item'] = (array)$item;
-    $data[$item->iid]['name'] = array('#value' => check_plain($item->name));
-    $data[$item->iid]['edit'] = array('#value' => l(t('edit item'), "admin/content/dictionary/edit_item/$item->iid"));
-    $data[$item->iid]['manage'] = array('#value' => l(t('manage translations'), "admin/content/dictionary/item/$item->iid"));
+    $data[$item->iid]['#item'] = (array) $item;
+    $data[$item->iid]['name'] = array('#markup' => check_plain($item->name));
+    $data[$item->iid]['edit'] = array('#markup' => l(t('edit item'), "admin/content/dictionary/edit_item/$item->iid"));
+    $data[$item->iid]['manage'] = array('#markup' => l(t('manage translations'), "admin/content/dictionary/item/$item->iid"));
   }
 
   return theme_dictionary_overview_items($data);
@@ -104,6 +104,7 @@
  * @see dictionary_overview_items()
  */
 function theme_dictionary_overview_items($data) {
+  // TODO: Should this theme dictionary_overview_items be declared in hook_theme()?
   $rows = array();
   foreach (element_children($data) as $key) {
     $item = &$data[$key];
@@ -112,14 +113,19 @@
     $row[] = drupal_render($item['name']);
     $row[] = drupal_render($item['edit']);
     $row[] = drupal_render($item['manage']);
-    $rows[] = array('data' => $row);   
+    $rows[] = $row;
   }
   if (empty($rows)) {
     $rows[] = array(array('data' => t('No items available.'), 'colspan' => '3'));
   }
   $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => '2'));
 
-  return theme('table', $header, $rows, array('id' => 'dictionary'));
+  return array(
+    '#theme' => 'table',
+    '#rows'  => $rows,
+    '#header' => $header,
+    '#attributes' => array('id' => 'dictionary')
+  );
 }
 
 /**
@@ -128,7 +134,7 @@
  * @ingroup forms
  * @see dictionary_form_item_submit()
  */
-function dictionary_form_item(&$form_state, $edit = array()) {
+function dictionary_form_item($form, &$form_state, $edit = array()) {
   $edit += array(
     'name' => '',
   );
@@ -156,11 +162,11 @@
   switch (dictionary_save_item($form_state['values'])) {
     case SAVED_NEW:
       drupal_set_message(t('Created new item %name.', array('%name' => $form_state['values']['name'])));
-      watchdog('dictionary', 'Created new item %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_item/'. $form_state['values']['iid']));
+      watchdog('dictionary', 'Created new item %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_item/' . $form_state['values']['iid']));
       break;
     case SAVED_UPDATED:
       drupal_set_message(t('Updated item %name.', array('%name' => $form_state['values']['name'])));
-      watchdog('dictionary', 'Updated item %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_item/'. $form_state['values']['iid']));
+      watchdog('dictionary', 'Updated item %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_item/' . $form_state['values']['iid']));
       $form_state['redirect'] = 'admin/content/dictionary/list_item';
       break;
   }
@@ -176,7 +182,7 @@
   if ((isset($_POST['op']) && $_POST['op'] == t('Delete')) || isset($_POST['confirm'])) {
     return drupal_get_form('dictionary_item_confirm_delete', $item->iid);
   }
-  return drupal_get_form('dictionary_form_item', (array)$item);
+  return drupal_get_form('dictionary_form_item', (array) $item);
 }
 
 /**
@@ -185,7 +191,7 @@
  * @ingroup forms
  * @see dictionary_settings_form_submit()
  */
-function dictionary_form_settings(&$form_state) {
+function dictionary_form_settings($form, &$form_state) {
   $form['dictionary_head'] = array(
     '#type' => 'textarea',
     '#title' => t('Dictionary introductory text'),
@@ -197,6 +203,10 @@
   return $form;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_form_settings_submit($form, &$form_state) {
   foreach ($form_state['values'] as $key => $value) {
     variable_set($key, $value);
@@ -216,10 +226,10 @@
   $languages = dictionary_get_languages();
   $data = array();
   foreach ($languages as $language) {
-    $data[$language->lid]['#language'] = (array)$language;
-    $data[$language->lid]['name'] = array('#value' => check_plain($language->name));
-    $data[$language->lid]['edit'] = array('#value' => l(t('edit language'), "admin/content/dictionary/edit_language/$language->lid"));
-    $data[$language->lid]['manage'] = array('#value' => l(t('manage translations'), "admin/content/dictionary/language/$language->lid"));
+    $data[$language->lid]['#language'] = (array) $language;
+    $data[$language->lid]['name'] = array('#markup' => check_plain($language->name));
+    $data[$language->lid]['edit'] = array('#markup' => l(t('edit language'), "admin/content/dictionary/edit_language/$language->lid"));
+    $data[$language->lid]['manage'] = array('#markup' => l(t('manage translations'), "admin/content/dictionary/language/$language->lid"));
   }
 
   return theme_dictionary_overview_languages($data);
@@ -232,6 +242,7 @@
  * @see dictionary_overview_languages()
  */
 function theme_dictionary_overview_languages($data) {
+  // TODO: Should this theme dictionary_overview_languages be declared in hook_theme()?
   $rows = array();
   foreach (element_children($data) as $key) {
     $language = &$data[$key];
@@ -240,14 +251,19 @@
     $row[] = drupal_render($language['name']);
     $row[] = drupal_render($language['edit']);
     $row[] = drupal_render($language['manage']);
-    $rows[] = array('data' => $row);   
+    $rows[] = array('data' => $row);
   }
   if (empty($rows)) {
     $rows[] = array(array('data' => t('No languages available.'), 'colspan' => '3'));
   }
   $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => '2'));
 
-  return theme('table', $header, $rows, array('id' => 'dictionary'));
+  return array(
+    '#theme' => 'table',
+    '#rows'  => $rows,
+    '#header' => $header,
+    '#attributes' => array('id' => 'dictionary')
+  );
 }
 
 /**
@@ -256,7 +272,7 @@
  * @ingroup forms
  * @see dictionary_form_language_submit()
  */
-function dictionary_form_language(&$form_state, $edit = array()) {
+function dictionary_form_language($form, &$form_state, $edit = array()) {
   $edit += array(
     'name' => '',
   );
@@ -284,11 +300,11 @@
   switch (dictionary_save_language($form_state['values'])) {
     case SAVED_NEW:
       drupal_set_message(t('Created new language %name.', array('%name' => $form_state['values']['name'])));
-      watchdog('dictionary', 'Created new language %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_language/'. $form_state['values']['lid']));
+      watchdog('dictionary', 'Created new language %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_language/' . $form_state['values']['lid']));
       break;
     case SAVED_UPDATED:
       drupal_set_message(t('Updated language %name.', array('%name' => $form_state['values']['name'])));
-      watchdog('dictionary', 'Updated language %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_language/'. $form_state['values']['lid']));
+      watchdog('dictionary', 'Updated language %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_language/' . $form_state['values']['lid']));
       $form_state['redirect'] = 'admin/content/dictionary/list_language';
       break;
   }
@@ -304,7 +320,7 @@
   if ((isset($_POST['op']) && $_POST['op'] == t('Delete')) || isset($_POST['confirm'])) {
     return drupal_get_form('dictionary_language_confirm_delete', $language->lid);
   }
-  return drupal_get_form('dictionary_form_language', (array)$language);
+  return drupal_get_form('dictionary_form_language', (array) $language);
 }
 
 /**
@@ -314,7 +330,7 @@
   if ((isset($_POST['op']) && $_POST['op'] == t('Delete')) || isset($_POST['confirm'])) {
     return drupal_get_form('dictionary_translation_confirm_delete', $translation->tid, $redirect);
   }
-  return drupal_get_form('dictionary_form_translation', dictionary_item_load($translation->iid), dictionary_language_load($translation->lid), $redirect, (array)$translation);
+  return drupal_get_form('dictionary_form_translation', dictionary_item_load($translation->iid), dictionary_language_load($translation->lid), $redirect, (array) $translation);
 }
 
 /**
@@ -323,19 +339,19 @@
  * @ingroup forms
  * @see dictionary_form_translation_submit()
  */
-function dictionary_form_translation(&$form_state, $item, $language, $redirect, $edit = array()) {
+function dictionary_form_translation($form, &$form_state, $item, $language, $redirect, $edit = array()) {
   $edit += array(
     'name' => '',
   );
 
   $form['#translation'] = $edit;
-  $form['#item'] = (array)$item;
-  $form['#language'] = (array)$language;
+  $form['#item'] = (array) $item;
+  $form['#language'] = (array) $language;
   if ($redirect == 'language') {
-    $form['#redirect'] = 'admin/content/dictionary/language/'. $language->lid;
+    $form_state['#redirect'] = 'admin/content/dictionary/language/' . $language->lid;
   }
   else {
-    $form['#redirect'] = 'admin/content/dictionary/item/'. $item->iid;
+    $form_state['#redirect'] = 'admin/content/dictionary/item/' . $item->iid;
   }
 
   // Check for confirmation forms.
@@ -357,7 +373,7 @@
     '#type' => 'submit',
     '#value' => t('Save'));
 
-  if ($edit['tid']) {
+  if (!empty($edit['tid'])) {
     $form['delete'] = array(
       '#type' => 'submit',
       '#value' => t('Delete'));
@@ -389,11 +405,11 @@
   switch (dictionary_save_translation($form_state['values'])) {
     case SAVED_NEW:
       drupal_set_message(t('Created new translation %translation.', array('%translation' => $form_state['values']['name'])));
-      watchdog('dictionary', 'Created new translation %translation.', array('%translation' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_translation/item/'. $form_state['values']['tid']));
+      watchdog('dictionary', 'Created new translation %translation.', array('%translation' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_translation/item/' . $form_state['values']['tid']));
       break;
     case SAVED_UPDATED:
       drupal_set_message(t('Updated translation %translation.', array('%translation' => $form_state['values']['name'])));
-      watchdog('dictionary', 'Updated translation %translation.', array('%translation' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_translation/item/'. $form_state['values']['tid']));
+      watchdog('dictionary', 'Updated translation %translation.', array('%translation' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/dictionary/edit_translation/item/' . $form_state['values']['tid']));
       break;
   }
 
@@ -407,7 +423,7 @@
  * @ingroup forms
  * @see dictionary_translation_confirm_delete_submit()
  */
-function dictionary_translation_confirm_delete(&$form_state, $tid, $redirect) {
+function dictionary_translation_confirm_delete($form, &$form_state, $tid, $redirect) {
   $translation = dictionary_translation_load($tid);
 
   $form['type'] = array('#type' => 'value', '#value' => 'translation');
@@ -415,10 +431,10 @@
   $form['tid'] = array('#type' => 'value', '#value' => $tid);
   $form['delete'] = array('#type' => 'value', '#value' => TRUE);
   if ($redirect == 'language') {
-    $form['#redirect'] = 'admin/content/dictionary/language/'. $translation->lid;
+    $form_state['#redirect'] = 'admin/content/dictionary/language/' . $translation->lid;
   }
   else {
-    $form['#redirect'] = 'admin/content/dictionary/item/'. $translation->iid;
+    $form_state['#redirect'] = 'admin/content/dictionary/item/' . $translation->iid;
   }
 
   return confirm_form($form,
@@ -448,7 +464,7 @@
  * @ingroup forms
  * @see dictionary_language_confirm_delete_submit()
  */
-function dictionary_language_confirm_delete(&$form_state, $lid) {
+function dictionary_language_confirm_delete($form, &$form_state, $lid) {
   $language = dictionary_language_load($lid);
 
   $form['type'] = array('#type' => 'value', '#value' => 'language');
@@ -482,7 +498,7 @@
  * @ingroup forms
  * @see dictionary_item_confirm_delete_submit()
  */
-function dictionary_item_confirm_delete(&$form_state, $iid) {
+function dictionary_item_confirm_delete($form, &$form_state, $iid) {
   $item = dictionary_item_load($iid);
 
   $form['type'] = array('#type' => 'value', '#value' => 'item');

=== modified file 'dictionary.info'
--- dictionary.info	2011-01-25 12:53:16 +0000
+++ dictionary.info	2011-01-26 21:43:28 +0000
@@ -2,16 +2,13 @@
 
 name = Dictionary
 description = Enables the setup of a dictionary.
-core = 6.x
+core = 7.x
 project = "Dictionary"
 dependencies[] = search
-dependencies[] = content
+dependencies[] = field
 dependencies[] = number
-dependencies[] = optionwidgets
+dependencies[] = options
+dependencies[] = cck
 
-; Information added by drupal.org packaging script on 2009-06-24
-version = "6.x-1.1"
-core = "6.x"
-project = "dictionary"
-datestamp = "1245856572"
+files[] = dictionary.admin.inc
 

=== modified file 'dictionary.install'
--- dictionary.install	2011-01-25 13:12:07 +0000
+++ dictionary.install	2011-01-26 23:25:02 +0000
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function dictionary_schema() {
   $schema['dictionary_translation'] = array(
@@ -103,11 +103,12 @@
 }
 
 /**
-* Implementation of hook_install().
-*/
+ * Implements hook_install().
+ */
 function dictionary_install() {
   // Create tables.
-  drupal_install_schema('dictionary');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_install_schema('dictionary')
   // Add the node type.
   _dictionary_install_type_create();
   // Add iid field to node type.
@@ -116,18 +117,19 @@
 
 function _dictionary_install_type_create() {
   // Create an additional node type.
-  $dictionary_node_type = array(
+  $dictionary_node_type = (object)array(
     'type' => 'dictionary_term',
     'name' => t('Dictionary term'),
     'module' => 'node',
+    'base' => 'node_content',
     'description' => t('A <em>dictionary term</em> is a page of content which gives describes or defines the terms listed in the dictionary. A dictionary term is references, and all translations of that term will be listed on the <em>dictionary term</em> page.'),
     'custom' => TRUE,
     'modified' => TRUE,
     'locked' => FALSE,
+    'disabled' => FALSE,
   );
 
-  $dictionary_node_type = (object)_node_type_set_defaults($dictionary_node_type);
-  node_type_save($dictionary_node_type);
+  $status = node_type_save($dictionary_node_type);
   // Default to not promoted.
   variable_set('node_options_dictionary_term', array('status'));
 }
@@ -135,27 +137,45 @@
 function _dictionary_install_type_create_field() {
   // Create the iid reference field.
   $field = array(
-    'type_name' => 'dictionary_term',
+    'field_name' => 'dictionary_term_iid',
+    'type' => 'list_integer',
+    'entity_types' => array('node'),
+    'translatable' => FALSE,
+    'settings' => array(
+      'allowed_values' => array(),
+      'allowed_values_function' => 'cck_allowed_values_php',
+      'allowed_values_php' => "\$result = db_query('SELECT * FROM {dictionary_item} ORDER BY name');\r\n\$iids = array();\r\nforeach (\$result as \$item) {\r\n  \$iids[\$item->iid] = \$item->name;\r\n}\r\nreturn \$iids;"
+    ),
+  );
+  field_create_field($field);
+
+  $instance = array(
+    'entity_type' => 'node',
+    'bundle' => 'dictionary_term',
+    'field_name' => 'dictionary_term_iid',
     'label' => 'Dictionary item reference',
-    'field_name' => 'field_dictionary_term_iid',
-    'type' => 'number_integer',
-    'widget_type' => 'optionwidgets_select',
-    'module' => 'number',
     'description' => 'The dictionary term that is being described in this node',
-    'weight' => -4,
+    'widget_type' => 'options_select',
+    'settings' => array(),
+    'display' => array(
+      'default' => array(
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ),
+      'teaser' => array(
+        'label' => 'hidden',
+        'type' => 'hidden',
+      ),
+    ),
     'required' => TRUE,
-    'multiple' => FALSE,
-    'allowed_values_php' => "\$result = db_query('SELECT * FROM {dictionary_item} ORDER BY name');\r\n\$iids = array();\r\nwhile (\$item = db_fetch_object(\$result)) {\r\n  \$iids[\$item->iid] = \$item->name;\r\n}\r\nreturn \$iids;",
-    'display_settings' => array('teaser' => array('exclude' => TRUE), 'full' => array('exclude' => TRUE)),
-    'op' => 'Save field settings',
   );
-  module_load_include('inc', 'content', 'includes/content.crud');
-  $created_field = content_field_instance_create($field);
+  field_create_instance($instance);
 }
 
 /**
-* Implementation of hook_uninstall().
-*/
+ * Implements hook_uninstall().
+ */
 function dictionary_uninstall() {
-  drupal_uninstall_schema('dictionary');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_uninstall_schema('dictionary')
 }

=== modified file 'dictionary.module'
--- dictionary.module	2011-01-25 13:12:07 +0000
+++ dictionary.module	2011-01-26 23:18:52 +0000
@@ -7,19 +7,28 @@
  */
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function dictionary_perm() {
-  return array('administer dictionary', 'access dictionary');
+function dictionary_permission() {
+  return array(
+    'administer dictionary' => array(
+      'title' => t('administer dictionary'),
+      'description' => t('TODO Add a description for \'administer dictionary\''),
+    ),
+    'access dictionary' => array(
+      'title' => t('access dictionary'),
+      'description' => t('TODO Add a description for \'access dictionary\''),
+    ),
+  );
 }
 
 /**
- * Implementation of hook_theme()
+ * Implements hook_theme().
  */
 function dictionary_theme() {
   return array(
     'dictionary' => array(
-    'arguments' => array(
+    'variables' => array(
       'lid1' => 1,
       'lid2' => 1,
       'empty' => '-',
@@ -27,33 +36,40 @@
       'template' => 'dictionary',
     ),
     'dictionary_translations' => array(
-      'arguments' => array(),
+      'variables' => array(),
     ),
     'dictionary_list' => array(
-      'arguments' => array(
+      'variables' => array(
         'translations' => NULL,
       ),
     ),
     'dictionary_language_select' => array(
-      'arguments' => array(
-        'element' => NULL,
-      ),
+      'render element' => 'element',
     ),
     'dictionary_item_select' => array(
-      'arguments' => array(
-        'element' => NULL,
-      ),
+      'render element' => 'element',
     ),
   );
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_preprocess_node(&$variables) {
-  $translations = db_query('SELECT t.name AS tname, l.name AS lname FROM {dictionary_translation} t INNER JOIN {dictionary_language} l ON t.lid = l.lid WHERE t.iid = %d ORDER BY l.name, t.name', $variables['node']->field_dictionary_term_iid[0]['value']);
-  while ($translation = db_fetch_object($translations)) {
-    $variables['translations'][] = array($translation->lname, $translation->tname);
+  if (!empty($variables['node']->field_dictionary_term_iid)) {
+    $translations = db_query('SELECT t.name AS tname, l.name AS lname FROM {dictionary_translation} t INNER JOIN {dictionary_language} l ON t.lid = l.lid WHERE t.iid = :t.iid ORDER BY l.name, t.name', array(':t.iid' => $variables['node']->field_dictionary_term_iid[0]['value']));
+
+    foreach ($translations as $translation) {
+      $variables['translations'][] = array($translation->lname, $translation->tname);
+    }
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_preprocess_dictionary(&$variables) {
   $variables['dictionary']['head'] = variable_get('dictionary_head', '');
   $variables['dictionary']['from'] = dictionary_language_load($variables['lid1']);
@@ -61,42 +77,56 @@
   $variables['dictionary']['translations'] = dictionary_get_translations($variables['dictionary']['from'], $variables['dictionary']['to']);
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_page($lid1 = 1, $lid2 = 1) {
-  drupal_add_css(drupal_get_path('module', 'dictionary') .'/dictionary.css');
-  return theme('dictionary', $lid1, $lid2);
-}
-
-function theme_dictionary_list($translations) {
-  return theme('item_list', $translations, NULL, 'ul', array('class' => 'dictionary-translations'));
-}
-
-function theme_dictionary_translations($from, $to, $translations, $empty = '-') {
+  drupal_add_css(drupal_get_path('module', 'dictionary') . '/dictionary.css');
+  return theme('dictionary', array('lid1' => $lid1, 'lid2' => $lid2));
+}
+
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_dictionary_list($variables) {
+  $translations = $variables['translations'];
+  return theme('item_list', array('items' => $translations, 'title' => NULL, 'type' => 'ul', 'attributes' => array('class' => 'dictionary-translations')));
+}
+
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_dictionary_translations() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
   $rows = array();
   foreach ($translations as $translation) {
     if (!$translation['nid']) {
       $sourcetext = check_plain($translation['source']->name);
     }
     else {
-      $sourcetext = l($translation['source']->name, 'node/'. $translation['nid']);
+      $sourcetext = l($translation['source']->name, 'node/' . $translation['nid']);
     }
     $targets = array();
     foreach ($translation['targets'] as $target) {
-      $targets[] = check_plain($target->name);  
+      $targets[] = check_plain($target->name);
     }
     if (empty($targets)) {
       $targets[] = $empty;
     }
-    $rows[] = array('source' => $sourcetext, 'translations' => theme('dictionary_list', $targets));
+    $rows[] = array('source' => $sourcetext, 'translations' => theme('dictionary_list', array('translations' => $targets)));
   }
   if (empty($rows)) {
     $rows[] = array(array('data' => t('No translations available.'), 'colspan' => '2'));
   }
   $header = array($from->name, $to->name);
-  return theme('table', $header, $rows, array('id' => 'dictionary'));
+  return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'dictionary')));
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function dictionary_menu() {
   $items['admin/content/dictionary'] = array(
@@ -105,6 +135,7 @@
     'page callback' => 'drupal_get_form',
     'page arguments' => array('dictionary_form_settings'),
     'access arguments' => array('administer dictionary'),
+    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
     'file' => 'dictionary.admin.inc'
   );
 
@@ -233,15 +264,26 @@
   return $items;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_save_language(&$edit) {
   if (!empty($edit['lid']) && !empty($edit['name'])) {
     drupal_write_record('dictionary_language', $edit, 'lid');
 
     // update all items that have a translation in that language
-    $iids = db_query("SELECT i.iid FROM {dictionary_item} i INNER JOIN {dictionary_translation} t ON i.iid = t.iid WHERE t.lid = %d", $edit['lid']);
-    $time = time();
-    while ($item = db_fetch_object($iids)) {
-      db_query("UPDATE {dictionary_item} SET changed = %d WHERE iid = %d", $time, $item->iid);
+    $iids = db_query("SELECT i.iid FROM {dictionary_item} i INNER JOIN {dictionary_translation} t ON i.iid = t.iid WHERE t.lid = :t.lid", array(':t.lid' => $edit['lid']));
+    $time = REQUEST_TIME;
+    foreach ($iids as $item) {
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("UPDATE {dictionary_item} SET changed = %d WHERE iid = %d", $time, $item->iid) */
+      db_update('dictionary_item')
+        ->fields(array(
+              'changed' => $time,
+            ))
+        ->condition('iid', $item->iid)
+        ->execute();
     }
 
     module_invoke_all('dictionary', 'update', 'language', $edit);
@@ -273,20 +315,31 @@
   $language = (array) dictionary_language_load($lid);
 
   // update all items that have a translation in that language
-  $iids = db_query("SELECT i.iid FROM {dictionary_item} i INNER JOIN {dictionary_translation} t ON i.iid = t.iid WHERE t.lid = %d", $lid);
-  $time = time();
-  while ($item = db_fetch_object($iids)) {
-    db_query("UPDATE {dictionary_item} SET changed = %d WHERE iid = %d", $time, $item->iid);
+  $iids = db_query("SELECT i.iid FROM {dictionary_item} i INNER JOIN {dictionary_translation} t ON i.iid = t.iid WHERE t.lid = :lid", array(':lid' => $lid));
+  $time = REQUEST_TIME;
+  foreach ($iids as $item) {
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("UPDATE {dictionary_item} SET changed = %d WHERE iid = %d", $time, $item->iid) */
+    db_update('dictionary_item')
+  ->fields(array(
+      'changed' => $time,
+    ))
+  ->condition('iid', $item->iid)
+  ->execute();
   }
 
   // delete all translations in that languag
-  $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = %d', $lid);
-  while ($translation = db_fetch_object($result)) {
+  $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = :lid', array(':lid' => $lid));
+  foreach ($result as $translation) {
     dictionary_del_translation($translation->tid);
   }
 
   // delete language
-  db_query('DELETE FROM {dictionary_language} WHERE lid = %d', $lid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('DELETE FROM {dictionary_language} WHERE lid = %d', $lid) */
+  db_delete('dictionary_language')
+  ->condition('lid', $lid)
+  ->execute();
 
   module_invoke_all('dictionary', 'delete', 'language', $language);
 
@@ -295,6 +348,10 @@
   return SAVED_DELETED;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_save_item(&$edit) {
   if (!empty($edit['iid']) && !empty($edit['name'])) {
     drupal_write_record('dictionary_item', $edit, 'iid');
@@ -328,13 +385,17 @@
   $item = (array) dictionary_item_load($iid);
 
   // delete all translations for that item
-  $result = db_query('SELECT * FROM {dictionary_translation} WHERE iid = %d', $iid);
-  while ($translation = db_fetch_object($result)) {
+  $result = db_query('SELECT * FROM {dictionary_translation} WHERE iid = :iid', array(':iid' => $iid));
+  foreach ($result as $translation) {
     dictionary_del_translation($translation->tid);
   }
 
   // delete item
-  db_query('DELETE FROM {dictionary_item} WHERE iid = %d', $iid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('DELETE FROM {dictionary_item} WHERE iid = %d', $iid) */
+  db_delete('dictionary_item')
+  ->condition('iid', $iid)
+  ->execute();
 
   module_invoke_all('dictionary', 'delete', 'item', $item);
 
@@ -391,9 +452,20 @@
   $translation = dictionary_translation_load($tid);
 
   // update item changed time
-  db_query("UPDATE {dictionary_item} SET changed = %d WHERE iid = %d", time(), $translation->iid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("UPDATE {dictionary_item} SET changed = %d WHERE iid = %d", REQUEST_TIME, $translation->iid) */
+  db_update('dictionary_item')
+  ->fields(array(
+    'changed' => REQUEST_TIME,
+  ))
+  ->condition('iid', $translation->iid)
+  ->execute();
 
-  db_query('DELETE FROM {dictionary_translation} WHERE tid = %d', $tid);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('DELETE FROM {dictionary_translation} WHERE tid = %d', $tid) */
+  db_delete('dictionary_translation')
+  ->condition('tid', $tid)
+  ->execute();
 
   module_invoke_all('dictionary', 'delete', 'translation', $translation);
 
@@ -426,7 +498,8 @@
 /**
  * We use the default selection field for choosing languages.
  */
-function theme_dictionary_language_select($element) {
+function theme_dictionary_language_select($variables) {
+  $element = $variables['element'];
   return theme('select', $element);
 }
 
@@ -453,7 +526,8 @@
 /**
  * We use the default selection field for choosing items.
  */
-function theme_dictionary_item_select($element) {
+function theme_dictionary_item_select($variables) {
+  $element = $variables['element'];
   return theme('select', $element);
 }
 
@@ -469,6 +543,10 @@
   return $form;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function dictionary_form_from_to_submit($form, &$form_state) {
   $form_state['redirect'] = 'dictionary/' . $form_state['values']['lid1'] . '/' . $form_state['values']['lid2'];
 }
@@ -481,7 +559,7 @@
   $result = db_query('SELECT * FROM {dictionary_item} ORDER BY name');
 
   $items = array();
-  while ($item = db_fetch_object($result)) {
+  foreach ($result as $item) {
     $items[$item->iid] = $item;
   }
 
@@ -496,7 +574,7 @@
   $result = db_query('SELECT * FROM {dictionary_language} ORDER BY name');
 
   $languages = array();
-  while ($lang = db_fetch_object($result)) {
+  foreach ($result as $lang) {
     $languages[$lang->lid] = $lang;
   }
 
@@ -517,17 +595,18 @@
  *   and an array of target translations 'targets'.
  */
 function dictionary_get_translations($from, $to) {
-  $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = %d ORDER BY name', $from->lid);
+  $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = :lid ORDER BY name', array(':lid' => $from->lid));
   $data = array();
-  while ($source = db_fetch_object($result)) {
+  foreach ($result as $source) {
+    // TODO Please convert this statement to the D7 database API syntax.
     $nid = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid as nid FROM {node} n LEFT JOIN {content_type_dictionary_term} dt ON n.nid = dt.nid WHERE dt.field_dictionary_term_iid_value = %d'), $source->iid));
-    $translations = db_query('SELECT * FROM {dictionary_translation} WHERE lid = %d AND iid = %d ORDER BY name', $to->lid, $source->iid);
+    $translations = db_query('SELECT * FROM {dictionary_translation} WHERE lid = :lid AND iid = :iid ORDER BY name', array(':lid' => $to->lid, ':iid' => $source->iid));
     $targets = array();
-    while ($target = db_fetch_object($translations)) {
+    foreach ($translations as $target) {
       $targets[] = $target;
     }
     $data[] = array('source' => $source, 'targets' => $targets, 'nid' => $nid->nid);
-   }
+  }
   return $data;
 }
 
@@ -535,9 +614,9 @@
  * Find all translations associated with the given item.
  */
 function dictionary_get_translations_by_item($iid) {
-  $result = db_query('SELECT * FROM {dictionary_translation} WHERE iid = %d ORDER BY name', $iid);
+  $result = db_query('SELECT * FROM {dictionary_translation} WHERE iid = :iid ORDER BY name', array(':iid' => $iid));
   $translations = array();
-  while ($translation = db_fetch_object($result)) {
+  foreach ($result as $translation) {
     $translations[$translation->tid] = $translation;
   }
   return $translations;
@@ -547,9 +626,9 @@
  * Find all translations associated with the given language.
  */
 function dictionary_get_translations_by_language($lid) {
-  $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = %d ORDER BY name', $lid);
+  $result = db_query('SELECT * FROM {dictionary_translation} WHERE lid = :lid ORDER BY name', array(':lid' => $lid));
   $translations = array();
-  while ($translation = db_fetch_object($result)) {
+  foreach ($result as $translation) {
     $translations[$translation->tid] = $translation;
   }
   return $translations;
@@ -569,7 +648,7 @@
   static $languagues = array();
 
   if (!isset($languages[$lid])) {
-    $languages[$lid] = db_fetch_object(db_query('SELECT * FROM {dictionary_language} WHERE lid = %d', $lid));
+    $languages[$lid] = db_query('SELECT * FROM {dictionary_language} WHERE lid = :lid', array(':lid' => $lid))->fetchObject();
   }
 
   // Return FALSE if this language does not exist.
@@ -590,7 +669,7 @@
   static $items = array();
 
   if (!isset($items[$iid])) {
-    $items[$iid] = db_fetch_object(db_query('SELECT * FROM {dictionary_item} WHERE iid = %d', $iid));
+    $items[$iid] = db_query('SELECT * FROM {dictionary_item} WHERE iid = :iid', array(':iid' => $iid))->fetchObject();
   }
 
   // Return FALSE if this item does not exist.
@@ -611,7 +690,7 @@
   static $translations = array();
 
   if (!isset($translations[$tid])) {
-    $translations[$tid] = db_fetch_object(db_query('SELECT * FROM {dictionary_translation} WHERE tid = %d', $tid));
+    $translations[$tid] = db_query('SELECT * FROM {dictionary_translation} WHERE tid = :tid', array(':tid' => $tid))->fetchObject();
   }
 
   // Return FALSE if this translation does not exist.
@@ -619,21 +698,19 @@
 }
 
 /**
- * Implementation of hook_hook_info().
+ * Implements hook_trigger_info().
  */
-function dictionary_hook_info() {
+function dictionary_trigger_info() {
   return array(
     'dictionary' => array(
-      'dictionary' => array(
-        'insert' => array(
-          'runs when' => t('After saving new dictionary data to the database'),
-        ),
-        'update' => array(
-          'runs when' => t('After saving updated dictionary data to the database'),
-        ),
-        'delete' => array(
-          'runs when' => t('After deleting dictionary data')
-        ),
+      'dictionary_insert' => array(
+        'label' => t('After saving new dictionary data to the database'),
+      ),
+      'dictionary_update' => array(
+        'label' => t('After saving updated dictionary data to the database'),
+      ),
+      'dictionary_delete' => array(
+        'label' => t('After deleting dictionary data'),
       ),
     ),
   );
@@ -644,27 +721,28 @@
  */
 function dictionary_get_extra_content($nid) {
   $extra = '';
-  $dictionary_term = db_fetch_object(db_query('SELECT * FROM {content_type_dictionary_term} WHERE nid = %d', $nid));
-  $results = db_query('SELECT t.name AS tname, l.name AS lname FROM {dictionary_translation} t INNER JOIN {dictionary_language} l WHERE t.iid = %d AND l.lid = t.lid ORDER BY l.name, t.name', $dictionary_term->field_dictionary_term_iid_value);
-  while ($next = db_fetch_object($results)) {
+  $dictionary_term = db_query('SELECT * FROM {content_type_dictionary_term} WHERE nid = :nid', array(':nid' => $nid))->fetchObject;
+  $results = db_query('SELECT t.name AS tname, l.name AS lname FROM {dictionary_translation} t INNER JOIN {dictionary_language} l WHERE t.iid = :t.iid AND l.lid = :l.lid ORDER BY l.name, t.name', array(':t.iid' => $dictionary_term->field_dictionary_term_iid_value, ':l.lid' => t . lid));
+  foreach ($results as $next) {
     $extra .= '<p>' . $next->lname . ': ' . $next->tname . ';</p>';
   }
   return $extra;
 }
 
 /**
- * Implementation of hook_update_index().
+ * Implements hook_update_index().
  */
 function dictionary_update_index() {
   $last = variable_get('dictionary_cron_last', 0);
-  $limit = (int)variable_get('search_cron_limit', 100);
-
-  $result = db_query_range(db_rewrite_sql('SELECT n.nid, c.last_comment_timestamp, di.changed AS translation_changed FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid LEFT JOIN {content_type_dictionary_term} ctt ON n.nid = ctt.nid LEFT JOIN {dictionary_item} di ON ctt.field_dictionary_term_iid_value = di.iid WHERE n.status = 1 AND n.moderate = 0 AND ((n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d) OR (di.changed > %d)) ORDER BY GREATEST(n.created, n.changed, c.last_comment_timestamp, di.changed) ASC'), $last, $last, $last, $last, 0, $limit);
-
-  while ($node = db_fetch_object($result)) {
+  $limit = (int) variable_get('search_cron_limit', 100);
+
+  // TODO Please convert this statement to the D7 database API syntax.
+  $result = db_query_range(db_rewrite_sql('SELECT n.nid, c.last_comment_timestamp, di.changed AS translation_changed FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid LEFT JOIN {content_type_dictionary_term} ctt ON n.nid = ctt.nid LEFT JOIN {dictionary_item} di ON ctt.field_dictionary_term_iid_value = di.iid WHERE n.status = 1 AND n.moderate = 0 AND ((n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d) OR (di.changed > %d)) ORDER BY GREATEST(n.created, n.changed, c.last_comment_timestamp, di.changed) ASC'), $last, $last, $last, $last);
+
+  foreach ($result as $node) {
     $last_comment = $node->last_comment_timestamp;
     $last_translation = $node->translation_changed;
-    $node = node_load(array('nid' => $node->nid));
+    $node = node_load($node->nid);
 
     // We update this variable per node in case cron times out, or if the node
     // cannot be indexed (PHP nodes which call drupal_goto, for example).
@@ -680,9 +758,9 @@
       $node = node_prepare($node, FALSE);
     }
     // Allow modules to change $node->body before viewing.
-    node_invoke_nodeapi($node, 'view', FALSE, FALSE);
+    module_invoke_all('node_view', $node, FALSE);
 
-    $text = '<h1>'. $node->title .'</h1>'. $node->body;
+    $text = '<h1>' . $node->title . '</h1>' . $node->body;
 
     // Fetch extra data normally not visible
     $text .= dictionary_get_extra_content($node->nid);
@@ -693,7 +771,7 @@
 }
 
 /**
- * Implementation of hook_search().
+ * Implements hook_search().
  */
 function dictionary_search($op = 'search', $keys = NULL) {
   switch ($op) {
@@ -708,8 +786,10 @@
     case 'status':
       $last = variable_get('dictionary_cron_last', 0);
       $last_iid = variable_get('dictionary_cron_last_iid', 0);
-      $total = db_result(db_query(db_rewrite_sql("SELECT COUNT(*) FROM {node} n WHERE n.type = 'dictionary_term'")));
-      $remaining = db_result(db_query(db_rewrite_sql("SELECT COUNT(*) FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid LEFT JOIN {content_type_dictionary_term} t ON n.nid = t.nid WHERE n.status = 1 AND n.type = 'dictionary_term' AND ((GREATEST(n.created, n.changed, c.last_comment_timestamp) = %d AND t.field_dictionary_term_iid_value > %d ) OR (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d))"), $last, $last_iid, $last, $last, $last));
+      // TODO Please convert this statement to the D7 database API syntax.
+      $total = db_query(db_rewrite_sql("SELECT COUNT(*) FROM {node} n WHERE n.type = 'dictionary_term'"))->fetchField();
+      // TODO Please convert this statement to the D7 database API syntax.
+      $remaining = db_query(db_rewrite_sql("SELECT COUNT(*) FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid LEFT JOIN {content_type_dictionary_term} t ON n.nid = t.nid WHERE n.status = 1 AND n.type = 'dictionary_term' AND ((GREATEST(n.created, n.changed, c.last_comment_timestamp) = %d AND t.field_dictionary_term_iid_value > %d ) OR (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d))"), $last, $last_iid, $last, $last, $last)->fetchField();
       return array('remaining' => $remaining, 'total' => $total);
 
     case 'search':
@@ -730,22 +810,22 @@
       // Used to avoid joining on node_comment_statistics twice
       $stats_join = FALSE;
       $total = 0;
-      if ($weight = (int)variable_get('node_rank_relevance', 5)) {
+      if ($weight = (int) variable_get('node_rank_relevance', 5)) {
         // Average relevance values hover around 0.15
         $ranking[] = '%d * i.relevance';
         $arguments2[] = $weight;
         $total += $weight;
       }
-      if ($weight = (int)variable_get('node_rank_recent', 5)) {
+      if ($weight = (int) variable_get('node_rank_recent', 5)) {
         // Exponential decay with half-life of 6 months, starting at last indexed node
         $ranking[] = '%d * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp)) - %d) * 6.43e-8)';
         $arguments2[] = $weight;
-        $arguments2[] = (int)variable_get('node_cron_last', 0);
+        $arguments2[] = (int) variable_get('node_cron_last', 0);
         $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid';
         $stats_join = TRUE;
         $total += $weight;
       }
-      if (module_exists('comment') && $weight = (int)variable_get('node_rank_comments', 5)) {
+      if (module_exists('comment') && $weight = (int) variable_get('node_rank_comments', 5)) {
         // Inverse law that maps the highest reply count on the site to 1 and 0 to 0.
         $scale = variable_get('node_cron_comments_scale', 0.0);
         $ranking[] = '%d * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * %f))';
@@ -757,7 +837,7 @@
         $total += $weight;
       }
       if (module_exists('statistics') && variable_get('statistics_count_content_views', 0) &&
-          $weight = (int)variable_get('node_rank_views', 5)) {
+          $weight = (int) variable_get('node_rank_views', 5)) {
         // Inverse law that maps the highest view count on the site to 1 and 0 to 0.
         $scale = variable_get('node_cron_views_scale', 0.0);
         $ranking[] = '%d * (2.0 - 2.0 / (1.0 + MAX(nc.totalcount) * %f))';
@@ -779,7 +859,7 @@
       }
 
       // Do search.
-      $find = do_search($keys, 'dictionary', 'INNER JOIN {node} n ON n.nid = i.sid '. $join1, $conditions1 . (empty($where1) ? '' : ' AND '. $where1), $arguments1, $select2, $join2, $arguments2);
+      $find = do_search($keys, 'dictionary', 'INNER JOIN {node} n ON n.nid = i.sid ' . $join1, $conditions1 . (empty($where1) ? '' : ' AND ' . $where1), $arguments1, $select2, $join2, $arguments2);
 
       // Load results.
       $results = array();
@@ -790,11 +870,11 @@
         $node = node_build_content($node, FALSE, FALSE);
         $node->body = drupal_render($node->content);
 
-        $extra = node_invoke_nodeapi($node, 'search result');
-        $results[] = array('link' => url('node/'. $item->sid, array('absolute' => TRUE)),
-                           'type' => node_get_types('name', $node),
+        $extra = module_invoke_all('node_search_result', $node);
+        $results[] = array('link' => url('node/' . $item->sid, array('absolute' => TRUE)),
+                           'type' => node_type_get_name($node),
                            'title' => $node->title,
-                           'user' => theme('username', $node),
+                           'user' => theme('username', array('account' => $node)),
                            'date' => $node->changed,
                            'node' => $node,
                            'extra' => $extra,

