DEFINE('PUBLIC_SCHEMA', 'public'); DEFINE('DEV_SCHEMA', 'public'); DEFINE('TEST_SCHEMA', 'public'); DEFINE('LIVE_SCHEMA', 'public'); /************* CORE HOST SETTINGS *****************/ if (file_exists(BASE.CONFIGS.'config.host.php')) { require BASE.CONFIGS.'config.host.php'; } if (!isset($SITE_CONFIG)) { $SITE_CONFIG = array(); } /************* DB ACCESS *****************/ if (file_exists(BASE.CONFIGS.'config.db.php')) { require BASE.CONFIGS.'config.db.php'; } if (!isset($DB_CONFIG)) { $DB_CONFIG = array(); } /************* OTHER PATHS *****************/ if (file_exists(BASE.CONFIGS.'config.path.php')) { require BASE.CONFIGS.'config.path.php'; } // live frontend pages // ** missing live domains ** // get the name without the port list($HOST_NAME) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null); // set HOST name DEFINE('HOST_NAME', $HOST_NAME); // BAIL ON MISSING MASTER SITE CONFIG if (!isset($SITE_CONFIG[HOST_NAME]['location'])) { echo 'Missing SITE_CONFIG entry for: "'.HOST_NAME.'". Contact Administrator'; exit; } // BAIL ON MISSING DB CONFIG: // we have either no db selction for this host but have db config entries // or we have a db selection but no db config as array or empty // or we have a selection but no matching db config entry if ((!isset($SITE_CONFIG[HOST_NAME]['db_host']) && count($DB_CONFIG)) || (isset($SITE_CONFIG[HOST_NAME]['db_host']) && // missing DB CONFIG ((is_array($DB_CONFIG) && !count($DB_CONFIG)) || !is_array($DB_CONFIG) || // has DB CONFIG but no match (is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']]))) ) ) { echo 'No matching DB config found for: "'.HOST_NAME.'". Contact Administrator'; exit; } // set SSL on if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) { DEFINE('HOST_SSL', true); DEFINE('HOST_PROTOCOL', 'https://'); } else { DEFINE('HOST_SSL', false); DEFINE('HOST_PROTOCOL', 'http://'); } // define the db config set name, the db config and the db schema DEFINE('DB_CONFIG_NAME', $SITE_CONFIG[HOST_NAME]['db_host']); DEFINE('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAME] : array()); // DEFINE('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']); // DEFINE('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']); // override for login and global schemas // DEFINE('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA); // where the edit* tables are // DEFINE('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA); // where global tables are that are used by all schemas (eg queue tables for online, etc) // debug settings, site lang, etc DEFINE('TARGET', $SITE_CONFIG[HOST_NAME]['location']); DEFINE('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag']); DEFINE('SITE_LANG', $SITE_CONFIG[HOST_NAME]['site_lang']); DEFINE('LOGIN_ENABLED', $SITE_CONFIG[HOST_NAME]['login_enabled']); // paths // DEFINE('CSV_PATH', $PATHS[TARGET]['csv_path']); // DEFINE('EXPORT_SCRIPT', $PATHS[TARGET]['perl_bin']); // DEFINE('REDIRECT_URL', $PATHS[TARGET]['redirect_url']); // show all errors if debug_all & show_error_handling are enabled DEFINE('SHOW_ALL_ERRORS', true); /************* GENERAL PAGE TITLE ********/ DEFINE('G_TITLE', ''); /************ STYLE SHEETS / JS **********/ DEFINE('ADMIN_STYLESHEET', 'edit.css'); DEFINE('ADMIN_JAVASCRIPT', 'edit.js'); DEFINE('STYLESHEET', 'frontend.css'); DEFINE('JAVASCRIPT', 'frontend.js'); // anything optional /************* INTERNAL ******************/ // any other global definitons here // DEFINE('SOME_ID', ); /************* CONVERT *******************/ $paths = array( '/bin', '/usr/bin', '/usr/local/bin' ); // find convert foreach ($paths as $path) { if (file_exists($path.DS.'convert') && is_file($path.DS.'convert')) { // image magick convert location DEFINE('CONVERT', $path.DS.'convert'); } } // turn off debug if debug flag is OFF if (defined('DEBUG') && DEBUG == false) { $ECHO_ALL = false; $DEBUG_ALL = false; $PRINT_ALL = false; $DB_DEBUG = false; $ENABLE_ERROR_HANDLING = false; $DEBUG_ALL_OVERRIDE = false; } else { $ECHO_ALL = false; $DEBUG_ALL = true; $PRINT_ALL = true; $DB_DEBUG = true; $ENABLE_ERROR_HANDLING = false; $DEBUG_ALL_OVERRIDE = false; } // read auto loader require BASE.LIB.'autoloader.php'; // __END__