00001 <?php
00002
00007 class oxSeoEncoder extends oxSuperCfg
00008 {
00015 protected static $_aReservedWords = array( 'admin' );
00016
00022 protected static $_sSeparator = null;
00023
00029 protected $_iIdLength = 255;
00030
00036 protected static $_sPrefix = null;
00037
00043 protected $_sAddParams = null;
00044
00048 protected static $_instance = null;
00049
00055 public static function getInstance()
00056 {
00057 if (!self::$_instance) {
00058 self::$_instance = oxNew("oxSeoEncoder");
00059 }
00060 return self::$_instance;
00061 }
00062
00066 public function __construct()
00067 {
00068 $myConfig = $this->getConfig();
00069 if (!self::$_sSeparator) {
00070 $this->setSeparator( $myConfig->getConfigParam( 'sSEOSeparator' ) );
00071 }
00072 if (!self::$_sPrefix) {
00073 $this->setPrefix( $myConfig->getConfigParam( 'sSEOuprefix' ) );
00074 }
00075 $this->setReservedWords( $myConfig->getConfigParam( 'aSEOReservedWords' ) );
00076 }
00077
00089 protected function _copyToHistory( $sId, $iShopId, $iLang, $sType = null, $sNewId = null )
00090 {
00091 $sObjectid = $sNewId?"'$sNewId'":'oxobjectid';
00092 $sType = $sType?"oxtype = {$sType} and":'';
00093
00094
00095 $sSub = "select {$sObjectid}, MD5( LOWER( oxseourl ) ), oxshopid, oxlang, now() from oxseo where {$sType} oxobjectid = {$sId} and oxshopid = {$iShopId} and oxlang = {$iLang} limit 1";
00096 $sQ = "replace oxseohistory ( oxobjectid, oxident, oxshopid, oxlang, oxinsert ) {$sSub}";
00097 oxDb::getDb()->execute( $sQ );
00098 }
00099
00106 protected function _getAddParams()
00107 {
00108
00109 if ( $this->_sAddParams === null ) {
00110 $this->_sAddParams = $this->_getAddParamsFnc( oxConfig::getParameter('currency'), $this->getConfig()->getShopId() );
00111 }
00112 return $this->_sAddParams;
00113 }
00114
00124 protected function _getAddParamsFnc( $iCur, $iActShop )
00125 {
00126
00127 $this->_sAddParams = '';
00128 $sSep = '?';
00129 if ( $iCur ) {
00130 $this->_sAddParams .= $sSep . 'cur=' . $iCur;
00131 $sSep = '&';
00132 }
00133
00134
00135 return $this->_sAddParams;
00136 }
00137
00147 protected function _getDynamicUri( $sStdUrl, $sSeoUrl, $iLang )
00148 {
00149 $iShopId = $this->getConfig()->getShopId();
00150
00151 $sStdUrl = $this->_trimUrl( $sStdUrl );
00152 $sObjectId = md5( strtolower( $iShopId . $sStdUrl ) );
00153 $sSeoUrl = $this->_prepareTitle( $sSeoUrl );
00154
00155
00156 $sOldSeoUrl = $this->_loadFromDb( 'dynamic', $sObjectId, $iLang );
00157 if ( $sOldSeoUrl === $sSeoUrl ) {
00158 $sSeoUrl = $sOldSeoUrl;
00159 } else {
00160
00161 if ( $sOldSeoUrl ) {
00162 $oDb = oxDb::getDb();
00163 $this->_copyToHistory( $oDb->quote( $sObjectId ), $oDb->quote( $iShopId ), $iLang, $oDb->quote( 'dynamic' ) );
00164 }
00165
00166
00167 $sSeoUrl = $this->_getUniqueSeoUrl( $sSeoUrl, null, $sObjectId, $iLang );
00168
00169
00170 $this->_saveToDb( 'dynamic', $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId );
00171 }
00172
00173 return $sSeoUrl;
00174 }
00175
00184 protected function _getFullUrl( $sSeoUrl, $iLang = null)
00185 {
00186 return $this->getConfig()->getShopURL( $iLang ) . $sSeoUrl . $this->_getAddParams();
00187 }
00188
00199 protected function _getSeoIdent( $sSeoUrl, $iLang = null )
00200 {
00201 return md5( strtolower( $sSeoUrl ) );
00202 }
00203
00213 protected function _getStaticUri( $sStdUrl, $iShopId, $iLang )
00214 {
00215 $sIdent = md5( strtolower( $iShopId . $this->_trimUrl( $sStdUrl, $iLang ) ) );
00216 return $this->_loadFromDb( 'static', $sIdent, $iLang );
00217 }
00218
00232 protected function _getUniqueSeoUrl( $sSeoUrl, $sConstEnd = null, $sObjectId = null, $iObjectLang = null )
00233 {
00234 $oStr = getStr();
00235 if ($sConstEnd === null) {
00236 $aMatched = array();
00237 if ( preg_match('/\.html?$/i', $sSeoUrl, $aMatched ) ) {
00238 $sConstEnd = $aMatched[0];
00239 } else {
00240 if ($sSeoUrl{$oStr->strlen($sSeoUrl)-1} != '/') {
00241 $sSeoUrl .= '/';
00242 }
00243 $sConstEnd = '/';
00244 }
00245 }
00246
00247 $sBaseSeoUrl = $sSeoUrl;
00248 if ( $sConstEnd && $oStr->substr( $sSeoUrl, 0 - $oStr->strlen( $sConstEnd ) ) == $sConstEnd ) {
00249 $sBaseSeoUrl = $oStr->substr( $sSeoUrl, 0, $oStr->strlen( $sSeoUrl ) - $oStr->strlen( $sConstEnd ) );
00250 }
00251
00252 $oDb = oxDb::getDb();
00253 $iShopId = $this->getConfig()->getShopId();
00254 $iCnt = 0;
00255 $sCheckSeoUrl = $this->_trimUrl( $sSeoUrl );
00256 $sQ = "select 1 from oxseo where oxshopid = '{$iShopId}'";
00257
00258
00259 if ( $sObjectId && isset($iObjectLang) ) {
00260 $sQ .= " and not (oxobjectid = '{$sObjectId}' and oxlang = $iObjectLang)";
00261 }
00262
00263 while ( $oDb->getOne( $sQ ." and oxident='".$this->_getSeoIdent( $sCheckSeoUrl )."' " ) ) {
00264 $sAdd = '';
00265 if ( self::$_sPrefix ) {
00266 $sAdd = self::$_sSeparator . self::$_sPrefix;
00267 }
00268 if ( $iCnt ) {
00269 $sAdd .= self::$_sSeparator . $iCnt;
00270 }
00271 ++$iCnt;
00272
00273 $sSeoUrl = $sBaseSeoUrl . $sAdd . $sConstEnd;
00274 $sCheckSeoUrl = $this->_trimUrl( $sSeoUrl );
00275 }
00276 return $sSeoUrl;
00277 }
00278
00294 protected function _loadFromDb( $sType, $sId, $iLang, $iShopId = null, $sParams = null, $blStrictParamsCheck = true)
00295 {
00296 $oDb = oxDb::getDb( true );
00297 if ( $iShopId === null ) {
00298 $iShopId = $this->getConfig()->getShopId();
00299 }
00300
00301 $iShopId = $oDb->quote( $iShopId );
00302 $sId = $oDb->quote( $sId );
00303 $sType = $oDb->quote( $sType );
00304 $iLang = (int) $iLang;
00305
00306 $sQ = "select oxfixed, oxseourl, oxexpired, oxtype from oxseo where oxtype = {$sType}
00307 and oxobjectid = {$sId} and oxshopid = {$iShopId} and oxlang = {$iLang}";
00308
00309 if ($sParams) {
00310 if ($blStrictParamsCheck) {
00311 $sQ .= " and oxparams = '{$sParams}'";
00312 } else {
00313 $sQ .= " order by oxparams = '{$sParams}' desc";
00314 }
00315 }
00316 $sQ .= " limit 1";
00317
00318 $sSeoUrl = false;
00319 $oRs = $oDb->execute( $sQ );
00320 if ( $oRs && $oRs->recordCount() > 0 && !$oRs->EOF ) {
00321
00322 if ( $oRs->fields['oxexpired'] && ( $oRs->fields['oxtype'] == 'static' || $oRs->fields['oxtype'] == 'dynamic' ) ) {
00323
00324 $this->_copyToHistory( $sId, $iShopId, $iLang );
00325 $oDb->execute( "update oxseo set oxexpired = 0 where oxobjectid = {$sId} and oxlang = '{$iLang}' " );
00326 $sSeoUrl = $oRs->fields['oxseourl'];
00327 } elseif ( !$oRs->fields['oxexpired'] || $oRs->fields['oxfixed'] ) {
00328
00329 $sSeoUrl = $oRs->fields['oxseourl'];
00330 }
00331 }
00332 return $sSeoUrl;
00333 }
00334
00343 protected function _prepareTitle( $sTitle, $blSkipTruncate = false )
00344 {
00345
00346 $sTitle = $this->encodeString( $sTitle );
00347
00348
00349 $sTitle = strip_tags( $sTitle );
00350 $sSeparator = self::$_sSeparator;
00351 $sPrefix = self::$_sPrefix;
00352
00353 foreach ( self::$_aReservedWords as $sWord ) {
00354
00355 $sTitle = preg_replace( array( "/(\s$sWord)$/i", "/^($sWord\s)/i", "/(\s$sWord\s)/i", "/^($sWord)$/i",
00356 "/(\/$sWord)$/i", "/^($sWord\/)/i", "/(\/$sWord\/)/i"),
00357 " $1{$sSeparator}{$sPrefix}{$sSeparator} ", $sTitle );
00358 }
00359
00360
00361 $sExt = '';
00362 $oStr = getStr();
00363 $aMatched = array();
00364 if ( preg_match( '/\.html?$/i', $sTitle, $aMatched ) ) {
00365 $sExt = $oStr->substr( $sTitle, 0 - $oStr->strlen( $aMatched[0] ) );
00366 $sTitle = $oStr->substr( $sTitle, 0, $oStr->strlen( $sTitle ) - $oStr->strlen( $aMatched[0] ) );
00367 }
00368
00369
00370 if ( !$blSkipTruncate && $oStr->strlen( $sTitle ) > $this->_iIdLength ) {
00371
00372 if ( ( $iFirstSpace = $oStr->strstr( $oStr->substr( $sTitle, $this->_iIdLength ), ' ' ) !== false ) ) {
00373 $sTitle = $oStr->substr( $sTitle, 0, $this->_iIdLength + $iFirstSpace );
00374 }
00375 }
00376
00377
00378 $sRegExp = '/[^A-Za-z0-9'.preg_quote( self::$_sSeparator, '/').'\/]+/';
00379 $sTitle = trim( $oStr->preg_replace( array( "/\W*\/\W*/", $sRegExp ), array( "/", self::$_sSeparator ), $sTitle ), self::$_sSeparator );
00380
00381
00382 if ( !$sTitle ) {
00383 $sTitle = $this->_prepareTitle( self::$_sPrefix );
00384 }
00385
00386
00387 $sTitle .= $sExt;
00388
00389
00390 return $oStr->preg_replace( array( '|//+|', '/' . preg_quote( self::$_sSeparator . self::$_sSeparator, '/' ) .'+/' ),
00391 array( '/', self::$_sSeparator ), $sTitle );
00392 }
00393
00394
00413 protected function _saveToDb( $sType, $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId = null, $blFixed = 0, $sKeywords = '', $sDescription = '', $sParams = null )
00414 {
00415 $oDb = oxDb::getDb( true );
00416 if ( $iShopId === null ) {
00417 $iShopId = $this->getConfig()->getShopId();
00418 }
00419
00420 $iShopId = $oDb->quote( $iShopId );
00421
00422 $sObjectId = $oDb->quote( $sObjectId );
00423 $sType = $oDb->quote( $sType );
00424
00425 $iLang = (int) $iLang;
00426
00427 $sStdUrl = $this->_trimUrl( $sStdUrl );
00428 $sSeoUrl = $this->_trimUrl( $sSeoUrl );
00429
00430 $sIdent = $this->_getSeoIdent( $sSeoUrl );
00431
00432 $sStdUrl = $oDb->quote( $sStdUrl );
00433 $sSeoUrl = $oDb->quote( $sSeoUrl );
00434
00435 $blFixed = (int) $blFixed;
00436
00437 $sQ = "select oxfixed, oxexpired, ( oxstdurl like {$sStdUrl} and oxexpired != 2 ) as samestdurl, oxseourl like {$sSeoUrl} as sameseourl from oxseo where oxtype = {$sType} and oxobjectid = {$sObjectId} and oxshopid = {$iShopId} and oxlang = {$iLang} ";
00438 $sQ .= $sParams?" and oxparams = '{$sParams}' " : '';
00439 $sQ .= "limit 1";
00440
00441 $oRs = $oDb->execute( $sQ );
00442 if ( $oRs && $oRs->recordCount() > 0 && !$oRs->EOF ) {
00443
00444 if ( $oRs->fields['samestdurl'] && $oRs->fields['sameseourl'] && $oRs->fields['oxexpired'] ) {
00445
00446 return $oDb->execute( "update oxseo set oxexpired = 0 where oxtype = {$sType} and oxobjectid = {$sObjectId} and oxshopid = {$iShopId} and oxlang = {$iLang} limit 1" );
00447 } elseif ( $oRs->fields['oxexpired'] && !$oRs->fields['oxfixed'] ) {
00448
00449 $this->_copyToHistory( $sObjectId, $iShopId, $iLang, $sType );
00450 }
00451 }
00452 $oStr = getStr();
00453 $sKeywords = $sKeywords?$oDb->quote( $oStr->htmlentities( $this->encodeString( strip_tags( $sKeywords ), false ) ) ):"''";
00454 $sDescription = $sDescription?$oDb->quote( $oStr->htmlentities( strip_tags( $sDescription ) ) ):"''";
00455
00456
00457 $sParams = $sParams ? $oDb->quote( $sParams ) :'""';
00458 $sQ = "replace into oxseo
00459 (oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype, oxfixed, oxexpired, oxkeywords, oxdescription, oxparams)
00460 values
00461 ( {$sObjectId}, '$sIdent', {$iShopId}, {$iLang}, {$sStdUrl}, {$sSeoUrl}, {$sType}, '$blFixed', '0', {$sKeywords}, {$sDescription}, $sParams )";
00462 return $oDb->execute( $sQ );
00463 }
00464
00475 protected function _trimUrl( $sUrl, $iLang = null )
00476 {
00477 $sUrl = str_replace( $this->getConfig()->getShopURL( $iLang ), '', $sUrl );
00478
00479 return preg_replace( '/(force_)?sid=[a-z0-9\.]+&?(amp;)?/i', '', $sUrl );
00480 }
00481
00490 public function encodeString( $sString, $blReplaceChars = true )
00491 {
00492
00493 $sString = getStr()->html_entity_decode( $sString );
00494
00495 if ( $blReplaceChars ) {
00496 $aReplaceChars = $this->getConfig()->getConfigParam( 'aSeoReplaceChars' );
00497 $sString = str_replace( array_keys( $aReplaceChars ), array_values( $aReplaceChars ), $sString );
00498 }
00499
00500
00501 $aReplaceWhat = array( '&', '"', ''', '<', '>' );
00502 return str_replace( $aReplaceWhat, '', $sString );
00503 }
00504
00512 public function setSeparator( $sSeparator = null )
00513 {
00514 self::$_sSeparator = $sSeparator;
00515 if ( !self::$_sSeparator ) {
00516 self::$_sSeparator = '-';
00517 }
00518 }
00519
00527 public function setPrefix( $sPrefix )
00528 {
00529 if ($sPrefix) {
00530 self::$_sPrefix = $sPrefix;
00531 } else {
00532 self::$_sPrefix = 'oxid';
00533 }
00534 }
00535
00543 public function setIdLength( $iIdlength = null )
00544 {
00545 if ( isset( $iIdlength ) ) {
00546 $this->_iIdLength = $iIdlength;
00547 }
00548 }
00549
00557 public function setReservedWords( $aReservedWords )
00558 {
00559 self::$_aReservedWords = array_merge( self::$_aReservedWords, $aReservedWords );
00560 }
00561
00562
00574 public function markAsExpired( $sId, $iShopId = null, $iExpStat = 1, $iLang = null, $sParams = null )
00575 {
00576 $sWhere = $sId ? "where oxobjectid = '{$sId}'" : '';
00577 $sWhere .= isset( $iShopId ) ? ( $sWhere ? " and oxshopid = '{$iShopId}'" : "where oxshopid = '{$iShopId}'" ) : '';
00578 $sWhere .= $iLang ? ( $sWhere ? " and oxlang = '{$iLang}'" : "where oxlang = '{$iLang}'" ) : '';
00579 $sWhere .= $sParams ? ( $sWhere ? " and {$sParams}" : "where {$sParams}" ) : '';
00580
00581 $sQ = "update oxseo set oxexpired = '{$iExpStat}' $sWhere ";
00582 oxDb::getDb()->execute( $sQ );
00583 }
00584
00598 protected function _getPageUri( $oObject, $sType, $sStdUrl, $sSeoUrl, $sParams, $iLang = null, $blFixed = false )
00599 {
00600 if (!isset($iLang)) {
00601 $iLang = $oObject->getLanguage();
00602 }
00603 $iShopId = $this->getConfig()->getShopId();
00604
00605
00606 if ( ( $sOldSeoUrl = $this->_loadFromDb( $sType, $oObject->getId(), $iLang, $iShopId, $sParams ) ) ) {
00607 if ( $sOldSeoUrl === $sSeoUrl ) {
00608 return $sSeoUrl;
00609 } else {
00610 $oDb = oxDb::getDb();
00611 $this->_copyToHistory( $oDb->quote( $oObject->getId() ), $oDb->quote( $iShopId ), $iLang, $oDb->quote( $sType ) );
00612 }
00613 }
00614
00615 $this->_saveToDb( $sType, $oObject->getId(), $sStdUrl, $sSeoUrl, $iLang, $iShopId, (int) $blFixed, '', '', $sParams );
00616
00617 return $sSeoUrl;
00618 }
00619
00629 public function encodeStaticUrls( $aStaticUrl, $iShopId, $iLang )
00630 {
00631 $oDb = oxDb::getDb();
00632 $sValues = '';
00633 $sOldObjectId = null;
00634
00635
00636 $sStdUrl = $this->_trimUrl( trim( $aStaticUrl['oxseo__oxstdurl'] ) );
00637 $sObjectId = $aStaticUrl['oxseo__oxobjectid'];
00638
00639 if ( !$sObjectId || $sObjectId == '-1' ) {
00640 $sObjectId = md5( strtolower ( $iShopId.$sStdUrl ) );
00641 } else {
00642
00643 $sOldObjectId = $sObjectId;
00644
00645
00646 if ( md5( strtolower ( $iShopId.$sStdUrl ) ) != $sObjectId ) {
00647 $sObjectId = md5( strtolower ( $iShopId.$sStdUrl ) );
00648 }
00649 }
00650
00651 foreach ( $aStaticUrl['oxseo__oxseourl'] as $iLang => $sSeoUrl ) {
00652
00653
00654 if ( ( $sSeoUrl = trim( $sSeoUrl ) ) ) {
00655 $sSeoUrl = $this->_prepareTitle( $this->_trimUrl( $sSeoUrl ) );
00656 $sSeoUrl = $this->_getUniqueSeoUrl( $sSeoUrl, null, $sObjectId, $iLang );
00657 }
00658
00659 if ( $sOldObjectId ) {
00660
00661 if ( !$oDb->getOne( "select ('{$sSeoUrl}' like oxseourl) & ('{$sStdUrl}' like oxstdurl) from oxseo where oxobjectid = '{$sOldObjectId}' and oxshopid = '{$iShopId}' and oxlang = '{$iLang}' " ) ) {
00662 $this->_copyToHistory( $oDb->quote( $sOldObjectId ), $oDb->quote( $iShopId ), $iLang, $oDb->quote( 'static' ), $sObjectId );
00663 }
00664 }
00665
00666 if ( !$sSeoUrl || !$sStdUrl ) {
00667 continue;
00668 }
00669
00670 $sIdent = $this->_getSeoIdent( $sSeoUrl );
00671
00672 if ( $sValues ) {
00673 $sValues .= ', ';
00674 }
00675
00676 $sValues .= "( '{$sObjectId}', '{$sIdent}', '{$iShopId}', '{$iLang}', '$sStdUrl', '$sSeoUrl', 'static' )";
00677 }
00678
00679
00680 if ( $sOldObjectId ) {
00681 $oDb->execute( "delete from oxseo where oxobjectid in ( '{$sOldObjectId}', '{$sObjectId}' )" );
00682 }
00683
00684
00685 if ( $sValues ) {
00686
00687 $sQ = "insert into oxseo ( oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype ) values {$sValues} ";
00688 $oDb->execute( $sQ );
00689 }
00690
00691 return $sObjectId;
00692 }
00693
00701 public function copyStaticUrls( $iShopId )
00702 {
00703 $iBaseShopId = $this->getConfig()->getBaseShopId();
00704 if ( $iShopId != $iBaseShopId ) {
00705 foreach (array_keys(oxLang::getInstance()->getLanguageIds()) as $iLang) {
00706 $iLang = (int) $iLang;
00707 $sQ = "insert into oxseo ( oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype )
00708 select MD5( LOWER( CONCAT( '{$iShopId}', oxstdurl ) ) ), MD5( LOWER( oxseourl ) ),
00709 '$iShopId', oxlang, oxstdurl, oxseourl, oxtype from oxseo where oxshopid = '{$iBaseShopId}' and oxtype = 'static' and oxlang='$iLang' ";
00710 oxDb::getDb()->execute( $sQ );
00711 }
00712 }
00713 }
00714
00724 public function getStaticUrl( $sStdUrl, $iLang = null, $iShopId = null )
00725 {
00726 if (!isset($iShopId)) {
00727 $iShopId = $this->getConfig()->getShopId();
00728 }
00729 if (!isset($iLang)) {
00730 $iLang = oxLang::getInstance()->getEditLanguage();
00731 }
00732
00733 $sFullUrl = '';
00734 if ( ( $sSeoUrl = $this->_getStaticUri( $sStdUrl, $iShopId, $iLang ) ) ) {
00735 $sFullUrl = $this->_getFullUrl( $sSeoUrl, $iLang );
00736 }
00737 return $sFullUrl;
00738 }
00739
00756 public function addSeoEntry( $sObjectId, $iShopId, $iLang, $sStdUrl, $sSeoUrl, $sType, $blFixed = 1, $sKeywords = '', $sDescription = '', $sParams = '' )
00757 {
00758 $sSeoUrl = $this->_getUniqueSeoUrl( $this->_prepareTitle( $this->_trimUrl( $sSeoUrl ) ), null, $sObjectId, $iLang );
00759 $this->_saveToDb( $sType, $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId, $blFixed, $sKeywords, $sDescription, $sParams );
00760 }
00761
00772 public function deleteSeoEntry( $sObjectId, $iShopId, $iLang, $sType )
00773 {
00774 $sQ = "delete from oxseo where oxobjectid = '{$sObjectId}' and oxshopid = '{$iShopId}' and oxlang = '{$iLang}' and oxtype = '{$sType}' ";
00775 oxDb::getDb()->execute( $sQ );
00776 }
00777
00788 public function getMetaData( $sObjectId, $sMetaType, $iShopId = null, $iLang = null )
00789 {
00790 $iShopId = ( !isset( $iShopId ) ) ? $this->getConfig()->getShopId():$iShopId;
00791 $iLang = ( !isset( $iLang ) ) ? oxLang::getInstance()->getTplLanguage():$iLang;
00792
00793 return oxDb::getDb()->getOne( "select {$sMetaType} from oxseo where oxobjectid = '{$sObjectId}' and oxshopid = '{$iShopId}' and oxlang = '{$iLang}' order by oxparams" );
00794 }
00795
00809 public function getDynamicUrl( $sStdUrl, $sSeoUrl, $iLang )
00810 {
00811 return $this->_getFullUrl( $this->_getDynamicUri( $sStdUrl, $sSeoUrl, $iLang ) );
00812 }
00813
00822 public function fetchSeoUrl( $sStdUrl, $iLanguage = null )
00823 {
00824 $oDb = oxDb::getDb( true );
00825 $sStdUrl = $oDb->quote( $sStdUrl );
00826 $iLanguage = isset( $iLanguage ) ? $iLanguage : oxLang::getInstance()->getBaseLanguage();
00827
00828 $sSeoUrl = false;
00829
00830 $sQ = "select oxseourl, oxlang from oxseo where oxstdurl = $sStdUrl and oxlang = '$iLanguage' limit 1";
00831 $oRs = $oDb->execute( $sQ );
00832 if ( !$oRs->EOF ) {
00833 $sSeoUrl = $oRs->fields['oxseourl'];
00834 }
00835
00836 return $sSeoUrl;
00837 }
00838 }