Only in ./: .DS_Store
Only in ./: .cvsignore
diff -up ./search_block.info ../search_block_D6/search_block.info
--- ./search_block.info	2008-06-25 12:49:12.000000000 -0400
+++ ../search_block_D6/search_block.info	2008-06-16 12:42:41.000000000 -0400
@@ -1,10 +1,9 @@
-name = Restricted Search
-description = "Enables restricting entire content types or nodes from the search engine"
-package = "Search"
-dependencies = search
-
 ; Information added by drupal.org packaging script on 2008-04-24
-version = "5.x-1.x-dev"
+version = "6.x-1.x-dev"
 project = "search_block"
-datestamp = "1208996116"
 
+name = Restricted Search
+description = "Enables restricting entire content types or nodes from the search engine"
+core = 6.x
+package = "Search"
+dependencies[] = search
\ No newline at end of file
diff -up ./search_block.install ../search_block_D6/search_block.install
--- ./search_block.install	2008-06-25 12:49:12.000000000 -0400
+++ ../search_block_D6/search_block.install	2008-06-25 12:44:36.000000000 -0400
@@ -3,33 +3,60 @@
 //$Id: search_block.install,v 1.1.4.1 2007/10/16 18:27:30 deviantintegral Exp $
 
 /**
+ * Implementation of hook_schema
+ */
+function search_block_schema() {
+  $schema['search_block'] = array(
+    'description' => t('The table to track nodes that are excluded from the search index.'),
+    'fields' => array(
+      'nid' => array(
+        'description' => t('Node ID'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'enabled' => array(
+        'type' => 'int',  // There is no BOOL type in $schema; use tinyint instead.
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0),
+      'dirty' => array(
+        'type' => 'int',  // There is no BOOL type in $schema; use tinyint instead.
+        'size' => 'tiny',
+        'not null' => TRUE,
+        'default' => 0),
+    ),
+    'primary key' => array('nid'),
+  );
+  
+  return $schema;
+}
+
+/**
  * Implementation of hook_install
  *
  */
 function search_block_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $q1 = db_query("CREATE TABLE IF NOT EXISTS {search_block} (
-                nid int(10) unsigned NOT NULL default '0',
-                enabled BOOL NOT NULL default '0',
-                dirty BOOL NOT NULL default '0',
-                PRIMARY KEY  (nid)
-            ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
-
-      if ($q1) {
-        $created = TRUE;
-      }
-      break;
-
-    case 'pgsql':
-      break;
-  }
-
-  if ($created) {
+  $created = drupal_install_schema('search_block');
+  if ($created[0]['success']) {
     drupal_set_message(t('Search Block module installed successfully.'));
   }
   else {
-    drupal_set_message(t('Table installation for the Search Block module was unsuccessful. The tables may need to be installed by hand. See the search_block.install file for a list of the installation queries.'), 'error');
+    drupal_set_message(t('Table installation for the Search Block module was unsuccessful. The tables may need to be installed by hand. See the search_block.install file for the database schema. Alternatively, see search_block.install for Drupal 5.x for the complete SQL command for MySQL.'), 'error');
   }
 }
+
+/**
+ * Implementation of hook_uninstall
+ */
+function search_block_uninstall() {
+  // Remove DB tables.
+  drupal_uninstall_schema('search_block');
+
+  // Delete variables.
+  $types = node_get_types();
+  foreach ($types as $type => $object) {
+    variable_del('search_block_'. $type);
+    variable_del('search_block_previous_.'. $type);
+  }
+}
\ No newline at end of file
diff -up ./search_block.module ../search_block_D6/search_block.module
--- ./search_block.module	2008-06-25 12:49:12.000000000 -0400
+++ ../search_block_D6/search_block.module	2008-06-25 12:44:40.000000000 -0400
@@ -10,25 +10,22 @@
 /**
  * Implementation of hook_menu().
  */
-function search_block_menu($may_cache) {
-  $items = array();
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/search/main',
-      'title' => t('Main'),
+function search_block_menu() {
+    $items['admin/settings/search/main'] = array(
+      'title' => 'Main',
+      'access callback' => 'user_access',
+      'access arguments' => array('administer search'),
       'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10,
     );
-    $items[] = array(
-      'path' => 'admin/settings/search/restrict',
-      'title' => t('Restrict Search'),
-      'description' => t('Restrict the node types that are searched.'),
-      'callback' => 'search_block_restrict_page',
+    $items['admin/settings/search/restrict'] = array(
+      'title' => 'Restrict Search',
+      'description' => 'Restrict the node types that are searched.',
+      'access callback' => 'user_access',
+      'access arguments' => array('restrict searches'),
+      'page callback' => 'search_block_restrict_page',
       'type' => MENU_LOCAL_TASK,
-      'access' => user_access('restrict searches'),
     );
-  }
+
   return $items;
 }
 
@@ -36,7 +33,7 @@ function search_block_menu($may_cache) {
  * Menu Callback; provides a page to restrict or allow search settings
  * for each Node type
  */
-function search_block_restrict_page(){
+function search_block_restrict_page() {
   $output = "<p>Restrict search results by node type.</p>";
   $output .= drupal_get_form('search_block_restrict_form');
   return $output;
@@ -45,12 +42,12 @@ function search_block_restrict_page(){
 /**
  * Implementation of hook_form()
  */
-function search_block_restrict_form(){
+function search_block_restrict_form() {
   $types = node_get_types($op = 'types', $node);
 
-  foreach($types as $key => $array){
-    $enabled = variable_get('search_block_' . $key, FALSE);
-    if ($enabled){
+  foreach ($types as $key => $array) {
+    $enabled = variable_get('search_block_'. $key, FALSE);
+    if ($enabled) {
       $icon = theme('image', 'misc/watchdog-error.png', t('error'), t('error'));
     }
     else {
@@ -74,8 +71,8 @@ function search_block_restrict_form(){
 /**
  * Implementation of hook_form_submit
  */
-function search_block_restrict_form_submit($form, $form_values) {
-  foreach($form_values as $key => $data){
+function search_block_restrict_form_submit($form, &$form_state) {
+  foreach ($form_state['values'] as $key => $data) {
     switch ($key) {
       case 'op':
       case 'submit':
@@ -83,7 +80,7 @@ function search_block_restrict_form_subm
       case 'form_id':
         break;
       default:
-        variable_set('search_block_' . $key, $data);
+        variable_set('search_block_'. $key, $data);
     }
   }
   drupal_set_message(t('Your restricted search settings have been saved.'));
@@ -100,7 +97,7 @@ function search_block_perm() {
  /**
   * Implementation of hook_form_alter
   */
-function search_block_form_alter($form_id, &$form) {
+function search_block_form_alter(&$form, $form_state, $form_id) {
   if (isset($form['type'])) {
     $type = $form['type']['#value'];
   }
@@ -110,7 +107,7 @@ function search_block_form_alter($form_i
   
   $enabled = variable_get('search_block_'. $type, FALSE);
 
-  switch($form_id) {
+  switch ($form_id) {
     case 'node_type_form':
       // Display each radio option
       $form['workflow']['search_block'] = array(
@@ -129,7 +126,7 @@ function search_block_form_alter($form_i
     // Here, we allow for a per-node search block.
     // This is not shown if the content is globally blocked
     // Perhaps we want to include the reverse option (index a single node)?
-    case $type . '_node_form':
+    case $type .'_node_form':
       if (user_access('restrict searches')) {
         $form['search_block_set'] = array(
           '#type' => 'fieldset',
@@ -137,7 +134,7 @@ function search_block_form_alter($form_i
           '#collapsible' => TRUE,
           '#collapsed' => TRUE,
         );
-        if(!$enabled) {
+        if (!$enabled) {
           $form['search_block_set']['search_block'] = array(
             '#type' => 'checkbox',
             '#title' => t('Restrict this node from the search index'),
@@ -172,13 +169,13 @@ function search_block_form_alter($form_i
  */
 function search_block_nodeapi(&$node, $op, $teaser, $page) {
   $type_enabled = variable_get('search_block_'. $node->type, FALSE);
-  switch($op) {
+  switch ($op) {
     case 'validate':
       break;
     case 'load':
       $query = "SELECT enabled FROM {search_block} WHERE nid = %d";
       $result = db_query($query, $node->nid);
-      if((db_result($result, 0) == TRUE) || $type_enabled) {
+      if ((db_result($result) == TRUE) || $type_enabled) {
         $node->search_block = TRUE;
       }
       else {
@@ -187,7 +184,7 @@ function search_block_nodeapi(&$node, $o
       break;
     case 'insert':
       $query = "";
-      if($node->search_block || $type_enabled) {
+      if ($node->search_block || $type_enabled) {
         $query = "INSERT INTO {search_block} VALUES ('%d', '1', '1')";
       }
       else {
@@ -197,7 +194,7 @@ function search_block_nodeapi(&$node, $o
       break;
     case 'update':
       $query = "";
-      if($node->search_block || $type_enabled) {
+      if ($node->search_block || $type_enabled) {
         $query = "INSERT INTO {search_block} (nid, enabled, dirty) VALUES ('%d', '1', '1')
           ON DUPLICATE KEY UPDATE enabled='1', dirty='1'";
       }
@@ -217,7 +214,7 @@ function search_block_nodeapi(&$node, $o
 }
 
 /**
- * Implementatino of hook_update_index
+ * Implementation of hook_update_index
  *
  * We might have a race condition here with other instances
  * of module's hook_update_index, but I'm not sure and it's
@@ -226,9 +223,8 @@ function search_block_nodeapi(&$node, $o
 function search_block_update_index() {
   $query = "SELECT nid FROM {search_block} WHERE enabled='1' AND dirty='1'";
   $result = db_query($query);
-  $row = 0;
-  while($nid = db_result($result, $row++)) {
-    watchdog('search_block', 'Dropping index for nid ' . $nid);
+  while($nid = db_result($result)) {
+    watchdog('search_block', 'Dropping index for nid '. $nid);
     search_index($nid, 'node', '');
     $query = "UPDATE {search_block} SET dirty='0' WHERE nid=%d";
     db_query($query, $nid);
@@ -249,32 +245,32 @@ function search_block_update_index() {
  */
 function search_block_cron() {
   $types= node_get_types();
-  foreach($types as $type=>$object) {
-    $enabled = variable_get('search_block_' . $type, FALSE);
-    $previous = variable_get('search_block_previous_' . $type, FALSE);
-    if($previous < $enabled) {
-      watchdog('search_block', 'Enabling and setting dirty for ' . $type);
+  foreach ($types as $type => $object) {
+    $enabled = variable_get('search_block_'. $type, FALSE);
+    $previous = variable_get('search_block_previous_'. $type, FALSE);
+    if ($previous < $enabled) {
+      watchdog('search_block', 'Enabling and setting dirty for '. $type);
       $query = "SELECT DISTINCT nid FROM {node} WHERE type='%s'";
       $result = db_query($query, $type);
       $row = 0;
-      while($nid = db_result($result, $row++)) {
+      while ($nid = db_result($result)) {
         $query = "INSERT INTO {search_block} (nid, enabled, dirty) VALUES ('%d', '1', '1')
           ON DUPLICATE KEY UPDATE enabled='1', dirty='1'";
         db_query($query, $nid);
       }
-      variable_set('search_block_previous_' . $type, $enabled);
+      variable_set('search_block_previous_'. $type, $enabled);
     }
     else if ($previous > $enabled) {
-      watchdog('search_block', 'Disabling and clearing dirty for ' . $type);
+      watchdog('search_block', 'Disabling and clearing dirty for '. $type);
       $query = "SELECT DISTINCT nid FROM {node} WHERE type='%s'";
       $result = db_query($query, $type);
       $row = 0;
-      while($nid = db_result($result, $row++)) {
+      while ($nid = db_result($result)) {
         $query = "INSERT INTO {search_block} (nid, enabled, dirty) VALUES ('%d', '0', '1')
           ON DUPLICATE KEY UPDATE enabled=0, dirty=1";
         db_query($query, $nid);
       }
-      variable_set('search_block_previous_' . $type, $enabled);
+      variable_set('search_block_previous_'. $type, $enabled);
     }
   }
   
@@ -284,7 +280,7 @@ function search_block_cron() {
   $result = db_query($query);
   
   $row = 0;
-  while($nid = db_result($result, $row++)) {
+  while ($nid = db_result($result)) {
     _search_block_reindex(node_load($nid));
     $query = "UPDATE {search_block} SET dirty=0 WHERE nid=%d";
     db_query($query, $nid);
@@ -299,17 +295,18 @@ function search_block_cron() {
  */
 function _search_block_reindex($node) {
   // Build the node body.
+  $node->build_mode = NODE_BUILD_SEARCH_INDEX;
   $node = node_build_content($node, FALSE, FALSE);
   $node->body = drupal_render($node->content);
-  
+
   $text = '<h1>'. check_plain($node->title) .'</h1>'. $node->body;
-  
+
   // Fetch extra data normally not visible
   $extra = node_invoke_nodeapi($node, 'update index');
   foreach ($extra as $t) {
     $text .= $t;
   }
-  
+
   // Update index
   search_index($node->nid, 'node', $text);
 }
\ No newline at end of file
Only in ./: search_block_port_to_D6.patch
