diff --git a/common.php b/common.php index 307dbdbcd..7993d7b56 100644 --- a/common.php +++ b/common.php @@ -13,6 +13,7 @@ if (isset($_REQUEST['GLOBALS'])) { define('TIMESTART', utime()); define('TIMENOW', time()); +define('BB_PATH', __DIR__); if (empty($_SERVER['REMOTE_ADDR'])) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; @@ -42,13 +43,13 @@ if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { } // Get all constants -require_once __DIR__ . '/library/defines.php'; +require_once BB_PATH . '/library/defines.php'; // Composer -if (!file_exists(__DIR__ . '/vendor/autoload.php')) { +if (!file_exists(BB_PATH . '/vendor/autoload.php')) { die('Please install composer and run composer install'); } -require_once __DIR__ . '/vendor/autoload.php'; +require_once BB_PATH . '/vendor/autoload.php'; /** * Gets the value of an environment variable. @@ -63,13 +64,13 @@ function env(string $key, $default = null) } // Get initial config -$dotenv = Dotenv\Dotenv::createMutable(__DIR__); +$dotenv = Dotenv\Dotenv::createMutable(BB_PATH); $dotenv->safeLoad(); -require_once __DIR__ . '/library/config.php'; +require_once BB_PATH . '/library/config.php'; // Local config -if (file_exists(__DIR__ . '/library/config.local.php')) { - require_once __DIR__ . '/library/config.local.php'; +if (file_exists(BB_PATH . '/library/config.local.php')) { + require_once BB_PATH . '/library/config.local.php'; } /** diff --git a/library/defines.php b/library/defines.php index b7a4d674c..ab80390ca 100644 --- a/library/defines.php +++ b/library/defines.php @@ -11,11 +11,6 @@ if (!defined('BB_ROOT')) { die(basename(__FILE__)); } -// Root path -$rootPath = __DIR__; -if (DIRECTORY_SEPARATOR != '/') $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath); -define('BB_PATH', dirname($rootPath)); - // System define('CHECK_REQIREMENTS', [ 'status' => true,