*** shindig_integrator/shindig_integrator.install	2009-10-23 14:28:34.000000000 +0200
--- shindig_integrator/shindig_integrator.install	2010-01-27 07:45:03.000000000 +0100
***************
*** 265,270 ****
--- 265,271 ----
        "person_service" => "ShindigIntegratorPeopleService",
        "activity_service" => "ShindigIntegratorActivitiesService",
        "app_data_service" => "ShindigIntegratorAppDataService",
+       "drupal_base_path" => "'.base_path().'",
      );
      $GLOBALS["shindigConfig"] = $shindigConfig;
  
*** shindig_integrator/shindig_files/ShindigIntegratorDbFetcher.php	2009-10-23 07:54:21.000000000 +0200
--- shindig_integrator/shindig_files/ShindigIntegratorDbFetcher.php	2010-01-27 07:54:56.000000000 +0100
***************
*** 8,36 ****
   * This module contains core shindig server
   */
  
- include(Config::get('settings_php'));
- include_once(Config::get('include_path')."/database.inc");
- include_once(Config::get('include_path')."/bootstrap.inc");
- include_once(Config::get('include_path')."/common.inc");
- 
- $url_array = parse_url($db_url);
- $GLOBALS['url_array'] = $url_array;
- include_once(Config::get('include_path')."/database.".$url_array['scheme'].".inc");
- 
- global $active_db;
- $active_db = db_connect($db_url);
- 
  class ShindigIntegratorDbFetcher {
  	private $db;
  	private $url_prefix;
  	
  	// Singleton
  	private static $fetcher;
  
  	private function __construct()
  	{
! 		global $url_array;
! 		$this->url_prefix = "http://" . $_SERVER['HTTP_HOST'] . $url_array['path']."/";
  	}
  
  	private function __clone()
--- 8,52 ----
   * This module contains core shindig server
   */
  
  class ShindigIntegratorDbFetcher {
  	private $db;
  	private $url_prefix;
+  	private $drupal_dir;
  	
  	// Singleton
  	private static $fetcher;
  
  	private function __construct()
  	{
!     global $base_url;
!     //Initiliaze Drupal
!     if(!defined(DRUPAL_BOOTSTRAP_DATABASE)) {
!       $base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http') . '://'. $_SERVER['HTTP_HOST'];    
!       try {
!         $base_path = Config::get('drupal_base_path');
!         if($base_path) {
!           $base_url .= $base_path;
!         }
!       }
!       catch(Exception $exc) {
!         //Ignore config exception for drupal_base_path
!       }
!       $dir = getcwd();
!       //Walk the directory tree to Drupal root
!       chdir(dirname(__FILE__));
!       $this->drupal_dir = getcwd();
!       chdir('..');
!       while(!file_exists('cron.php') && $this->drupal_dir != getcwd()) {
!         $this->drupal_dir = getcwd();
!         chdir('..');
!       }
!       $this->drupal_dir = getcwd();
!       require_once './includes/bootstrap.inc';
!       drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
!       //Return to original dir
!       chdir($dir);
!     }
! 		$this->url_prefix = $base_url;
  	}
  
  	private function __clone()
