22 $sUrl = $oStr->html_entity_decode($sUrl);
24 if (($iPos = strpos($sUrl,
'?')) !==
false) {
25 parse_str($oStr->substr($sUrl, $iPos + 1), $aRet);
39 protected function _getIdent($sSeoUrl, $blIgnore =
false)
41 return md5(strtolower($sSeoUrl));
56 $sBaseUrl = $this->
getConfig()->getShopURL();
57 if ($oStr->strpos($sSeoUrl, $sBaseUrl) === 0) {
58 $sSeoUrl = $oStr->substr($sSeoUrl, $oStr->strlen($sBaseUrl));
60 $sSeoUrl = rawurldecode($sSeoUrl);
61 $iShopId = $this->
getConfig()->getShopId();
67 $oRs = $oDb->select(
"select oxstdurl, oxlang from oxseo where oxident=" . $oDb->quote($sKey) .
" and oxshopid='$iShopId' limit 1");
70 $aRet = $this->
parseStdUrl($oRs->fields[
'oxstdurl']);
71 $aRet[
'lang'] = $oRs->fields[
'oxlang'];
90 $sBaseUrl = $this->
getConfig()->getShopURL();
91 if ($oStr->strpos($sSeoUrl, $sBaseUrl) === 0) {
92 $sSeoUrl = $oStr->substr($sSeoUrl, $oStr->strlen($sBaseUrl));
94 $iShopId = $this->
getConfig()->getShopId();
95 $sSeoUrl = rawurldecode($sSeoUrl);
100 $oRs = $oDb->select(
"select oxobjectid, oxlang from oxseohistory where oxident = " . $oDb->quote($sKey) .
" and oxshopid = '{$iShopId}' limit 1");
103 $oDb->execute(
"update oxseohistory set oxhits = oxhits + 1 where oxident = " . $oDb->quote($sKey) .
" and oxshopid = '{$iShopId}' limit 1");
106 $sUrl = $this->
_getSeoUrl($oRs->fields[
'oxobjectid'], $oRs->fields[
'oxlang'], $iShopId);
124 if (($sQ = $_SERVER[
"QUERY_STRING"])) {
125 $sUrl = rtrim($sUrl,
"&?");
126 $sQ = ltrim($sQ,
"&?");
128 $sUrl .= (strpos($sUrl,
'?') ===
false) ?
"?" :
"&";
148 $aInfo = $oDb->getRow(
"select oxseourl, oxtype from oxseo where oxobjectid = " . $oDb->quote($sObjectId) .
" and oxlang = " . $oDb->quote($iLang) .
" and oxshopid = " . $oDb->quote($iShopId) .
" order by oxparams limit 1");
149 if (
'oxarticle' == $aInfo[
'oxtype']) {
150 $sMainCatId = $oDb->getOne(
"select oxcatnid from " . getViewName(
"oxobject2category") .
" where oxobjectid = " . $oDb->quote($sObjectId) .
" order by oxtime");
152 $sUrl = $oDb->getOne(
"select oxseourl from oxseo where oxobjectid = " . $oDb->quote($sObjectId) .
" and oxlang = " . $oDb->quote($iLang) .
" and oxshopid = " . $oDb->quote($iShopId) .
" and oxparams = " . $oDb->quote($sMainCatId) .
" order by oxexpired");
159 return $aInfo[
'oxseourl'];
174 if (isset($_SERVER[
'REQUEST_URI']) && $_SERVER[
'REQUEST_URI']) {
175 $sRequest = $_SERVER[
'REQUEST_URI'];
178 $sRequest = $_SERVER[
'SCRIPT_URI'];
182 $sPath = $sPath ? $sPath : str_replace(
'oxseo.php',
'', $_SERVER[
'SCRIPT_NAME']);
183 if (($sParams = $this->
_getParams($sRequest, $sPath))) {
186 if (is_array($aGet = $this->
decodeUrl($sParams))) {
187 $_GET = array_merge($aGet, $_GET);
189 } elseif (($sRedirectUrl = $this->
_decodeOldUrl($sParams))) {
198 error_404_handler($sParams);
214 $sLastParam = rtrim($sParams,
'/');
215 $sLastParam = $oStr->substr($sLastParam, ((
int ) strrpos($sLastParam,
'/')) - ($oStr->strlen($sLastParam)));
216 $sLastParam = trim($sParams,
'/');
226 if (strpos($sLastParam,
'.htm') !==
false) {
227 $sUrl = $this->
_getObjectUrl($sLastParam,
'oxarticles', $iLanguage,
'oxarticle');
231 if (!($sUrl = $this->
_getObjectUrl($sLastParam,
'oxcategories', $iLanguage,
'oxcategory'))) {
233 if (!($sUrl = $this->
_getObjectUrl($sLastParam,
'oxmanufacturers', $iLanguage,
'oxmanufacturer'))) {
235 $sUrl = $this->
_getObjectUrl($sLastParam,
'oxvendor', $iLanguage,
'oxvendor');
257 $sTable = getViewName($sTable, $iLanguage);
261 if ($oDb->getOne(
"show columns from {$sTable} where field = 'oxseoid'")) {
263 if ($sObjectId = $oDb->getOne(
"select oxid from {$sTable} where oxseoid = " . $oDb->quote($sSeoId))) {
264 $sSeoUrl = $oDb->getOne(
"select oxseourl from oxseo where oxtype = " . $oDb->quote($sType) .
" and oxobjectid = " . $oDb->quote($sObjectId) .
" and oxlang = " . $oDb->quote($iLanguage) .
" ");
283 $sParams = $oStr->preg_replace(
'/\?.*/',
'', $sRequest);
284 $sPath = preg_quote($sPath,
'/');
285 $sParams = $oStr->preg_replace(
"/^$sPath/",
'', $sParams);
288 if ($sParams && !$oStr->preg_match(
'/\.html$/', $sParams) && !$oStr->preg_match(
'/\/$/', $sParams)) {