? mdomainpatch.patch
Index: multidomain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/multidomain/multidomain.module,v
retrieving revision 1.1
diff -u -p -r1.1 multidomain.module
--- multidomain.module	19 Dec 2006 02:02:56 -0000	1.1
+++ multidomain.module	22 Jun 2007 21:49:55 -0000
@@ -77,7 +77,14 @@ function multidomain_default_domain_sett
 		'#description' => t("Always use this domain if no matching domains were found? This option is recommended, but it might be necessary to disable this for certain configurations of shared tables.")
 	);
 
-	return system_settings_form($form);
+	$form['multidomain_filter_type_domain'] = array(
+	  '#type' => 'checkbox',
+	  '#title' => t('Filter content types by domain.'),
+	  '#default_value' => variable_get('multidomain_filter_type_domain', false),
+	  '#description' => t("Enabling this option allows will allow you to filter node types per domain.")
+	  );
+
+  return system_settings_form($form);
 }
 
 function multidomain_valid_domain($element) {
@@ -355,3 +362,28 @@ if (!function_exists('custom_url_rewrite
 else {
   drupal_set_message('error', t('The multi domain module has found a custom_url_rewrite function that is already defined. This conflicts with the module\'s operations, and as such the multi domain module will not work'));
 }
+
+function multidomain_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
+  global $conf;
+  if( variable_get('multidomain_filter_type_domain', false) ) {
+  $protocol = ( $_SERVER['HTTPS'] ) ? 'https://' : 'http://' ;
+  $domain = $protocol . $_SERVER['HTTP_HOST'];
+  $types = $conf['multidomain_sites'][$domain]['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;
+    }
+  }
+  }
+}
\ No newline at end of file
