Index: trunk/core/units/general/inp1_parser.php =================================================================== diff -u -N -r4446 -r4567 --- trunk/core/units/general/inp1_parser.php (.../inp1_parser.php) (revision 4446) +++ trunk/core/units/general/inp1_parser.php (.../inp1_parser.php) (revision 4567) @@ -1,12 +1,15 @@ InportalInited) { //$save_t = $this->Application->GetVar('t'); $this->InitInPortal(); @@ -31,6 +34,7 @@ $template_body = $this->Application->Parser->Parse( $template_cache->GetTemplateBody($t), $t, 0 ); } else { + $this->InitParser(); $template_body = $objTemplate->ParseTemplateFromBuffer($tname, $template_body); } return $template_body; @@ -45,6 +49,25 @@ return $tname; } + function InitParser() + { + global $objTemplate, $CurrentTheme, $objThemes, $objLanguageCache, $var_list; + if ($this->InpParsetInited) return true; + + $theme_id = $this->Application->GetVar('m_theme'); + if ($theme_id) { + $CurrentTheme = $objThemes->GetItem($theme_id); + + $timeout = $CurrentTheme->Get('CacheTimeout'); + $objLanguageCache->LoadTemplateCache($var_list['t'], $timeout, $theme_id); + $objLanguageCache->LoadCachedVars($this->Application->GetVar('m_lang')); + + $objTemplate = new clsTemplateList(FULL_PATH.THEMES_PATH.'/'); + } + + $this->InpParsetInited = true; + } + function InitInPortal() { $this->InportalInited = true; @@ -94,100 +117,39 @@ include_once(FULL_PATH."/kernel/startup.php"); $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); - - //$secureURL = "https://".ThisDomain().$objConfig->Get("Site_Path"); $secureURL = $rootURL; - $html= ''; - if( !$var_list['t'] ) $var_list['t'] = 'index'; - if( !isset($CurrentTheme) ) $CurrentTheme = null; + $this->InitParser(); - $theme_id = defined('DBG_FORCE_THEME') && DBG_FORCE_THEME ? DBG_FORCE_THEME : $m_var_list['theme']; - - if( !is_object($CurrentTheme) ) $CurrentTheme = $objThemes->GetItem($theme_id); - - if(is_object($CurrentTheme)) - { - if(!$CurrentTheme->Get("Enabled")) - { - $CurrentTheme = $objThemes->GetItem($objThemes->GetPrimaryTheme()); - } - if((int)$CurrentTheme->Get("ThemeId")>0) - { - $timeout = $CurrentTheme->Get("CacheTimeout"); - $objLanguageCache->LoadTemplateCache($var_list["t"],$timeout,$CurrentTheme->Get("ThemeId")); - $objLanguageCache->LoadCachedVars($objSession->Get("Language")); - - $TemplateRoot = $CurrentTheme->ThemeDirectory()."/"; - - $objTemplate = new clsTemplateList($TemplateRoot); - //$html = $objTemplate->ParseTemplate($var_list["t"]); - } - else - { - echo "No Primary Theme Selected"; - die(); - } - } - else - { - echo "No Primary Theme Selected\n"; - die(); - } - - if(is_object($objSession)) - { + // process referer in session: begin + if (is_object($objSession)) { $k4_referer = $objSession->GetVariable('K4_Template_Referer'); - if($k4_referer) - { + if ($k4_referer) { $_local_t = $k4_referer; $this->Application->RemoveVar('K4_Template_Referer'); } - $objSession->SetVariable("Template_Referer", $_local_t); + $objSession->SetVariable('Template_Referer', $_local_t); } - if($objTemplate->ErrorNo == -1) - { - $html = $objTemplate->ParseTemplate('error_template'); - } - //$html = replacePngTags($html); - LogEntry("Output Start\n"); - $html .= ""; - if( IsDebugMode() ) - { - if($Action) $debugger->setHTMLByIndex(1,'Front Action: '.$Action.'','append'); - //$html = 'Show Debugger
'.$html; - } - else - { -// header("Content-length: ".strlen($html)); - } -// header("Connection-Type: Keep-Alive"); -// echo $html; + // process referer in session: end - LogEntry("Output End\n"); - - if( isset($template) && $template->ErrorNo != 0 ) - { - print "\n(".$objTemplate->ErrorNo.") ".$objTemplate->ErrorStr."\n"; + if ($this->Application->isDebugMode() && $Action) { + $this->Application->Debugger->setHTMLByIndex(1, 'Front Action: '.$Action.'', 'append'); } LogEntry("Output Complete\n"); $objLanguageCache->SaveTemplateCache(); LogEntry("Templates Cached\n"); - //if($objSession->SessionEnabled()) - // $objSession->SaveSessionData(); - //echo "Cookie:
"; print_r($_COOKIE); echo "

\n"; - //ob_end_flush(); $timeend = getmicrotime(); $diff = $timeend - $timestart; LogEntry("\nTotal Queries Executed: $sqlcount in $totalsql seconds\n"); LogEntry("\nPage Execution Time: $diff seconds\n", true); - if($LogFile) + if ($LogFile) { fclose($LogFile); + } } }