Index: skinr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/skinr/skinr.module,v
retrieving revision 1.13.2.21
diff -u -r1.13.2.21 skinr.module
--- skinr.module	22 Oct 2010 04:04:30 -0000	1.13.2.21
+++ skinr.module	26 Oct 2010 08:25:07 -0000
@@ -292,6 +292,54 @@
   }
 }
 
+ /**
+ * Find all the base themes for the specified theme.
+ *
+ * Themes can inherit templates and function implementations from earlier themes.
+ * Copied (and modified) from function system_find_base_themes in system.module
+ *
+ * @param $themes
+ *   An array of available themes.
+ * @param $key
+ *   The name of the theme whose base we are looking for.
+ * @param $used_keys
+ *   A recursion parameter preventing endless loops.
+ * @return
+ *   Returns an array of all of the theme's ancestors; the first element's value
+ *   will be NULL if an error occurred.
+ */
+function skinr_find_base_themes($themes, $key, $used_keys = array()) {
+  // Fix http://drupal.org/node/943782.
+  if (!array_key_exists('base theme', $themes[$key]->info)) {
+    // Return empty array.
+    return array();
+  }
+
+  $base_key = $themes[$key]->info['base theme'];
+  // Does the base theme exist?
+  if (!isset($themes[$base_key])) {
+    return array($base_key => NULL);
+  }
+
+  $current_base_theme = array($base_key => $themes[$base_key]->info['name']);
+
+  // Is the base theme itself a child of another theme?
+  if (isset($themes[$base_key]->info['base theme'])) {
+    // Do we already know the base themes of this theme?
+    if (isset($themes[$base_key]->base_themes)) {
+      return $themes[$base_key]->base_themes + $current_base_theme;
+    }
+    // Prevent loops.
+    if (!empty($used_keys[$base_key])) {
+      return array($base_key => NULL);
+    }
+    $used_keys[$base_key] = TRUE;
+    return system_find_base_themes($themes, $base_key, $used_keys) + $current_base_theme;
+  }
+  // If we get here, then this is our parent theme.
+  return $current_base_theme;
+}
+
 /**
  * Implementation of hook_preprocess().
  */
@@ -307,7 +355,7 @@
   $theme_registry = theme_get_registry();
 
   // Add any base themes.
-  $themes = array_keys(system_find_base_themes(_system_theme_data(), $current_theme));
+  $themes = array_keys(skinr_find_base_themes(_system_theme_data(), $current_theme));
   // Add the current theme.
   $themes[] = $current_theme;
 
