? ~multidomain.patch
Index: multidomain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/multidomain/multidomain.module,v
retrieving revision 1.1.2.17
diff -u -p -r1.1.2.17 multidomain.module
--- multidomain.module	26 Jun 2007 01:21:14 -0000	1.1.2.17
+++ multidomain.module	29 Jun 2007 21:49:21 -0000
@@ -17,6 +17,11 @@ define('MULTIDOMAIN_TAXONOMY_REWRITE_NON
 define('MULTIDOMAIN_TAXONOMY_REWRITE_ALL', 2);
 
 /**
+ * Filter node type by domain.
+ */
+define('MULTIDOMAIN_FILTER_TYPE_DOMAIN', false);
+
+/**
  * Implementation of hook_help().
  */
 function multidomain_help($section) {
@@ -178,7 +183,12 @@ function multidomain_default_domain_sett
     '#description' => t('A list of node types you want to be associated with domains.'),
     '#required' => TRUE,
   );
-
+  $form['multidomain_filter_type_domain'] = array(
+	  '#type' => 'checkbox',
+	  '#title' => t('Filter content types by domain.'),
+	  '#default_value' => variable_get('multidomain_filter_type_domain', MULTIDOMAIN_FILTER_TYPE_DOMAIN),
+	  '#description' => t("Enabling this option allows will allow you to filter node types per domain.")
+	 );
   $form = system_settings_form($form);
   // Don't use the default form handling.
   unset($form['#base']);
@@ -555,15 +565,18 @@ function multidomain_init() {
  * Limit nodes returned by domain term.
  */
 function multidomain_db_rewrite_sql($query, $primary_table, $primary_field) {
+  global $conf;
   static $domains;
   static $rewrite;
   static $default;
+  static $filter_type;
   $return = array();
   if ($primary_field == 'nid') {
     if ($domains === NULL) {
       $domains = variable_get('multidomain_sites', array());
       $rewrite = variable_get('multidomain_taxonomy_rewrite_sql', MULTIDOMAIN_TAXONOMY_REWRITE_NONE);
       $default = variable_get('singlesignon_master_url', 'http://');
+      $filter_type = variable_get('multidomain_filter_type_domain', false);
       // The domains array doesn't include the default domain. Add it if needed.
       if ($rewrite == MULTIDOMAIN_TAXONOMY_REWRITE_ALL) {
         $domains[$default] = array(
@@ -572,6 +585,23 @@ function multidomain_db_rewrite_sql($que
       }
     }
     $current = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'];
+    $types = $conf['multidomain_sites'][$current]['types'];
+    if($types) {
+      $valid = array();
+      foreach ($types as $key => $type) {
+        if($type != '0') {
+          $valid[] = $key;
+        }
+      }
+      $whereStr = implode('","',$valid);
+      switch ($primary_field) {
+       case 'nid':
+          $return = array();
+          $return['where'] = 'type in ("'.$whereStr.'")';
+          return $return;
+          break;
+      }
+    }
     switch ($rewrite) {
       // If we are not rewriting, simply return.
       case MULTIDOMAIN_TAXONOMY_REWRITE_NONE:
