From 1b835d03e6efe7ee42cc2328c3fd1c0fb7422e07 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 12 Nov 2013 17:43:34 -0800 Subject: [PATCH] Add civicrm.config.php.wordpress. This is used by GenCode and distmaker when running on a WP-only installation (when there is no Drupal) --- civicrm.config.php.wordpress | 117 +++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 civicrm.config.php.wordpress diff --git a/civicrm.config.php.wordpress b/civicrm.config.php.wordpress new file mode 100644 index 000000000000..ce0cbb55977f --- /dev/null +++ b/civicrm.config.php.wordpress @@ -0,0 +1,117 @@ +
\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; +} + +$settingsFile = civicrm_conf_init( ) . '/civicrm.settings.php'; +define('CIVICRM_SETTINGS_PATH', $settingsFile); +$error = @include_once( $settingsFile ); +if ( $error == false ) { + echo "Could not load the settings file at: {$settingsFile}\n"; + exit( ); +} + +// Load class loader +global $civicrm_root; +require_once $civicrm_root . '/CRM/Core/ClassLoader.php'; +CRM_Core_ClassLoader::singleton()->register();