diff --git a/.gitattributes b/.gitattributes
index 60f4d3a..1bc0150 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
diff --git a/copy_this/modules/d3/d3geoip/d3_geoip_stub.php b/copy_this/modules/d3/d3geoip/IntelliSenseHelper.php
similarity index 100%
rename from copy_this/modules/d3/d3geoip/d3_geoip_stub.php
rename to copy_this/modules/d3/d3geoip/IntelliSenseHelper.php
diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php
index cbd15ea..61ec21e 100644
--- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php
+++ b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php
@@ -28,4 +28,4 @@ class d3_cfg_geoipset extends d3_cfg_mod_
return parent::render();
}
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php
index fd10925..7535c00 100644
--- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php
+++ b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php
@@ -21,4 +21,4 @@ class d3_cfg_geoipset_licence extends d3_cfg_mod_licence
protected $_hasNewsletterForm = false;
protected $_sMenuItemTitle = 'd3mxgeoip';
protected $_sMenuSubItemTitle = 'd3mxgeoip_settings';
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php
index 94b9f83..250bb00 100644
--- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php
+++ b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php
@@ -38,4 +38,4 @@ class d3_cfg_geoipset_list extends d3_cfg_mod_list
return $sRet;
}
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php
index f5cf3ca..47390bd 100644
--- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php
+++ b/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php
@@ -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);
@@ -87,4 +86,4 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
return $oCountryList;
}
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php b/copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php
index 63c25dd..5caa23f 100644
--- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php
+++ b/copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php
@@ -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,59 +40,49 @@ 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);
+ $this->addTplParam("oxid", $soxId);
// for reloading upper frame
$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);
+ $oCountry = oxNew("oxcountry");
+ $oCountry->loadInLang($this->_iEditLang, $soxId);
+
+ if ($oCountry->isForeignCountry()) {
+ $this->addTplParam("blForeignCountry", true);
+ } else {
+ $this->addTplParam("blForeignCountry", false);
}
$oOtherLang = $oCountry->getAvailableInLangs();
- if (!isset($oOtherLang[$this->_iEditLang]))
- {
- $oCountry->loadInLang( key($oOtherLang), $soxId );
+ if (!isset($oOtherLang[$this->_iEditLang])) {
+ $oCountry->loadInLang(key($oOtherLang), $soxId);
}
$this->oCountry = $oCountry;
$this->addTplParam("edit", $oCountry);
// remove already created languages
- $aLang = array_diff (oxRegistry::getLang()->getLanguageNames(), $oOtherLang );
+ $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,38 +117,33 @@ 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;
}
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
- $aParams = oxRegistry::getConfig()->getRequestParameter("editval" );
+ $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
/** @var $oCountry oxcountry */
- $oCountry = oxNew( "oxcountry" );
+ $oCountry = oxNew("oxcountry");
- if ( $soxId != "-1")
- {
- $oCountry->loadInLang( $this->_iEditLang, $soxId );
- }
- else
- {
- $aParams['oxcountry__oxid'] = NULL;
+ if ($soxId != "-1") {
+ $oCountry->loadInLang($this->_iEditLang, $soxId);
+ } else {
+ $aParams['oxcountry__oxid'] = null;
}
$oCountry->setLanguage(0);
- $oCountry->assign( $aParams );
+ $oCountry->assign($aParams);
$oCountry->setLanguage($this->_iEditLang);
- $oCountry = oxRegistry::get('oxUtilsFile')->processFiles( $oCountry );
+ $oCountry = oxRegistry::get('oxUtilsFile')->processFiles($oCountry);
$oCountry->save();
$this->addTplParam("updatelist", "1");
// set oxid if inserted
- if ( $soxId == "-1")
- {
- oxRegistry::getSession()->setVariable( "saved_oxid", $oCountry->getId());
+ 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,60 +201,50 @@ 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) )
- {
+ reset($aConfLanguages);
+ 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;
+ 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;
}
}
- if (is_array($aLangParams) ) {
- uasort( $aLanguages, array($this, '_sortLanguagesCallback') );
+ if (is_array($aLangParams)) {
+ uasort($aLanguages, array($this, '_sortLanguagesCallback'));
}
return $aLanguages;
@@ -288,20 +255,16 @@ class d3_country_geoip extends oxAdminView
* @param $oLang2
* @return int
*/
- protected function _sortLanguagesCallback( $oLang1, $oLang2 )
+ protected function _sortLanguagesCallback($oLang1, $oLang2)
{
$sSortParam = $this->_sDefSort;
- $sVal1 = is_string($oLang1->$sSortParam) ? strtolower( $oLang1->$sSortParam ) : $oLang1->$sSortParam;
- $sVal2 = is_string($oLang2->$sSortParam) ? strtolower( $oLang2->$sSortParam ) : $oLang2->$sSortParam;
+ $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;
}
}
-
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/models/d3geoip.php b/copy_this/modules/d3/d3geoip/models/d3geoip.php
index 3d5654f..d71df8b 100644
--- a/copy_this/modules/d3/d3geoip/models/d3geoip.php
+++ b/copy_this/modules/d3/d3geoip/models/d3geoip.php
@@ -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();
@@ -362,12 +408,12 @@ class d3GeoIP extends oxbase
{
startProfile(__METHOD__);
- $oShoplist = oxNew( 'oxshoplist' );
+ $oShoplist = oxNew('oxshoplist');
$oShoplist->getList();
$aShopUrls = array();
- foreach ( $oShoplist as $sId => $oShop )
- {
- $aShopUrls[$sId] = $this->getConfig()->getShopConfVar( 'sMallShopURL', $sId );
+
+ foreach (array_keys($oShoplist) as $sId) {
+ $aShopUrls[$sId] = $this->getConfig()->getShopConfVar('sMallShopURL', $sId);
}
stopProfile(__METHOD__);
@@ -392,11 +438,10 @@ 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;
}
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php b/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php
index 2f088d2..18739c3 100644
--- a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php
+++ b/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php
@@ -16,17 +16,15 @@
*/
class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
{
- private $_sModId = 'd3_geoip';
+ private $_sModId = 'd3_geoip';
/**
* @return null
*/
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();
@@ -35,9 +33,8 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
/** @var $oLocation d3geoip */
$oLocation = oxNew('d3geoip');
$oLocation->setCountryCurrency();
- }
+ }
return parent::init();
}
-
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php b/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php
index b585a5b..7a6e026 100644
--- a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php
+++ b/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php
@@ -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();
@@ -32,4 +31,4 @@ class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
return parent::init();
}
-}
\ No newline at end of file
+}
diff --git a/copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php b/copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php
index 7bf8a34..2548d9f 100644
--- a/copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php
+++ b/copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php
@@ -20,46 +20,44 @@ $iLangNr = 0;
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
+ 'charset' => 'ISO-8859-15',
+ 'd3mxgeoip' => 'GeoIP',
+ 'd3mxgeoip_settings' => 'Einstellungen',
+ 'd3tbclgeoip_settings_main' => 'Grundeinstellungen',
+ 'tbclcountry_geoip' => 'GeoIP-Kundenumleitungen',
-'charset' => 'ISO-8859-15',
-'d3mxgeoip' => 'GeoIP',
-'d3mxgeoip_settings' => 'Einstellungen',
-'d3tbclgeoip_settings_main' => 'Grundeinstellungen',
-'tbclcountry_geoip' => 'GeoIP-Kundenumleitungen',
+ 'D3_GEOIP_TRANSL' => 'GeoIP-Kundenumleitungen',
-'D3_GEOIP_TRANSL' => 'GeoIP-Kundenumleitungen',
+ 'D3_GEOIP_SET_DEBUG_DESC' => 'Mit aktiviertem Debug-Modus wird im Frontend die aktuelle IP-Adresse des Shopbesuchers gezeigt. Beachten Sie, dass Umleitungen, die auf Weiterleitungen basieren, dann nicht ausgeführt werden können.',
+ 'D3_GEOIP_SET_OPTIONS' => 'Optionen',
+ 'D3_GEOIP_SET_OPTIONS_CHANGESHOP' => 'Mandant wechseln, wenn eingestellt (nur EE)',
+ 'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
+ 'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
+ 'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
+ 'D3_GEOIP_SET_OPTIONS_NOCOUNTRY' => 'Shop verwendet die Einstellung dieses Landes, wenn IP nicht zuzuordnen ist',
+ 'D3_GEOIP_SET_IP' => 'IP-Einstellungen',
+ 'D3_GEOIP_SET_IP_TESTIP' => 'statt Kunden-IP immer diese IP-Adresse verwenden',
+ 'D3_GEOIP_SET_IP_TESTCOUNTRY' => 'statt Kunden-IP immer eine IP-Adresse dieses Landes verwenden',
+ 'D3_GEOIP_SET_IP_TESTCOUNTRY_INACTIVE' => '(inaktiv)',
+ 'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen',
+ 'D3_GEOIP_SET_IP_CHECKIP_NOTSET' => 'IP nicht zugewiesen oder Land nicht aktiv',
+ 'D3_GENERAL_GEOIP_SAVE' => 'Speichern',
-'D3_GEOIP_SET_DEBUG_DESC' => 'Mit aktiviertem Debug-Modus wird im Frontend die aktuelle IP-Adresse des Shopbesuchers gezeigt. Beachten Sie, dass Umleitungen, die auf Weiterleitungen basieren, dann nicht ausgeführt werden können.',
-'D3_GEOIP_SET_OPTIONS' => 'Optionen',
-'D3_GEOIP_SET_OPTIONS_CHANGESHOP' => 'Mandant wechseln, wenn eingestellt (nur EE)',
-'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
-'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
-'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
-'D3_GEOIP_SET_OPTIONS_NOCOUNTRY' => 'Shop verwendet die Einstellung dieses Landes, wenn IP nicht zuzuordnen ist',
-'D3_GEOIP_SET_IP' => 'IP-Einstellungen',
-'D3_GEOIP_SET_IP_TESTIP' => 'statt Kunden-IP immer diese IP-Adresse verwenden',
-'D3_GEOIP_SET_IP_TESTCOUNTRY' => 'statt Kunden-IP immer eine IP-Adresse dieses Landes verwenden',
-'D3_GEOIP_SET_IP_TESTCOUNTRY_INACTIVE' => '(inaktiv)',
-'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen',
-'D3_GEOIP_SET_IP_CHECKIP_NOTSET' => 'IP nicht zugewiesen oder Land nicht aktiv',
-'D3_GENERAL_GEOIP_SAVE' => 'Speichern',
+ 'D3_GEOIP_SELSHOP' => 'zuständiger Shop',
+ 'D3_GEOIP_SELLANG' => 'vorgewählte Sprache',
+ 'D3_GEOIP_SELCUR' => 'vorgewählte Währung',
+ 'D3_GEOIP_CUSTSELSHOP' => ' - vom Kunden gewählter Shop - ',
+ 'D3_GEOIP_CUSTSELLANG' => ' - vom Kunden gewählte Sprache - ',
+ 'D3_GEOIP_CUSTSELCUR' => ' - vom Kunden gewählte Währung - ',
+ 'D3_GEOIP_OR' => 'oder',
+ 'D3_GEOIP_DISABLED' => '(deaktiviert)',
+ 'D3_GEOIP_SELURL' => 'zu wechselnde URL',
+ 'D3_GEOIP_SELURL_DESC' => 'Sobald im URL-Feld eine Eingabe vorhanden ist, wird bei passenden Kunden versucht, zur hinterlegten URL zu wechseln. Möchten Sie den Mandanten, die Währung und / oder die Sprache einstellen, entfernen Sie die URL.
Aktivieren / deaktivieren Sie den URL-Wechsel zusätzlich in den Modul-Grundeinstellungen.',
-'D3_GEOIP_SELSHOP' => 'zuständiger Shop',
-'D3_GEOIP_SELLANG' => 'vorgewählte Sprache',
-'D3_GEOIP_SELCUR' => 'vorgewählte Währung',
-'D3_GEOIP_CUSTSELSHOP' => ' - vom Kunden gewählter Shop - ',
-'D3_GEOIP_CUSTSELLANG' => ' - vom Kunden gewählte Sprache - ',
-'D3_GEOIP_CUSTSELCUR' => ' - vom Kunden gewählte Währung - ',
-'D3_GEOIP_OR' => 'oder',
-'D3_GEOIP_DISABLED' => '(deaktiviert)',
-'D3_GEOIP_SELURL' => 'zu wechselnde URL',
-'D3_GEOIP_SELURL_DESC' => 'Sobald im URL-Feld eine Eingabe vorhanden ist, wird bei passenden Kunden versucht, zur hinterlegten URL zu wechseln. Möchten Sie den Mandanten, die Währung und / oder die Sprache einstellen, entfernen Sie die URL.
Aktivieren / deaktivieren Sie den URL-Wechsel zusätzlich in den Modul-Grundeinstellungen.',
-
-'D3_GEOIP_METADATA_TITLE' => 'D³ GeoIP Vorauswahl',
-'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.',
+ 'D3_GEOIP_METADATA_TITLE' => 'D³ GeoIP Vorauswahl',
+ '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.',
);
/*
diff --git a/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl b/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl
index d7c1309..768569c 100644
--- a/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl
+++ b/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl
@@ -2,9 +2,9 @@
-[{ if $readonly }]
+[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
-