Anpassung auf 6.1.x

This commit is contained in:
Markus Gärtner 2020-04-17 09:29:09 +02:00
parent bf2e874254
commit 265cd90dd0
20 changed files with 628 additions and 435 deletions

View File

@ -1,50 +0,0 @@
<?php
/**
* Metadata version
*/
$sMetadataVersion = '1.1';
/**
* Module information
*/
$aModule = array(
'id' => 'd3geoip',
'title' => (class_exists('d3utils') ? d3utils::getInstance()->getD3Logo() : 'D&sup3;') . ' GeoIP Vorauswahl',
'description' => array(
'de' => 'Begr&uuml;&szlig;en Sie Ihre Kunden in seiner Landessprache.',
'en' => '',
),
'thumbnail' => 'picture.png',
'version' => '3.1.0.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
'extend' => array(
'oxcmp_lang' => 'd3/d3geoip/modules/components/d3_oxcmp_lang_geoip',
'oxshopcontrol' => 'd3/d3geoip/modules/controllers/d3_oxshopcontrol_geoip',
),
'files' => array(
'd3cmp_geoip' => 'd3/d3geoip/components/d3cmp_geoip.php',
'd3_cfg_geoipset' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset.php',
'd3_cfg_geoipset_list' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php',
'd3_cfg_geoipset_main' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php',
'd3_cfg_geoipset_licence' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php',
'd3_country_geoip' => 'd3/d3geoip/controllers/admin/d3_country_geoip.php',
'd3geoip' => 'd3/d3geoip/models/d3geoip.php',
'd3geoip_update' => 'd3/d3geoip/setup/d3geoip_update.php',
),
'templates' => array(
'd3_cfg_geoipset_main.tpl' => 'd3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl',
'd3_country_geoip.tpl' => 'd3/d3geoip/views/admin/tpl/d3_country_geoip.tpl',
),
'events' => array(
'onActivate' => 'd3install::checkUpdateStart',
),
'blocks' => array(
),
'd3FileRegister' => array(
'd3/d3geoip/IntelliSenseHelper.php',
'd3/d3geoip/metadata.php',
'd3/d3geoip/views/admin/de/d3_geoip_lang.php',
),
);

View File

@ -1,17 +0,0 @@
<?php
class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
{
private $_sModId = 'd3_geoip';
public function init()
{
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
/** @var $oLocation d3geoip */
$oLocation = oxNew('d3geoip');
$oLocation->setCountryLanguage();
}
parent::init();
}
}

View File

