Example #1
0
define('APP_INIT', true);
// Initialize, load and set up Carbon Core
require_once CARBON_SITE_ROOT . '/carbon/core/init.php';
// Make sure Carbon Core is initialized successfully
if (!defined('CARBON_CORE_INIT_DONE') || CARBON_CORE_INIT_DONE != true) {
    die('Failed to load the application because Carbon Core couldn\'t be initialized');
}
// Include the loader for the app and set it up
require_once APP_ROOT . '/autoloader/loader/AppLoader.php';
use app\autoloader\loader\AppLoader;
use app\registry\Registry;
use carbon\core\autoloader\Autoloader;
Autoloader::addLoader(new AppLoader());
// Load the configuration
use app\config\Config;
Config::load();
// Set up the error handler
use carbon\core\ErrorHandler;
ErrorHandler::init(true, true, Config::getValue('app', 'debug'));
// Connect to the database
use app\database\Database;
Database::connect();
// Set up the cookie manager
use carbon\core\cookie\CookieManager;
CookieManager::setCookieDomain(Config::getValue('cookie', 'domain', ''));
CookieManager::setCookiePath(Config::getValue('cookie', 'path', '/'));
CookieManager::setCookiePrefix(Config::getValue('cookie', 'prefix', ''));
// Set up the language manager
use app\language\LanguageManager;
LanguageManager::init(true, Registry::getValue('language.default.tag')->getValue());
$languageTag = LanguageManager::getCookieLanguageTag();