Exemplo n.º 1
0
 public function testAliasResolving()
 {
     return false;
     $this->insertFixtures();
     $url = new Url('http://example.com/testalias');
     $resolver = new Resolver($url, 1, self::$em, '', $this->mockFallbackLanguages, true);
     $resolver->resolveAlias();
     $resolver->resolve();
     $p = $resolver->getPage();
     $this->assertEquals(1, $p->getLang());
     $this->assertEquals('testpage1_child', $p->getTitle());
 }
Exemplo n.º 2
0
 /**
  * Does the resolving
  *
  * For modes other than 'frontend', no actual resolving is done,
  * resolver is just initialized in order to return the correct result
  * for $resolver->getUrl()
  * @todo Implement resolver for backend
  * @todo Is this useful in CLI mode?
  */
 protected function resolve()
 {
     $this->resolver = new \Cx\Core\Routing\Resolver($this->getRequest()->getUrl(), null, $this->getDb()->getEntityManager(), null, null);
     $this->request->getUrl()->setMode($this->mode);
     if ($this->mode == self::MODE_FRONTEND) {
         // TODO: Workaround for upload-component as it is loaded in preResolve-hook.
         // Remove this workaround once the Upload-component has been replaced
         // by the new Uploader-component which operates only through JsonData
         // and does therefore not depend on the resolved page any longer.
         if (isset($_GET['section']) && $_GET['section'] == 'Upload') {
             $this->resolvedPage = new \Cx\Core\ContentManager\Model\Entity\Page();
             $this->resolvedPage->setVirtual(true);
         } else {
             $this->resolvedPage = $this->resolver->resolve();
         }
     } else {
         global $cmd, $act, $isRegularPageRequest, $plainCmd;
         // resolve pretty url's
         $path = preg_replace('#^' . $this->getWebsiteOffsetPath() . '(' . $this->getBackendFolderName() . ')?/#', '', $_GET['__cap']);
         if ($path != 'index.php' && $path != '') {
             $path = explode('/', $path, 2);
             if (!isset($_GET['cmd'])) {
                 $_REQUEST['cmd'] = $path[0];
                 $_GET['cmd'] = $_REQUEST['cmd'];
             }
             if (isset($path[1])) {
                 if (substr($path[1], -1, 1) == '/') {
                     $path[1] = substr($path[1], 0, -1);
                 }
                 if (!isset($_GET['act'])) {
                     $_REQUEST['act'] = $path[1];
                     $_GET['act'] = $_REQUEST['act'];
                 }
             }
         }
         $this->resolvedPage = new \Cx\Core\ContentManager\Model\Entity\Page();
         $this->resolvedPage->setVirtual(true);
         if (!isset($plainCmd)) {
             $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'Home';
             $act = isset($_REQUEST['act']) ? $_REQUEST['act'] : '';
             $plainCmd = $cmd;
         }
         // If standalone is set, then we will not have to initialize/load any content page related stuff
         $isRegularPageRequest = !isset($_REQUEST['standalone']) || $_REQUEST['standalone'] == 'false';
     }
 }