Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r16339 -r16348 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 16339) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 16348) @@ -1,6 +1,6 @@ InitParser(); + /** @var kThemesHelper $themes_helper */ + $themes_helper = $this->recallObject('ThemesHelper'); + // Set Web Request variables to affect link building on template itself. + $this->SetVar('t', $template); + $this->SetVar('m_cat_id', $themes_helper->getPageByTemplate($template)); + $this->SetVar('passed', 'm'); + + // Replace current page content with given template. + $this->InitParser(); $this->Parser->Clear(); - $this->HTML = $this->Parser->Run($this->GetVar('t')); + $this->HTML = $this->Parser->Run($template); } /** Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r16313 -r16348 --- branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 16313) +++ branches/5.2.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 16348) @@ -1,6 +1,6 @@ Application->ConfigValue('ErrorTemplate'); - $real_t = $not_found ? $not_found : 'error_notfound'; - - $themes_helper = $this->Application->recallObject('ThemesHelper'); - /* @var $themes_helper kThemesHelper */ - - $theme_id = $this->Application->GetVar('m_theme'); - $category_id = $themes_helper->getPageByTemplate($real_t, $theme_id); - $this->Application->SetVar('m_cat_id', $category_id); - - header('HTTP/1.0 404 Not Found'); + $this->Application->UrlManager->show404(); } // replace alias in form #alias_name# to actual template used in this theme Index: branches/5.2.x/core/kernel/managers/rewrite_url_processor.php =================================================================== diff -u -N -r16339 -r16348 --- branches/5.2.x/core/kernel/managers/rewrite_url_processor.php (.../rewrite_url_processor.php) (revision 16339) +++ branches/5.2.x/core/kernel/managers/rewrite_url_processor.php (.../rewrite_url_processor.php) (revision 16348) @@ -1,6 +1,6 @@ _setCachedUrl($url, Array ('vars' => $vars, 'passed' => $passed)); } + else { + header('HTTP/1.0 404 Not Found'); + } if ( $this->Application->GetVarDirect('t', 'Post') ) { // template from POST overrides template from URL. @@ -445,7 +448,13 @@ } if ( $this->_partsToParse ) { - $vars = array_merge($vars, $this->manager->prepare404($vars['m_theme'])); + /** @var kThemesHelper $themes_helper */ + $themes_helper = $this->Application->recallObject('ThemesHelper'); + + $not_found = $this->Application->ConfigValue('ErrorTemplate'); + $vars['t'] = $not_found ? $not_found : 'error_notfound'; + $vars['m_cat_id'] = $themes_helper->getPageByTemplate($vars['t'], $vars['m_theme']); + $vars['pass'] = array('m'); } return $vars; @@ -1078,4 +1087,4 @@ return $ret; } -} \ No newline at end of file +} Index: branches/5.2.x/core/kernel/managers/url_manager.php =================================================================== diff -u -N -r16339 -r16348 --- branches/5.2.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 16339) +++ branches/5.2.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 16348) @@ -1,6 +1,6 @@ Application->GetVar('m_theme'); - } - - $not_found = $this->Application->ConfigValue('ErrorTemplate'); - $vars['t'] = $not_found ? $not_found : 'error_notfound'; - - $themes_helper = $this->Application->recallObject('ThemesHelper'); - /* @var $themes_helper kThemesHelper */ - - $vars['m_cat_id'] = $themes_helper->getPageByTemplate($vars['t'], $theme_id); - - header('HTTP/1.0 404 Not Found'); - - return $vars; - } - - /** * Show 404 page and exit * * @return void * @access public */ public function show404() { - $vars = $this->prepare404(); + header('HTTP/1.0 404 Not Found'); - foreach ($vars as $var_name => $var_value) { - $this->Application->SetVar($var_name, $var_value); - } + $not_found = $this->Application->ConfigValue('ErrorTemplate'); + $template = $not_found ? $not_found : 'error_notfound'; - // ensure parser is available (e.g. 404 page requested from event) - $this->Application->QuickRun(); + $this->Application->QuickRun($template); $this->Application->Done(); exit; } -} \ No newline at end of file +} Index: branches/5.2.x/core/kernel/nparser/nparser.php =================================================================== diff -u -N -r16270 -r16348 --- branches/5.2.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 16270) +++ branches/5.2.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 16348) @@ -1,6 +1,6 @@ $keep_buffering_levels ) { + ob_end_clean(); + } + $this->Stack = array(); $this->Level = 0;