Index: skinr.module
===================================================================
--- skinr.module	(revision 1306)
+++ skinr.module	(working copy)
@@ -307,7 +307,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(system_find_base_themes(_skinr_get_theme_data(), $current_theme));
   // Add the current theme.
   $themes[] = $current_theme;
 
@@ -364,6 +364,32 @@
 }
 
 /**
+ * Helper function to load theme data
+ * Code borrowed from list_themes().
+ */
+function _skinr_get_theme_data() {
+  static $themes;
+  
+  if (!isset($themes)) {
+    if (db_is_active() && !defined('MAINTENANCE_MODE')) {
+      $result = db_query("SELECT * FROM {system} WHERE type = '%s'", 'theme');
+      while ($theme = db_fetch_object($result)) {
+        if (file_exists($theme->filename)) {
+          $theme->info = unserialize($theme->info);
+          $themes[] = $theme;
+        }
+      }
+    }
+    else {
+      // Scan the installation when the database should not be read.
+      $themes = _system_theme_data();
+    }
+  }
+  return $themes;
+}
+
+
+/**
  * Helper function to add CSS and JS files.
  *
  * The function checks an array of paths for the existence of the file to account for base themes.
@@ -557,7 +583,7 @@
   static $cache = NULL;
 
   if (is_null($cache)) {
-    $themes = _system_theme_data();
+    $themes = _skinr_get_theme_data();
 
     foreach ($themes as $theme) {
       $cache[$theme->name] = array(
