E D 8F0A(B BBBE D 8F0A(B BBBA HXXd1jFBE E(A0A8D` 8A0A(B BBBF X3LX3!X3;X 4;X84;Yd4;Y4!0Y4:(DY4QBNJ0 DBF pY 7 BBB B(D0A8GT 8D0A(B BBBK `HYBH]AG]IPM^HmRiA$zRx ,@ PZ,A10dZXABGA D0  AABA HZABIB E(A0A8F` 8A0A(B BBBD LZ8IFBD A(Jz (A ABBI Q]MFX4[K.BBB E(A0A8Dp 8D0A(B BBBA xBhxBpp[MFEB B(A0D8GM\B 8D0A(B BBBH BSB\Hj!\dj@,\ kFBE D(D0F@_ 0A(A BBBF Hp\|kFBB E(D0D8FP~ 8A0A(B BBBA H\kFBB B(A0A8DP, 8D0A(B BBBE ]4m!H]PmFBB E(A0D8Dp 8D0A(B BBBG 0h]nFBA D@  ABBG 0]`oFBA D@  ABBG (] pFAD@ ABA ]p ^pOEB A(A0 (A BBBA * (A EGBE D (A EGBE D (A FBDI C0^tFBB B(A0A8m 0D(B BBBI  0D(B BBBG v 0E(E BBBB 4 0A(E BBBH n 0A(W BBBD x?x?@y?Py?/\@y?Py?-1@y?Py?;? Pcox?x?px?  ?x? x? ooox?o#9?? ??? @return mixed */ public function __get($strKey) { return $this->arrData[$strKey] ?? parent::__get($strKey); } /** * Check whether a property is set * * @param string $strKey * * @return boolean */ public function __isset($strKey) { return isset($this->arrData[$strKey]); } /** * Return the model * * @return Model */ public function getModel() { return $this->objModel; } /** * Parse the template * * @return string */ public function generate() { $this->Template = new FrontendTemplate($this->strTemplate); $this->Template->setData($this->arrData); $this->compile(); // Do not change this order (see #6191) $this->Template->style = !empty($this->arrStyle) ? implode(' ', $this->arrStyle) : ''; $this->Template->class = trim('mod_' . $this->type . ' ' . ($this->cssID[1] ?? '')); $this->Template->cssID = !empty($this->cssID[0]) ? ' id="' . $this->cssID[0] . '"' : ''; $this->Template->inColumn = $this->strColumn; if (!$this->Template->headline) { $this->Template->headline = $this->headline; } if (!$this->Template->hl) { $this->Template->hl = $this->hl; } if (!empty($this->objModel->classes) && \is_array($this->objModel->classes)) { $this->Template->class .= ' ' . implode(' ', $this->objModel->classes); } // Tag the module (see #2137) if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger') && !empty($tags = $this->getResponseCacheTags())) { $responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger'); $responseTagger->addTags($tags); } return $this->Template->parse(); } /** * Compile the current element */ abstract protected function compile(); /** * Get a list of tags that should be applied to the response when calling generate(). */ protected function getResponseCacheTags(): array { if ($this->objModel === null) { return array(); } return array(System::getContainer()->get('contao.cache.entity_tags')->getTagForModelInstance($this->objModel)); } /** * Recursively compile the navigation menu and return it as HTML string * * @param integer $pid * @param integer $level * @param string $host * @param string $language * * @return string */ protected function renderNavigation($pid, $level=1, $host=null, $language=null) { // Get all active subpages $arrSubpages = static::getPublishedSubpagesByPid($pid, $this->showHidden, $this instanceof ModuleSitemap); if ($arrSubpages === null) { return ''; } $items = array(); $security = System::getContainer()->get('security.helper'); $isMember = $security->isGranted('ROLE_MEMBER'); $blnShowUnpublished = System::getContainer()->get('contao.security.token_checker')->isPreviewMode(); $objTemplate = new FrontendTemplate($this->navigationTpl ?: 'nav_default'); $objTemplate->pid = $pid; $objTemplate->type = static::class; $objTemplate->cssID = $this->cssID; // see #4897 $objTemplate->level = 'level_' . $level++; $objTemplate->module = $this; // see #155 /** @var PageModel $objPage */ global $objPage; // Browse subpages foreach ($arrSubpages as list('page' => $objSubpage, 'hasSubpages' => $blnHasSubpages)) { // Skip hidden sitemap pages if ($this instanceof ModuleSitemap && $objSubpage->sitemap == 'map_never') { continue; } $objSubpage->loadDetails(); // Override the domain (see #3765) if ($host !== null) { $objSubpage->domain = $host; } if ($objSubpage->tabindex > 0) { trigger_deprecation('contao/core-bundle', '4.12', 'Using a tabindex value greater than 0 has been deprecated and will no longer work in Contao 5.0.'); } // Hide the page if it is not protected and only visible to guests (backwards compatibility) if ($objSubpage->guests && !$objSubpage->protected && $isMember) { trigger_deprecation('contao/core-bundle', '4.12', 'Using the "show to guests only" feature has been deprecated an will no longer work in Contao 5.0. Use the "protect page" function instead.'); continue; } $subitems = ''; // PageModel->groups is an array after calling loadDetails() if (!$objSubpage->protected || $this->showProtected || ($this instanceof ModuleSitemap && $objSubpage->sitemap == 'map_always') || $security->isGranted(ContaoCorePermissions::MEMBER_IN_GROUPS, $objSubpage->groups)) { // Check whether there will be subpages if ($blnHasSubpages && (!$this->showLevel || $this->showLevel >= $level || (!$this->hardLimit && ($objPage->id == $objSubpage->id || \in_array($objPage->id, $this->Database->getChildRecords($objSubpage->id, 'tl_page')))))) { $subitems = $this->renderNavigation($objSubpage->id, $level, $host, $language); } // Get href switch ($objSubpage->type) { case 'redirect': $href = $objSubpage->url; if (strncasecmp($href, 'mailto:', 7) === 0) { $href = StringUtil::encodeEmail($href); } break; case 'forward': if ($objSubpage->jumpTo) { $objNext = PageModel::findPublishedById($objSubpage->jumpTo); } else { $objNext = PageModel::findFirstPublishedRegularByPid($objSubpage->id); } // Hide the link if the target page is invisible if (!$objNext instanceof PageModel || (!$objNext->loadDetails()->isPublic && !$blnShowUnpublished)) { continue 2; } try { $href = $objNext->getFrontendUrl(); } catch (ExceptionInterface $exception) { continue 2; } break; default: try { $href = $objSubpage->getFrontendUrl(); } catch (ExceptionInterface $exception) { continue 2; } break; } $items[] = $this->compileNavigationRow($objPage, $objSubpage, $subitems, $href); } } // Add classes first and last if (!empty($items)) { $last = \count($items) - 1; $items[0]['class'] = trim($items[0]['class'] . ' first'); $items[$last]['class'] = trim($items[$last]['class'] . ' last'); } $objTemplate->items = $items; return !empty($items) ? $objTemplate->parse() : ''; } /** * Compile the navigation row and return it as array * * @param PageModel $objPage * @param PageModel $objSubpage * @param string $subitems * @param string $href * * @return array */ protected function compileNavigationRow(PageModel $objPage, PageModel $objSubpage, $subitems, $href) { $row = $objSubpage->row(); $trail = \in_array($objSubpage->id, $objPage->trail); // Use the path without query string to check for active pages (see #480) list($path) = explode('?', Environment::get('request'), 2); // Active page if (($objPage->id == $objSubpage->id || ($objSubpage->type == 'forward' && $objPage->id == $objSubpage->jumpTo)) && !($this instanceof ModuleSitemap) && $href == $path) { // Mark active forward pages (see #4822) $strClass = (($objSubpage->type == 'forward' && $objPage->id == $objSubpage->jumpTo) ? 'forward' . ($trail ? ' trail' : '') : 'active') . ($subitems ? ' submenu' : '') . ($objSubpage->protected ? ' protected' : '') . ($objSubpage->cssClass ? ' ' . $objSubpage->cssClass : ''); $row['isActive'] = true; $row['isTrail'] = false; } // Regular page else { $strClass = ($subitems ? 'submenu' : '') . ($objSubpage->protected ? ' protected' : '') . ($trail ? ' trail' : '') . ($objSubpage->cssClass ? ' ' . $objSubpage->cssClass : ''); // Mark pages on the same level (see #2419) if ($objSubpage->pid == $objPage->pid) { $strClass .= ' sibling'; } $row['isActive'] = false; $row['isTrail'] = $trail; } $row['subitems'] = $subitems; $row['class'] = trim($strClass); $row['title'] = StringUtil::specialchars($objSubpage->title, true); $row['pageTitle'] = StringUtil::specialchars($objSubpage->pageTitle, true); $row['link'] = $objSubpage->title; $row['href'] = $href; $row['rel'] = ''; $row['nofollow'] = false; // backwards compatibility $row['target'] = ''; $row['description'] = str_replace(array("\n", "\r"), array(' ', ''), (string) $objSubpage->description); $arrRel = array(); // Override the link target if ($objSubpage->type == 'redirect' && $objSubpage->target) { $arrRel[] = 'noreferrer'; $arrRel[] = 'noopener'; $row['target'] = ' target="_blank"'; } // Set the rel attribute if (!empty($arrRel)) { $row['rel'] = ' rel="' . implode(' ', $arrRel) . '"'; } // Tag the page if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger')) { $responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger'); $responseTagger->addTags(array('contao.db.tl_page.' . $objSubpage->id)); } return $row; } /** * Get all published pages by their parent ID and add the "hasSubpages" property * * @param integer $intPid The parent page's ID * @param boolean $blnShowHidden If true, hidden pages will be included * @param boolean $blnIsSitemap If true, the sitemap settings apply * * @return array|null */ protected static function getPublishedSubpagesByPid($intPid, $blnShowHidden=false, $blnIsSitemap=false): ?array { $time = Date::floorToMinute(); $tokenChecker = System::getContainer()->get('contao.security.token_checker'); $blnBeUserLoggedIn = $tokenChecker->isPreviewMode(); $unroutableTypes = System::getContainer()->get('contao.routing.page_registry')->getUnroutableTypes(); $arrPages = Database::getInstance()->prepare("SELECT p1.id, EXISTS(SELECT * FROM tl_page p2 WHERE p2.pid=p1.id AND p2.type!='root' AND p2.type NOT IN ('" . implode("', '", $unroutableTypes) . "')" . (!$blnShowHidden ? ($blnIsSitemap ? " AND (p2.hide='' OR sitemap='map_always')" : " AND p2.hide=''") : "") . (!$blnBeUserLoggedIn ? " AND p2.published='1' AND (p2.start='' OR p2.start<='$time') AND (p2.stop='' OR p2.stop>'$time')" : "") . ") AS hasSubpages FROM tl_page p1 WHERE p1.pid=? AND p1.type!='root' AND p1.type NOT IN ('" . implode("', '", $unroutableTypes) . "')" . (!$blnShowHidden ? ($blnIsSitemap ? " AND (p1.hide='' OR sitemap='map_always')" : " AND p1.hide=''") : "") . (!$blnBeUserLoggedIn ? " AND p1.published='1' AND (p1.start='' OR p1.start<='$time') AND (p1.stop='' OR p1.stop>'$time')" : "") . " ORDER BY p1.sorting") ->execute($intPid) ->fetchAllAssoc(); if (\count($arrPages) < 1) { return null; } // Load models into the registry with a single query PageModel::findMultipleByIds(array_map(static function ($row) { return $row['id']; }, $arrPages)); return array_map( static function (array $row): array { return array( 'page' => PageModel::findByPk($row['id']), 'hasSubpages' => (bool) $row['hasSubpages'], ); }, $arrPages ); } /** * Get all published pages by their parent ID and exclude pages only visible for guests * * @param integer $intPid The parent page's ID * @param boolean $blnShowHidden If true, hidden pages will be included * @param boolean $blnIsSitemap If true, the sitemap settings apply * * @return array|null * * @deprecated Deprecated since Contao 4.12, to be removed in Contao 5.0; * use Module::getPublishedSubpagesByPid() instead and filter the guests pages yourself. */ protected static function getPublishedSubpagesWithoutGuestsByPid($intPid, $blnShowHidden=false, $blnIsSitemap=false): ?array { trigger_deprecation('contao/core-bundle', '4.9', 'Using Module::getPublishedSubpagesWithoutGuestsByPid() has been deprecated and will no longer work Contao 5.0. Use Module::getPublishedSubpagesByPid() instead and filter the guests pages yourself.'); $time = Date::floorToMinute(); $tokenChecker = System::getContainer()->get('contao.security.token_checker'); $blnFeUserLoggedIn = $tokenChecker->hasFrontendUser(); $blnBeUserLoggedIn = $tokenChecker->isPreviewMode(); $unroutableTypes = System::getContainer()->get('contao.routing.page_registry')->getUnroutableTypes(); $arrPages = Database::getInstance()->prepare("SELECT p1.id, EXISTS(SELECT * FROM tl_page p2 WHERE p2.pid=p1.id AND p2.type!='root' AND p2.type NOT IN ('" . implode("', '", $unroutableTypes) . "')" . (!$blnShowHidden ? ($blnIsSitemap ? " AND (p2.hide='' OR sitemap='map_always')" : " AND p2.hide=''") : "") . ($blnFeUserLoggedIn ? " AND p2.guests=''" : "") . (!$blnBeUserLoggedIn ? " AND p2.published='1' AND (p2.start='' OR p2.start<='$time') AND (p2.stop='' OR p2.stop>'$time')" : "") . ") AS hasSubpages FROM tl_page p1 WHERE p1.pid=? AND p1.type!='root' AND p1.type NOT IN ('" . implode("', '", $unroutableTypes) . "')" . (!$blnShowHidden ? ($blnIsSitemap ? " AND (p1.hide='' OR sitemap='map_always')" : " AND p1.hide=''") : "") . ($blnFeUserLoggedIn ? " AND p1.guests=''" : "") . (!$blnBeUserLoggedIn ? " AND p1.published='1' AND (p1.start='' OR p1.start<='$time') AND (p1.stop='' OR p1.stop>'$time')" : "") . " ORDER BY p1.sorting") ->execute($intPid) ->fetchAllAssoc(); if (\count($arrPages) < 1) { return null; } // Load models into the registry with a single query PageModel::findMultipleByIds(array_map(static function ($row) { return $row['id']; }, $arrPages)); return array_map( static function (array $row): array { return array( 'page' => PageModel::findByPk($row['id']), 'hasSubpages' => (bool) $row['hasSubpages'], ); }, $arrPages ); } /** * Find a front end module in the FE_MOD array and return the class name * * @param string $strName The front end module name * * @return string The class name */ public static function findClass($strName) { foreach ($GLOBALS['FE_MOD'] as $v) { foreach ($v as $kk=>$vv) { if ($kk == $strName) { return $vv; } } } return ''; } } class_alias(Module::class, 'Module'); An Error Occurred: Internal Server Error

Oops! An Error Occurred

The server returned a "500 Internal Server Error".

Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.