code syntax improved
This commit is contained in:
parent
475405dbb8
commit
177b6ebce6
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,12 +1,12 @@
|
||||
* text=auto !eol
|
||||
/Doxyfile -text
|
||||
copy_this/.noencode -text
|
||||
copy_this/modules/d3/d3geoip/IntelliSenseHelper.php -text
|
||||
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php -text
|
||||
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php -text
|
||||
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php -text
|
||||
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php -text
|
||||
copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php -text
|
||||
copy_this/modules/d3/d3geoip/d3_geoip_stub.php -text
|
||||
copy_this/modules/d3/d3geoip/menu.xml -text
|
||||
copy_this/modules/d3/d3geoip/metadata.php -text
|
||||
copy_this/modules/d3/d3geoip/models/d3geoip.php -text
|
||||
|
@ -18,7 +18,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
|
||||
{
|
||||
protected $_sModId = 'd3_geoip';
|
||||
protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl";
|
||||
protected $_blHasDebugSwitch = TRUE;
|
||||
protected $_blHasDebugSwitch = true;
|
||||
protected $_sDebugHelpTextIdent = 'D3_GEOIP_SET_DEBUG_DESC';
|
||||
|
||||
/**
|
||||
@ -33,12 +33,9 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
|
||||
$oD3GeoIP = oxNew('d3geoip');
|
||||
$oCountry = $oD3GeoIP->getUserLocationCountryObject($sIP);
|
||||
|
||||
if ($oCountry->getId())
|
||||
{
|
||||
if ($oCountry->getId()) {
|
||||
$sTitle = $oCountry->getFieldData('oxtitle');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sTitle = oxRegistry::getLang()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET');
|
||||
}
|
||||
|
||||
@ -79,7 +76,9 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
|
||||
$oCountryList = oxNew('oxcountrylist');
|
||||
$oListObject = $oCountryList->getBaseObject();
|
||||
$sFieldList = $oListObject->getSelectFields();
|
||||
$sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName()." WHERE D3ISO = " .$oListObject->getViewName(). ".oxisoalpha2 LIMIT 1) as IP, $sFieldList from " . $oListObject->getViewName();
|
||||
$sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName().
|
||||
" WHERE D3ISO = " .$oListObject->getViewName(). ".
|
||||
oxisoalpha2 LIMIT 1) as IP, $sFieldList from " . $oListObject->getViewName();
|
||||
|
||||
$oCountryList->selectString($sQ);
|
||||
|
||||
|
@ -31,9 +31,8 @@ class d3_country_geoip extends oxAdminView
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if ( !oxRegistry::getConfig()->getConfigParam( 'blAllowSharedEdit' ) )
|
||||
{
|
||||
$this->addTplParam('readonly', TRUE);
|
||||
if (false == oxRegistry::getConfig()->getConfigParam('blAllowSharedEdit')) {
|
||||
$this->addTplParam('readonly', true);
|
||||
}
|
||||
|
||||
$ret = parent::render();
|
||||
@ -41,8 +40,7 @@ class d3_country_geoip extends oxAdminView
|
||||
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
|
||||
// check if we right now saved a new entry
|
||||
$sSavedID = oxRegistry::getConfig()->getRequestParameter("saved_oxid");
|
||||
if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) )
|
||||
{
|
||||
if (($soxId == "-1" || !isset($soxId)) && isset($sSavedID)) {
|
||||
$soxId = $sSavedID;
|
||||
oxRegistry::getSession()->deleteVariable("saved_oxid");
|
||||
$this->addTplParam("oxid", $soxId);
|
||||
@ -50,25 +48,20 @@ class d3_country_geoip extends oxAdminView
|
||||
$this->addTplParam("updatelist", "1");
|
||||
}
|
||||
|
||||
if ( $soxId != "-1" && isset( $soxId))
|
||||
{
|
||||
if ($soxId != "-1" && isset($soxId)) {
|
||||
// load object
|
||||
/** @var $oCountry oxcountry */
|
||||
$oCountry = oxNew("oxcountry");
|
||||
$oCountry->loadInLang($this->_iEditLang, $soxId);
|
||||
|
||||
if ($oCountry->isForeignCountry())
|
||||
{
|
||||
$this->addTplParam("blForeignCountry", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addTplParam("blForeignCountry", FALSE);
|
||||
if ($oCountry->isForeignCountry()) {
|
||||
$this->addTplParam("blForeignCountry", true);
|
||||
} else {
|
||||
$this->addTplParam("blForeignCountry", false);
|
||||
}
|
||||
|
||||
$oOtherLang = $oCountry->getAvailableInLangs();
|
||||
if (!isset($oOtherLang[$this->_iEditLang]))
|
||||
{
|
||||
if (!isset($oOtherLang[$this->_iEditLang])) {
|
||||
$oCountry->loadInLang(key($oOtherLang), $soxId);
|
||||
}
|
||||
|
||||
@ -78,22 +71,18 @@ class d3_country_geoip extends oxAdminView
|
||||
// remove already created languages
|
||||
$aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
|
||||
|
||||
if ( count( $aLang))
|
||||
{
|
||||
if (count($aLang)) {
|
||||
$this->addTplParam("posslang", $aLang);
|
||||
}
|
||||
|
||||
foreach ( $oOtherLang as $id => $language)
|
||||
{
|
||||
foreach ($oOtherLang as $id => $language) {
|
||||
$oLang= new stdClass();
|
||||
$oLang->sLangDesc = $language;
|
||||
$oLang->selected = ($id == $this->_iEditLang);
|
||||
$this->_aViewData["otherlang"][$id] = clone $oLang;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addTplParam("blForeignCountry", TRUE);
|
||||
} else {
|
||||
$this->addTplParam("blForeignCountry", true);
|
||||
}
|
||||
|
||||
$this->oShopList = oxNew('oxshoplist');
|
||||
@ -128,8 +117,7 @@ class d3_country_geoip extends oxAdminView
|
||||
public function save()
|
||||
{
|
||||
//allow malladmin only to perform this action
|
||||
if ( !oxRegistry::getConfig()->getConfigParam( 'blAllowSharedEdit' ) )
|
||||
{
|
||||
if (false == oxRegistry::getConfig()->getConfigParam('blAllowSharedEdit')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -139,13 +127,10 @@ class d3_country_geoip extends oxAdminView
|
||||
/** @var $oCountry oxcountry */
|
||||
$oCountry = oxNew("oxcountry");
|
||||
|
||||
if ( $soxId != "-1")
|
||||
{
|
||||
if ($soxId != "-1") {
|
||||
$oCountry->loadInLang($this->_iEditLang, $soxId);
|
||||
}
|
||||
else
|
||||
{
|
||||
$aParams['oxcountry__oxid'] = NULL;
|
||||
} else {
|
||||
$aParams['oxcountry__oxid'] = null;
|
||||
}
|
||||
|
||||
$oCountry->setLanguage(0);
|
||||
@ -157,8 +142,7 @@ class d3_country_geoip extends oxAdminView
|
||||
$this->addTplParam("updatelist", "1");
|
||||
|
||||
// set oxid if inserted
|
||||
if ( $soxId == "-1")
|
||||
{
|
||||
if ($soxId == "-1") {
|
||||
oxRegistry::getSession()->setVariable("saved_oxid", $oCountry->getId());
|
||||
}
|
||||
}
|
||||
@ -178,23 +162,19 @@ class d3_country_geoip extends oxAdminView
|
||||
{
|
||||
$aCurrencies = array();
|
||||
|
||||
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop'))
|
||||
{
|
||||
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop')) {
|
||||
$sShopId = $this->oCountry->getFieldData('d3geoipshop');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
|
||||
}
|
||||
|
||||
$sQ = "select DECODE( oxvarvalue, '".$this->getConfig()->getConfigParam( 'sConfigKey' )."') as oxvarvalue from oxconfig where oxshopid = '".$sShopId."' AND oxvarname = 'aCurrencies'";
|
||||
$sQ = "select DECODE( oxvarvalue, '".oxRegistry::getConfig()->getConfigParam('sConfigKey').
|
||||
"') as oxvarvalue from oxconfig where oxshopid = '".$sShopId."' AND oxvarname = 'aCurrencies'";
|
||||
|
||||
$sCurs = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getOne($sQ);
|
||||
|
||||
if ($sCurs)
|
||||
{
|
||||
foreach (unserialize($sCurs) as $sKey => $sValue)
|
||||
{
|
||||
if ($sCurs) {
|
||||
foreach (unserialize($sCurs) as $sKey => $sValue) {
|
||||
$aFields = explode('@', $sValue);
|
||||
$aCurrencies[$sKey]->id = $sKey;
|
||||
$aCurrencies[$sKey]->name = $aFields[0];
|
||||
@ -211,12 +191,9 @@ class d3_country_geoip extends oxAdminView
|
||||
*/
|
||||
public function getLangList()
|
||||
{
|
||||
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop'))
|
||||
{
|
||||
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop')) {
|
||||
$sShopId = $this->oCountry->getFieldData('d3geoipshop');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
|
||||
}
|
||||
|
||||
@ -224,54 +201,44 @@ class d3_country_geoip extends oxAdminView
|
||||
$aLangParams = oxRegistry::getConfig()->getShopConfVar('aLanguageParams', $sShopId);
|
||||
$aConfLanguages = oxRegistry::getConfig()->getShopConfVar('aLanguages', $sShopId);
|
||||
|
||||
if ( is_array( $aConfLanguages ) )
|
||||
{
|
||||
if (is_array($aConfLanguages)) {
|
||||
$i = 0;
|
||||
reset($aConfLanguages);
|
||||
while ( list( $key, $val ) = each( $aConfLanguages ) )
|
||||
{
|
||||
if (is_array($aLangParams) )
|
||||
{
|
||||
while ((list($key, $val) = each($aConfLanguages))) {
|
||||
if (is_array($aLangParams)) {
|
||||
//skipping non active languages
|
||||
if ( !$aLangParams[$key]['active'] )
|
||||
{
|
||||
if (false == $aLangParams[$key]['active']) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $val)
|
||||
{
|
||||
if ($val) {
|
||||
$oLang = new stdClass();
|
||||
if ( isset($aLangParams[$key]['baseId']) )
|
||||
{
|
||||
if (isset($aLangParams[$key]['baseId'])) {
|
||||
$oLang->id = $aLangParams[$key]['baseId'];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$oLang->id = $i;
|
||||
}
|
||||
$oLang->oxid = $key;
|
||||
$oLang->abbr = $key;
|
||||
$oLang->name = $val;
|
||||
|
||||
if ( is_array($aLangParams) )
|
||||
{
|
||||
if (is_array($aLangParams)) {
|
||||
$oLang->active = $aLangParams[$key]['active'];
|
||||
$oLang->sort = $aLangParams[$key]['sort'];
|
||||
}
|
||||
|
||||
if ( isset( $iLanguage ) && $oLang->id == $iLanguage )
|
||||
{
|
||||
if (isset($iLanguage) && $oLang->id == $iLanguage) {
|
||||
$oLang->selected = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$oLang->selected = 0;
|
||||
}
|
||||
if ($oLang->active)
|
||||
|
||||
if ($oLang->active) {
|
||||
$aLanguages[$oLang->id] = $oLang;
|
||||
}
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
@ -294,14 +261,10 @@ class d3_country_geoip extends oxAdminView
|
||||
$sVal1 = is_string($oLang1->$sSortParam) ? strtolower($oLang1->$sSortParam) : $oLang1->$sSortParam;
|
||||
$sVal2 = is_string($oLang2->$sSortParam) ? strtolower($oLang2->$sSortParam) : $oLang2->$sSortParam;
|
||||
|
||||
if ( $this->_sDefSortOrder == 'asc' )
|
||||
{
|
||||
if ($this->_sDefSortOrder == 'asc') {
|
||||
return ($sVal1 < $sVal2) ? -1 : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return ($sVal1 > $sVal2) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -39,12 +39,10 @@ class d3GeoIP extends oxbase
|
||||
*/
|
||||
public function getUserLocationCountryObject($sIP = null)
|
||||
{
|
||||
if (!$this->oCountry)
|
||||
{
|
||||
if (!$this->oCountry) {
|
||||
startProfile(__METHOD__);
|
||||
|
||||
if (!$sIP)
|
||||
{
|
||||
if (!$sIP) {
|
||||
$sIP = $this->getIP();
|
||||
}
|
||||
|
||||
@ -56,14 +54,25 @@ class d3GeoIP extends oxbase
|
||||
|
||||
$sISOAlpha = $this->loadByIPNum($iIPNum);
|
||||
|
||||
if (!$sISOAlpha)
|
||||
{
|
||||
$this->_getLog()->log(d3log::ERROR, __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
|
||||
if (!$sISOAlpha) {
|
||||
$this->_getLog()->log(
|
||||
d3log::ERROR,
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
'get ISO by IP failed',
|
||||
$sIP
|
||||
);
|
||||
$this->oCountry = $this->getCountryFallBackObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP', $sIP." => ".$sISOAlpha);
|
||||
} else {
|
||||
$this->_getLog()->log(
|
||||
d3log::INFO,
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
'get ISO by IP',
|
||||
$sIP." => ".$sISOAlpha
|
||||
);
|
||||
$this->oCountry = $this->getCountryObject($sISOAlpha);
|
||||
}
|
||||
|
||||
@ -82,16 +91,15 @@ class d3GeoIP extends oxbase
|
||||
{
|
||||
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');
|
||||
}
|
||||
elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp'))
|
||||
{
|
||||
} elseif ($this->_getModConfig()->getValue('blUseTestCountry')
|
||||
&& $this->_getModConfig()->getValue('sTestCountryIp')
|
||||
) {
|
||||
$sIP = $this->_getModConfig()->getValue('sTestCountryIp');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// ToDo: use $_SERVER['X-Forwared-For'] && Client-IP in case of proxy
|
||||
$sIP = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
@ -110,33 +118,30 @@ class d3GeoIP extends oxbase
|
||||
protected function _getNumIp($sIP)
|
||||
{
|
||||
// make sure it is an ip
|
||||
if (filter_var($sIP, FILTER_VALIDATE_IP) === FALSE)
|
||||
return FALSE;
|
||||
if (filter_var($sIP, FILTER_VALIDATE_IP) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
startProfile(__METHOD__);
|
||||
|
||||
$parts = unpack('N*', inet_pton($sIP));
|
||||
|
||||
if (strpos($sIP, '.') !== FALSE)
|
||||
{
|
||||
if (strpos($sIP, '.') !== false) {
|
||||
$parts = array(1=>0, 2=>0, 3=>0, 4=>$parts[1]);
|
||||
}
|
||||
|
||||
foreach ($parts as &$part)
|
||||
{
|
||||
if ($part < 0)
|
||||
foreach ($parts as &$part) {
|
||||
if ($part < 0) {
|
||||
$part += 4294967296;
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('bcadd'))
|
||||
{
|
||||
if (function_exists('bcadd')) {
|
||||
$dIP = $parts[4];
|
||||
$dIP = bcadd($dIP, bcmul($parts[3], '4294967296'));
|
||||
$dIP = bcadd($dIP, bcmul($parts[2], '18446744073709551616'));
|
||||
$dIP = bcadd($dIP, bcmul($parts[1], '79228162514264337593543950336'));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new Exception('extension BCMath is required');
|
||||
}
|
||||
|
||||
@ -153,7 +158,7 @@ class d3GeoIP extends oxbase
|
||||
* @param int $iIPNum IP number
|
||||
* @return string
|
||||
*/
|
||||
public function LoadByIPNum($iIPNum)
|
||||
public function loadByIPNum($iIPNum)
|
||||
{
|
||||
startProfile(__METHOD__);
|
||||
|
||||
@ -176,7 +181,8 @@ class d3GeoIP extends oxbase
|
||||
startProfile(__METHOD__);
|
||||
|
||||
$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));
|
||||
|
||||
@ -196,8 +202,9 @@ class d3GeoIP extends oxbase
|
||||
|
||||
$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'));
|
||||
}
|
||||
|
||||
@ -217,17 +224,27 @@ class d3GeoIP extends oxbase
|
||||
$this->performURLSwitch();
|
||||
$this->performShopSwitch();
|
||||
|
||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeLang'))
|
||||
{
|
||||
if (!$this->_getModConfig()->isActive()
|
||||
|| false == $this->_getModConfig()->getValue('blChangeLang')) {
|
||||
stopProfile(__METHOD__);
|
||||
return;
|
||||
}
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
|
||||
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && oxRegistry::getSession()->getVariable('d3isSetLang') === null && $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1)
|
||||
{
|
||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'set language', $this->getIP().' => '.$oCountry->getFieldData('d3geoiplang'));
|
||||
if (!$this->isAdmin()
|
||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||
&& oxRegistry::getSession()->getVariable('d3isSetLang') === null
|
||||
&& $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1
|
||||
) {
|
||||
$this->_getLog()->log(
|
||||
d3log::INFO,
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
'set language',
|
||||
$this->getIP().' => '.$oCountry->getFieldData('d3geoiplang')
|
||||
);
|
||||
oxRegistry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
||||
oxRegistry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
||||
oxRegistry::getSession()->setVariable('d3isSetLang', true);
|
||||
@ -242,16 +259,30 @@ class d3GeoIP extends oxbase
|
||||
*/
|
||||
public function setCountryCurrency()
|
||||
{
|
||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeCurr'))
|
||||
if (!$this->_getModConfig()->isActive()
|
||||
|| false == $this->_getModConfig()->getValue('blChangeCurr')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
startProfile(__METHOD__);
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
|
||||
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && !oxRegistry::getSession()->getVariable('d3isSetCurr') && $oCountry->getId() && $oCountry->getFieldData('d3geoipcur') > -1)
|
||||
{
|
||||
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'set currency', $this->getIP().' => '.$oCountry->getFieldData('d3geoipcur'));
|
||||
if (!$this->isAdmin()
|
||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||
&& !oxRegistry::getSession()->getVariable('d3isSetCurr')
|
||||
&& $oCountry->getId()
|
||||
&& $oCountry->getFieldData('d3geoipcur') > -1
|
||||
) {
|
||||
$this->_getLog()->log(
|
||||
d3log::INFO,
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
'set currency',
|
||||
$this->getIP().' => '.$oCountry->getFieldData('d3geoipcur')
|
||||
);
|
||||
oxRegistry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
|
||||
oxRegistry::getSession()->setVariable('d3isSetCurr', true);
|
||||
}
|
||||
@ -265,40 +296,38 @@ class d3GeoIP extends oxbase
|
||||
*/
|
||||
public function performShopSwitch()
|
||||
{
|
||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop'))
|
||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop')) {
|
||||
return;
|
||||
}
|
||||
|
||||
startProfile(__METHOD__);
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
$iNewShop = $oCountry->getFieldData('d3geoipshop');
|
||||
|
||||
if (oxRegistry::getConfig()->getRequestParameter('d3redirect') != 1 &&
|
||||
!$this->isAdmin() &&
|
||||
oxRegistry::getUtils()->isSearchEngine() === false &&
|
||||
$oCountry->getId() &&
|
||||
$this->getConfig()->isMall() &&
|
||||
$iNewShop > -1 &&
|
||||
if (oxRegistry::getConfig()->getRequestParameter('d3redirect') != 1
|
||||
&& false == $this->isAdmin()
|
||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||
&& $oCountry->getId()
|
||||
&& $this->getConfig()->isMall()
|
||||
&& $iNewShop > -1 &&
|
||||
(
|
||||
$iNewShop != $this->getConfig()->getShopId() ||
|
||||
strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
|
||||
$iNewShop != $this->getConfig()->getShopId()
|
||||
|| strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
|
||||
)
|
||||
)
|
||||
{
|
||||
) {
|
||||
$oNewConf = new oxConfig();
|
||||
$oNewConf->setShopId($iNewShop);
|
||||
$oNewConf->init();
|
||||
|
||||
$this->getConfig()->onShopChange();
|
||||
|
||||
if (!oxRegistry::getSession()->getVariable('d3isSetLang') &&
|
||||
$this->_getModConfig()->getValue('blChangeLang') &&
|
||||
$oCountry->getFieldData('d3geoiplang') > -1)
|
||||
{
|
||||
if (!oxRegistry::getSession()->getVariable('d3isSetLang')
|
||||
&& $this->_getModConfig()->getValue('blChangeLang')
|
||||
&& $oCountry->getFieldData('d3geoiplang') > -1
|
||||
) {
|
||||
$sLangId = $oCountry->getFieldData('d3geoiplang');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sLangId = '';
|
||||
}
|
||||
|
||||
@ -309,9 +338,20 @@ class d3GeoIP extends oxbase
|
||||
'fnc' => oxRegistry::getConfig()->getRequestParameter('fnc'),
|
||||
'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);
|
||||
exit();
|
||||
@ -326,8 +366,8 @@ class d3GeoIP extends oxbase
|
||||
*/
|
||||
public function performURLSwitch()
|
||||
{
|
||||
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeURL'))
|
||||
{
|
||||
if (!$this->_getModConfig()->isActive()
|
||||
|| false == $this->_getModConfig()->getValue('blChangeURL')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -335,16 +375,22 @@ class d3GeoIP extends oxbase
|
||||
|
||||
$oCountry = $this->getUserLocationCountryObject();
|
||||
|
||||
if (!$this->isAdmin() &&
|
||||
oxRegistry::getUtils()->isSearchEngine() === false &&
|
||||
$oCountry->getId() &&
|
||||
$oCountry->getFieldData('d3geoipurl') &&
|
||||
strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
|
||||
)
|
||||
{
|
||||
if (false == $this->isAdmin()
|
||||
&& oxRegistry::getUtils()->isSearchEngine() === false
|
||||
&& $oCountry->getId()
|
||||
&& $oCountry->getFieldData('d3geoipurl')
|
||||
&& strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
|
||||
) {
|
||||
$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);
|
||||
exit();
|
||||
@ -365,8 +411,8 @@ class d3GeoIP extends oxbase
|
||||
$oShoplist = oxNew('oxshoplist');
|
||||
$oShoplist->getList();
|
||||
$aShopUrls = array();
|
||||
foreach ( $oShoplist as $sId => $oShop )
|
||||
{
|
||||
|
||||
foreach (array_keys($oShoplist) as $sId) {
|
||||
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar('sMallShopURL', $sId);
|
||||
}
|
||||
|
||||
@ -392,9 +438,8 @@ class d3GeoIP extends oxbase
|
||||
*/
|
||||
protected function _getLog()
|
||||
{
|
||||
if (!$this->oD3Log)
|
||||
{
|
||||
$this->oD3Log = $this->_getModConfig()->getLog();
|
||||
if (!$this->oD3Log) {
|
||||
$this->oD3Log = $this->_getModConfig()->d3getLog();
|
||||
}
|
||||
|
||||
return $this->oD3Log;
|
||||
|
@ -23,10 +23,8 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if (d3_cfg_mod::get($this->_sModId)->isActive())
|
||||
{
|
||||
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode())
|
||||
{
|
||||
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
|
||||
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
|
||||
/** @var $oGeoIp d3geoip */
|
||||
$oGeoIp = oxNew('d3geoip');
|
||||
echo $oGeoIp->getIP();
|
||||
@ -39,5 +37,4 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
|
||||
|
||||
return parent::init();
|
||||
}
|
||||
|
||||
}
|
@ -23,8 +23,7 @@ class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if (d3_cfg_mod::get($this->_sModId)->isActive())
|
||||
{
|
||||
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
|
||||
/** @var $oLocation d3geoip */
|
||||
$oLocation = oxNew('d3geoip');
|
||||
$oLocation->setCountryLanguage();
|
||||
|
@ -20,7 +20,6 @@ $iLangNr = 0;
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = array(
|
||||
|
||||
'charset' => 'ISO-8859-15',
|
||||
'd3mxgeoip' => 'GeoIP',
|
||||
'd3mxgeoip_settings' => 'Einstellungen',
|
||||
@ -59,7 +58,6 @@ $aLang = array(
|
||||
'D3_GEOIP_METADATA_DESC' => 'Begrüßen Sie Ihre Kunden in seiner Landessprache.',
|
||||
|
||||
'D3_GEOIP_UPDATE_ITEMINSTALL' => 'Die umfangreiche IP-Liste kann leider nicht über die automatische Installation eingebunden werden. Bitte installieren Sie diese manuell. '.PHP_EOL.PHP_EOL.'Die erforderlichen Daten finden Sie im Installationspaket des Moduls unter "setup+doku/geoip-Data_IPv4_*.sql" ("setup+doku/geoip-Data_IPv6_*.sql" für IPv6-Adressen) oder als handlichere SQL-Dateien unter "setup+doku/geoip_data_parts/". '.PHP_EOL.PHP_EOL.'Sie benötigen entweder die Komplettdateien oder die Sammlung kleinerer Daten. Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
|
@ -47,11 +47,11 @@ function showFormatSettings(sElemId, visible, blUseOldElem)
|
||||
sOldSettingElem = sElemId;
|
||||
}
|
||||
|
||||
if (visible == true)
|
||||
if (visible == true) {
|
||||
document.getElementById(sElemId).style.display = 'block';
|
||||
else
|
||||
} else {
|
||||
document.getElementById(sElemId).style.display = 'none';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-->
|
||||
@ -259,7 +259,6 @@ td.edittext {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="edittext ext_edittext" align="left">
|
||||
|
Loading…
Reference in New Issue
Block a user