@ -14,7 +14,20 @@
* @link http://www.oxidmodule.com
*/
class d3cmp_geoip extends oxView
namespace D3\GeoIp\Application\Component;
use D3\GeoIp\Application\Model\d3geoip;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Core\Controller\BaseController;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry;
class d3cmp_geoip extends BaseController
{
/**
* Marking object as component
@ -25,17 +38,27 @@ class d3cmp_geoip extends oxView
private $_sModId = 'd3_geoip';
/**
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws ConnectionException
* @throws SystemComponentException
*/
public function init()
{
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
/** @var $oGeoIp d3geoip */
$oGeoIp = oxNew('d3geoip');
$oGeoIp = oxNew(d3geoip::class);
echo $oGeoIp->getIP();
}
/** @var $oLocation d3geoip */
$oLocation = oxNew('d3geoip');
$oLocation = oxNew(d3geoip::class);
$oLocation->setCountryCurrency();
// moved to oxcmp_lang extension because here it's to late
// $oLocation->setCountryLanguage();
@ -48,7 +71,7 @@ class d3cmp_geoip extends oxView
// reason: own component can added after default components only
if ($oLocation->hasNotSetCurrency($oBasket->getBasketCurrency())) {
/** @var oxUBase $oActView */
$oActView = oxRegistry::getConfig()->getActiveView();
$oActView = Registry::getConfig()->getActiveView();
$aComponents = $oActView->getComponents();
/** @var oxcmp_cur $oCurCmp */

View File

@ -1,5 +1,9 @@
<?php
namespace D3\GeoIp\Application\Controller\Admin;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.

View File

@ -1,5 +1,4 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -15,6 +14,10 @@
* @link http://www.oxidmodule.com
*/
namespace D3\GeoIp\Application\Controller\Admin;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_licence;
class d3_cfg_geoipset_licence extends d3_cfg_mod_licence
{
protected $_sModId = 'd3_geoip';

View File

@ -1,5 +1,4 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -15,6 +14,10 @@
* @link http://www.oxidmodule.com
*/
namespace D3\GeoIp\Application\Controller\Admin;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
class d3_cfg_geoipset_list extends d3_cfg_mod_list
{
// enables language depended configuration

View File

@ -1,5 +1,12 @@
<?php
namespace D3\GeoIp\Application\Controller\Admin;
use D3\GeoIp\Application\Model\d3geoip;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
use OxidEsales\Eshop\Application\Model\CountryList;
use OxidEsales\Eshop\Core\Registry;
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -27,19 +34,25 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
/**
* @param $sIP
* @return string
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
*/
public function getIpCountry($sIP)
{
startProfile(__METHOD__);
/** @var $oD3GeoIP d3geoip */
$oD3GeoIP = oxNew('d3geoip');
$oD3GeoIP = oxNew(d3geoip::class);
$oCountry = $oD3GeoIP->getUserLocationCountryObject($sIP);
if ($oCountry->getId()) {
$sTitle = $oCountry->getFieldData('oxtitle');
} else {
$sTitle = oxRegistry::getLang()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET');
$sTitle = Registry::getLang()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET');
}
stopProfile(__METHOD__);
@ -48,7 +61,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
}
/**
* @return oxcountrylist
* @return CountryList
*/
public function getIPCountryList()
{
@ -57,10 +70,10 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
}
startProfile(__METHOD__);
/** @var $oGeoIp d3geoip */
$oGeoIp = oxNew('d3geoip');
/** @var $oCountryList oxcountrylist */
$this->oCountryList = oxNew('oxcountrylist');
/** @var $oGeoIp d3geoip */
$oGeoIp = oxNew(d3geoip::class);
/** @var $oCountryList CountryList */
$this->oCountryList = oxNew(CountryList::class);
$oListObject = $this->oCountryList->getBaseObject();
$sFieldList = $oListObject->getSelectFields();
$sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName().

View File

@ -1,5 +1,4 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -15,7 +14,16 @@
* @link http://www.oxidmodule.com
*/
class d3_country_geoip extends oxAdminView
namespace D3\GeoIp\Application\Controller\Admin;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use stdClass;
class d3_country_geoip extends AdminDetailsController
{
protected $_sDefSort = 'sort';
protected $_sDefSortOrder = 'asc';
@ -31,18 +39,18 @@ class d3_country_geoip extends oxAdminView
*/
public function render()
{
if (false == oxRegistry::getConfig()->getConfigParam('blAllowSharedEdit')) {
if (false == Registry::getConfig()->getConfigParam('blAllowSharedEdit')) {
$this->addTplParam('readonly', true);
}
$ret = parent::render();
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
$soxId = Registry::get(Request::class)->getRequestParameter("oxid");
// check if we right now saved a new entry
$sSavedID = oxRegistry::getConfig()->getRequestParameter("saved_oxid");
$sSavedID = Registry::get(Request::class)->getRequestParameter("saved_oxid");
if (($soxId == "-1" || !isset($soxId)) && isset($sSavedID)) {
$soxId = $sSavedID;
oxRegistry::getSession()->deleteVariable("saved_oxid");
Registry::getSession()->deleteVariable("saved_oxid");
$this->addTplParam("oxid", $soxId);
// for reloading upper frame
$this->addTplParam("updatelist", "1");
@ -69,7 +77,7 @@ class d3_country_geoip extends oxAdminView
$this->addTplParam("edit", $oCountry);
// remove already created languages
$aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
$aLang = array_diff(Registry::getLang()->getLanguageNames(), $oOtherLang);
if (count($aLang)) {
$this->addTplParam("posslang", $aLang);
@ -98,6 +106,9 @@ class d3_country_geoip extends oxAdminView
/**
* @param $sIdent
* @return mixed
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
public function getModCfgValue($sIdent)
{
@ -117,12 +128,12 @@ class d3_country_geoip extends oxAdminView
public function save()
{
//allow malladmin only to perform this action
if (false == oxRegistry::getConfig()->getConfigParam('blAllowSharedEdit')) {
if (false == Registry::getConfig()->getConfigParam('blAllowSharedEdit')) {
return;
}
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
$aParams = oxRegistry::getConfig()->getRequestParameter("editval");
$soxId = Registry::get(Request::class)->getRequestParameter("oxid");
$aParams = Registry::get(Request::class)->getRequestParameter("editval");
/** @var $oCountry oxcountry */
$oCountry = oxNew("oxcountry");
@ -136,14 +147,14 @@ class d3_country_geoip extends oxAdminView
$oCountry->setLanguage(0);
$oCountry->assign($aParams);
$oCountry->setLanguage($this->_iEditLang);
$oCountry = oxRegistry::get('oxUtilsFile')->processFiles($oCountry);
$oCountry = Registry::get('oxUtilsFile')->processFiles($oCountry);
$oCountry->save();
$this->addTplParam("updatelist", "1");
// set oxid if inserted
if ($soxId == "-1") {
oxRegistry::getSession()->setVariable("saved_oxid", $oCountry->getId());
Registry::getSession()->setVariable("saved_oxid", $oCountry->getId());
}
}
@ -157,6 +168,9 @@ class d3_country_geoip extends oxAdminView
/**
* @return array
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
public function getCurList()
{
@ -166,13 +180,14 @@ class d3_country_geoip extends oxAdminView
) {
$sShopId = $this->oCountry->getFieldData('d3geoipshop');
} else {
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
$sShopId = Registry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
}
$sQ = "select DECODE( oxvarvalue, '".oxRegistry::getConfig()->getConfigParam('sConfigKey').
$sQ = "select DECODE( oxvarvalue, '".Registry::getConfig()->getConfigParam('sConfigKey').
"') as oxvarvalue from oxconfig where oxshopid = '".$sShopId."' AND oxvarname = 'aCurrencies'";
$sCurs = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getOne($sQ);
$oDB = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
$sCurs = $oDB->getOne($sQ);
return $this->d3ExtractCurList($sCurs);
}
@ -201,6 +216,9 @@ class d3_country_geoip extends oxAdminView
/**
* ToDo: has to be refactored
* @return array
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
public function getLangList()
{
@ -210,12 +228,12 @@ class d3_country_geoip extends oxAdminView
) {
$sShopId = $this->oCountry->getFieldData('d3geoipshop');
} else {
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
$sShopId = Registry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
}
$aLanguages = array();
$aLangParams = oxRegistry::getConfig()->getShopConfVar('aLanguageParams', $sShopId);
$aConfLanguages = oxRegistry::getConfig()->getShopConfVar('aLanguages', $sShopId);
$aLangParams = Registry::getConfig()->getShopConfVar('aLanguageParams', $sShopId);
$aConfLanguages = Registry::getConfig()->getShopConfVar('aLanguages', $sShopId);
if (is_array($aConfLanguages)) {
$i = 0;

View File

@ -1,5 +1,4 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -15,7 +14,17 @@
* @link http://www.oxidmodule.com
*/
class d3GeoIP extends oxBase
namespace D3\GeoIp\Application\Model;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
use D3\ModCfg\Application\Model\Log\d3log;
use OxidEsales\Eshop\Application\Model\Country;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Model\BaseModel;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
class d3geoip extends BaseModel
{
protected $_sClassName = 'd3geoip';
private $_sModId = 'd3_geoip';
@ -31,16 +40,19 @@ class d3GeoIP extends oxBase
$this->init('d3geoip');
}
/**
* get oxcountry object by given IP address (optional)
*
* @param string $sIP optional
*
* @return oxcountry
* @throws d3_cfg_mod_exception
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* get oxcountry object by given IP address (optional)
*
* @param string $sIP optional
*
* @return oxcountry
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
*/
public function getUserLocationCountryObject($sIP = null)
{
if (!$this->oCountry) {
@ -50,7 +62,7 @@ class d3GeoIP extends oxBase
$sIP = $this->getIP();
}
$sISOAlpha = $this->loadByIP(oxRegistry::getConfig()->checkParamSpecialChars($sIP));
$sISOAlpha = $this->loadByIP(Registry::getConfig()->checkParamSpecialChars($sIP));
if (!$sISOAlpha) {
$this->_getLog()->log(
@ -80,12 +92,14 @@ class d3GeoIP extends oxBase
return $this->oCountry;
}
/**
* get IP address from client or set test IP address
*
* @return string
* @throws d3_cfg_mod_exception
*/
/**
* get IP address from client or set test IP address
*
* @return string
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
public function getIP()
{
startProfile(__METHOD__);
@ -123,17 +137,17 @@ class d3GeoIP extends oxBase
stopProfile(__METHOD__);
return oxRegistry::getConfig()->checkParamSpecialChars($sIP);
return Registry::getConfig()->checkParamSpecialChars($sIP);
}
/**
* get ISO alpha 2 ID by IP address
*
* @param int $sIP IP address
*
* @return string
* @throws oxConnectionException
*/
/**
* get ISO alpha 2 ID by IP address
*
* @param int $sIP IP address
*
* @return string
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
*/
public function loadByIP($sIP)
{
startProfile(__METHOD__);
@ -156,44 +170,47 @@ class d3GeoIP extends oxBase
0
) BETWEEN D3STARTIPBIN AND D3ENDIPBIN";
$sISO = oxDb::getDb()->getOne($sSelect);
$oDB = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
$sISO = $oDB->getOne($sSelect);
stopProfile(__METHOD__);
return $sISO;
}
/**
* get oxcountry object by ISO alpha 2 ID
*
* @param string $sISOAlpha
*
* @return oxcountry
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* get Country object by ISO alpha 2 ID
*
* @param string $sISOAlpha
*
* @return Country
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
*/
public function getCountryObject($sISOAlpha)
{
startProfile(__METHOD__);
$oCountry = oxNew('oxcountry');
/** @var Country $oCountry */
$oCountry = oxNew(Country::class);
$sSelect = "SELECT oxid FROM ".$oCountry->getViewName().
" WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'";
$oCountry->load(oxDb::getDb()->getOne($sSelect));
$oDB = DatabaseProvider::getDb();
$oCountry->load($oDB->getOne($sSelect));
stopProfile(__METHOD__);
return $oCountry;
}
/**
* get oxcountry object for fallback, if set
*
* @return oxcountry
* @throws d3_cfg_mod_exception
* @throws oxSystemComponentException
*/
/**
* get Country object for fallback, if set
*
* @return oxcountry
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
public function getCountryFallBackObject()
{
startProfile(__METHOD__);
@ -211,13 +228,18 @@ class d3GeoIP extends oxBase
return $oCountry;
}
/**
* check module active state and set user country specific language
*
* @throws d3_cfg_mod_exception
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* check module active state and set user country specific language
*
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
public function setCountryLanguage()
{
startProfile(__METHOD__);
@ -234,9 +256,9 @@ class d3GeoIP extends oxBase
$oCountry = $this->getUserLocationCountryObject();
if (!$this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& oxRegistry::getSession()->getId()
&& oxRegistry::getSession()->getVariable('d3isSetLang') === null
&& Registry::getUtils()->isSearchEngine() === false
&& Registry::getSession()->getId()
&& Registry::getSession()->getVariable('d3isSetLang') === null
&& $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1
) {
$this->_getLog()->log(
@ -247,21 +269,26 @@ class d3GeoIP extends oxBase
'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);
Registry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
Registry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
Registry::getSession()->setVariable('d3isSetLang', true);
}
stopProfile(__METHOD__);
}
/**
* check module active state and set user country specific currency
*
* @throws d3_cfg_mod_exception
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* check module active state and set user country specific currency
*
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
public function setCountryCurrency()
{
if (!$this->_getModConfig()->isActive()
@ -275,8 +302,8 @@ class d3GeoIP extends oxBase
$oCountry = $this->getUserLocationCountryObject();
if (!$this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& !oxRegistry::getSession()->getVariable('d3isSetCurr')
&& Registry::getUtils()->isSearchEngine() === false
&& !Registry::getSession()->getVariable('d3isSetCurr')
&& $oCountry->getId()
&& $oCountry->getFieldData('d3geoipcur') > -1
) {
@ -288,8 +315,8 @@ class d3GeoIP extends oxBase
'set currency',
$this->getIP().' => '.$oCountry->getFieldData('d3geoipcur')
);
oxRegistry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
oxRegistry::getSession()->setVariable('d3isSetCurr', true);
Registry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
Registry::getSession()->setVariable('d3isSetCurr', true);
}
stopProfile(__METHOD__);
@ -315,13 +342,18 @@ class d3GeoIP extends oxBase
return false;
}
/**
* check module active state and perform switching to user country specific shop (EE only)
*
* @throws d3_cfg_mod_exception
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* check module active state and perform switching to user country specific shop (EE only)
*
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
public function performShopSwitch()
{
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop')) {
@ -333,15 +365,15 @@ class d3GeoIP extends oxBase
$oCountry = $this->getUserLocationCountryObject();
$iNewShop = $oCountry->getFieldData('d3geoipshop');
if (oxRegistry::getConfig()->getRequestParameter('d3redirect') != 1
if (Registry::get(Request::class)->getRequestParameter('d3redirect') != 1
&& false == $this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& Registry::getUtils()->isSearchEngine() === false
&& $oCountry->getId()
&& $this->getConfig()->isMall()
&& $iNewShop > -1 &&
(
$iNewShop != $this->getConfig()->getShopId()
|| strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
|| strtolower($this->getConfig()->getActiveView()->getClassKey()) == 'mallstart'
)
) {
$oNewConf = new oxConfig();
@ -350,7 +382,7 @@ class d3GeoIP extends oxBase
$this->getConfig()->onShopChange();
if (!oxRegistry::getSession()->getVariable('d3isSetLang')
if (!Registry::getSession()->getVariable('d3isSetLang')
&& $this->_getModConfig()->getValue('blChangeLang')
&& $oCountry->getFieldData('d3geoiplang') > -1
) {
@ -360,10 +392,10 @@ class d3GeoIP extends oxBase
}
/** @var $oStr d3str */
$oStr = oxRegistry::get('d3str');
$oStr = Registry::get('d3str');
$aParams = array(
'd3redirect' => '1',
'fnc' => oxRegistry::getConfig()->getRequestParameter('fnc'),
'fnc' => Registry::get(Request::class)->getRequestParameter('fnc'),
'shp' => $iNewShop
);
$sUrl = str_replace(
@ -388,13 +420,18 @@ class d3GeoIP extends oxBase
stopProfile(__METHOD__);
}
/**
* check module active state and perform switching to user country specific url
*
* @throws d3_cfg_mod_exception
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* check module active state and perform switching to user country specific url
*
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
public function performURLSwitch()
{
if (!$this->_getModConfig()->isActive()
@ -407,7 +444,7 @@ class d3GeoIP extends oxBase
$oCountry = $this->getUserLocationCountryObject();
if (false == $this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& Registry::getUtils()->isSearchEngine() === false
&& $oCountry->getId()
&& $oCountry->getFieldData('d3geoipurl')
&& strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
@ -453,23 +490,27 @@ class d3GeoIP extends oxBase
return $aShopUrls;
}
/**
* get modcfg instance
*
* @return d3_cfg_mod
* @throws d3_cfg_mod_exception
*/
/**
* get modcfg instance
*
* @return d3_cfg_mod
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
protected function _getModConfig()
{
return d3_cfg_mod::get($this->_sModId);
}
/**
* get d3log instance
*
* @return d3log
* @throws d3_cfg_mod_exception
*/
/**
* get d3log instance
*
* @return d3log
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
protected function _getLog()
{
if (!$this->oD3Log) {

View File

@ -1,71 +1,71 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
* @link http://www.oxidmodule.com
*/
$sLangName = 'Deutsch';
$iLangNr = 0;
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
'charset' => 'ISO-8859-15',
'd3mxgeoip' => "<i class='fa fa-globe'></i> GeoIP",
'd3mxgeoip_settings' => 'Einstellungen',
'd3tbclgeoip_settings_main' => 'Grundeinstellungen',
'tbclcountry_geoip' => '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_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.<br><br>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.
'Laden Sie bitte die aktuellen CSV-Daten des Anbieters Maxmind. In "setup+doku/importCSVtoMySQL" des Modulpaketes finden Sie weitere Informationen und die erforderlichen Datenbank-Befehle, um die nötigen Daten zu generieren.'.PHP_EOL.PHP_EOL.
'Alternativ finden Sie die erforderlichen Daten im Installationspaket des Moduls unter "setup+doku/geoip-data_*". '.PHP_EOL.PHP_EOL.
'Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
);
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
* @link http://www.oxidmodule.com
*/
$sLangName = 'Deutsch';
$iLangNr = 0;
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
'charset' => 'UTF-8',
'd3mxgeoip' => "<i class='fa fa-globe'></i> GeoIP",
'd3mxgeoip_settings' => 'Einstellungen',
'd3tbclgeoip_settings_main' => 'Grundeinstellungen',
'tbclcountry_geoip' => '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_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.<br><br>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.
'Laden Sie bitte die aktuellen CSV-Daten des Anbieters Maxmind. In "setup+doku/importCSVtoMySQL" des Modulpaketes finden Sie weitere Informationen und die erforderlichen Datenbank-Befehle, um die nötigen Daten zu generieren.'.PHP_EOL.PHP_EOL.
'Alternativ finden Sie die erforderlichen Daten im Installationspaket des Moduls unter "setup+doku/geoip-data_*". '.PHP_EOL.PHP_EOL.
'Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
);

View File

@ -1,118 +1,118 @@
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
<script type="text/javascript">
<!--
window.onload = function ()
{
[{if $updatelist == 1}]
top.oxid.admin.updateList('[{$oxid}]');
[{/if}]
var oField = top.oxid.admin.getLockTarget();
oField.onchange = oField.onkeyup = oField.onmouseout = top.oxid.admin.unlockSave;
}
//-->
</script>
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
<form name="transfer" id="transfer" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="oxidCopy" value="[{$oxid}]">
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="language" value="[{$actlang}]">
</form>
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="voxid" value="[{$oxid}]">
<input type="hidden" name="oxparentid" value="[{$oxparentid}]">
<input type="hidden" name="editval[oxcountry__oxid]" value="[{$oxid}]">
<input type="hidden" name="language" value="[{$actlang}]">
<table cellspacing="0" cellpadding="0" border="0" width="98%">
<tr>
<td valign="top" class="edittext" style="width: 45%">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="edittext" width="120">
<label for="d3geoipshop">[{oxmultilang ident="D3_GEOIP_SELSHOP"}]:</label>
</td>
<td class="edittext">
<SELECT id="d3geoipshop" name="editval[oxcountry__d3geoipshop]" class="edittext" onchange="document.getElementById('myedit').fnc.value = 'saveshop'; document.getElementById('myedit').submit();" [{if !$oView->getModCfgValue('blChangeShop')}]disabled[{/if}]>
<option value="-1">[{oxmultilang ident="D3_GEOIP_CUSTSELSHOP"}]</option>
[{foreach from=$oView->getShopList() item=shop}]
<option value="[{$shop->oxshops__oxid->value}]" [{if $edit->oxcountry__d3geoipshop->value == $shop->oxshops__oxid->value}]selected[{/if}]>[{$shop->oxshops__oxname->value}]</option>
[{/foreach}]
</SELECT>[{if !$oView->getModCfgValue('blChangeShop')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
</td>
</tr>
<tr>
<td class="edittext">
<label for="d3geoiplang">[{oxmultilang ident="D3_GEOIP_SELLANG"}]:</label>
</td>
<td class="edittext">
<SELECT id="d3geoiplang" name="editval[oxcountry__d3geoiplang]" class="edittext" [{if !$oView->getModCfgValue('blChangeLang')}]disabled[{/if}]>
<option value="-1">[{oxmultilang ident="D3_GEOIP_CUSTSELLANG"}]</option>
[{foreach from=$oView->getLangList() item=lang}]
<option value="[{$lang->id}]" [{if $edit->oxcountry__d3geoiplang->value == $lang->id}]selected[{/if}]>[{$lang->name}]</option>
[{/foreach}]
</SELECT>[{if !$oView->getModCfgValue('blChangeLang')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
</td>
</tr>
<tr>
<td class="edittext">
<label for="d3geoipcur">[{oxmultilang ident="D3_GEOIP_SELCUR"}]:</label>
</td>
<td class="edittext">
<SELECT id="d3geoipcur" name="editval[oxcountry__d3geoipcur]" class="edittext" [{if !$oView->getModCfgValue('blChangeCurr')}]disabled[{/if}]>
<option value="-1">[{oxmultilang ident="D3_GEOIP_CUSTSELCUR"}]</option>
[{foreach from=$oView->getCurList() item=cur}]
<option value="[{$cur->id}]" [{if $edit->oxcountry__d3geoipcur->value == $cur->id}]selected[{/if}]>[{$cur->name}] ([{$cur->sign}])</option>
[{/foreach}]
</SELECT>[{if !$oView->getModCfgValue('blChangeCurr')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
</td>
</tr>
<tr>
<td class="edittext"><br><br>
</td>
<td class="edittext"><br><br>
<input type="submit" class="edittext" id="oLockButton" name="saveArticle" value="[{oxmultilang ident="GENERAL_SAVE"}]" onClick="Javascript:document.myedit.fnc.value='save'"" [{$readonly}] [{if !$edit->oxcountry__oxtitle->value && !$oxparentid}]disabled[{/if}]><br>
</td>
</tr>
</table>
</td>
<td valign="top" class="edittext" align="left" width="10%">
[{oxmultilang ident="D3_GEOIP_OR"}]
</td>
<!-- Anfang rechte Seite -->
<td valign="top" class="edittext" align="left" width="45%">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="edittext" width="120">
<label for="d3geoipurl">[{oxmultilang ident="D3_GEOIP_SELURL"}]:</label>
</td>
<td class="edittext">
<input id="d3geoipurl" type="text" maxlength="255" size="50" name="editval[oxcountry__d3geoipurl]" value="[{$edit->oxcountry__d3geoipurl->value}]" [{if !$oView->getModCfgValue('blChangeURL')}]disabled[{/if}]> [{if !$oView->getModCfgValue('blChangeURL')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
[{oxinputhelp ident="D3_GEOIP_SELURL_DESC"}]
</td>
</tr>
</table>
</td>
<!-- Ende rechte Seite -->
</tr>
</table>
</form>
[{include file="bottomnaviitem.tpl"}]
[{include file="bottomitem.tpl"}]
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
<script type="text/javascript">
<!--
window.onload = function ()
{
[{if $updatelist == 1}]
top.oxid.admin.updateList('[{$oxid}]');
[{/if}]
var oField = top.oxid.admin.getLockTarget();
oField.onchange = oField.onkeyup = oField.onmouseout = top.oxid.admin.unlockSave;
}
//-->
</script>
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
<form name="transfer" id="transfer" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="oxidCopy" value="[{$oxid}]">
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="language" value="[{$actlang}]">
</form>
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="voxid" value="[{$oxid}]">
<input type="hidden" name="oxparentid" value="[{$oxparentid}]">
<input type="hidden" name="editval[oxcountry__oxid]" value="[{$oxid}]">
<input type="hidden" name="language" value="[{$actlang}]">
<table cellspacing="0" cellpadding="0" border="0" width="98%">
<tr>
<td valign="top" class="edittext" style="width: 45%">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="edittext" width="120">
<label for="d3geoipshop">[{oxmultilang ident="D3_GEOIP_SELSHOP"}]:</label>
</td>
<td class="edittext">
<SELECT id="d3geoipshop" name="editval[oxcountry__d3geoipshop]" class="edittext" onchange="document.getElementById('myedit').fnc.value = 'saveshop'; document.getElementById('myedit').submit();" [{if !$oView->getModCfgValue('blChangeShop')}]disabled[{/if}]>
<option value="-1">[{oxmultilang ident="D3_GEOIP_CUSTSELSHOP"}]</option>
[{foreach from=$oView->getShopList() item=shop}]
<option value="[{$shop->oxshops__oxid->value}]" [{if $edit->oxcountry__d3geoipshop->value == $shop->oxshops__oxid->value}]selected[{/if}]>[{$shop->oxshops__oxname->value}]</option>
[{/foreach}]
</SELECT>[{if !$oView->getModCfgValue('blChangeShop')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
</td>
</tr>
<tr>
<td class="edittext">
<label for="d3geoiplang">[{oxmultilang ident="D3_GEOIP_SELLANG"}]:</label>
</td>
<td class="edittext">
<SELECT id="d3geoiplang" name="editval[oxcountry__d3geoiplang]" class="edittext" [{if !$oView->getModCfgValue('blChangeLang')}]disabled[{/if}]>
<option value="-1">[{oxmultilang ident="D3_GEOIP_CUSTSELLANG"}]</option>
[{foreach from=$oView->getLangList() item=lang}]
<option value="[{$lang->id}]" [{if $edit->oxcountry__d3geoiplang->value == $lang->id}]selected[{/if}]>[{$lang->name}]</option>
[{/foreach}]
</SELECT>[{if !$oView->getModCfgValue('blChangeLang')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
</td>
</tr>
<tr>
<td class="edittext">
<label for="d3geoipcur">[{oxmultilang ident="D3_GEOIP_SELCUR"}]:</label>
</td>
<td class="edittext">
<SELECT id="d3geoipcur" name="editval[oxcountry__d3geoipcur]" class="edittext" [{if !$oView->getModCfgValue('blChangeCurr')}]disabled[{/if}]>
<option value="-1">[{oxmultilang ident="D3_GEOIP_CUSTSELCUR"}]</option>
[{foreach from=$oView->getCurList() item=cur}]
<option value="[{$cur->id}]" [{if $edit->oxcountry__d3geoipcur->value == $cur->id}]selected[{/if}]>[{$cur->name}] ([{$cur->sign}])</option>
[{/foreach}]
</SELECT>[{if !$oView->getModCfgValue('blChangeCurr')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
</td>
</tr>
<tr>
<td class="edittext"><br><br>
</td>
<td class="edittext"><br><br>
<input type="submit" class="edittext" id="oLockButton" name="saveArticle" value="[{oxmultilang ident="GENERAL_SAVE"}]" onClick="Javascript:document.myedit.fnc.value='save'"" [{$readonly}] [{if !$edit->oxcountry__oxtitle->value && !$oxparentid}]disabled[{/if}]><br>
</td>
</tr>
</table>
</td>
<td valign="top" class="edittext" align="left" width="10%">
[{oxmultilang ident="D3_GEOIP_OR"}]
</td>
<!-- Anfang rechte Seite -->
<td valign="top" class="edittext" align="left" width="45%">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="edittext" width="120">
<label for="d3geoipurl">[{oxmultilang ident="D3_GEOIP_SELURL"}]:</label>
</td>
<td class="edittext">
<input id="d3geoipurl" type="text" maxlength="255" size="50" name="editval[oxcountry__d3geoipurl]" value="[{$edit->oxcountry__d3geoipurl->value}]" [{if !$oView->getModCfgValue('blChangeURL')}]disabled[{/if}]> [{if !$oView->getModCfgValue('blChangeURL')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}]
[{oxinputhelp ident="D3_GEOIP_SELURL_DESC"}]
</td>
</tr>
</table>
</td>
<!-- Ende rechte Seite -->
</tr>
</table>
</form>
[{include file="bottomnaviitem.tpl"}]
[{include file="bottomitem.tpl"}]

View File

@ -1,21 +1,21 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
* @link http://www.oxidmodule.com
*/
/** */
class d3_oxcmp_cur_geoip_parent extends oxcmp_cur {}
/** */
class d3_oxcmp_lang_geoip_parent extends oxcmp_lang {}
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
* @link http://www.oxidmodule.com
*/
/** */
class d3_oxcmp_cur_geoip_parent extends oxcmp_cur {}
/** */
class d3_oxcmp_lang_geoip_parent extends oxcmp_lang {}

View File

@ -0,0 +1,30 @@
<?php
namespace D3\GeoIp\Modules\Component;
use D3\GeoIp\Application\Model\d3geoip;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
{
private $_sModId = 'd3_geoip';
/**
* @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException
* @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws \OxidEsales\Eshop\Core\Exception\StandardException
*/
public function init()
{
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
/** @var $oLocation d3geoip */
$oLocation = oxNew(d3geoip::class);
$oLocation->setCountryLanguage();
}
parent::init();
}
}

View File

@ -1,5 +1,4 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -15,6 +14,10 @@
* @link http://www.oxidmodule.com
*/
namespace D3\GeoIp\Modules\Controller;
use OxidEsales\Eshop\Core\Registry;
class d3_oxshopcontrol_geoip extends d3_oxshopcontrol_geoip_parent
{
/**
@ -37,7 +40,7 @@ class d3_oxshopcontrol_geoip extends d3_oxshopcontrol_geoip_parent
{
startProfile(__METHOD__);
$aUserComponentNames = oxRegistry::getConfig()->getConfigParam('aUserComponentNames');
$aUserComponentNames = Registry::getConfig()->getConfigParam('aUserComponentNames');
$sGeoIpCmpName = 'd3cmp_geoip';
$blDontUseCache = 1;
@ -47,7 +50,7 @@ class d3_oxshopcontrol_geoip extends d3_oxshopcontrol_geoip_parent
if (false == in_array($sGeoIpCmpName, array_keys($aUserComponentNames))) {
$aUserComponentNames[$sGeoIpCmpName] = $blDontUseCache;
oxRegistry::getConfig()->setConfigParam('aUserComponentNames', $aUserComponentNames);
Registry::getConfig()->setConfigParam('aUserComponentNames', $aUserComponentNames);
}
stopProfile(__METHOD__);

View File

@ -14,6 +14,18 @@
* @link http://www.oxidmodule.com
*/
namespace D3\GeoIp\Setup;
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
use D3\ModCfg\Application\Model\Installwizzard\d3installdbfield;
use D3\ModCfg\Application\Model\Installwizzard\d3installdbrecord;
use d3\modcfg\Application\Model\d3database;
use D3\ModCfg\Application\Model\Installwizzard\d3installdbtable;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Facts\Facts;
class d3geoip_update extends d3install_updatebase
{
public $sModKey = 'd3_geoip';
@ -249,7 +261,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
public function hasDeleteGeoIpTableFields()
{
/** @var d3installdbfield $oInstallDbField */
$oInstallDbField = oxNew('d3installdbfield', $this);
$oInstallDbField = oxNew(d3installdbfield::class, $this);
return $oInstallDbField->checkDeleteFields();
}
@ -262,7 +274,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
$blRet = false;
if ($this->hasDeleteGeoIpTableFields()) {
/** @var d3installdbfield $oInstallDbField */
$oInstallDbField = oxNew('d3installdbfield', $this);
$oInstallDbField = oxNew(d3installdbfield::class, $this);
$blRet = $oInstallDbField->fixDeleteFields(__METHOD__);
}
@ -276,7 +288,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
public function checkGeoIpTableEngine()
{
/** @var d3installdbtable $oDbTable */
$oDbTable = oxNew('d3installdbtable', $this);
$oDbTable = oxNew(d3installdbtable::class, $this);
$aData = $oDbTable->getTableData('d3geoip');
if (isset($aData) && count($aData) && isset($aData['ENGINE']) && $aData['ENGINE'] == 'InnoDB') {
@ -286,14 +298,15 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
return true;
}
/**
* @return bool
* @throws oxSystemComponentException
*/
/**
* @return bool
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
public function updateGeoIpTableEngine()
{
/** @var d3installdbtable $oDbTable */
$oDbTable = oxNew('d3installdbtable', $this);
$oDbTable = oxNew(d3installdbtable::class, $this);
$blRet = $oDbTable->changeTableEngine('d3geoip', 'InnoDB');
return $blRet;
}
@ -322,6 +335,8 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
/**
* @return bool
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
*/
public function checkModCfgItemExist()
{
@ -430,7 +445,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
),
array (
'fieldname' => 'OXSHOPVERSION',
'content' => oxRegistry::getConfig()->getEdition(),
'content' => Registry::getConfig()->getEdition(),
'force_update' => true,
'use_quote' => true,
'use_multilang' => false,
@ -516,7 +531,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
*/
public function checkRegisteredComponent()
{
/** @var $oShop oxshop */
/** @var $oShop Shop */
foreach ($this->getShopListByActiveModule('d3geoip') as $oShop) {
$aUserComponents = $this->_d3GetUserComponentsFromDb($oShop);
@ -557,25 +572,26 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
return $blRet;
}
/**
* @param oxShop $oShop
*
* @return array|null
* @throws oxConnectionException
*/
protected function _d3GetUserComponentsFromDb(oxShop $oShop)
/**
* @param Shop $oShop
*
* @return array|null
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
*/
protected function _d3GetUserComponentsFromDb(Shop $oShop)
{
$sVarName = 'aUserComponentNames';
$sModuleId = '';
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC);
$sSelect = "SELECT oxvartype as type, ".oxRegistry::getConfig()->getDecodeValueQuery().
$oDb = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
$sSelect = "SELECT oxvartype as type, ".Registry::getConfig()->getDecodeValueQuery().
" as value FROM `oxconfig` WHERE oxshopid = ".$oDb->quote($oShop->getId()).
" AND oxvarname = ".$oDb->quote($sVarName).
" AND oxmodule = ".$oDb->quote($sModuleId);
$aResult = $oDb->getAll($sSelect);
$aUserComponents = is_array($aResult) && count($aResult)
? oxRegistry::getConfig()->decodeValue($aResult[0]['type'], $aResult[0]['value'])
? Registry::getConfig()->decodeValue($aResult[0]['type'], $aResult[0]['value'])
: null;
return $aUserComponents;

View File

@ -0,0 +1,37 @@
{
"name": "d3/geoip",
"description": "D3: GeoIp",
"type": "oxideshop-module",
"version": "1.0",
"keywords": [
"oxid",
"modules",
"eShop",
"d3"
],
"authors": [
{
"name": "D3 Data Development (Inh. Thomas Dartsch)",
"email": "info@shopmodule.com",
"homepage": "http://www.d3data.de",
"role": "Owner"
}
],
"support": {
"email": "support@shopmodule.com"
},
"homepage": "https://www.oxidmodule.com/",
"license": [
"proprietary"
],
"extra": {
"source-directory": "/",
"target-directory": "d3/geoip"
},
"require": {},
"autoload": {
"psr-4": {
"D3\\GeoIp\\": "../../../../source/modules/d3/geoip"
}
}
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Metadata version
*/
$sMetadataVersion = '2.0';
use D3\GeoIp\Application\Component\d3cmp_geoip;
use D3\GeoIp\Application\Controller\Admin\d3_cfg_geoipset;
use D3\GeoIp\Application\Controller\Admin\d3_cfg_geoipset_licence;
use D3\GeoIp\Application\Controller\Admin\d3_cfg_geoipset_list;
use D3\GeoIp\Application\Controller\Admin\d3_cfg_geoipset_main;
use D3\GeoIp\Application\Controller\Admin\d3_country_geoip;
use D3\GeoIp\Application\Model\d3geoip;
use D3\GeoIp\Modules\Component\d3_oxcmp_lang_geoip;
use D3\GeoIp\Modules\Controller\d3_oxshopcontrol_geoip;
use D3\GeoIp\Setup as ModuleSetup;
use D3\GeoIp\Setup\d3geoip_update;
use OxidEsales\Eshop\Application\Component\LanguageComponent;
use OxidEsales\Eshop\Core\ShopControl;
$sD3Logo = (class_exists(d3\modcfg\Application\Model\d3utils::class) ? d3\modcfg\Application\Model\d3utils::getInstance()->getD3Logo() : 'D&sup3;');
/**
* Module information
*/
$aModule = array(
'id' => 'd3geoip',
'title' => $sD3Logo . ' GeoIP Vorauswahl',
'description' => array(
'de' => 'Begr&uuml;&szlig;en Sie Ihre Kunden in seiner Landessprache.',
'en' => '',
),
'thumbnail' => 'picture.png',
'version' => '3.1.0.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
'extend' => array(
LanguageComponent::class => d3_oxcmp_lang_geoip::class,
ShopControl::class => d3_oxshopcontrol_geoip::class
),
'controllers' => array(
'd3cmp_geoip' => d3cmp_geoip::class,
'd3_cfg_geoipset' => d3_cfg_geoipset::class,
'd3_cfg_geoipset_list' => d3_cfg_geoipset_list::class,
'd3_cfg_geoipset_main' => d3_cfg_geoipset_main::class,
'd3_cfg_geoipset_licence' => d3_cfg_geoipset_licence::class,
'd3_country_geoip' => d3_country_geoip::class,
'd3geoip' => d3geoip::class,
'd3geoip_update' => d3geoip_update::class,
),
'templates' => array(
'd3_cfg_geoipset_main.tpl' => 'd3/geoip/Application/views/admin/tpl/d3_cfg_geoipset_main.tpl',
'd3_country_geoip.tpl' => 'd3/geoip/Application/views/admin/tpl/d3_country_geoip.tpl',
),
'events' => array(
'onActivate' => '\D3\GeoIp\Setup\Events::onActivate',
),
'blocks' => array(
),
'd3SetupClasses' => array(
d3geoip_update::class,
),
'd3FileRegister' => array(
'd3/geoip/IntelliSenseHelper.php',
'd3/geoip/metadata.php',
'd3/geoip/Application/views/admin/de/d3_geoip_lang.php',
),
);

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB