merge rel_3.x changes to trunk
This commit is contained in:
parent
df4a861c6a
commit
5478261ffb
@ -46,14 +46,33 @@ class d3GeoIP extends oxbase
|
|||||||
$sIP = $this->getIP();
|
$sIP = $this->getIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
$iIPNum = $this->_getNumIp($sIP);
|
$iIPNum = $this->_getNumIp(
|
||||||
$sISOAlpha = $this->LoadByIPNum($iIPNum);
|
oxRegistry::getConfig()->checkParamSpecialChars(
|
||||||
|
str_replace(' ', '', $sIP)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$sISOAlpha = $this->loadByIPNum($iIPNum);
|
||||||
|
|
||||||
if (!$sISOAlpha) {
|
if (!$sISOAlpha) {
|
||||||
$this->_getLog()->log(d3log::ERROR, __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
|
$this->_getLog()->log(
|
||||||
|
d3log::ERROR,
|
||||||
|
__CLASS__,
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
'get ISO by IP failed',
|
||||||
|
$sIP
|
||||||
|
);
|
||||||
$this->oCountry = $this->getCountryFallBackObject();
|
$this->oCountry = $this->getCountryFallBackObject();
|
||||||
} else {
|
} else {
|
||||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP', $sIP." => ".$sISOAlpha);
|
$this->_getLog()->log(
|
||||||
|
d3log::INFO,
|
||||||
|
__CLASS__,
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
'get ISO by IP',
|
||||||
|
$sIP." => ".$sISOAlpha
|
||||||
|
);
|
||||||
$this->oCountry = $this->getCountryObject($sISOAlpha);
|
$this->oCountry = $this->getCountryObject($sISOAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,9 +91,13 @@ class d3GeoIP extends oxbase
|
|||||||
{
|
{
|
||||||
startProfile(__METHOD__);
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp')) {
|
if ($this->_getModConfig()->getValue('blUseTestIp')
|
||||||
|
&& $this->_getModConfig()->getValue('sTestIp')
|
||||||
|
) {
|
||||||
$sIP = $this->_getModConfig()->getValue('sTestIp');
|
$sIP = $this->_getModConfig()->getValue('sTestIp');
|
||||||
} elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp')) {
|
} elseif ($this->_getModConfig()->getValue('blUseTestCountry')
|
||||||
|
&& $this->_getModConfig()->getValue('sTestCountryIp')
|
||||||
|
) {
|
||||||
$sIP = $this->_getModConfig()->getValue('sTestCountryIp');
|
$sIP = $this->_getModConfig()->getValue('sTestCountryIp');
|
||||||
} else {
|
} else {
|
||||||
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
||||||
@ -100,7 +123,7 @@ class d3GeoIP extends oxbase
|
|||||||
|
|
||||||
stopProfile(__METHOD__);
|
stopProfile(__METHOD__);
|
||||||
|
|
||||||
return $sIP;
|
return oxRegistry::getConfig()->checkParamSpecialChars(str_replace(' ', '', $sIP));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,7 +175,7 @@ class d3GeoIP extends oxbase
|
|||||||
* @param int $iIPNum IP number
|
* @param int $iIPNum IP number
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function LoadByIPNum($iIPNum)
|
public function loadByIPNum($iIPNum)
|
||||||
{
|
{
|
||||||
startProfile(__METHOD__);
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
@ -175,7 +198,8 @@ class d3GeoIP extends oxbase
|
|||||||
startProfile(__METHOD__);
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
$oCountry = oxNew('oxcountry');
|
$oCountry = oxNew('oxcountry');
|
||||||
$sSelect = "SELECT oxid FROM ".$oCountry->getViewName()." WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'";
|
$sSelect = "SELECT oxid FROM ".$oCountry->getViewName().
|
||||||
|
" WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'";
|
||||||
|
|
||||||
$oCountry->load(oxDb::getDb()->getOne($sSelect));
|
$oCountry->load(oxDb::getDb()->getOne($sSelect));
|
||||||
|
|
||||||
@ -195,7 +219,9 @@ class d3GeoIP extends oxbase
|
|||||||
|
|
||||||
$oCountry = oxNew('oxcountry');
|
$oCountry = oxNew('oxcountry');
|
||||||
|
|
||||||
if ($this->_getModConfig()->getValue('blUseFallback') && $this->_getModConfig()->getValue('sFallbackCountryId')) {
|
if ($this->_getModConfig()->getValue('blUseFallback')
|
||||||
|
&& $this->_getModConfig()->getValue('sFallbackCountryId')
|
||||||
|
) {
|
||||||
$oCountry->Load($this->_getModConfig()->getValue('sFallbackCountryId'));
|
$oCountry->Load($this->_getModConfig()->getValue('sFallbackCountryId'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +241,8 @@ class d3GeoIP extends oxbase
|
|||||||
$this->performURLSwitch();
|
$this->performURLSwitch();
|
||||||
$this->performShopSwitch();
|
$this->performShopSwitch();
|
||||||
|
|
||||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeLang')) {
|
if (!$this->_getModConfig()->isActive()
|
||||||
|
|| false == $this->_getModConfig()->getValue('blChangeLang')) {
|
||||||
stopProfile(__METHOD__);
|
stopProfile(__METHOD__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -225,10 +252,16 @@ class d3GeoIP extends oxbase
|
|||||||
if (!$this->isAdmin()
|
if (!$this->isAdmin()
|
||||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||||
&& oxRegistry::getSession()->getVariable('d3isSetLang') === null
|
&& oxRegistry::getSession()->getVariable('d3isSetLang') === null
|
||||||
&& $oCountry->getId()
|
&& $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1
|
||||||
&& $oCountry->getFieldData('d3geoiplang') > -1
|
|
||||||
) {
|
) {
|
||||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'set language', $this->getIP().' => '.$oCountry->getFieldData('d3geoiplang'));
|
$this->_getLog()->log(
|
||||||
|
d3log::INFO,
|
||||||
|
__CLASS__,
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
'set language',
|
||||||
|
$this->getIP().' => '.$oCountry->getFieldData('d3geoiplang')
|
||||||
|
);
|
||||||
oxRegistry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
oxRegistry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
||||||
oxRegistry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
oxRegistry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
||||||
oxRegistry::getSession()->setVariable('d3isSetLang', true);
|
oxRegistry::getSession()->setVariable('d3isSetLang', true);
|
||||||
@ -243,7 +276,9 @@ class d3GeoIP extends oxbase
|
|||||||
*/
|
*/
|
||||||
public function setCountryCurrency()
|
public function setCountryCurrency()
|
||||||
{
|
{
|
||||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeCurr')) {
|
if (!$this->_getModConfig()->isActive()
|
||||||
|
|| false == $this->_getModConfig()->getValue('blChangeCurr')
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,11 +288,18 @@ class d3GeoIP extends oxbase
|
|||||||
|
|
||||||
if (!$this->isAdmin()
|
if (!$this->isAdmin()
|
||||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||||
&& false == oxRegistry::getSession()->getVariable('d3isSetCurr')
|
&& !oxRegistry::getSession()->getVariable('d3isSetCurr')
|
||||||
&& $oCountry->getId()
|
&& $oCountry->getId()
|
||||||
&& $oCountry->getFieldData('d3geoipcur') > -1
|
&& $oCountry->getFieldData('d3geoipcur') > -1
|
||||||
) {
|
) {
|
||||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'set currency', $this->getIP().' => '.$oCountry->getFieldData('d3geoipcur'));
|
$this->_getLog()->log(
|
||||||
|
d3log::INFO,
|
||||||
|
__CLASS__,
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
'set currency',
|
||||||
|
$this->getIP().' => '.$oCountry->getFieldData('d3geoipcur')
|
||||||
|
);
|
||||||
oxRegistry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
|
oxRegistry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
|
||||||
oxRegistry::getSession()->setVariable('d3isSetCurr', true);
|
oxRegistry::getSession()->setVariable('d3isSetCurr', true);
|
||||||
}
|
}
|
||||||
@ -285,8 +327,8 @@ class d3GeoIP extends oxbase
|
|||||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||||
&& $oCountry->getId()
|
&& $oCountry->getId()
|
||||||
&& $this->getConfig()->isMall()
|
&& $this->getConfig()->isMall()
|
||||||
&& $iNewShop > -1
|
&& $iNewShop > -1 &&
|
||||||
&& (
|
(
|
||||||
$iNewShop != $this->getConfig()->getShopId()
|
$iNewShop != $this->getConfig()->getShopId()
|
||||||
|| strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
|
|| strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
|
||||||
)
|
)
|
||||||
@ -297,9 +339,9 @@ class d3GeoIP extends oxbase
|
|||||||
|
|
||||||
$this->getConfig()->onShopChange();
|
$this->getConfig()->onShopChange();
|
||||||
|
|
||||||
if (!oxRegistry::getSession()->getVariable('d3isSetLang') &&
|
if (!oxRegistry::getSession()->getVariable('d3isSetLang')
|
||||||
$this->_getModConfig()->getValue('blChangeLang') &&
|
&& $this->_getModConfig()->getValue('blChangeLang')
|
||||||
$oCountry->getFieldData('d3geoiplang') > -1
|
&& $oCountry->getFieldData('d3geoiplang') > -1
|
||||||
) {
|
) {
|
||||||
$sLangId = $oCountry->getFieldData('d3geoiplang');
|
$sLangId = $oCountry->getFieldData('d3geoiplang');
|
||||||
} else {
|
} else {
|
||||||
@ -313,9 +355,20 @@ class d3GeoIP extends oxbase
|
|||||||
'fnc' => oxRegistry::getConfig()->getRequestParameter('fnc'),
|
'fnc' => oxRegistry::getConfig()->getRequestParameter('fnc'),
|
||||||
'shp' => $iNewShop
|
'shp' => $iNewShop
|
||||||
);
|
);
|
||||||
$sUrl = str_replace('&', '&', $oStr->generateParameterUrl($oNewConf->getShopHomeUrl($sLangId), $aParams));
|
$sUrl = str_replace(
|
||||||
|
'&',
|
||||||
|
'&',
|
||||||
|
$oStr->generateParameterUrl($oNewConf->getShopHomeUrl($sLangId), $aParams)
|
||||||
|
);
|
||||||
|
|
||||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'change shop', $this->getIP().' => '.$sUrl);
|
$this->_getLog()->log(
|
||||||
|
d3log::INFO,
|
||||||
|
__CLASS__,
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
'change shop',
|
||||||
|
$this->getIP().' => '.$sUrl
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ".$sUrl);
|
header("Location: ".$sUrl);
|
||||||
exit();
|
exit();
|
||||||
@ -330,7 +383,8 @@ class d3GeoIP extends oxbase
|
|||||||
*/
|
*/
|
||||||
public function performURLSwitch()
|
public function performURLSwitch()
|
||||||
{
|
{
|
||||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeURL')) {
|
if (!$this->_getModConfig()->isActive()
|
||||||
|
|| false == $this->_getModConfig()->getValue('blChangeURL')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,15 +392,22 @@ class d3GeoIP extends oxbase
|
|||||||
|
|
||||||
$oCountry = $this->getUserLocationCountryObject();
|
$oCountry = $this->getUserLocationCountryObject();
|
||||||
|
|
||||||
if (!$this->isAdmin() &&
|
if (false == $this->isAdmin()
|
||||||
oxRegistry::getUtils()->isSearchEngine() === false &&
|
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||||
$oCountry->getId() &&
|
&& $oCountry->getId()
|
||||||
$oCountry->getFieldData('d3geoipurl') &&
|
&& $oCountry->getFieldData('d3geoipurl')
|
||||||
strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
|
&& strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
|
||||||
) {
|
) {
|
||||||
$sNewUrl = $oCountry->getFieldData('d3geoipurl');
|
$sNewUrl = $oCountry->getFieldData('d3geoipurl');
|
||||||
|
|
||||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'change url', $this->getIP().' => '.$oCountry->getFieldData('d3geoipurl'));
|
$this->_getLog()->log(
|
||||||
|
d3log::INFO,
|
||||||
|
__CLASS__,
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
'change url',
|
||||||
|
$this->getIP().' => '.$oCountry->getFieldData('d3geoipurl')
|
||||||
|
);
|
||||||
|
|
||||||
header("Location: ".$sNewUrl);
|
header("Location: ".$sNewUrl);
|
||||||
exit();
|
exit();
|
||||||
@ -364,11 +425,12 @@ class d3GeoIP extends oxbase
|
|||||||
{
|
{
|
||||||
startProfile(__METHOD__);
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
$oShoplist = oxNew( 'oxshoplist' );
|
$oShoplist = oxNew('oxshoplist');
|
||||||
$oShoplist->getList();
|
$oShoplist->getList();
|
||||||
$aShopUrls = array();
|
$aShopUrls = array();
|
||||||
foreach ($oShoplist as $sId => $oShop) {
|
|
||||||
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar( 'sMallShopURL', $sId );
|
foreach ($oShoplist->arrayKeys() as $sId) {
|
||||||
|
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar('sMallShopURL', $sId);
|
||||||
}
|
}
|
||||||
|
|
||||||
stopProfile(__METHOD__);
|
stopProfile(__METHOD__);
|
||||||
@ -394,9 +456,10 @@ class d3GeoIP extends oxbase
|
|||||||
protected function _getLog()
|
protected function _getLog()
|
||||||
{
|
{
|
||||||
if (!$this->oD3Log) {
|
if (!$this->oD3Log) {
|
||||||
$this->oD3Log = $this->_getModConfig()->getLog();
|
$this->oD3Log = $this->_getModConfig()->d3getLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->oD3Log;
|
return $this->oD3Log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
=> 3.0.1.0
|
=> 3.0.1.0
|
||||||
- weitere IP-Quellen eingefügt
|
- Kompatibilität mit OXID Dynamic Content Cache hergestellt
|
||||||
|
- prüft IP-Syntax bei Eingabe im Adminbereich
|
||||||
|
- weitere Bezugsquellen für Kunden-IP hinzugefügt
|
||||||
|
- auf Kompatibilität mit Shopversion 4.9.6 / 5.2.6 geprüft
|
||||||
|
- Precheck aktualisiert
|
||||||
|
|
||||||
=> 3.0.0.2
|
=> 3.0.0.2
|
||||||
- auf Kompatibilität mit Shopversion 4.8.3 geprüft
|
- auf Kompatibilität mit Shopversion 4.8.3 geprüft
|
||||||
|
Loading…
x
Reference in New Issue
Block a user