Example #1
0
 private function provideConnection()
 {
     $curlOptions = $this->injector->getParameter('CurlConnection.options');
     $connection = new connection\CurlConnection($curlOptions, FajrUtils::getCookieFile());
     $this->statistics->setRawStatistics($connection->getStats());
     $connection = new connection\AIS2ErrorCheckingConnection($connection);
     return $this->statistics->hookFinalConnection($connection);
 }
Example #2
0
 private function provideConnection()
 {
     $curlOptions = $this->injector->getParameter('CurlConnection.options');
     $connection = new connection\CurlConnection($curlOptions, FajrUtils::getCookieFile());
     $connection = $this->statistics->hookRawConnection($connection);
     $connection = new connection\GzipDecompressingConnection($connection, FajrConfig::getDirectory('Path.Temporary'));
     $connection = new connection\AIS2ErrorCheckingConnection($connection);
     return $this->statistics->hookFinalConnection($connection);
 }
Example #3
0
 public static function getInstance()
 {
     $statistics = Statistics::getInstance();
     $curlOptions = self::getOptions();
     $connection = new CurlConnection($curlOptions, self::provideCookieFile());
     $statistics->setRawStatistics($connection->getStats());
     $connection = new AIS2ErrorCheckingConnection($connection);
     return $statistics->hookFinalConnection($connection);
 }
Example #4
0
 /**
  * Sets dafault template fields.
  * TODO: set as twig globals?
  */
 private function setResponseFields(Request $request)
 {
     $skinSettings = SkinSettings::getInstance();
     if ($request->isMobileBrowser()) {
         $skinSettings->setDefaultSkinName('mobile');
     }
     $this->displayManager->setSkin($skinSettings->getUserSkin());
     $params = array();
     $referrer = $request->getHeader('Referer');
     $pageMovedCookie = isset($_COOKIE['FajrPageMoved']);
     $pageMovedReferer = preg_match('#^https?://fajr.dcs.fmph.uniba.sk#', $referrer) === 1;
     if ($pageMovedCookie || $pageMovedReferer) {
         Warnings::getInstance()->addWarning(array('type' => 'pageMoved'));
     }
     $params['version'] = new Version();
     $params['banner_debug'] = $this->config->get(FajrConfigOptions::DEBUG_BANNER);
     if ($request->isDoNotTrack()) {
         $params['google_analytics'] = null;
     } else {
         $params['google_analytics'] = $this->config->get(FajrConfigOptions::GOOGLE_ANALYTICS_ACCOUNT);
     }
     $params['base'] = FajrUtils::basePath();
     $params['language'] = 'sk';
     $params['availableServers'] = array();
     $params['currentServer'] = array('isBeta' => false, 'instanceName' => 'Chyba');
     $server = $this->serverManager->getActiveServer();
     $serverList = $this->config->get(FajrConfigOptions::AIS_SERVERLIST);
     $params['availableServers'] = $serverList;
     $params['currentServer'] = $server;
     $params['backendType'] = $server->getBackendType();
     $params['aisVersion'] = null;
     $params['aisVersionIncompatible'] = false;
     $params['loggedIn'] = false;
     $params['developmentVersion'] = $this->config->get(FajrConfigOptions::IS_DEVEL);
     $params['statistics'] = Statistics::getInstance();
     $params['warnings'] = Warnings::getInstance();
     $this->displayManager->setDefaultParams($params);
 }