public static function getInstance() { if (!isset(self::$instance)) { $config = FajrConfigLoader::getConfiguration(); $type = $config->get(FajrConfigOptions::DEBUG_TRACE); $uniqueID = sha1(uniqid('trace', true)); $header = 'Trace (id: ' . $uniqueID . ')'; $tags = array('unique-id' => $uniqueID); if ($type === FajrConfigOptions::DEBUG_TRACE_NONE) { self::$instance = new NullTrace(); } else { if ($type === FajrConfigOptions::DEBUG_TRACE_ARRAY) { self::$instance = new ArrayTrace(SystemTimer::getInstance(), $header); } else { // File-based trace $traceDir = $config->getDirectory(FajrConfigOptions::DEBUG_TRACE_DIR); if ($traceDir === null) { throw new \LogicException(FajrConfigOptions::DEBUG_TRACE_DIR . ' is not set, but is required for file-based traces'); } $ext = $type == FajrConfigOptions::DEBUG_TRACE_TEXT ? 'txt' : 'bin'; $filename = FajrUtils::joinPath($traceDir, 'trace' . $uniqueID . '.' . $ext); $file = @fopen($filename, 'ab'); if ($file === false) { throw new \Exception('Cannot open trace file'); } if ($type == FajrConfigOptions::DEBUG_TRACE_TEXT) { self::$instance = new FileTrace(SystemTimer::getInstance(), $file, 0, $header); } else { self::$instance = new BinaryFileTrace(SystemTimer::getInstance(), $file, $header, $tags); } } } } return self::$instance; }
public function getPath() { $dir = $this->config['path']; if (FajrUtils::isAbsolutePath($dir)) { return $dir; } // default resolve relative to Template.Directory $relativeTo = FajrConfig::getDirectory('Template.Directory'); return FajrUtils::joinPath($relativeTo, $dir); }
/** Return an instance of Router * @return Router */ public static function getInstance() { if (!isset(self::$instance)) { $config = FajrConfigLoader::getConfiguration(); $cachePath = $config->getDirectory(FajrConfigOptions::PATH_TO_ROUTER_CACHE); $controllerPath = FajrUtils::joinPath(FajrUtils::getProjectRootDirectory(), '/src/controller'); $locator = new FileLocator(array($controllerPath)); $request = SymfonyRequest::createFromGlobals(); $requestContext = new RequestContext(); $requestContext->fromRequest($request); $sfRouter = new SymfonyRouter(new YamlFileLoader($locator), "routes.yml", array('cache_dir' => $config->get(FajrConfigOptions::USE_CACHE) ? $cachePath : null), $requestContext); self::$instance = new Router($sfRouter, $request); } return self::$instance; }
public function warnWrongTableStructure(Trace $trace, $tableName, array $expectedDefinition, array $definition) { Preconditions::checkIsString($tableName); if ($expectedDefinition != $definition) { $message = array('type' => 'unexpectedTableStructure', 'tableName' => $tableName); $this->addWarning($message); $child = $trace->addChild("Differences in data table " . $tableName); list($del, $both, $ins) = FajrUtils::compareArrays($expectedDefinition, $definition); $child->tlogVariable('deleted', $del); $child->tlogVariable('unchanged', $both); $child->tlogVariable('inserted', $ins); $child->tlogVariable('expectedDefinition', $expectedDefinition); $child->tlogVariable('definition', $definition); } }
public function login(Trace $trace, ServerConfig $serverConfig, LoginFactory $factory, AIS2ServerConnection $connection) { $login = $this->provideLogin($serverConfig, $factory, $this->request); if ($login === null) { return false; } $trace->tlog("logging in"); if (!$login->login($connection)) { return false; } $trace->tlog("logged in correctly."); $this->session->write('login/login.class', $login); $this->session->write('server', $serverConfig); FajrUtils::redirect(); // it should be safe to end script execution here. exit; }
public function prepare() { if (self::$prepared) { throw new IllegalStateException("Input::prepare should be called only once per request."); } self::$prepared = true; if (FajrConfig::get('URL.Path')) { $_get = array_merge(FajrRouter::pathToParams(FajrUtils::pathInfo()), $_GET); } else { $_get = $_GET; } $_post = $_POST; // budeme pouzivat uz len Input unset($_GET); unset($_POST); $this->_get = $this->_prepare_array($_get, $this->allowed_get); $this->_post = $this->_prepare_array($_post, $this->allowed_post); $this->inputParameters = array_merge($this->_get, $this->_post); }
public function runLogic(Trace $trace, HttpConnection $connection) { $session = $this->context->getSessionStorage(); $loginManager = new LoginManager($session, $this->context->getRequest()); $server = $this->getServer(); $serverConnection = new AIS2ServerConnection($connection, new AIS2ServerUrlMap($server->getServerName())); $action = $this->context->getRequest()->getParameter('action', 'studium.MojeTerminyHodnotenia'); $response = $this->context->getResponse(); if ($action == 'logout') { $loginManager->logout($serverConnection); FajrUtils::redirect(array(), 'index.php'); exit; } else { if ($action == 'termsOfUse') { // TODO(anty): refactor this $response->setTemplate('termsOfUse'); return; } } if ($loginManager->shouldLogin()) { $factory = $this->injector->getInstance('LoginFactory.class'); $loginManager->login($trace->addChild("Logging in..."), $server, $factory, $serverConnection); $loggedIn = false; // login makes redirect on success } else { $loggedIn = $loginManager->isLoggedIn($serverConnection); } if ($loggedIn) { $controllerInjector = new Injector(array(new ControllerInjectorModule($serverConnection, $server, $session))); $mainScreen = $controllerInjector->getInstance('AIS2MainScreen.class'); if (($aisVersion = $session->read('ais/aisVersion')) == null) { $aisVersion = $mainScreen->getAisVersion($trace->addChild('Get AIS version')); $session->write('ais/aisVersion', $aisVersion); } if (($aisApps = $session->read('ais/aisApps')) == null) { $aisApps = $mainScreen->getAllAvailableApplications($trace->addChild('Get all applications')); $session->write('ais/aisApps', $aisApps); } if (($userName = $session->read('ais/aisUserName')) == null) { $userName = $mainScreen->getFullUserName($trace->addChild('Get user name')); $session->write('ais/aisUserName', $userName); } $response->set('aisVersion', $aisVersion); $response->set('aisVersionIncompatible', !($aisVersion >= regression\VersionRange::getMinVersion() && $aisVersion <= regression\VersionRange::getMaxVersion())); $response->set('aisUserName', $userName); $controller = new DispatchController($controllerInjector, $this->injector->getParameter('controller.dispatchMap')); $response->set("action", $action); $controller->invokeAction($trace, $action, $this->context); $response->set('statistics', $this->statistics); } else { $server = $this->getServer(); switch ($server->getLoginType()) { case 'password': $response->setTemplate('welcome'); break; case 'cosign': $response->setTemplate('welcomeCosign'); break; case 'cosignproxy': $response->setTemplate('welcomeCosignProxy'); break; case 'nologin': $response->setTemplate('welcomeDemo'); break; default: throw new Exception("Invalid type of login"); } } }
/** * @returns string absolute path to configuration file */ public static function getConfigurationFileName() { return FajrUtils::joinPath(FajrUtils::getProjectRootDirectory(), '/config/configuration.php'); }
/** * Get a directory configuration path. * * If a relative path is given in configuration, it is resolved * relative to the specified directory or project root directory * if no directory was specified * * @param string $key * @returns string absolute path for the directory specified in configuration * or null if this option was not specified and does not have * a default value * @see FajrConfig::getParameterDescription() * @see configuration.example.php */ public function getDirectory($key) { $dir = $this->get($key); if ($dir === null) { return null; } if (FajrUtils::isAbsolutePath($dir)) { return $dir; } // default resolve relative $relativeTo = FajrUtils::getProjectRootDirectory(); $parameters = $this->getParameterDescription(); assert(array_key_exists($key, $parameters)); $param = $parameters[$key]; if (array_key_exists('relativeTo', $param)) { $relativeTo = $this->getDirectory($param['relativeTo']); } return FajrUtils::joinPath($relativeTo, $dir); }
napriek tomu ponúkame možnosť ich pohodlne zmeniť na jednom mieste - v tomto súbore. </p> <p> <strong>Dôležité:</strong> Pred používaním aplikácie je ešte nutné správne nastaviť skupinu na <code>www-data</code> (alebo pod čím beží webserver) a práva na adresáre <code>./temp</code>, <code>./temp/cookies</code> a <code>./temp/sessions</code> (alebo na tie, čo ste nastavili v konfigurácii), tak, aby boli nastavené práva len na zapisovanie a použitie , t.j. <code>d----wx---</code>. </p> '); } $config = FajrConfigLoader::getConfiguration(); if ($config->get(FajrConfigOptions::REQUIRE_SSL) && !FajrUtils::isHTTPS()) { fajr_bootstrap_error(' <p> Pre túto inštanciu fajr-u je vyžadované HTTPS spojenie. Prosím skontrolujte prepisovacie pravidlá v <code>.htaccess</code> (alebo konfigurácii web servera), ktoré presmerovávajú HTTP spojenia na HTTPS. Ak nechcete vyžadovať SSL spojenie, je možné túto kontrolu vypnúť v konfiguračnom súbore, <strong>avšak na produkčných inštaláciách, alebo inštaláciách s funkčným SSL sa neodporúča túto kontrolu vypínať. </strong> </p> '); } // bootstrapping whole application // TODO: DEBUG_EXCEPTION_SHOWSTACKTRACE sa nejako vytratilo... SystemTimer::setInitialTime($startTime);
/** * Sends redirect headers. * * Note that this will not end script execution! * * @param array|string $target array query params or absolute url as string * @param string $file file to which redirect * @todo set http response code to 302/303. * * @returns void */ public function redirect($target = array(), $file = 'fajr.php') { Preconditions::check(is_array($target) || is_string($target), '$target needs to be array or string'); if (is_array($target)) { $url = FajrUtils::buildUrl($target, $file); } else { if (is_string($target)) { $url = $target; } else { assert(false); } } // Note: It is tempting to end script execution here. // However, it is not wise. Calling exit() will start // php shutdown phase and according to manual // there is unpredictable object destruction order // in this phase header('Location: ' . $url); $this->set('redirectUrl', $url); $this->setTemplate('redirect'); }
public function runInformacnyList(Trace $trace, Request $request) { $searchCode = $request->getParameter('code'); $format = $request->getParameter('format'); Preconditions::check(!empty($searchCode), "Nezadaný kód predmetu!"); // Zistime aktualny akad rok. $akadRok = FajrUtils::getAcademicYear(); $content = $this->registerPredmetovScreen->getInformacnyList($trace, $searchCode, $akadRok); // Docasny fix, vrati PDF s informacnym listom $response = new \Symfony\Component\HttpFoundation\Response($content, 200); $response->headers->set('Content-Type', 'application/pdf'); return $response; $ip = new InformacnyListParser(); $list = $ip->parse($trace, $content); $params = array(); $params['list'] = $list->getAllAttributes(); $params['code'] = $searchCode; $name = $list->getAttribute('nazov'); $code = $list->getAttribute('kod'); if ($code === false) { $code = $searchCode; } else { $code = $code['values'][0]; } if ($name === false) { $name = 'Predmet ' . $code; } else { $name = $name['values'][0]; } $params['subjectName'] = $name; return $this->renderResponse('predmety/informacnyList', $params, $format == 'json' ? 'json' : 'html'); }
private function adjustResponse(\Symfony\Component\HttpFoundation\Response $response) { $pageMovedCookie = isset($_COOKIE['FajrPageMoved']); if ($pageMovedCookie) { $response->headers->clearCookie('FajrPageMoved', '/', 'fajr.fmph.uniba.sk'); } // https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header $response->headers->set('X-Frame-Options', 'DENY'); if (FajrUtils::isHTTPS()) { $hstsExpireTime = $this->config->get(FajrConfigOptions::STRICT_TRANSPORT_SECURITY); if ($hstsExpireTime !== null && intval($hstsExpireTime) > 0) { $response->headers->set('Strict-Transport-Security', 'max-age=' . intval($hstsExpireTime)); } } }
public static function getInstance() { require_once FajrUtils::joinPath(__DIR__, '..', 'third_party', 'icalcreator', 'iCalcreator.class.php'); return new \vcalendar(); }
/** * Get a directory configuration path. * * If a relative path is given in configuration, it is resolved * relative to the specified directory or project root directory * if no directory was specified * * @param string $key * @returns string absolute path for the directory specified in configuration * or null if this option was not specified and does not have * a default value * @see FajrConfig::$defaultOptions * @see FajrConfig::$directoriesRelativeTo * @see configuration.example.php */ public static function getDirectory($key) { self::assertInitialized(); $dir = self::get($key); if ($dir === null) { return null; } if (FajrUtils::isAbsolutePath($dir)) { return $dir; } // default resolve relative $relativeTo = FajrUtils::joinPath(dirname(__FILE__), '..'); $parameters = self::getParameterDescription(); assert(array_key_exists($key, $parameters)); $param = $parameters[$key]; if (array_key_exists('relativeTo', $param)) { $relativeTo = self::getDirectory($param['relativeTo']); } return FajrUtils::joinPath($relativeTo, $dir); }
/** * Akcia ktora sa pokusi prihlasit cloveka na danu skusku * * @param Trace $trace trace object * @param Context $context */ public function runPrihlasNaSkusku(Trace $trace, Context $context) { $request = $context->getRequest(); $response = $context->getResponse(); $predmetIndex = $request->getParameter("prihlasPredmetIndex"); $terminIndex = $request->getParameter("prihlasTerminIndex"); $predmety = $this->terminyHodnoteniaScreen->getPredmetyZapisnehoListu($trace->addChild('Predmety zapisneho listu'))->getData(); $predmetKey = -1; foreach ($predmety as $key => $row) { if ((string) $row[PredmetyFields::INDEX] === $predmetIndex) { $predmetKey = $key; } } $childTrace = $trace->addChild('Zoznam terminov'); $terminyDialog = $this->terminyHodnoteniaScreen->getZoznamTerminovDialog($childTrace, $predmetIndex); $terminy = $terminyDialog->getZoznamTerminov($childTrace)->getData(); $terminKey = -1; foreach ($terminy as $key => $terminyRow) { if ((string) $terminyRow[TerminyFields::INDEX] === $terminIndex) { $terminKey = $key; } } if ($predmetKey == -1 || $terminKey == -1) { throw new Exception("Ooops, predmet/termín nenájdený. Pravdepodobne\n zmena dát v AISe."); } $hash = StudiumUtils::hashNaPrihlasenie($predmety[$predmetKey][PredmetyFields::SKRATKA], $terminy[$terminIndex]); if ($hash != $request->getParameter('hash')) { throw new Exception("Ooops, nesedia údaje o termíne. Pravdepodobne zmena\n dát v AISe spôsobila posunutie tabuliek."); } if (!$terminyDialog->prihlasNaTermin($trace->addChild('prihlasujem na termin'), $terminIndex)) { throw new Exception('Na skúšku sa nepodarilo prihlásiť.'); } $response->setTemplate('redirect'); FajrUtils::redirect(array('action' => 'studium.MojeTerminyHodnotenia', 'studium' => $this->studium, 'list' => $this->zapisnyList)); }
public function testExtractExceptionInfoWithPrevious() { $previous = new Exception('previousMessage'); $exception = new Exception('testMessage', null, $previous); $info = FajrUtils::extractExceptionInfo($exception); $this->assertTrue(is_array($info['previous'])); $infoPrevious = $info['previous']; $this->assertEquals($infoPrevious['message'], 'previousMessage'); $this->assertEquals($infoPrevious['file'], $previous->getFile()); $this->assertEquals($infoPrevious['line'], $previous->getLine()); $this->assertEquals($infoPrevious['code'], $previous->getCode()); $this->assertEquals($infoPrevious['previous'], false); $trace = $exception->getTrace(); $infoTrace = $infoPrevious['trace']; $this->assertEquals(count($infoTrace), count($trace)); foreach ($infoTrace as $item) { foreach ($item as $key => $value) { if ($key == 'args') { $this->assertTrue(is_array($value)); foreach ($value as $arg) { $this->assertTrue(is_string($arg)); } } else { if ($key == 'line') { $this->assertTrue(is_string($value) || is_int($value)); } else { $this->assertTrue(is_string($value)); } } } } }
public function testCompareArrays() { $old = array(); $new = array('jedna'); list($del, $both, $ins) = FajrUtils::compareArrays($old, $new); $this->assertEquals(array(), $del); $this->assertEquals(array(), $both); $this->assertEquals(array('jedna'), $ins); $old = array('jedna'); $new = array(); list($del, $both, $ins) = FajrUtils::compareArrays($old, $new); $this->assertEquals(array('jedna'), $del); $this->assertEquals(array(), $both); $this->assertEquals(array(), $ins); $old = array('jedna'); $new = array('jedna'); list($del, $both, $ins) = FajrUtils::compareArrays($old, $new); $this->assertEquals(array(), $del); $this->assertEquals(array('jedna'), $both); $this->assertEquals(array(), $ins); $old = array('jedna', 'dva', 'styri'); $new = array('jedna', 'tri', 'styri'); list($del, $both, $ins) = FajrUtils::compareArrays($old, $new); $this->assertEquals(array('dva'), $del); $this->assertEquals(array('jedna', 'styri'), $both); $this->assertEquals(array('tri'), $ins); }
/** * Akcia ktora zobrazi terminy, na ktore je mozne potencialne sa prihlasit. * * @param Trace $trace trace object * @param Context $context */ public function runZoznamTerminov(Trace $trace, Context $context) { $request = $context->getRequest(); $response = $context->getResponse(); $predmetyZapisnehoListu = $this->terminyHodnoteniaScreen->getPredmetyZapisnehoListu($trace); FajrUtils::warnWrongTableStructure($response, 'terminy hodnotenia - predmety', regression\ZapisanePredmetyRegression::get(), $predmetyZapisnehoListu->getTableDefinition()); $hodnotenia = $this->hodnoteniaScreen->getHodnotenia($trace); FajrUtils::warnWrongTableStructure($response, 'hodnotenia', regression\HodnoteniaRegression::get(), $hodnotenia->getTableDefinition()); $hodnoteniaData = array(); foreach ($hodnotenia->getData() as $row) { $hodnoteniaData[$row[HodnoteniaFields::PREDMET_SKRATKA]] = $row; } $mozePrihlasitHelper = new MozePrihlasitNaTerminHelper($hodnoteniaData); $terminyData = array(); foreach ($predmetyZapisnehoListu->getData() as $predmetRow) { $predmetSkratka = $predmetRow[PredmetyFields::SKRATKA]; $predmetId = $predmetRow[PredmetyFields::INDEX]; $predmet = $predmetRow[PredmetyFields::NAZOV]; $childTrace = $trace->addChild('Zoznam terminov k predmetu ' . $predmet); $dialog = $this->terminyHodnoteniaScreen->getZoznamTerminovDialog($childTrace, $predmetId); $terminy = $dialog->getZoznamTerminov($childTrace); FajrUtils::warnWrongTableStructure($response, 'zoznam terminov k predmetu ' . $predmet, regression\TerminyKPredmetuRegression::get(), $terminy->getTableDefinition()); // explicitly close this dialog otherwise we will be blocked for next iteration! $dialog->closeIfNeeded($childTrace); foreach ($terminy->getData() as $row) { $prihlasTerminyRow = $row; $prihlasTerminyRow[PrihlasTerminyFields::PREDMET] = $predmet; $prihlasTerminyRow[PrihlasTerminyFields::PREDMET_INDEX] = $predmetId; $prihlasTerminyRow[PrihlasTerminyFields::PREDMET_SKRATKA] = $predmetSkratka; $prihlasTerminyRow[PrihlasTerminyFields::ZNAMKA] = $hodnoteniaData[$predmetSkratka][HodnoteniaFields::ZNAMKA]; $prihlasTerminyRow[PrihlasTerminyFields::HASH_PRIHLASENIE] = StudiumUtils::hashNaPrihlasenie($predmetSkratka, $row); // PrihlasTerminyFields::ZNAMKA, PREDMET_SKRATKA must be set before! $prihlasTerminyRow[PrihlasTerminyFields::FAJR_MOZE_PRIHLASIT] = $mozePrihlasitHelper->mozeSaPrihlasit($prihlasTerminyRow, $request->getRequestTime()); $terminyData[] = $prihlasTerminyRow; } } $response->set('prihlaseni', null); if ($request->getParameter('termin') !== '' && $request->getParameter('predmet') !== '') { $prihlaseni = $this->terminyHodnoteniaScreen->getZoznamTerminovDialog($trace, $request->getParameter('predmet'))->getZoznamPrihlasenychDialog($trace, $request->getParameter('termin'))->getZoznamPrihlasenych($trace); FajrUtils::warnWrongTableStructure($response, 'zoznam prihlasenych k terminu', regression\PrihlaseniNaTerminRegression::get(), $prihlaseni->getTableDefinition()); $response->set('prihlaseni', $prihlaseni->getData()); } $response->set('predmetyZapisnehoListu', $predmetyZapisnehoListu); $response->set('terminy', $terminyData); $response->set('termin', $request->getParameter('termin')); $response->set('predmet', $request->getParameter('predmet')); $response->setTemplate('studium/zoznamTerminov'); }
/** * Akcia pre zobrazenie mojich terminov hodnotenia * * @param Trace $trace trace object * @param Request $request request from browser */ public function runMojeTerminyHodnotenia(Trace $trace, Request $request) { $this->templateParams['currentTab'] = 'TerminyHodnotenia'; if ($this->terminyHodnoteniaScreen == null) { return $this->renderResponse('studium/terminyHodnoteniaNedostupne', $this->templateParams); } $termin = $request->getParameter('termin'); $terminyHodnotenia = $this->terminyHodnoteniaScreen->getTerminyHodnotenia($trace->addChild("get terminy hodnotenia")); $this->warnings->warnWrongTableStructure($trace, 'moje terminy hodnotenia', regression\MojeTerminyRegression::get(), $terminyHodnotenia->getTableDefinition()); $hodnotenia = $this->hodnoteniaScreen->getHodnotenia($trace->addChild("get hodnotenia")); $this->warnings->warnWrongTableStructure($trace, 'hodnotenia', regression\HodnoteniaRegression::get(), $hodnotenia->getTableDefinition()); $hodnoteniePredmetu = array(); foreach ($hodnotenia->getData() as $hodnoteniaRow) { $hodnoteniePredmetu[$hodnoteniaRow[HodnoteniaFields::PREDMET_SKRATKA]] = $hodnoteniaRow[HodnoteniaFields::ZNAMKA]; } if ($request->getParameter('format') === 'ics') { $calendar = CalendarProvider::getInstance(); $calendar->setConfig('unique_id', $request->getHostName()); $calendar->setProperty('METHOD', 'PUBLISH'); $calendar->setProperty("x-wr-calname", 'Moje termíny hodnotenia'); $calendar->setProperty("X-WR-CALDESC", "Kalendár skúšok vyexportovaný z aplikácie FAJR"); $calendar->setProperty("X-WR-TIMEZONE", 'Europe/Bratislava'); $datetimeFields = array('TZID=Europe/Bratislava'); foreach ($terminyHodnotenia->getData() as $terminyRow) { if ($terminyRow[TerminyFields::JE_PRIHLASENY] !== 'TRUE') { continue; } $casSkusky = AIS2Utils::parseAISDateTime($terminyRow[TerminyFields::DATUM] . " " . $terminyRow[TerminyFields::CAS]); $vevent = new \vevent(); $vevent->setProperty('dtstart', FajrUtils::datetime2icsdatetime($casSkusky), $datetimeFields); // koniec dame povedzme 4 hodiny po konci, kedze nevieme kolko skuska trva $vevent->setProperty('dtend', FajrUtils::datetime2icsdatetime($casSkusky + 4 * 3600), $datetimeFields); $vevent->setProperty('location', $terminyRow['miestnosti']); $vevent->setProperty('summary', $terminyRow['predmetNazov']); // TODO: toto uid je unikatne, len pokial sa nezmeni niektora z vlastnosti skusok // co znamena, ze to nie je uplne OK podla standardu // - sposobi to, ze pridavanie novych skusok bude fungovat OK // ale mazanie/presuvanie nebude fungovat // najlepsie by bolo, ak by sme mali nejake unikatne id-cko skusky priamo z AISu $uid = $casSkusky . '-' . $terminyRow[TerminyFields::PREDMET_SKRATKA]; $uid .= '-' . $terminyRow['miestnosti']; $uid .= '@' . $request->getHostName(); $uid = str_replace(' ', '-', $uid); $vevent->setProperty('uid', $uid); $description = 'Prihlasovanie: ' . $terminyRow['prihlasovanie'] . "\r\n"; $description .= 'Odhlasovanie: ' . $terminyRow['odhlasovanie'] . "\r\n"; $description .= 'Poznámka: ' . $terminyRow['poznamka']; $vevent->setProperty('description', $description); $calendar->setComponent($vevent); } $response = new Response($calendar->createCalendar()); $response->headers->set('Content-Type', 'text/calendar; charset=utf-8'); $response->headers->set('Content-Disposition', 'attachment; filename="MojeSkusky.ics"'); $response->setMaxAge(10); return $response; } $terminyHodnoteniaActive = array(); $terminyHodnoteniaOld = array(); foreach ($terminyHodnotenia->getData() as $terminyRow) { $mojeTerminyRow = $terminyRow; if ($terminyRow[TerminyFields::ZNAMKA] == '') { // skusme najst znamku v hodnoteniach $predmet = $terminyRow[TerminyFields::PREDMET_SKRATKA]; if (isset($hodnoteniePredmetu[$predmet]) && $hodnoteniePredmetu[$predmet] != '') { // TODO(ppershing): move this to another field and deal with it in template! $mojeTerminyRow[TerminyFields::ZNAMKA] = $hodnoteniePredmetu[$predmet] . " (nepriradená k termínu)"; } } $datum = AIS2Utils::parseAISDateTime($terminyRow[TerminyFields::DATUM] . " " . $terminyRow[TerminyFields::CAS]); if ($datum < $this->serverTime) { if ($terminyRow[TerminyFields::JE_PRIHLASENY] == 'TRUE') { $terminyHodnoteniaOld[] = $mojeTerminyRow; } } else { if ($terminyRow[TerminyFields::MOZE_ODHLASIT] == 1) { $mojeTerminyRow[MojeTerminyFields::HASH_ODHLASENIE] = StudiumUtils::hashNaOdhlasenie($terminyRow); } $terminyHodnoteniaActive[] = $mojeTerminyRow; } } $this->templateParams['prihlaseni'] = null; if ($request->getParameter('termin') !== '') { $prihlaseni = $this->terminyHodnoteniaScreen->getZoznamPrihlasenychDialog($trace, $termin)->getZoznamPrihlasenych($trace); $this->warnings->warnWrongTableStructure($trace, 'prihlaseni na termin', regression\PrihlaseniNaTerminRegression::get(), $prihlaseni->getTableDefinition()); $this->templateParams['prihlaseni'] = $prihlaseni->getData(); } $this->templateParams['terminyActive'] = $terminyHodnoteniaActive; $this->templateParams['terminyOld'] = $terminyHodnoteniaOld; $this->templateParams['termin'] = $termin; return $this->renderResponse('studium/mojeTerminyHodnotenia', $this->templateParams); }
/** * Sets common template fields. */ private function setResponseFields(Response $response) { $response = $this->context->getResponse(); $response->set('version', new Version()); $response->set('banner_debug', $this->config->get(FajrConfigOptions::DEBUG_BANNER)); $response->set('google_analytics', $this->config->get(FajrConfigOptions::GOOGLE_ANALYTICS_ACCOUNT)); $response->set('base', FajrUtils::basePath()); $response->set('language', 'sk'); $response->set('availableServers', array()); $response->set('currentServer', array('isBeta' => false, 'instanceName' => 'Chyba')); $server = $this->getServer(); $serverList = $this->config->get(FajrConfigOptions::AIS_SERVERLIST); $response->set('availableServers', $serverList); $response->set('currentServer', $server); $response->set('aisVersion', null); $response->set('aisVersionIncompatible', false); $response->set('loggedIn', false); $response->set('developmentVersion', $this->config->get(FajrConfigOptions::IS_DEVEL)); }
konfiguračných volieb by mali byť vhodné pre väčšinu inštalácií, no napriek tomu ponúkame možnosť ich pohodlne zmeniť na jednom mieste - v tomto súbore. </p> <p> <strong>Dôležité:</strong> Pred používaním aplikácie je ešte nutné správne nastaviť skupinu na <code>www-data</code> (alebo pod čím beží webserver) a práva na adresáre <code>./temp</code>, <code>./temp/cookies</code> a <code>./temp/sessions</code> (alebo na tie, čo ste nastavili v konfigurácii), tak, aby boli nastavené práva len na zapisovanie a použitie , t.j. <code>d----wx---</code>. </p> '); } if (FajrConfig::get('SSL.Require') && !FajrUtils::isHTTPS()) { fajr_bootstrap_error(' <p> Pre túto inštanciu fajr-u je vyžadované HTTPS spojenie. Prosím skontrolujte prepisovacie pravidlá v <code>.htaccess</code> (alebo konfigurácii web servera), ktoré presmerovávajú HTTP spojenia na HTTPS. Ak nechcete vyžadovať SSL spojenie, je možné túto kontrolu vypnúť v konfiguračnom súbore, <strong>avšak na produkčných inštaláciách, alebo inštaláciách s funkčným SSL sa neodporúča túto kontrolu vypínať. </strong> </p> '); } // bootstrapping whole application $modules = array(new TimerModule($startTime), new StatisticsModule(), new ContextModule(), new ControllerModule(), new DisplayManagerModule(), new CurlConnectionOptionsModule(), new SessionModule(), new TraceModule(), new LoginFactoryModule(), new InputModule()); $injector = new Injector($modules);
private static function provideCookieFile() { $config = FajrConfigLoader::getConfiguration(); return FajrUtils::joinPath($config->getDirectory('Path.Temporary.Cookies'), 'cookie_' . session_id()); }