/**
  * Creates an isntance of this class.
  */
 public function __construct()
 {
     $this->apiWrapper = tx_realurl_apiwrapper::getInstance();
     $urlParameters = $this->apiWrapper->array_merge_recursive_overrule($_GET, $_POST);
     $this->currentPage = max(1, intval($urlParameters['page']));
     unset($urlParameters['page']);
     unset($urlParameters['cmd']);
     $this->baseURL = $this->apiWrapper->getIndpEnv('TYPO3_REQUEST_SCRIPT') . '?' . $this->apiWrapper->implodeArrayForUrl('', $urlParameters);
     $this->resultsPerPage = self::RESULTS_PER_PAGE_DEFAULT;
 }
Esempio n. 2
0
 /**
  * Decodes a speaking URL path into an array of GET parameters and a page id.
  *
  * @param string $speakingURIpath Speaking URL path (after the "root" path of the website!) but without query parameters
  * @param boolean $cHashCache If cHash caching is enabled or not.
  * @return array Array with id and GET parameters.
  * @see decodeSpURL()
  */
 protected function decodeSpURL_doDecode($speakingURIpath, $cHashCache = FALSE)
 {
     // Cached info
     $cachedInfo = array();
     // Convert URL to segments
     $pathParts = explode('/', $speakingURIpath);
     array_walk($pathParts, create_function('&$value', '$value = urldecode($value);'));
     // Strip/process file name or extension first
     $file_GET_VARS = $this->decodeSpURL_decodeFileName($pathParts);
     // Setting original dir-parts
     $this->dirParts = $pathParts;
     // Setting "preVars"
     $pre_GET_VARS = $this->decodeSpURL_settingPreVars($pathParts, $this->extConf['preVars']);
     if (isset($this->extConf['pagePath']['languageGetVar'])) {
         $languageGetVar = $this->extConf['pagePath']['languageGetVar'];
         if (isset($pre_GET_VARS[$languageGetVar]) && $this->apiWrapper->testInt($pre_GET_VARS[$languageGetVar])) {
             // Language from URL
             $this->detectedLanguage = $pre_GET_VARS[$languageGetVar];
         } elseif (isset($_GET[$languageGetVar]) && $this->apiWrapper->testInt($_GET[$languageGetVar])) {
             // This is for _DOMAINS feature
             $this->detectedLanguage = $_GET[$languageGetVar];
         }
     }
     // Setting page id
     list($cachedInfo['id'], $id_GET_VARS, $cachedInfo['rootpage_id']) = $this->decodeSpURL_idFromPath($pathParts);
     // Fixed Post-vars
     $fixedPostVarSetCfg = $this->getPostVarSetConfig($cachedInfo['id'], 'fixedPostVars');
     $fixedPost_GET_VARS = $this->decodeSpURL_settingPreVars($pathParts, $fixedPostVarSetCfg);
     // Setting "postVarSets"
     $postVarSetCfg = $this->getPostVarSetConfig($cachedInfo['id']);
     $post_GET_VARS = $this->decodeSpURL_settingPostVarSets($pathParts, $postVarSetCfg, $cachedInfo['id']);
     // Looking for remaining parts
     if (count($pathParts)) {
         $this->decodeSpURL_throw404('"' . $speakingURIpath . '" could not be found, closest page matching is ' . substr(implode('/', $this->dirParts), 0, -strlen(implode('/', $pathParts))) . '');
     }
     // Merge GET vars together
     $cachedInfo['GET_VARS'] = array();
     if (is_array($pre_GET_VARS)) {
         $cachedInfo['GET_VARS'] = $this->apiWrapper->array_merge_recursive_overrule($cachedInfo['GET_VARS'], $pre_GET_VARS);
     }
     if (is_array($id_GET_VARS)) {
         $cachedInfo['GET_VARS'] = $this->apiWrapper->array_merge_recursive_overrule($cachedInfo['GET_VARS'], $id_GET_VARS);
     }
     if (is_array($fixedPost_GET_VARS)) {
         $cachedInfo['GET_VARS'] = $this->apiWrapper->array_merge_recursive_overrule($cachedInfo['GET_VARS'], $fixedPost_GET_VARS);
     }
     if (is_array($post_GET_VARS)) {
         $cachedInfo['GET_VARS'] = $this->apiWrapper->array_merge_recursive_overrule($cachedInfo['GET_VARS'], $post_GET_VARS);
     }
     if (is_array($file_GET_VARS)) {
         $cachedInfo['GET_VARS'] = $this->apiWrapper->array_merge_recursive_overrule($cachedInfo['GET_VARS'], $file_GET_VARS);
     }
     // cHash handling
     if ($cHashCache) {
         $queryString = $this->apiWrapper->implodeArrayForUrl('', $cachedInfo['GET_VARS']);
         $containsRelevantParametersForCHashCreation = count($this->apiWrapper->getRelevantChashParameters($queryString)) > 0;
         if ($containsRelevantParametersForCHashCreation) {
             $cHash_value = $this->decodeSpURL_cHashCache($speakingURIpath);
             if ($cHash_value) {
                 $cachedInfo['GET_VARS']['cHash'] = $cHash_value;
             }
         }
     }
     // Return information found
     return $cachedInfo;
 }