* @link * @package Nakon * @subpackage System * @since * @version SVN: $Id$ * @filesource $URL: svn+ssh://192.168.10.199/www/svn/nakon/trunk/config/sys.inc.php $ */ /** * Пути к файлам системы. */ $a = realpath(dirname(__FILE__).'/../..').'/'; define('INIT_PATH', $a.'config'); define('CORE_PATH', $a.'core/classes'); define('LIB_PATH', $a.'lib'); define('MODEL_PATH', $a.'lib/models'); define('CACHE_PATH', $a.'cache'); if (!defined('SITE_PART')) { define('SITE_PART', 'admin'); } define('HTDOCS_PATH', $a.SITE_PART.'/htdocs'); define('DECORATOR_PATH', $a.SITE_PART.'/decorators'); define('ACTION_PATH', $a.SITE_PART.'/actions'); define('TPL_PATH', $a.SITE_PART.'/templates'); define('CONFIG_PATH', $a.SITE_PART.'/config'); unset($a); define('WRAPPERS_TPL_PATH', TPL_PATH.'/wrappers'); define('ACTION_TPL_PATH', TPL_PATH.'/actions'); define('STATIC_TPL_PATH', TPL_PATH.'/static'); define('DECORATOR_POSTFIX', 'Decorator'); define('MODEL_POSTFIX', 'Model'); define('ACTION_POSTFIX', 'Action'); define('EXCEPTION_POSTFIX', 'Exception'); define('TIME_NOW', time()); /** * Основные файлы системы. * Эти файлы загружаются всегда, т.к. без них работа системы невозможна */ require(CORE_PATH.'/Env.class.php'); require(CORE_PATH.'/Load.class.php'); require(CORE_PATH.'/Router.class.php'); require(CORE_PATH.'/PageController.class.php'); require(CORE_PATH.'/Decorator.class.php'); require(CORE_PATH.'/Action.class.php'); /** * Файлы конфигурации. */ if (file_exists(INIT_PATH.'/local.inc.php')) { require(INIT_PATH.'/local.inc.php'); } else { require(INIT_PATH.'/global.inc.php'); } Env::setParams($CONFIG); require(CONFIG_PATH.'/config.inc.php'); Env::setParams($CONFIG); function __autoload($name) { preg_match_all('/[A-Z]+[^A-Z]+/', $name, $match); $type = end($match[0]); $class_name = substr($name, 0, -strlen($type)); switch ($type) { case 'DBConnector': require(CORE_PATH.'/'.(defined('CUSTOM_DBCONNECTOR') ? CUSTOM_DBCONNECTOR.'_' : '').'DBConnector.class.php'); break; case $name: case EXCEPTION_POSTFIX: require(CORE_PATH.'/'.$name.'.class.php'); break; case ACTION_POSTFIX: require(ACTION_PATH.'/'.strtolower($match[0][0]).'/'.$class_name.'.action.php'); break; case DECORATOR_POSTFIX: require(DECORATOR_PATH.'/'.$class_name.'.decorator.php'); break; case MODEL_POSTFIX: require(MODEL_PATH.'/'.$class_name.'.model.php'); break; default: require(LIB_PATH.'/'.$name.'.lib.php'); } } ?>