* and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ use Tygh\Bootstrap; use Tygh\Debugger; use Tygh\Registry; // Register autoloader $this_dir = dirname(__FILE__); $classLoader = (require $this_dir . '/app/lib/vendor/autoload.php'); $classLoader->add('Tygh', $this_dir . '/app'); class_alias('\\Tygh\\Tygh', 'Tygh'); // Prepare environment and process request vars list($_REQUEST, $_SERVER, $_GET, $_POST) = Bootstrap::initEnv($_GET, $_POST, $_SERVER, $this_dir); // Get config data $config = (require DIR_ROOT . '/config.php'); if (isset($_REQUEST['version'])) { die(PRODUCT_NAME . ' <b>' . PRODUCT_VERSION . ' ' . (PRODUCT_STATUS != '' ? ' (' . PRODUCT_STATUS . ')' : '') . (PRODUCT_BUILD != '' ? ' ' . PRODUCT_BUILD : '') . '</b>'); } Debugger::init(false, $config); // Start debugger log Debugger::checkpoint('Before init'); // Callback: verifies if https works if (isset($_REQUEST['check_https'])) { die(defined('HTTPS') ? 'OK' : ''); } // Check if software is installed if ($config['db_host'] == '%DB_HOST%') { die(PRODUCT_NAME . ' is <b>not installed</b>. Please click here to start the installation process: <a href="install/">[install]</a>');
/** * Init's applicaion // FIXME: Bad method... * * @param array $params Params for initiate installer * @return bool Always true */ public function init($params = array()) { if (defined('INSTALLER_INITED')) { return true; } $config = array(); define('AREA', 'A'); define('ACCOUNT_TYPE', 'admin'); date_default_timezone_set('Europe/Moscow'); $base_path = isset($params['base_path']) ? $params['base_path'] : realpath(dirname(__FILE__) . '/../../../'); // Register autoloader $classLoader = (require $base_path . '/app/lib/vendor/autoload.php'); $classLoader->add('Tygh', realpath($base_path . '/app')); // Prepare environment and process request vars list($_REQUEST, $_SERVER) = Bootstrap::initEnv($_GET, $_POST, $_SERVER, $base_path); if (defined('CONSOLE')) { chdir(getcwd() . '/install'); } // Get config data $config = (require DIR_ROOT . '/config.php'); if (isset($_REQUEST['version'])) { die(PRODUCT_NAME . ': version <b>' . PRODUCT_VERSION . ' ' . PRODUCT_EDITION . (PRODUCT_STATUS != '' ? ' (' . PRODUCT_STATUS . ')' : '') . (PRODUCT_BUILD != '' ? ' ' . PRODUCT_BUILD : '') . '</b>'); } // Callback: verifies if https works if (isset($_REQUEST['check_https'])) { die(defined('HTTPS') ? 'OK' : ''); } // Load core functions $fn_list = array('fn.addons.php', 'fn.companies.php', 'fn.database.php', 'fn.fs.php', 'fn.cms.php', 'fn.cart.php', 'fn.common.php', 'fn.control.php', 'fn.init.php', 'fn.users.php', 'fn.images.php', 'fn.log.php'); if (PRODUCT_EDITION == 'MULTIVENDOR' || PRODUCT_EDITION == 'ULTIMATE') { $fn_list[] = 'fn.' . strtolower(PRODUCT_EDITION) . '.php'; } foreach ($fn_list as $file) { require $config['dir']['functions'] . $file; } $config['dir']['install_themes'] = is_dir($config['dir']['root'] . '/var/themes_repository') ? $config['dir']['root'] . '/var/themes_repository' : $config['dir']['root'] . '/themes'; $config['dir']['install'] = $config['dir']['root'] . '/install/'; $classLoader->add('', $config['dir']['install'] . 'app/'); Registry::set('class_loader', $classLoader); Registry::set('config', $config); $session_id = session_id(); if (empty($session_id)) { session_start(); } fn_init_ajax(); // Init storage Registry::set('runtime.storage', array('storage' => 'file')); if (!empty($params['sl'])) { $this->setCurrentLangCode($params['sl']); } elseif ($this->getFromStorage('sl')) { $this->setCurrentLangCode($this->getFromStorage('sl')); } else { $this->setCurrentLangCode(self::DEFAULT_LANGUAGE); } $this->_loadLanguageVariables(); //define DEFAULT_LANGUAGE for correct addon installing if (!defined('DEFAULT_LANGUAGE')) { define('DEFAULT_LANGUAGE', self::DEFAULT_LANGUAGE); } define('INSTALLER_INITED', true); unset($config); }