Index: multidomain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/multidomain/multidomain.module,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 multidomain.module
--- multidomain.module	7 Mar 2007 23:20:58 -0000	1.1.2.4
+++ multidomain.module	27 Apr 2007 16:46:44 -0000
@@ -152,6 +152,27 @@
     '#default_value' => $edit['weight'],
   );
 
+  // Add variables that can be set for this domain.
+  $form['variables'] = array(
+    '#tree' => TRUE,
+  );
+
+  $forms = array(
+    // Key is form_id.
+    'system_site_information_settings' => array(
+      // Values are keys of form elements.
+      array('site_name'),
+      array('site_slogan'),
+      array('site_footer'),
+    ),
+    'menu_configure' => array(
+      array('settings_links', 'menu_primary_menu'),
+      array('settings_links', 'menu_secondary_menu'),
+    ),
+  );
+
+  $form['variables'] += multidomain_get_form_bits($forms);
+
   $types = node_get_types();
   $form['page_vis_settings']['types'] = array(
     '#type' => 'checkboxes',
@@ -313,12 +334,45 @@
   $domains = variable_get('multidomain_sites', array());
   $protocol = ( $_SERVER['HTTPS'] ) ? 'https://' : 'http://' ;
   if ($domain = $domains[$protocol . $_SERVER['HTTP_HOST']]) {
+    // Set any variables specific to this domain.
+    if(isset($domain['variables']) && is_array($domain['variables'])) {
+      foreach($domain['variables'] as $name => $value) {
+        $conf[$name] = $value;
+      }
+    }
     if ($domain['init']) {
       drupal_eval($domain['init']);
     }
   }
 }
 
+/**
+ * Return specified elements from an array of forms.
+ */
+function multidomain_get_form_bits($forms) {
+  $form = array();
+  foreach ($forms as $form_id => $elements) {
+    if (function_exists($form_id)) {
+      $source_form = $form_id();
+      foreach ($elements as $element) {
+        $return = $source_form;
+        foreach ($element as $key) {
+          if (isset($return[$key])) {
+            $return = $return[$key];
+          }
+          else {
+            break;
+          }
+        }
+        if ($return !== $source_form) {
+          $form[$key] = $return;
+        }
+      }
+    }
+  }
+  return $form;
+}
+
 if (!function_exists('custom_url_rewrite')) {
   function custom_url_rewrite($type, $alias, $real_path) {
     static $default = null;
@@ -339,8 +393,15 @@
     }
     $base = $force_default ? $default : NULL;
     foreach ($domains as $domain => $info) {
+      $page_match = FALSE;
+      // If this is a link to the configuration of this domain, match it.
+      // This is needed because we need the variables to be set to this domain's
+      // versions, so that the form elements load with the correct defaults.
+      if ($path == 'admin/settings/multidomain/settings/'. str_replace('://', '_', $domain)) {
+        $page_match = TRUE;
+      }
       // Match path if necessary
-      if ($info['pages']) {
+      if (!$page_match && $info['pages']) {
         if ($info['visibility'] < 2) {
           $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($info['pages'], '/')) .')$/';
           // Compare with the internal and path alias (if any).
@@ -357,11 +418,8 @@
           $page_match = drupal_eval($info['pages']);
         }
       }
-      else {
-        $page_match = FALSE;
-      }
 
-      if (sizeof($info['types'])) {
+      if (!$page_match && sizeof($info['types'])) {
         $parts = explode('/', $real_path);
         if ($parts[0] == 'node' && is_numeric($parts[1])) {
           $node = node_load($parts[1]);
