/** * Runs the whole logic. It is fajr's main() * * @returns void */ public function run() { $this->injector->getInstance('SessionInitializer.class')->startSession(); $trace = $this->injector->getInstance('Trace.class'); $this->statistics = $this->injector->getInstance('Statistics.class'); $this->displayManager = $this->injector->getInstance('DisplayManager.class'); $this->context = $this->injector->getInstance('Context.class'); try { Input::prepare(); $this->regenerateSessionOnLogin(); $connection = $this->provideConnection(); $this->runLogic($trace, $connection); } catch (LoginException $e) { if ($connection) { FajrUtils::logout($connection); } $this->setException($e); } catch (Exception $e) { $this->setException($e); } $trace->tlog("everything done, generating html"); $this->context->getResponse()->set('trace', null); if (FajrConfig::get('Debug.Trace') === true) { $this->context->getResponse()->set('trace', $trace); } $this->context->getResponse()->set('base', FajrUtils::basePath()); $this->context->getResponse()->set('language', 'sk'); try { echo $this->displayManager->display($this->context->getResponse()); } catch (Exception $e) { throw new Exception('Chyba pri renderovaní template: ' . $e->getMessage(), null, $e); } }
/** * Runs the whole logic. It is fajr's main() * * @returns void */ public function run() { $this->injector->getInstance('SessionInitializer.class')->startSession(); $timer = new SystemTimer(); // TODO(ppershing): use injector here! $trace = new NullTrace(); if (FajrConfig::get('Debug.Trace') === true) { $trace = new HtmlTrace($timer, "--Trace--"); } try { Input::prepare(); $this->regenerateSessionOnLogin(); $connection = $this->provideConnection(); $this->runLogic($trace, $connection); } catch (LoginException $e) { if ($connection) { FajrUtils::logout($connection); } DisplayManager::addException($e); } catch (Exception $e) { DisplayManager::addException($e); } DisplayManager::setBase(hescape(FajrUtils::basePath())); $trace->tlog("everything done, generating html"); if (FajrConfig::get('Debug.Trace') === true) { $traceHtml = $trace->getHtml(); DisplayManager::addContent('<div class="span-24">' . $traceHtml . '<div> Trace size:' . sprintf("%.2f", strlen($traceHtml) / 1024.0 / 1024.0) . ' MB</div></div>'); } echo DisplayManager::display(); }
/** * Runs the whole logic. It is fajr's main() * * @returns void */ public function run() { $trace = $this->injector->getInstance('Trace.class'); $this->statistics = $this->injector->getInstance('Statistics.class'); $this->displayManager = $this->injector->getInstance('DisplayManager.class'); $this->context = $this->injector->getInstance('Context.class'); $session = $this->injector->getInstance('Session.Storage.class'); $loginManager = new LoginManager($session, $this->context->getRequest()); $response = $this->context->getResponse(); try { Input::prepare(); // we are going to log in, so we get a clean session // this needs to be done before a connection // is created, because we pass cookie file name // that contains session_id into AIS2CurlConnection if ($loginManager->shouldLogin()) { $session->regenerate(true); } $connection = $this->provideConnection(); $this->setResponseFields($response); $this->runLogic($trace, $connection); } catch (LoginException $e) { if ($connection) { FajrUtils::logout($connection); } $this->setException($e); } catch (SecurityException $e) { die($e); $this->logSecurityException($e); $response->setTemplate("securityViolation"); } catch (Exception $e) { die($e); $this->setException($e); } $trace->tlog("everything done, rendering template"); if (FajrConfig::get('Debug.Trace') === true) { $response->set('trace', $trace); } else { $response->set('trace', null); } try { echo $this->displayManager->display($this->context->getResponse()); } catch (Exception $e) { throw new Exception('Chyba pri renderovaní template ' . $this->context->getResponse()->getTemplate() . ':' . $e->getMessage(), null, $e); } }