Esempio n. 1
0
 public function getPage($id)
 {
     $article = $this->pageFacade->getPage(intval($id));
     if ($article === null) {
         $this->flashMessage('pages.messages.articleNotFound', FlashMessage::WARNING);
         $this->redirect(':Pages:Admin:Page:overview');
     }
     return $article;
 }
Esempio n. 2
0
 public function actionShow($internal_id)
 {
     $result = $this->pageFacade->getPage($internal_id, true);
     /** @var Page $page */
     $page = $result[0];
     if ($page === null) {
         // nothing found
         throw new BadRequestException();
     }
     if ($page->getLocaleCode() !== $this->locale) {
         throw new BadRequestException();
     }
     // only owner of blog can see articles drafts
     if (($page->isDraft() === true or $page->getPublishedAt() > new \DateTime('now')) and !$this->user->isLoggedIn()) {
         throw new BadRequestException();
     }
     $this['pageTitle']->setPageTitle($page->getTitle());
     $this['metas']->addMeta('description', $page->getMetaDescription());
     $this['metas']->addMeta('keywords', $page->getMetaKeywords());
     $this->page = $result;
 }