index.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. $configRun = false;
  3. $extensions = get_loaded_extensions();
  4. $airtimeSetup = false;
  5. function showConfigCheckPage() {
  6. global $configRun;
  7. if (!$configRun) {
  8. // This will run any necessary setup we need if
  9. // configuration hasn't been initialized
  10. checkConfiguration();
  11. }
  12. require_once(CONFIG_PATH . 'config-check.php');
  13. die();
  14. }
  15. function isApiCall() {
  16. $path = $_SERVER['PHP_SELF'];
  17. return strpos($path, "api") !== false;
  18. }
  19. // Define application path constants
  20. define('ROOT_PATH', dirname( __DIR__) . '/');
  21. define('LIB_PATH', ROOT_PATH . 'library/');
  22. define('BUILD_PATH', ROOT_PATH . 'build/');
  23. define('SETUP_PATH', BUILD_PATH . 'airtime-setup/');
  24. define('APPLICATION_PATH', ROOT_PATH . 'application/');
  25. define('CONFIG_PATH', APPLICATION_PATH . 'configs/');
  26. define("AIRTIME_CONFIG_STOR", "/etc/airtime/");
  27. define('AIRTIME_CONFIG', 'airtime.conf');
  28. require_once(LIB_PATH . "propel/runtime/lib/Propel.php");
  29. require_once(CONFIG_PATH . 'conf.php');
  30. require_once(SETUP_PATH . 'load.php');
  31. // This allows us to pass ?config as a parameter to any page
  32. // and get to the config checklist.
  33. if (array_key_exists('config', $_GET)) {
  34. showConfigCheckPage();
  35. }
  36. // If a configuration file exists, forward to our boot script
  37. if (file_exists(AIRTIME_CONFIG_STOR . AIRTIME_CONFIG)) {
  38. require_once(APPLICATION_PATH . 'airtime-boot.php');
  39. }
  40. // Otherwise, we'll need to run our configuration setup
  41. else {
  42. $airtimeSetup = true;
  43. require_once(SETUP_PATH . 'setup-config.php');
  44. }