2010-12-07 20:19:27 +01:00
|
|
|
<?php
|
|
|
|
|
2014-12-01 21:49:53 +01:00
|
|
|
$configRun = false;
|
|
|
|
$extensions = get_loaded_extensions();
|
|
|
|
$airtimeSetup = false;
|
2014-11-28 01:10:23 +01:00
|
|
|
|
|
|
|
function showConfigCheckPage() {
|
2014-12-01 21:49:53 +01:00
|
|
|
global $configRun;
|
|
|
|
if (!$configRun) {
|
2014-11-28 01:10:23 +01:00
|
|
|
// This will run any necessary setup we need if
|
|
|
|
// configuration hasn't been initialized
|
2014-12-04 00:04:47 +01:00
|
|
|
checkConfiguration();
|
2014-11-28 01:10:23 +01:00
|
|
|
}
|
2014-09-29 20:22:10 +02:00
|
|
|
|
2014-11-28 21:30:11 +01:00
|
|
|
require_once(CONFIG_PATH . 'config-check.php');
|
2014-11-28 01:10:23 +01:00
|
|
|
die();
|
|
|
|
}
|
2012-09-10 23:36:55 +02:00
|
|
|
|
2015-01-16 22:15:16 +01:00
|
|
|
function isApiCall() {
|
|
|
|
$path = $_SERVER['PHP_SELF'];
|
|
|
|
return strpos($path, "api") !== false;
|
2012-09-10 23:36:55 +02:00
|
|
|
}
|
2011-02-02 02:28:38 +01:00
|
|
|
|
2014-11-28 21:30:11 +01:00
|
|
|
// Define application path constants
|
2014-11-28 00:47:05 +01:00
|
|
|
define('ROOT_PATH', dirname( __DIR__) . '/');
|
|
|
|
define('LIB_PATH', ROOT_PATH . 'library/');
|
|
|
|
define('BUILD_PATH', ROOT_PATH . 'build/');
|
2014-11-28 21:30:11 +01:00
|
|
|
define('SETUP_PATH', BUILD_PATH . 'airtime-setup/');
|
|
|
|
define('APPLICATION_PATH', ROOT_PATH . 'application/');
|
|
|
|
define('CONFIG_PATH', APPLICATION_PATH . 'configs/');
|
2021-09-11 04:20:50 +02:00
|
|
|
define('VENDOR_PATH', ROOT_PATH . 'vendor/');
|
2015-09-16 20:22:13 +02:00
|
|
|
define('REST_MODULE_CONTROLLER_PATH', APPLICATION_PATH . 'modules/rest/controllers/');
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2014-12-09 23:48:16 +01:00
|
|
|
define("AIRTIME_CONFIG_STOR", "/etc/airtime/");
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2014-11-28 00:47:05 +01:00
|
|
|
define('AIRTIME_CONFIG', 'airtime.conf');
|
2012-09-12 17:45:08 +02:00
|
|
|
|
2015-09-16 20:22:13 +02:00
|
|
|
//Rest Module Controllers - for custom Rest_RouteController.php
|
|
|
|
set_include_path(REST_MODULE_CONTROLLER_PATH . PATH_SEPARATOR . get_include_path());
|
|
|
|
|
2018-12-22 23:42:39 +01:00
|
|
|
// Vendors (Composer, zend-loader is explicitly specified due to https://github.com/zf1/zend-application/pull/2#issuecomment-102599655)
|
|
|
|
set_include_path(VENDOR_PATH . PATH_SEPARATOR . VENDOR_PATH . 'zf1s/zend-loader/library/' . PATH_SEPARATOR . get_include_path());
|
2014-07-23 22:13:55 +02:00
|
|
|
|
2010-12-07 20:19:27 +01:00
|
|
|
// Ensure library/ is on include_path
|
2015-05-22 22:05:29 +02:00
|
|
|
set_include_path(LIB_PATH . PATH_SEPARATOR . get_include_path());
|
2012-04-13 23:45:28 +02:00
|
|
|
|
2017-02-28 12:25:24 +01:00
|
|
|
require_once VENDOR_PATH . '/autoload.php';
|
|
|
|
|
|
|
|
if (!class_exists('Propel'))
|
2015-05-22 22:05:29 +02:00
|
|
|
{
|
|
|
|
die('Error: Propel not found. Did you install Airtime\'s third-party dependencies with composer? (Check the README.)');
|
2012-02-08 17:42:21 +01:00
|
|
|
}
|
|
|
|
|
2014-11-28 21:30:11 +01:00
|
|
|
require_once(CONFIG_PATH . 'conf.php');
|
|
|
|
require_once(SETUP_PATH . 'load.php');
|
2014-07-01 19:36:09 +02:00
|
|
|
|
2014-11-28 21:30:11 +01:00
|
|
|
// This allows us to pass ?config as a parameter to any page
|
|
|
|
// and get to the config checklist.
|
2014-11-28 00:47:05 +01:00
|
|
|
if (array_key_exists('config', $_GET)) {
|
|
|
|
showConfigCheckPage();
|
|
|
|
}
|
2015-02-06 21:20:01 +01:00
|
|
|
|
2015-06-16 17:20:43 +02:00
|
|
|
$filename = isset($_SERVER['AIRTIME_CONF']) ?
|
2015-06-10 21:38:27 +02:00
|
|
|
$_SERVER['AIRTIME_CONF'] : AIRTIME_CONFIG_STOR . AIRTIME_CONFIG;
|
|
|
|
|
2014-11-28 00:47:05 +01:00
|
|
|
// If a configuration file exists, forward to our boot script
|
2015-06-10 21:38:27 +02:00
|
|
|
if (file_exists($filename)) {
|
2014-11-28 21:30:11 +01:00
|
|
|
require_once(APPLICATION_PATH . 'airtime-boot.php');
|
2014-11-28 00:47:05 +01:00
|
|
|
}
|
|
|
|
// Otherwise, we'll need to run our configuration setup
|
|
|
|
else {
|
2014-12-01 21:49:53 +01:00
|
|
|
$airtimeSetup = true;
|
2014-11-28 21:30:11 +01:00
|
|
|
require_once(SETUP_PATH . 'setup-config.php');
|
2012-09-05 23:29:34 +02:00
|
|
|
}
|