<?php /** SamsonPHP init script */ /** Set default locale to - Russian */ define('DEFAULT_LOCALE', 'ru'); // Check if composer is installed if (!file_exists('../vendor/autoload.php')) { die('/vendor folder does not exists, probably you have not installed composer dependencies(composer install)'); } /** Load SamsonPHP framework */ require '../vendor/autoload.php'; /** Set supported locales */ setlocales('ru'); /** Start SamsonPHP web-application */ s()->environment(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : null)->composer()->subscribe('core.e404', 'e404__handler')->start('main'); // Start framework
if (!defined('DEFAULT_LOCALE')) { define('DEFAULT_LOCALE', 'ru'); } /** Require composer autoloader */ if (!class_exists('samson\\core\\Core')) { require_once '../vendor/autoload.php'; } /** Automatic parent web-application configuration read */ if (file_exists('../../../app/config')) { /** Special constant to disable local ActiveRecord configuration */ define('EXTERNAL_CONFIG', true); // Signal core configure event \samsonphp\event\Event::signal('core.configure', array('../../../' . __SAMSON_CONFIG_PATH, __SAMSON_PUBLIC_PATH . __SAMSON_BASE__)); } // Set supported locales setlocales('en', 'ua', 'ru'); // Start SamsonPHP application s()->composer()->subscribe('core.e404', 'default_e404')->subscribe('core.routing', array(url(), 'router')); /** Automatic external SamsonCMS Application searching */ if (file_exists('../../../src/')) { // Get reource map to find all modules in src folder foreach (\samson\core\ResourceMap::get('../../../src/')->modules as $module) { // We are only interested in SamsonCMS application ancestors if (in_array('samson\\cms\\App', class_parents($module[2])) !== false) { // Remove possible '/src/' path from module path if (($pos = strripos($module[1], '/src/')) !== false) { $module[1] = substr($module[1], 0, $pos); } // Load s()->load($module[1]); }