\n";
echo "If this is a standalone installation (i.e. not a Drupal or ";
echo "Joomla module) and you'd like to re-initialize it, ";
echo "click here.\n";
exit( );
}
$phpSelf = array_key_exists( 'PHP_SELF' , $_SERVER ) ? $_SERVER['PHP_SELF' ] : '';
$httpHost = array_key_exists( 'HTTP_HOST', $_SERVER ) ? $_SERVER['HTTP_HOST'] : '';
$uri = explode('/', $phpSelf );
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($httpHost, '.')))));
for ($i = count($uri) - 1; $i > 0; $i--) {
for ($j = count($server); $j > 0; $j--) {
$dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
if (file_exists("$confdir/$dir/civicrm.settings.php")) {
$conf = "$confdir/$dir";
return $conf;
}
}
}
// FIXME: problem spot for Drupal 5.1 config dir layout
$conf = "$confdir/default";
return $conf;
}
include_once conf_init( ) . '/civicrm.settings.php';