/** * Displays the form for creating a new post. * * @dontvalidate $post * * @param Topic $topic The topic in which the new post is to be created. * @param Post $post The new post. * @param Post $quote An optional post that will be quoted within the bodytext of the new post. * @return void */ public function newAction(Topic $topic, Post $post = NULL, Post $quote = NULL) { // Assert authorization $this->authenticationService->assertNewPostAuthorization($topic); // If no post is specified, create an optionally pre-filled post (if a // quoted post was specified). if ($post === NULL) { $post = $quote !== NULL ? $this->postFactory->createPostWithQuote($quote) : $this->postFactory->createEmptyPost(); } $this->view->assignMultiple(['topic' => $topic, 'post' => $post, 'currentUser' => $this->frontendUserRepository->findCurrent()]); }
/** * Show action. Displays a single topic and all posts contained in this topic. * * @param Topic $topic The topic that is to be displayed. * @param Post $quote An optional post that will be quoted within the bodytext of the new post. * @param int $showForm ShowForm */ public function showAction(Topic $topic, Post $quote = NULL, $showForm = 0) { $posts = $this->postRepository->findForTopic($topic); if ($quote != FALSE) { $this->view->assign('quote', $this->postFactory->createPostWithQuote($quote)); } // Set Title $GLOBALS['TSFE']->page['title'] = $topic->getTitle(); $googlePlus = $topic->getAuthor()->getGoogle(); if ($googlePlus) { $this->response->addAdditionalHeaderData('<link rel="author" href="' . $googlePlus . '"/>'); } // AdHandling End $this->authenticationService->assertReadAuthorization($topic); $this->markTopicRead($topic); $this->view->assignMultiple(['posts' => $posts, 'showForm' => $showForm, 'topic' => $topic, 'user' => $this->authenticationService->getUser()]); }