--- civicrm.config.php.org	2012-11-08 07:26:31.000000000 -0700
+++ civicrm.config.php	2012-11-19 04:40:03.000000000 -0700
@@ -58,12 +58,25 @@
         // to the script that invokes it
         $moduleDir  = 'sites' . DIRECTORY_SEPARATOR . 'all' . DIRECTORY_SEPARATOR . 'modules';
         $contribDir = $moduleDir . DIRECTORY_SEPARATOR . 'contrib';
+        $profileDir = DIRECTORY_SEPARATOR . 'profiles' . DIRECTORY_SEPARATOR;
+                       
         // check to see if this is under sites/all/modules/contrib
         if ( strpos( $currentDir, $contribDir ) !== false ) {
             $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
         // check to see if this is under sites/all/modules
         } else if ( strpos( $currentDir, $moduleDir ) !== false ) {
             $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
+        // check to see if this is under profiles/[PROFILE]/modules    
+        } else if ( strpos( $currentDir, $profileDir ) !== false ) {
+            //
+            $drupalbase = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; 
+            define('DRUPAL_ROOT', $drupalbase);
+            require_once $drupalbase . '/includes/bootstrap.inc';
+            //print_r(conf_path());
+            
+            
+            $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . conf_path(); 
+            
         } else if ( strpos( $currentDir, 'plugins' . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm' ) !== false ) {
              //if its wordpress
             $confdir = $currentDir . DIRECTORY_SEPARATOR . '..';
@@ -71,7 +84,7 @@
             $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
         }
     }
-
+    
     if ( file_exists( $confdir . DIRECTORY_SEPARATOR . 'civicrm.settings.php' ) ) {
         return $confdir;
     }
@@ -102,6 +115,8 @@
 }
 
 $settingsFile = civicrm_conf_init( ) . '/civicrm.settings.php';
+
+
 define('CIVICRM_SETTINGS_PATH', $settingsFile);
 $error = @include_once( $settingsFile );
 if ( $error == false ) {
