Comparer les révisions
Pas de révisions en commun. "master" et "4.1.1.0" ont des historiques entièrement différents.
@ -1,9 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
- 4.1.2.0
|
||||
- verwendet Assertions für Bedingungsprüfung
|
||||
- fehlerhaften Methodenaufruf korrigiert
|
||||
|
||||
- 4.1.1.0
|
||||
- Support für OXID 6.5.2
|
||||
- Logging erweitert
|
||||
|
@ -37,8 +37,7 @@
|
||||
},
|
||||
"require": {
|
||||
"oxid-esales/oxideshop-ce": "6.8 - 6.14",
|
||||
"d3/modcfg": "^6",
|
||||
"beberlei/assert": "^3.3"
|
||||
"d3/modcfg": "^6"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
@ -17,8 +16,6 @@
|
||||
|
||||
namespace D3\GeoIp\Application\Model;
|
||||
|
||||
use Assert\Assert;
|
||||
use Assert\InvalidArgumentException;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\d3str;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
@ -260,11 +257,14 @@ class d3geoip extends BaseModel
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
|
||||
try {
|
||||
$this->canChangeLanguage( $oCountry );
|
||||
|
||||
if (!$this->isAdmin()
|
||||
&& Registry::getUtils()->isSearchEngine() === false
|
||||
&& Registry::getSession()->getId()
|
||||
&& Registry::getSession()->getVariable('d3isSetLang') === null
|
||||
&& $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1
|
||||
) {
|
||||
$language = (int) $oCountry->getFieldData('d3geoiplang');
|
||||
$this->_getModConfig()->d3getLog()->info(
|
||||
$this->_getModConfig()->info(
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
@ -274,9 +274,6 @@ class d3geoip extends BaseModel
|
||||
Registry::getLang()->setTplLanguage($language);
|
||||
Registry::getLang()->setBaseLanguage($language);
|
||||
Registry::getSession()->setVariable('d3isSetLang', true);
|
||||
Registry::getLogger()->debug('language set', [$language]);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Registry::getLogger()->debug($e->getMessage(), [$oCountry]);
|
||||
}
|
||||
|
||||
stopProfile(__METHOD__);
|
||||
@ -304,9 +301,12 @@ class d3geoip extends BaseModel
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
|
||||
try {
|
||||
$this->canChangeCurrency( $oCountry );
|
||||
|
||||
if (!$this->isAdmin()
|
||||
&& Registry::getUtils()->isSearchEngine() === false
|
||||
&& !Registry::getSession()->getVariable('d3isSetCurr')
|
||||
&& $oCountry->getId()
|
||||
&& $oCountry->getFieldData('d3geoipcur') > -1
|
||||
) {
|
||||
$this->_getLog()->log(
|
||||
d3log::INFO,
|
||||
__CLASS__,
|
||||
@ -317,8 +317,6 @@ class d3geoip extends BaseModel
|
||||
);
|
||||
Registry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
|
||||
Registry::getSession()->setVariable('d3isSetCurr', true);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Registry::getLogger()->debug($e->getMessage(), [$oCountry]);
|
||||
}
|
||||
|
||||
stopProfile(__METHOD__);
|
||||
@ -371,10 +369,19 @@ class d3geoip extends BaseModel
|
||||
|
||||
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'check allowed shop change');
|
||||
|
||||
try {
|
||||
$this->canChangeShop( $oCountry, $iNewShop );
|
||||
|
||||
if (Registry::getRequest()->getRequestEscapedParameter('d3redirect') != 1
|
||||
&& false == $this->isAdmin()
|
||||
&& Registry::getUtils()->isSearchEngine() === false
|
||||
&& $oCountry->getId()
|
||||
&& Registry::getConfig()->isMall()
|
||||
&& $iNewShop > -1 &&
|
||||
(
|
||||
$iNewShop != Registry::getConfig()->getShopId()
|
||||
|| strtolower(Registry::getConfig()->getActiveView()->getClassKey()) == 'mallstart'
|
||||
)
|
||||
) {
|
||||
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'prepare shop change to '.$iNewShop);
|
||||
|
||||
$oNewConf = new Config();
|
||||
$oNewConf->setShopId($iNewShop);
|
||||
$oNewConf->init();
|
||||
@ -416,8 +423,6 @@ class d3geoip extends BaseModel
|
||||
|
||||
header("Location: ".$sUrl);
|
||||
exit();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Registry::getLogger()->debug($e->getMessage(), [$oCountry]);
|
||||
}
|
||||
|
||||
stopProfile(__METHOD__);
|
||||
@ -448,9 +453,13 @@ class d3geoip extends BaseModel
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
|
||||
try {
|
||||
$this->canRedirect( $oCountry );
|
||||
|
||||
if ($this->dontSkipUrlRedirect()
|
||||
&& false == $this->isAdmin()
|
||||
&& Registry::getUtils()->isSearchEngine() === false
|
||||
&& $oCountry->getId()
|
||||
&& $oCountry->getFieldData('d3geoipurl')
|
||||
&& strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
|
||||
) {
|
||||
$sNewUrl = $oCountry->getFieldData('d3geoipurl');
|
||||
|
||||
$this->_getLog()->log(
|
||||
@ -464,8 +473,6 @@ class d3geoip extends BaseModel
|
||||
|
||||
header("Location: ".$sNewUrl);
|
||||
exit();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Registry::getLogger()->debug($e->getMessage(), [$oCountry]);
|
||||
}
|
||||
|
||||
stopProfile(__METHOD__);
|
||||
@ -533,77 +540,5 @@ class d3geoip extends BaseModel
|
||||
|
||||
return $this->oD3Log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Country $oCountry
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function canRedirect( Country $oCountry )
|
||||
{
|
||||
Assert::that($this->dontSkipUrlRedirect())->true('redirect skip is not provided');
|
||||
$this->isUserInFrontend();
|
||||
Assert::that($oCountry->getId())->notBlank('no country loaded');
|
||||
Assert::that($oCountry->getFieldData( 'd3geoipurl' ))->notBlank('no redirect url set');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Country $oCountry
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
/**
|
||||
* @param Country $oCountry
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function canChangeLanguage( Country $oCountry )
|
||||
{
|
||||
$this->isUserInFrontend();
|
||||
Assert::that(Registry::getSession()->getVariable( 'd3isSetLang' ))->null('language already set');
|
||||
Assert::that($oCountry->getId())->notBlank('no country loaded');
|
||||
Assert::that($oCountry->getFieldData( 'd3geoiplang' ))->greaterThan(-1, 'no target language set');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Country $oCountry
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function canChangeCurrency( Country $oCountry )
|
||||
{
|
||||
$this->isUserInFrontend();
|
||||
Assert::that(Registry::getSession()->getVariable( 'd3isSetCurr' ))->null('currency already set');
|
||||
Assert::that($oCountry->getId())->notBlank('no country loaded');
|
||||
Assert::that($oCountry->getFieldData( 'd3geoipcur' ))->greaterThan(-1, 'no target currency set');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Country $oCountry
|
||||
* @param $iNewShop
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function canChangeShop( Country $oCountry, $iNewShop )
|
||||
{
|
||||
Assert::that(Registry::getRequest()->getRequestEscapedParameter( 'd3redirect' ))->notSame('1', 'redirect already performed');
|
||||
$this->isUserInFrontend();
|
||||
Assert::that($oCountry->getId())->notBlank('no country loaded');
|
||||
Assert::that(Registry::getConfig()->isMall())->true('no mall installation');
|
||||
Assert::that($iNewShop)->greaterThan(-1, 'no target shop id set');
|
||||
Assert::that(
|
||||
$iNewShop != Registry::getConfig()->getShopId() ||
|
||||
strtolower( Registry::getConfig()->getActiveView()->getClassKey() ) == 'mallstart'
|
||||
)->true('no different shop and no mallstart');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function isUserInFrontend()
|
||||
{
|
||||
Assert::that($this->isAdmin())->false('User is in admin');
|
||||
Assert::that(Registry::getUtils()->isSearchEngine())->false('User is search engine');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,15 +38,15 @@ class d3geoip_update extends d3install_updatebase
|
||||
{
|
||||
public $sModKey = 'd3_geoip';
|
||||
public $sModName = 'GeoIP';
|
||||
public $sModVersion = '4.1.2.0';
|
||||
public $sModRevision = '4120';
|
||||
public $sModVersion = '4.1.1.0';
|
||||
public $sModRevision = '4110';
|
||||
public $sBaseConf = '--------------------------------------------------------------------------------
|
||||
4I6v2==YXpDb3ovcGlNbStFUXg1UXBUR0h6aXRiS2hZMHorN3d3Q2ZjTmVWcE8yNy9COFRidHFqL0VhW
|
||||
WZVS2hvY2JlQ29EcTRoaEJJQjJoVXc5M1B3TmFseXEyUHQrUHEveUtGUFdhVW5wWFc3d2xTNGcyeDE3a
|
||||
DBHbFBicHR1TWxWMkxZQURFMFNnV05ubllTcGRWdkw1SlJNNmk0OVBBT3Y5N0dRb1drWXJSUStsc1Q5Z
|
||||
Gh0L09EMnhVYW9FUGNGSG5jcktXSXpVeE10Tm9IT2VmQW1VSFZQWmxaMG0ycHNKeks1cUNCWnI4c1Q3M
|
||||
1F2U3RMY1FsWHRRTGRRL2kzN1pTaWpKWXBlaXBFYVFTN3lOWnpnZVl5blVhWkxNMnBqT1JQT3M2cnJYT
|
||||
S9kMERSZUFscmR6VW9iZlZVZjhoYzNUdWo=
|
||||
61Gv2==Z0Ztc2NYQnJkMEZDYnhyaEFkTUtHRm9OSjUzQnAyTUhZaTRhaDRDNFRRdk1hVlFnRXZYNlJFT
|
||||
3pwb2F0cTd4T2o1Nmc1KzFuODNqOHdlelZsd2lMa1huNUVIbDRsVlVQMFBXaVRaZXV4eUVnRmpSM3RzV
|
||||
1c4LzQwK0tJMUV1YlpMUU1wRXIxNGdybVZEdi9lSG1PTlNSZE5zZXhNUy9FUjNaVjNsd2lGQTRzWHB2N
|
||||
lhTend3akIyZU9QUzNuMmtjVkx4a0tpZHdmaDdwNjIzVVF5OENJKzhZYk84cjZ1TGZKZ0dISkdzTm50d
|
||||
ld5bWZ2b0VFYWNIT3cxVGVwSEpjRDQvdE92cE5GQ2E2QkR3ZCtnOGQ5czVQakJkTEhITXdDb1BEa2xEc
|
||||
WJtL0VZdk1OWmFyR216eTQyWHFxOEdxUkk=
|
||||
--------------------------------------------------------------------------------';
|
||||
public $sRequirements = '';
|
||||
public $sBaseValue = '';
|
||||
|
@ -30,7 +30,7 @@ $aModule = [
|
||||
'en' => '',
|
||||
],
|
||||
'thumbnail' => 'picture.png',
|
||||
'version' => '4.1.2.0',
|
||||
'version' => '4.1.1.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
|
Chargement…
Référencer dans un nouveau ticket
Block a user