setDateFormat( 'M d H:i:s Y' ) ->setStrictContext( false ); //$reporter->addReporter( 'system', E_ERROR_ALL | E_WARNING_ALL ); $reporter->addReporter( 'system', E_ALL ); ErrorList::singleton( $reporter, '__error' ); ### 0.1 ENABLE DEBUG IN DEV ENV if( isset( $_env_dev ) ) foreach( $_env_dev as $k => $pattern ) { if ( fnmatch ( $pattern, $_SERVER[$k] ) ) { ini_set( 'display_errors', 'On' ); ini_set( 'error_reporting', E_ALL ); define ( '_TIMER_', true ); define ( '_DEBUG_', 1 ); define ( '_DEVEL_', true ); // define ( '_ENVIRONMENT_', 'devel' ); break; } } //if( in_array( $_SERVER['REMOTE_ADDR'], $_dev_ips ) ){ /* if( isset( sys::$conf['enviroment_detect'] ) ) { foreach( sys::$conf['enviroment_detect'] as $env => $v ) { foreach( $env as $k => $pattern ) { if( fnmatch( $pattern, $_SERVER[$k] ) ) { sys::$conf['environment'] = $env; sys::load_config( $env ); break; } } if ( isset( sys::$conf['environment'] ) ) break; } }*/ ### 1 CORE INCLUDES //require _APP_ . 'lib/class.Sys.php'; //sys::error_handler (); //sys::load_config (); //sys::environment_detect (); //sys::autoloader (); ### 3 CONFIGURATION ### require _APP_ . 'lib/defaults.inc.php'; ### 0.4 AUTOLOADING require _APP_ . 'lib/AutoLoader.php'; $autoloader = new \opensourceame\AutoLoader ( $_sys['autoloader'] ); $autoloader->init(); //ini_set("include_path", _ROOT_ ); ### if( defined( '_DEVEL_' ) ){ $reporter->addReporter( 'system', E_VERY_ALL ) ->addReporter( 'console', E_VERY_ALL ); defined( 'DO_NOT_SEND_CONTENT_LENGTH' ) || define( 'DO_NOT_SEND_CONTENT_LENGTH', 1 ); } ### 2 PERFOMANCE PROFILING if( defined( '_TIMER_' ) ) { timer::start ( $__timer_start ); timer::enable_display (); } ### 3 CONFIGURATION ### #require_once( _LIB_ . 'defaults.inc.php' ); // config'as ish /site/ include_once( sys::FileFindLocation( 'config.php' )); //$reporter->addReporter('file', E_USER_ALL, _DEBUG_LOG_FILE ); ### 4 ROUTERS ### /* sys::router_add( array( '/admin($|/)' => function() { define( '_ADMIN_', _APP_ . 'com/admin/' ); define( '_ADMIN_RES_', _BASE_ . '/_app/com/admin' ); define( '_APP_BASE_', _BASE_ . '/_app' ); require_once( _ADMIN_ .'index.php' ); return true; // exit(); }) ); sys::router_add( function() { return include( _APP_ . 'com/dbfront/dbfront.php' ); // return true; }); sys::router_add( function() { include( _APP_ . 'theme/equs/404.php' ); return true; }); */ $routes = array ( array( _ADMIN_URL_ . '(?:$|/)', _APP_ . 'com/admin/index.php', 'name'=>'admin' ), array( null, _APP_ . 'com/dbfront/dbfront.php', ), array( null, _APP_ . 'theme/equs/404.php', ), ); sys::route( $routes, new Request() ); /* $routes = array( array( 'pages', 'AdminPages' ), array( 'pages/edit/{id:[0-9]+}', 'AdminPages::edit' ), array( 'tables/{table}', 'AdminTables' ), ); */ /* sys::router_add( array( _ADMIN_URL_ . '($|/)' => _APP_ . 'com/admin/index.php' ) ); sys::router_add( _APP_ . 'com/dbfront/dbfront.php' ); sys::router_add( _APP_ . 'theme/equs/404.php' ); ### RUN ### sys::route( new Request() ); */ /* ### ROUTE TO ADMIN ? if( isset($_SERVER["PATH_INFO"]) && ( $_SERVER["PATH_INFO"] == _ADMIN_URL_ || 0 === strpos ( $_SERVER["PATH_INFO"], _ADMIN_URL_ . '/' ) ) ) { define( '_ADMIN_', _APP_ . 'com/admin/' ); define( '_ADMIN_RES_', _BASE_ . '/_app/com/admin' ); define( '_APP_BASE_', _BASE_ . '/_app' ); require_once( _ADMIN_ .'index.php' ); exit(); }*/ /* ### ROUTE TO MANAGER ? if( preg_match( '/^\/manager(\/|^)/', $_SERVER["PATH_INFO"] ) ) { $default_page = '/manager'; $_VBUI['base'] = '/vbui/'; $_VBUI['site_base'] = '/site/'; chdir($_SERVER['DOCUMENT_ROOT'].$_VBUI['base'] ); include( 'lib/manager/process.php'); exit(); } */ /* ### 5 INITIALIZATION : BASE FUNCTIONS ### require_once( _LIB_ . 'compat/functions.inc.php' ); require_once( _LIB_ . 'request/opath_urlfilters.php' ); ### 6 INITIALIZATION : MAIN CLASSES ### ### initas: lang //$lang=new LANG( $site->lang ); $lang = new LANG( $_site['language'] ); $lang->setlocale(); ### initas: url $url = new URL(); ### editable mode? //if( defined( '_DEVEL_' ) || isset($_COOKIE['vbui_editable']) ){ if( 1==@$_COOKIE['vbui_editable'] ){ $_sys['editmode'] = true; } $opath_options['default'] = '/'; $opath_options['page'] = @$_GET['page']; $opath = new OPath( $opath_options ); // cia turi buti page kesho chekinimas //A// if ( class_exists( 'CacheMgr' ) ){ $cache = new CacheMgr; $pcache = $cache->getPageCache( $opath->op['oid'], $opath->op['parts'] ); if ( is_object($pcache) ){ if( defined('_DEVEL_') || (!empty($_SERVER['QUERY_STRING'])) || count($_POST)>0 || @$_sys['editmode'] ) { // jei url su queriu tai geriau jokio kiashinimo by default // arba jeigu postinam // arba jei edit mode (kai admininam) // $pcache->setCaching( 'nocache', 0, 0 ); $pcache->setMaxLevel( CACHE_LEVEL_NOCACHE ); log::debug( $opath->op['oid'] . ' ' . $opath->op['req'], 'nocache' ); }elseif( $pcache->getFromCache() ) { // radom keshe, viska isoutputinom, the end exit; } } //} // require_once( 'local_config.inc' ); ## db $db = sys::db(); ### initas: page $page = new PageDB( $opath ); if( ! $page->exists() ){ include( _LIB_ . 'sys/err_not_found.inc'); } ########### objektu inicializavimas $tpl = new VBuiTemplateMaster(); $mm = new Module_Manager( $modules ); $tpl->set_ref( 'POST', $_POST ); $tpl->set_ref( 'GET', $_GET ); $tpl->set_ref( 'CHARSET', $lang->charset ); ########### start page processing $page->start(); ########### end page && send output $page->end(); */ ?>