domainlock(); // locks domain, load config and start i18n # -- database and metadata load if (!$core->dbconnect()) $core->offlineMode = true; if (!$core->loadMetadata() || !$core->loadPageSettings()) $core->errorControl->raise(1); if ($core->debugmode) $core->applyMetaData(); // only in debug. Executes onMeta's and save metadata/sql changes # -- start parsing the request $core->parseRequest(); if (!$core->isFM) { # -- which page I want and context are ready on parseRequest, load template require CONS_PATH_INCLUDE."template/tc.php"; $core->template = new CKTemplate(null,CONS_PATH_INCLUDE."template/",$core->debugmode,true); $core->template->constants = array( 'PAGE_TITLE' => UcWords($_SESSION['CODE']), // will replace with dimconfig 'IMG_PATH' => CONS_INSTALL_ROOT.CONS_PATH_PAGES.$_SESSION['CODE']."/files/", 'FMANAGER_PATH' => CONS_INSTALL_ROOT.CONS_FMANAGER, // CONS_FMANAGER came from custom config.php 'BASE_PATH' => CONS_INSTALL_ROOT, 'JS_PATH' => CONS_INSTALL_ROOT.CONS_PATH_JSFRAMEWORK, 'SESSION_LANG' => $_SESSION[CONS_SESSION_LANG], 'CHARSET' => $core->charset, 'DOMAIN_NAME' => $core->domain, 'METAKEYS' => '', // meta keys contents (not the tag) 'METADESC' => '', // meta description contents ( not the tag) 'CANONICAL' => '', // canonical contents (the URL, not the tag) 'HEADCSSTAGS' => '', // CSS tags (should be echoed before js) 'HEADJSTAGS' => '', // JS tags 'HEADUSERTAGS' => '', // other tags that will come last in the HEADER 'METATAGS' => '' // actual meta tags (build with the contents above, at core::showTemplate) ); require CONS_PATH_SYSTEM."tcexternal.php"; $core->template->externalClasses = new CKTCexternal($core); $core->loadIntlControl(); } else { $core->onShow(); $core->close(true); } # -- at this point, the overhead is done. From now on, it's mostly the site code. # ab -n200 67 53 48 (mean) if (!CONS_CACHE || (!$core->offlineMode && !$core->cacheControl->canUseCache())) { # NO CACHE AVAILABLE /* if (CONS_CACHE && !$this->isFM) { $core->cacheControl->cachepath = isset($_REQUEST['nocache'])?"":CONS_PATH_CACHE.$_SESSION['CODE']."/"; # the files have "template" in their path so I don't need to add it here or I have a template/template structure $core->cacheControl->cacheSeed = $_SESSION[CONS_SESSION_LANG]; } */ $core->checkActions(); $core->cronCheck(); $core->template->constants['ACTION'] = $core->action; $core->template->constants['CONTEXT'] = $core->context_str; $core->renderPage(); $PAGE = $core->showTemplate(); unset($core->template); $core->dbo->close(); //if (CONS_CACHE && $core->layout < 2) $core->cacheControl->setCache($PAGE); } else { # CACHE AVAILABLE if ($core->layout != 2 || CONS_AJAXRUNSSCRIPTS) { $core->checkActions(); $core->cronCheck(); } $PAGE = $core->cacheControl->renderCache(); $core->dbo->close(); } $error = ob_get_contents(); ob_end_clean(); $core->headerControl->showHeaders(); if ($error != "") { if ($core->layout<2) $PAGE .= $core->errorControl->dumpUnexpectedOutput($error); else $PAGE .= $error; } # -- any script want to check the raw text/HTML output? foreach ($core->onEcho as $scriptName) { $core->loadedPlugins[$scriptName]->onEcho($PAGE); } # -- we are done here, close up whatever is no longer necessary and prepare to echo $core->close(false); $willGZIP = CONS_GZIP_OK && $core->layout < 2 && strlen($PAGE)>CONS_GZIP_MINSIZE; # -- outputs gzip if on normal layout and browser supports gzip if ($willGZIP) { header("Content-Encoding: gzip"); echo gzencode($PAGE); } else echo $PAGE; unset($PAGE);