Exemple #1
0
 /**
  * In non admin mode checks if request was NOT processed by seo handler.
  * If NOT, then tries to load alternative SEO url and if url is available -
  * redirects to it. If no alternative path was found - 404 header is emitted
  * and page is rendered
  */
 protected function _processRequest()
 {
     $myUtils = oxRegistry::getUtils();
     // non admin, request is not empty and was not processed by seo engine
     if (!isSearchEngineUrl() && $myUtils->seoIsActive() && ($sStdUrl = getRequestUrl('', true))) {
         // fetching standard url and looking for it in seo table
         if ($this->_canRedirect() && ($sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl($sStdUrl))) {
             $myUtils->redirect($this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false);
         } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
             // forcing to set no index/follow meta
             $this->_forceNoIndex();
             if ($this->getConfig()->getConfigParam('blSeoLogging')) {
                 $sShopId = $this->getConfig()->getShopId();
                 $sLangId = oxRegistry::getLang()->getBaseLanguage();
                 $sIdent = md5(strtolower($sStdUrl) . $sShopId . $sLangId);
                 // logging "not found" url
                 $oDb = oxDb::getDb();
                 $oDb->execute("replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )\n                               values ( " . $oDb->quote($sStdUrl) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) ");
             }
         }
     }
 }
 /**
  * Testing request removing sid from link
  */
 public function testGetRequestUrl_removingSID()
 {
     $_SERVER["REQUEST_METHOD"] = 'GET';
     $_SERVER['REQUEST_URI'] = 'test.php?param1=value1&sid=zzz&sysid=vvv&param2=ttt';
     $this->assertEquals('index.php?param1=value1&sysid=vvv&param2=ttt', getRequestUrl());
     $_SERVER['REQUEST_URI'] = 'test.php?sid=zzz&param1=value1&sysid=vvv&param2=ttt';
     $this->assertEquals('index.php?param1=value1&sysid=vvv&param2=ttt', getRequestUrl());
     $_SERVER['REQUEST_URI'] = 'test.php?param1=value1&sysid=vvv&param2=ttt&sid=zzz';
     $this->assertEquals('index.php?param1=value1&sysid=vvv&param2=ttt', getRequestUrl());
 }
        // in index.php line 512 (described)
        $sEmptyVar = "-";
        if (!isset($aArg[$iCtr + 1]) || $aArg[$iCtr + 1] == $sEmptyVar) {
            $aArg[$iCtr + 1] = "";
        }
        if (strpos(rawurldecode($aArg[$iCtr]), "[") !== false && preg_match("/.*\\[.*\\]/", rawurldecode($aArg[$iCtr]))) {
            $sVar = rawurldecode($aArg[$iCtr]);
            $sName = preg_replace("/\\[.*\\]/", "", $sVar);
            $sKey = preg_replace(array("/.*\\[/", "/\\]/"), "", $sVar);
            $aArray[$sKey] = $aArg[$iCtr + 1];
            @($_GET[$sName] = $aArray);
            @($_REQUEST[$sName] = $aArray);
            $sProcUrl .= "{$sName}[{$sKey}]=" . $aArg[$iCtr + 1] . "&";
        } else {
            @($_GET[$aArg[$iCtr]] = rawurldecode($aArg[$iCtr + 1]));
            @($_REQUEST[$aArg[$iCtr]] = rawurldecode($aArg[$iCtr + 1]));
            // skipping session id
            if ($aArg[$iCtr] != 'sid' && $aArg[$iCtr + 1]) {
                $sProcUrl .= $aArg[$iCtr] . "=" . $aArg[$iCtr + 1] . "&";
            }
        }
        $iCtr++;
    }
}
if (isset($sParams) && $sParams && $_SERVER["REQUEST_METHOD"] != "POST") {
    getRequestUrl($sParams);
}
/**
 * Includes index.php file
 */
require "index.php";
 /**
  * In non admin mode checks if request was NOT processed by seo handler.
  * If NOT, then tries to load alternative SEO url and if url is available -
  * redirects to it. If no alternative path was found - 404 header is emitted
  * and page is rendered
  */
 protected function _processRequest()
 {
     $utils = oxRegistry::getUtils();
     // non admin, request is not empty and was not processed by seo engine
     if (!isSearchEngineUrl() && $utils->seoIsActive() && ($requestUrl = getRequestUrl())) {
         // fetching standard url and looking for it in seo table
         if ($this->_canRedirect() && ($redirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl($requestUrl))) {
             $utils->redirect($this->getConfig()->getCurrentShopUrl() . $redirectUrl, false, 301);
         } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
             // forcing to set no index/follow meta
             $this->_forceNoIndex();
             if ($this->getConfig()->getConfigParam('blSeoLogging')) {
                 $shopId = $this->getConfig()->getShopId();
                 $languageId = oxRegistry::getLang()->getBaseLanguage();
                 $id = md5(strtolower($requestUrl) . $shopId . $languageId);
                 // logging "not found" url
                 $database = oxDb::getDb();
                 $database->execute("replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang ) values ( ?, ?, ?, ? ) ", array($requestUrl, $id, $shopId, $languageId));
             }
         }
     }
 }