/** * 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(); }
private function setResponseFields(Response $response) { $response = $this->context->getResponse(); $response->set('version', new Version()); $response->set('banner_debug', FajrConfig::get('Debug.Banner')); $response->set('google_analytics', FajrConfig::get('GoogleAnalytics.Account')); $response->set('instanceName', FajrConfig::get('AIS2.InstanceName')); $response->set('base', FajrUtils::basePath()); $response->set('language', 'sk'); $server = $this->getServer(); $serverList = FajrConfig::get('AIS2.ServerList'); $response->set('availableServers', $serverList); $response->set('currentServer', $server); // $response->set('serverName', $server->getServerName()); // $response->set('banner_beta', $server->isBeta()); // $response->set('cosignCookieName', $server->getCosignCookieName()); }