? 6-validate.patch
? 6-x-conf-ignore.patch
? 632220-domain-DRUPAL-6--2-dev.patch
? 632220-domain-generate.patch
? 652000-settings-b.patch
? 698566-domain-content.patch
? 706490-form.patch
? 706490-redirect.patch
? 710712-vbo.patch
? domain_content/README-698568.txt.patch
? domain_content/contributions-modules-domain-698566.patch
Index: domain.bootstrap.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.bootstrap.inc,v
retrieving revision 1.10.2.3
diff -u -p -r1.10.2.3 domain.bootstrap.inc
--- domain.bootstrap.inc	13 Feb 2010 16:24:14 -0000	1.10.2.3
+++ domain.bootstrap.inc	13 Feb 2010 17:00:17 -0000
@@ -262,3 +262,14 @@ function domain_unserialize($object) {
   }
   return unserialize(db_decode_blob($object));
 }
+
+/**
+ * Store the initially loaded domain, for later use.
+ */
+function domain_initial_domain($domain = array()) {
+  static $initial;
+  if (!isset($initial) && !empty($domain)) {
+    $initial = $domain;
+  }
+  return $initial;
+}
Index: domain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v
retrieving revision 1.134.2.3
diff -u -p -r1.134.2.3 domain.module
--- domain.module	8 Dec 2009 16:57:18 -0000	1.134.2.3
+++ domain.module	13 Feb 2010 17:00:20 -0000
@@ -93,6 +93,9 @@ function domain_init() {
   $domain = domain_lookup($_domain['domain_id']);
   $_domain = array_merge($domain, $_domain);
 
+  // Set the initial domain record, for later reference. See http://drupal.org/node/706490.
+  domain_initial_domain($_domain);
+
   // If we have replaced 'www.' in the url, redirect to the clean domain.
   if ($www_replaced) {
     drupal_goto(domain_get_uri($_domain));
@@ -1145,8 +1148,9 @@ function domain_nodeapi(&$node, $op, $a3
       break;
     case 'insert':
     case 'update':
-      global $_domain;
-      $_SESSION['domain_save_id'] = $_domain['domain_id'];
+      // We cannot use the global domain here, since it can be modified.
+      $domain = domain_initial_domain();
+      $_SESSION['domain_save_id'] = $domain['domain_id'];
       break;
   }
 }
@@ -1487,7 +1491,8 @@ function domain_form_alter(&$form, &$for
   // to the currently active domain.  See http://drupal.org/node/196217.
   $seo = variable_get('domain_seo', 0);
   if ($seo) {
-    global $_domain;
+    // We cannot use the global domain here, since it can be modified.
+    $domain = domain_initial_domain();
     $action = parse_url($form['#action']);
     if (isset($action['query'])) {
       $action['path'] .= '?';
@@ -1498,7 +1503,7 @@ function domain_form_alter(&$form, &$for
     // We cannot reset this if it has already been set by another module.
     // See http://drupal.org/node/306551
     if (empty($action['host'])) {
-      $form['#action'] =  $_domain['scheme'] .'://'. $_domain['subdomain'] . $action['path'] . $action['query'];
+      $form['#action'] =  $domain['scheme'] .'://'. $domain['subdomain'] . $action['path'] . $action['query'];
     }
   }
 
