? .project
? .settings
? 567100.patch
? sites/all/modules/devel
? sites/all/modules/devel-7.x-1.x-dev.tar.gz
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.11
diff -u -p -r1.11 search.admin.inc
--- modules/search/search.admin.inc	29 Aug 2009 21:05:16 -0000	1.11
+++ modules/search/search.admin.inc	5 Sep 2009 13:51:11 -0000
@@ -110,14 +110,24 @@ function search_admin_settings() {
     '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.')
   );
 
+  $module_names = _search_get_module_names();
   $form['search_active_modules'] = array(
     '#type' => 'checkboxes',
     '#title' => t('Active search modules'),
     '#default_value' => array('node', 'user'),
-    '#options' => _search_get_module_names(),
-    '#description' => t('Determine which search modules are active from the available modules.')
+    '#options' => $module_names,
+    '#description' => t('Determine which search modules are active from the available modules.'),
   );
 
+  $form['search_default_module'] = array(
+    '#type' => 'radios',
+    '#title' => t('Default search module'),
+    '#default_value' => variable_get('search_default_module', 'node'),
+    '#options' => $module_names,
+    '#description' => t('The default search module to use when the user browses to /search.'),
+  );
+
+
   $form['#submit'][] = 'search_admin_settings_submit';
 
   // Per module settings
@@ -132,6 +142,19 @@ function search_admin_settings() {
 }
 
 /**
+ * Validation callback.
+ */
+function search_admin_settings_validate($form, &$form_state) {
+  //Ensure that the selected default module is active.
+  if (count($form_state['complete form']['search_active_modules']['#value'])) {
+    $default = $form_state['values']['search_default_module'];
+    if (empty($form_state['values']['search_active_modules'][$default])) {
+      form_set_error('search_default_module', t('Please select an active search module to use as the default.'));
+    }
+  }
+}
+
+/**
  * Submit callback.
  */
 function search_admin_settings_submit($form, &$form_state) {
Index: modules/search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.11
diff -u -p -r1.11 search.pages.inc
--- modules/search/search.pages.inc	25 Aug 2009 10:27:14 -0000	1.11
+++ modules/search/search.pages.inc	5 Sep 2009 13:51:11 -0000
@@ -9,16 +9,21 @@
 /**
  * Menu callback; presents the search form and/or search results.
  */
-function search_view($type = 'node') {
+function search_view($type = NULL) {
   // Search form submits with POST but redirects to GET. This way we can keep
   // the search query URL clean as a whistle:
   // search/type/keyword+keyword
   if (!isset($_POST['form_id'])) {
-    if ($type == '') {
+    //Ensure that the user is not presented with the search form for an inactive module.
+    $active_modules = variable_get('search_active_modules', array('node', 'user'));
+    if (empty($active_modules[$type])) {
+      $module = variable_get('search_default_module', 'node');
+      $search_hooks = search_get_info();
+      $path = $search_hooks[$module]['path'];
       // Note: search/node can not be a default tab because it would take on the
       // path of its parent (search). It would prevent remembering keywords when
       // switching tabs. This is why we drupal_goto to it from the parent instead.
-      drupal_goto('search/node');
+      drupal_goto('search/'. $path);
     }
 
     $keys = search_get_keys();
@@ -136,7 +141,7 @@ function search_form_submit($form, &$for
     // Fall through to the drupal_goto() call.
   }
 
-  $type = $form_state['values']['module'] ? $form_state['values']['module'] : 'node';
+  $type = $form_state['values']['module'] ? $form_state['values']['module'] : variable_get('search_default_module', 'node');
   $form_state['redirect'] = 'search/' . $type . '/' . $keys;
   return;
 }
