Esempio n. 1
0
 /**
  * Sets configuration in $this->extConf, taking host domain into account
  *
  * @return	void
  * @see encodeSpURL(), decodeSpURL()
  */
 protected function setConfig()
 {
     // Finding host-name / IP, always in lowercase
     $this->hostConfigured = $this->host = $this->getHost();
     $realUrlConf = (array) @unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl']);
     // Autoconfiguration
     if ($realUrlConf['enableAutoConf']) {
         $autoConfPath = PATH_site . TX_REALURL_AUTOCONF_FILE;
         $testConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'];
         if (is_array($testConf)) {
             unset($testConf['getHost']);
         } else {
             $testConf = array();
         }
         /** @noinspection PhpIncludeInspection */
         if (count($testConf) == 0 && !@(include_once $autoConfPath)) {
             $autoConfGenerator = $this->apiWrapper->makeInstance('tx_realurl_autoconfgen');
             $autoConfGenerator->generateConfiguration();
             unset($autoConfGenerator);
             /** @noinspection PhpIncludeInspection */
             @(include_once $autoConfPath);
         }
         unset($autoConfPath, $testConf);
     }
     $extConf =& $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'];
     $this->multidomain = $this->isMultidomain();
     // First pass, finding configuration OR pointer string
     if (isset($extConf[$this->host])) {
         $this->extConf = $extConf[$this->host];
         // If it turned out to be a string pointer, then look up the real config
         while (!is_null($this->extConf) && is_string($this->extConf)) {
             $this->hostConfigured = $this->extConf;
             $this->extConf = $extConf[$this->extConf];
         }
         if (!is_array($this->extConf)) {
             $this->extConf = $extConf['_DEFAULT'];
             $this->hostConfigured = '_DEFAULT';
             if ($this->multidomain && isset($this->extConf['pagePath']['rootpage_id'])) {
                 // This can't be right!
                 unset($this->extConf['pagePath']['rootpage_id']);
             }
         }
     } else {
         if ($this->enableStrictMode && $this->multidomain) {
             $this->pObj->pageNotFoundAndExit('RealURL strict mode error: ' . 'multidomain configuration detected and domain \'' . $this->host . '\' is not configured for RealURL. Please, fix your RealURL configuration!');
         }
         $this->extConf = (array) $extConf['_DEFAULT'];
         $this->hostConfigured = '_DEFAULT';
         if ($this->multidomain && isset($this->extConf['pagePath']['rootpage_id'])) {
             // This can't be right!
             unset($this->extConf['pagePath']['rootpage_id']);
         }
     }
 }