Ejemplo n.º 1
0
 /**
  * @test
  */
 public function uriForPrefixesControllerArgumentsWithSubRequestArgumentNamespaceOfParentRequestIfCurrentRequestHasNoNamespace()
 {
     $expectedArguments = array('SubNamespace' => array('arg1' => 'val1', '@action' => 'someaction', '@controller' => 'somecontroller', '@package' => 'somepackage'));
     $this->mockMainRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array()));
     $this->mockSubSubRequest->expects($this->any())->method('getArgumentNamespace')->will($this->returnValue(''));
     $this->uriBuilder->setRequest($this->mockSubSubRequest);
     $this->uriBuilder->uriFor('SomeAction', array('arg1' => 'val1'), 'SomeController', 'SomePackage');
     $this->assertEquals($expectedArguments, $this->uriBuilder->getLastArguments());
 }
Ejemplo n.º 2
0
 /**
  * Merging the configuration of the Settings.yaml with some default values for OPAuth
  *
  * @param array $configuration
  * @return array
  */
 protected function createConfiguration(array $configuration)
 {
     $route = $configuration['authenticationControllerRoute'];
     $opauthBasePath = $this->uriBuilder->uriFor('opauth', array('strategy' => ''), $this->getRoutePart($route, '@controller'), $this->getRoutePart($route, '@package'), $this->getRoutePart($route, '@subpackage'));
     $opauthCallbackPath = $this->uriBuilder->uriFor('authenticate', array(), $this->getRoutePart($route, '@controller'), $this->getRoutePart($route, '@package'), $this->getRoutePart($route, '@subpackage'));
     $opauthConfiguration = array();
     $opauthConfiguration['defaultRoleIdentifier'] = $configuration['defaultRoleIdentifier'];
     $opauthConfiguration['authenticationProviderName'] = $configuration['authenticationProviderName'];
     // should be created with UriBuilder
     $opauthConfiguration['path'] = $opauthBasePath;
     // should be created with UriBuilder
     $opauthConfiguration['callback_url'] = $opauthCallbackPath;
     // it must be 'post'
     $opauthConfiguration['callback_transport'] = 'post';
     // the security salt
     $opauthConfiguration['security_salt'] = $configuration['securitySalt'];
     // the strategy directory
     $opauthConfiguration['strategy_dir'] = $this->getStrategyDirectory($configuration);
     // import all strategy settings
     $opauthConfiguration['Strategy'] = $configuration['strategies'];
     return $opauthConfiguration;
 }
Ejemplo n.º 3
0
 /**
  * @param ActionRequest $request
  * @return string
  */
 protected function buildActionUri(ActionRequest $request)
 {
     $packageKey = $this->parseOption('package');
     $controllerName = $this->parseOption('controller');
     $actionName = $this->parseOption('action');
     $arguments = $this->parseOption('arguments');
     $subpackageKey = null;
     if ($packageKey !== null && strpos($packageKey, '\\') !== false) {
         list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2);
     }
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($request);
     $uriBuilder->reset();
     $uri = $uriBuilder->uriFor($actionName, $arguments, $controllerName, $packageKey, $subpackageKey);
     return $uri;
 }
 /**
  * Returns a specific URI string to redirect to after the logout; or NULL if there is none.
  * In case of NULL, it's the responsibility of the AuthenticationController where to redirect,
  * most likely to the LoginController's index action.
  *
  * @param ActionRequest $actionRequest
  * @return string A possible redirection URI, if any
  */
 public function getAfterLogoutRedirectionUri(ActionRequest $actionRequest)
 {
     $lastVisitedNode = $this->getLastVisitedNode('live');
     if ($lastVisitedNode === null) {
         return null;
     }
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($actionRequest);
     $uriBuilder->setFormat('html');
     $uriBuilder->setCreateAbsoluteUri(true);
     return $uriBuilder->uriFor('show', array('node' => $lastVisitedNode), 'Frontend\\Node', 'TYPO3.Neos');
 }
 /**
  * Renders an RSS feed
  *
  * @return string
  */
 public function rssAction()
 {
     /** @var NodeInterface $blogDocumentNode */
     $rssDocumentNode = $this->request->getInternalArgument('__documentNode');
     if ($rssDocumentNode === NULL) {
         return 'Error: The Blog Post Plugin cannot determine the current document node. Please make sure to include this plugin only by inserting it into a page / document.';
     }
     $blogDocumentNode = $rssDocumentNode->getParent();
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($this->request->getMainRequest());
     $uriBuilder->setCreateAbsoluteUri(TRUE);
     if ($this->settings['feed']['uri'] !== '') {
         $feedUri = $this->settings['feed']['uri'];
     } else {
         $uriBuilder->setFormat('xml');
         $feedUri = $uriBuilder->uriFor('show', array('node' => $rssDocumentNode), 'Frontend\\Node', 'TYPO3.Neos');
     }
     $channel = new Channel();
     $channel->setTitle($this->settings['feed']['title']);
     $channel->setDescription($this->settings['feed']['description']);
     $channel->setFeedUri($feedUri);
     $channel->setWebsiteUri($this->request->getHttpRequest()->getBaseUri());
     $channel->setLanguage((string) $this->i18nService->getConfiguration()->getCurrentLocale());
     foreach ($blogDocumentNode->getChildNodes('RobertLemke.Plugin.Blog:Post') as $postNode) {
         /* @var $postNode NodeInterface */
         $uriBuilder->setFormat('html');
         $postUri = $uriBuilder->uriFor('show', array('node' => $postNode), 'Frontend\\Node', 'TYPO3.Neos');
         $item = new Item();
         $item->setTitle($postNode->getProperty('title'));
         $item->setGuid($postNode->getIdentifier());
         // TODO: Remove this once all old node properties are migrated:
         $publicationDate = $postNode->getProperty('datePublished');
         if (is_string($publicationDate)) {
             $publicationDate = \DateTime::createFromFormat('Y-m-d', $publicationDate);
             $postNode->setProperty('datePublished', $publicationDate);
         }
         $item->setPublicationDate($postNode->getProperty('datePublished'));
         $item->setItemLink((string) $postUri);
         $item->setCommentsLink((string) $postUri . '#comments');
         // TODO: Remove this once all old node properties are migrated:
         $author = $postNode->getProperty('author');
         if ($author === NULL) {
             $author = 'Robert Lemke';
             $postNode->setProperty('author', $author);
         }
         $item->setCreator($author);
         #			$item->setCategories(array('test'));
         $description = $this->contentService->renderTeaser($postNode) . ' <a href="' . $postUri . '">Read more</a>';
         $item->setDescription($description);
         $channel->addItem($item);
     }
     // This won't work yet (plugin sub responses can't set headers yet) but keep that as a reminder:
     $headers = $this->response->getHeaders();
     $headers->setCacheControlDirective('s-max-age', 3600);
     $headers->set('Content-Type', 'application/rss+xml');
     $feed = new Feed();
     $feed->addChannel($channel);
     return $feed->render();
 }