From 816aa39a4ab3a36ce4953f5bb628e6df65202a0c Mon Sep 17 00:00:00 2001 From: DanielSeifert Date: Mon, 22 Apr 2013 09:25:27 +0000 Subject: [PATCH] add test country settings --- .../420-461/out/admin/de/d3_geoip_lang.php | 2 ++ .../out/admin/tpl/d3_cfg_geoipset_main.tpl | 20 ++++++++++++++++-- copy_this/admin/d3_cfg_geoipset_main.php | 21 +++++++++++++++++-- copy_this/core/d3geoip.php | 3 +++ .../d3_geoip/views/d3_oxcmp_cur_geoip.php | 4 ++-- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/changed_full/420-461/out/admin/de/d3_geoip_lang.php b/changed_full/420-461/out/admin/de/d3_geoip_lang.php index f85ed2b..a99e596 100644 --- a/changed_full/420-461/out/admin/de/d3_geoip_lang.php +++ b/changed_full/420-461/out/admin/de/d3_geoip_lang.php @@ -39,6 +39,8 @@ $aLang = array( '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', diff --git a/changed_full/420-461/out/admin/tpl/d3_cfg_geoipset_main.tpl b/changed_full/420-461/out/admin/tpl/d3_cfg_geoipset_main.tpl index 9ad6e15..df40a90 100644 --- a/changed_full/420-461/out/admin/tpl/d3_cfg_geoipset_main.tpl +++ b/changed_full/420-461/out/admin/tpl/d3_cfg_geoipset_main.tpl @@ -270,7 +270,7 @@ td.edittext { - +
@@ -290,6 +290,22 @@ td.edittext {
+
+
+ [{oxmultilang ident="D3_GEOIP_SET_IP_TESTCOUNTRY"}] + + getValue('blUseTestCountry') == 1}]checked[{/if}]> +
+
+ + [{ oxinputhelp ident="D3_GEOIP_SET_IP_TESTCOUNTRY_DESC" }] +
+
+
[{oxmultilang ident="D3_GEOIP_SET_IP_CHECKIP"}] @@ -297,7 +313,7 @@ td.edittext {
[{ oxinputhelp ident="D3_GEOIP_SET_IP_CHECKIP_DESC" }] - + [{if $edit->getValue('sCheckIp')}] [{$oView->getIpCountry($edit->getValue('sCheckIp'))}] [{/if}] diff --git a/copy_this/admin/d3_cfg_geoipset_main.php b/copy_this/admin/d3_cfg_geoipset_main.php index ebdb73e..da02493 100644 --- a/copy_this/admin/d3_cfg_geoipset_main.php +++ b/copy_this/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"; - + public function getIpCountry($sIP) { $oD3GeoIP = oxNew('d3geoip'); @@ -31,7 +31,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main return $sTitle; } - + public function getCountryList() { $oCountryList = oxNew('oxcountrylist'); @@ -46,4 +46,21 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main return $oCountryList; } + + public function getIPCountryList() + { + $oGeoIp = oxNew('d3geoip'); + $oCountryList = oxNew('oxcountrylist'); + if ($oCountryList->getBaseObject()->isMultilang()) + { + $oCountryList->getBaseObject()->setLanguage(oxLang::getInstance()->getTplLanguage()); + } + $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(); + + $oCountryList->selectString($sQ); + + return $oCountryList; + } } \ No newline at end of file diff --git a/copy_this/core/d3geoip.php b/copy_this/core/d3geoip.php index 72c2362..4ffe108 100644 --- a/copy_this/core/d3geoip.php +++ b/copy_this/core/d3geoip.php @@ -80,6 +80,8 @@ class d3GeoIP extends oxI18n { if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp')) return $this->_getModConfig()->getValue('sTestIp'); + elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp')) + return $this->_getModConfig()->getValue('sTestCountryIp'); else return $_SERVER['REMOTE_ADDR']; } @@ -119,6 +121,7 @@ class d3GeoIP extends oxI18n { $oCountry = oxNew('oxcountry'); $sSelect = "SELECT oxid FROM ".$oCountry->getViewName()." WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'"; + $oCountry->load(oxDb::getDb()->getOne($sSelect)); return $oCountry; diff --git a/copy_this/modules/d3_geoip/views/d3_oxcmp_cur_geoip.php b/copy_this/modules/d3_geoip/views/d3_oxcmp_cur_geoip.php index 251b7b6..718b402 100644 --- a/copy_this/modules/d3_geoip/views/d3_oxcmp_cur_geoip.php +++ b/copy_this/modules/d3_geoip/views/d3_oxcmp_cur_geoip.php @@ -3,7 +3,7 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent { private $_sModId = 'd3_geoip'; - + public function init() { if (d3_cfg_mod::get($this->_sModId)->getValue('blDebugmodeGlobal')) @@ -11,7 +11,7 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent $oGeoIp = oxNew('d3geoip'); echo $oGeoIp->getIP(); } - + $oLocation = oxNew('d3geoip'); //$oLocation->setUserCountry(); $oLocation->setCountryCurrency();