/** * 获取核心 * @return Core\Core */ function c() { return Core\Core::getInstance(); }
define('NS', 'front'); define('VERSION', '1.2.0'); error_reporting(E_ALL); if (!is_file('config.php')) { header("location: install/"); exit; } require 'config.php'; if (!defined('DIR_APPLICATION')) { header('Location: install/index.php'); exit; } require DIR_SYSTEM . 'startup.php'; require_once DIR_ROOT . 'system/Core/Core.php'; $core = new \Core\Core($config); $core->load->library('customer'); $core->customer = new Customer(); $currency = new \Core\Currency(); $core->currency = $currency; if (is_file(DIR_VENDOR . 'autoload.php')) { require DIR_VENDOR . 'autoload.php'; } if (BASE_REQUEST_TYPE == 'cli') { $core->dispatch_cli(); } else { $core->addPreAction('common/maintenance'); $core->addPreAction('common/seo_url'); $core->addPreAction('common/home/marketing'); $core->dispatch(); }
} if (!isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1); if (isset($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; } } if (!isset($_SERVER['HTTP_HOST'])) { $_SERVER['HTTP_HOST'] = getenv('HTTP_HOST'); } // Helper require_once DIR_SYSTEM . 'helper/json.php'; require_once DIR_SYSTEM . 'helper/utf8.php'; require_once DIR_SYSTEM . 'helper/helpers.php'; require_once DIR_ROOT . 'system/Core/Core.php'; $core = new \Core\Core(array(), 'installer'); $core->default_route = 'step_1'; // Upgrade $upgrade = false; if (file_exists(DIR_ROOT . 'config.php')) { if (filesize(DIR_ROOT . '/config.php') > 0) { $upgrade = true; $core->default_route = 'upgrade'; $lines = file(DIR_ROOT . 'config.php'); foreach ($lines as $line) { if (strpos(strtoupper($line), 'DB_') !== false) { $parts = explode("=>", $line); $_k = str_replace(array("'", '"'), "", trim($parts[0])); $_v = str_replace(array("'", '"'), "", trim($parts[1])); $core->config->set($_k, $_v); }
<?php define('VERSION', '1.2.0'); define('NS', 'admin'); error_reporting(E_ALL); require 'config.php'; if (!defined('DIR_APPLICATION')) { header('Location: ../install/index.php'); exit; } require DIR_SYSTEM . 'startup.php'; require_once DIR_ROOT . 'system/Core/Core.php'; $core = new \Core\Core($config, 'admin'); $core->user = new \Core\User(); if (is_file(DIR_VENDOR . 'autoload.php')) { require DIR_VENDOR . 'autoload.php'; } $core->addPreAction('user/login/status'); $core->addPreAction('user/login/permission'); $core->dispatch();
/** * 获取系统配置 * @return Core\Config */ function cfg() { return Core\Core::getInstance()->getConfig(); }