Index: branches/5.3.x/core/kernel/application.php =================================================================== diff -u -N -r16222 -r16395 --- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 16222) +++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 16395) @@ -1,6 +1,6 @@ SetVar('m_cat_id', 0); } - if ( !$this->RecallVar('curr_iso') ) { + if ( !$this->RecallVar('curr_iso') && !(defined('IS_INSTALL') && IS_INSTALL) ) { $this->StoreVar('curr_iso', $this->GetPrimaryCurrency(), true); // true for optional } @@ -383,7 +383,9 @@ $this->InitDone = true; - $this->HandleEvent(new kEvent('adm:OnStartup')); + if ( PHP_SAPI !== 'cli' && !$this->isAdmin ) { + $this->HandleEvent(new kEvent('adm:OnStartup')); + } return true; } @@ -701,6 +703,7 @@ // Cache. $this->registerClass('kCacheManager', KERNEL_PATH . '/managers/cache_manager.php'); $this->registerClass('kCache', KERNEL_PATH . '/utility/cache.php'); + $this->registerClass('kSubscriptionItem', KERNEL_PATH . '/managers/subscription_manager.php'); // Unit configs. $this->registerClass('kUnitConfigReader', KERNEL_PATH . '/utility/unit_config_reader.php'); @@ -732,9 +735,8 @@ * Registers default build events * * @return void - * @access protected */ - protected function RegisterDefaultBuildEvents() + public function RegisterDefaultBuildEvents() { $this->EventManager->registerBuildEvent('kTempTablesHandler', 'OnTempHandlerBuild'); } @@ -1065,18 +1067,26 @@ } /** - * Only renders template + * Replaces current rendered template with given one. * - * @see kDBEventHandler::_errorNotFound() + * @param string|null $template Template. + * + * @return void */ - public function QuickRun() + public function QuickRun($template) { - // discard any half-parsed content - ob_clean(); + /** @var kThemesHelper $themes_helper */ + $themes_helper = $this->recallObject('ThemesHelper'); - // replace current page content with 404 + // 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->HTML = $this->Parser->Run($this->GetVar('t')); + $this->Parser->Clear(); + $this->HTML = $this->Parser->Run($template); } /** @@ -1880,7 +1890,7 @@ echo 'Debug output above !!!
' . "\n"; if ( array_key_exists('HTTP_REFERER', $_SERVER) ) { - echo 'Referer: ' . $_SERVER['HTTP_REFERER'] . '
' . "\n"; + echo 'Referer: ' . kUtil::escape($_SERVER['HTTP_REFERER'], kUtil::ESCAPE_HTML) . '
' . "\n"; } echo "Proceed to redirect: {$location}
\n"; @@ -1908,7 +1918,7 @@ } elseif ( headers_sent() != '' ) { // some output occurred -> redirect using javascript - echo ''; + echo ''; } else { // no output before -> redirect using HTTP header @@ -2144,6 +2154,18 @@ } /** + * Finds the absolute path to the file where the class is defined. + * + * @param string $class The name of the class. + * + * @return string|false + */ + public function findClassFile($class) + { + return $this->Factory->findClassFile($class); + } + + /** * Add new scheduled task * * @param string $short_name name to be used to store last maintenance run info