From 265cd90dd0ed8d215be4ca03773a89ca64047e82 Mon Sep 17 00:00:00 2001 From: MarkusGaertner Date: Fri, 17 Apr 2020 09:29:09 +0200 Subject: [PATCH] Anpassung auf 6.1.x --- copy_this/modules/d3/d3geoip/metadata.php | 50 ---- .../components/d3_oxcmp_lang_geoip.php | 17 -- .../Application/Component}/d3cmp_geoip.php | 31 ++- .../Controller/Admin}/d3_cfg_geoipset.php | 4 + .../Admin}/d3_cfg_geoipset_licence.php | 5 +- .../Admin}/d3_cfg_geoipset_list.php | 5 +- .../Admin}/d3_cfg_geoipset_main.php | 27 +- .../Controller/Admin}/d3_country_geoip.php | 54 ++-- .../Application/Model}/d3geoip.php | 249 ++++++++++-------- .../views/admin/de/d3_geoip_lang.php | 142 +++++----- .../views/admin/tpl/d3_cfg_geoipset_main.tpl | 0 .../views/admin/tpl/d3_country_geoip.tpl | 236 ++++++++--------- .../{d3geoip => geoip}/IntelliSenseHelper.php | 42 +-- .../Modules/Component/d3_oxcmp_lang_geoip.php | 30 +++ .../Controller}/d3_oxshopcontrol_geoip.php | 9 +- .../setup => geoip/Setup}/d3geoip_update.php | 56 ++-- copy_this/modules/d3/geoip/composer.json | 37 +++ .../modules/d3/{d3geoip => geoip}/menu.xml | 0 copy_this/modules/d3/geoip/metadata.php | 69 +++++ .../modules/d3/{d3geoip => geoip}/picture.png | Bin 20 files changed, 628 insertions(+), 435 deletions(-) delete mode 100644 copy_this/modules/d3/d3geoip/metadata.php delete mode 100644 copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php rename copy_this/modules/d3/{d3geoip/components => geoip/Application/Component}/d3cmp_geoip.php (62%) rename copy_this/modules/d3/{d3geoip/controllers/admin => geoip/Application/Controller/Admin}/d3_cfg_geoipset.php (88%) rename copy_this/modules/d3/{d3geoip/controllers/admin => geoip/Application/Controller/Admin}/d3_cfg_geoipset_licence.php (86%) rename copy_this/modules/d3/{d3geoip/controllers/admin => geoip/Application/Controller/Admin}/d3_cfg_geoipset_list.php (90%) rename copy_this/modules/d3/{d3geoip/controllers/admin => geoip/Application/Controller/Admin}/d3_cfg_geoipset_main.php (66%) rename copy_this/modules/d3/{d3geoip/controllers/admin => geoip/Application/Controller/Admin}/d3_country_geoip.php (76%) rename copy_this/modules/d3/{d3geoip/models => geoip/Application/Model}/d3geoip.php (60%) rename copy_this/modules/d3/{d3geoip => geoip/Application}/views/admin/de/d3_geoip_lang.php (76%) rename copy_this/modules/d3/{d3geoip => geoip/Application}/views/admin/tpl/d3_cfg_geoipset_main.tpl (100%) rename copy_this/modules/d3/{d3geoip => geoip/Application}/views/admin/tpl/d3_country_geoip.tpl (98%) rename copy_this/modules/d3/{d3geoip => geoip}/IntelliSenseHelper.php (96%) create mode 100644 copy_this/modules/d3/geoip/Modules/Component/d3_oxcmp_lang_geoip.php rename copy_this/modules/d3/{d3geoip/modules/controllers => geoip/Modules/Controller}/d3_oxshopcontrol_geoip.php (84%) rename copy_this/modules/d3/{d3geoip/setup => geoip/Setup}/d3geoip_update.php (91%) create mode 100644 copy_this/modules/d3/geoip/composer.json rename copy_this/modules/d3/{d3geoip => geoip}/menu.xml (100%) create mode 100644 copy_this/modules/d3/geoip/metadata.php rename copy_this/modules/d3/{d3geoip => geoip}/picture.png (100%) diff --git a/copy_this/modules/d3/d3geoip/metadata.php b/copy_this/modules/d3/d3geoip/metadata.php deleted file mode 100644 index 1b34e19..0000000 --- a/copy_this/modules/d3/d3geoip/metadata.php +++ /dev/null @@ -1,50 +0,0 @@ - 'd3geoip', - 'title' => (class_exists('d3utils') ? d3utils::getInstance()->getD3Logo() : 'D³') . ' GeoIP Vorauswahl', - 'description' => array( - 'de' => 'Begrüßen Sie Ihre Kunden in seiner Landessprache.', - 'en' => '', - ), - 'thumbnail' => 'picture.png', - 'version' => '3.1.0.0', - 'author' => 'D³ 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', - ), -); \ 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 deleted file mode 100644 index 6793c39..0000000 --- a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php +++ /dev/null @@ -1,17 +0,0 @@ -_sModId)->isActive()) { - /** @var $oLocation d3geoip */ - $oLocation = oxNew('d3geoip'); - $oLocation->setCountryLanguage(); - } - - parent::init(); - } -} \ No newline at end of file diff --git a/copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php b/copy_this/modules/d3/geoip/Application/Component/d3cmp_geoip.php similarity index 62% rename from copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php rename to copy_this/modules/d3/geoip/Application/Component/d3cmp_geoip.php index b9f0d2a..da5aeac 100644 --- a/copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php +++ b/copy_this/modules/d3/geoip/Application/Component/d3cmp_geoip.php @@ -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 */ diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php b/copy_this/modules/d3/geoip/Application/Controller/Admin/d3_cfg_geoipset.php similarity index 88% rename from copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php rename to copy_this/modules/d3/geoip/Application/Controller/Admin/d3_cfg_geoipset.php index 61ec21e..2761010 100644 --- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php +++ b/copy_this/modules/d3/geoip/Application/Controller/Admin/d3_cfg_geoipset.php @@ -1,5 +1,9 @@ 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(). diff --git a/copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php b/copy_this/modules/d3/geoip/Application/Controller/Admin/d3_country_geoip.php similarity index 76% rename from copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php rename to copy_this/modules/d3/geoip/Application/Controller/Admin/d3_country_geoip.php index a44c328..f1c5bc8 100644 --- a/copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php +++ b/copy_this/modules/d3/geoip/Application/Controller/Admin/d3_country_geoip.php @@ -1,5 +1,4 @@ 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; diff --git a/copy_this/modules/d3/d3geoip/models/d3geoip.php b/copy_this/modules/d3/geoip/Application/Model/d3geoip.php similarity index 60% rename from copy_this/modules/d3/d3geoip/models/d3geoip.php rename to copy_this/modules/d3/geoip/Application/Model/d3geoip.php index 516bf3d..f376d8a 100644 --- a/copy_this/modules/d3/d3geoip/models/d3geoip.php +++ b/copy_this/modules/d3/geoip/Application/Model/d3geoip.php @@ -1,5 +1,4 @@ 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) { diff --git a/copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php b/copy_this/modules/d3/geoip/Application/views/admin/de/d3_geoip_lang.php similarity index 76% rename from copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php rename to copy_this/modules/d3/geoip/Application/views/admin/de/d3_geoip_lang.php index 7baa5d4..3f3836a 100644 --- a/copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php +++ b/copy_this/modules/d3/geoip/Application/views/admin/de/d3_geoip_lang.php @@ -1,71 +1,71 @@ - - * @link http://www.oxidmodule.com - */ - -$sLangName = 'Deutsch'; -$iLangNr = 0; -// ------------------------------- -// RESOURCE IDENTITFIER = STRING -// ------------------------------- -$aLang = array( - 'charset' => 'ISO-8859-15', - 'd3mxgeoip' => " 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.

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.', -); + + * @link http://www.oxidmodule.com + */ + +$sLangName = 'Deutsch'; +$iLangNr = 0; +// ------------------------------- +// RESOURCE IDENTITFIER = STRING +// ------------------------------- +$aLang = array( + 'charset' => 'UTF-8', + 'd3mxgeoip' => " 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.

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.', +); diff --git a/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl b/copy_this/modules/d3/geoip/Application/views/admin/tpl/d3_cfg_geoipset_main.tpl similarity index 100% rename from copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl rename to copy_this/modules/d3/geoip/Application/views/admin/tpl/d3_cfg_geoipset_main.tpl diff --git a/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_country_geoip.tpl b/copy_this/modules/d3/geoip/Application/views/admin/tpl/d3_country_geoip.tpl similarity index 98% rename from copy_this/modules/d3/d3geoip/views/admin/tpl/d3_country_geoip.tpl rename to copy_this/modules/d3/geoip/Application/views/admin/tpl/d3_country_geoip.tpl index 4ea0608..e3c4f4f 100644 --- a/copy_this/modules/d3/d3geoip/views/admin/tpl/d3_country_geoip.tpl +++ b/copy_this/modules/d3/geoip/Application/views/admin/tpl/d3_country_geoip.tpl @@ -1,118 +1,118 @@ -[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] - - - -[{if $readonly}] - [{assign var="readonly" value="readonly disabled"}] -[{else}] - [{assign var="readonly" value=""}] -[{/if}] - -
- [{$oViewConf->getHiddenSid()}] - - - - -
- -
- [{$oViewConf->getHiddenSid()}] - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - [{if !$oView->getModCfgValue('blChangeShop')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] -
- - - [{if !$oView->getModCfgValue('blChangeLang')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] -
- - - [{if !$oView->getModCfgValue('blChangeCurr')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] -


-


- oxcountry__oxtitle->value && !$oxparentid}]disabled[{/if}]>
-
-
- [{oxmultilang ident="D3_GEOIP_OR"}] - - - - - - -
- - - getModCfgValue('blChangeURL')}]disabled[{/if}]> [{if !$oView->getModCfgValue('blChangeURL')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] - [{oxinputhelp ident="D3_GEOIP_SELURL_DESC"}] -
-
-
- -[{include file="bottomnaviitem.tpl"}] - -[{include file="bottomitem.tpl"}] +[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] + + + +[{if $readonly}] + [{assign var="readonly" value="readonly disabled"}] +[{else}] + [{assign var="readonly" value=""}] +[{/if}] + +
+ [{$oViewConf->getHiddenSid()}] + + + + +
+ +
+ [{$oViewConf->getHiddenSid()}] + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + [{if !$oView->getModCfgValue('blChangeShop')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] +
+ + + [{if !$oView->getModCfgValue('blChangeLang')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] +
+ + + [{if !$oView->getModCfgValue('blChangeCurr')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] +


+


+ oxcountry__oxtitle->value && !$oxparentid}]disabled[{/if}]>
+
+
+ [{oxmultilang ident="D3_GEOIP_OR"}] + + + + + + +
+ + + getModCfgValue('blChangeURL')}]disabled[{/if}]> [{if !$oView->getModCfgValue('blChangeURL')}] [{oxmultilang ident="D3_GEOIP_DISABLED"}][{/if}] + [{oxinputhelp ident="D3_GEOIP_SELURL_DESC"}] +
+
+
+ +[{include file="bottomnaviitem.tpl"}] + +[{include file="bottomitem.tpl"}] diff --git a/copy_this/modules/d3/d3geoip/IntelliSenseHelper.php b/copy_this/modules/d3/geoip/IntelliSenseHelper.php similarity index 96% rename from copy_this/modules/d3/d3geoip/IntelliSenseHelper.php rename to copy_this/modules/d3/geoip/IntelliSenseHelper.php index 9463e18..11d48fd 100644 --- a/copy_this/modules/d3/d3geoip/IntelliSenseHelper.php +++ b/copy_this/modules/d3/geoip/IntelliSenseHelper.php @@ -1,21 +1,21 @@ - - * @link http://www.oxidmodule.com - */ - -/** */ -class d3_oxcmp_cur_geoip_parent extends oxcmp_cur {} - -/** */ -class d3_oxcmp_lang_geoip_parent extends oxcmp_lang {} + + * @link http://www.oxidmodule.com + */ + +/** */ +class d3_oxcmp_cur_geoip_parent extends oxcmp_cur {} + +/** */ +class d3_oxcmp_lang_geoip_parent extends oxcmp_lang {} diff --git a/copy_this/modules/d3/geoip/Modules/Component/d3_oxcmp_lang_geoip.php b/copy_this/modules/d3/geoip/Modules/Component/d3_oxcmp_lang_geoip.php new file mode 100644 index 0000000..ce3c351 --- /dev/null +++ b/copy_this/modules/d3/geoip/Modules/Component/d3_oxcmp_lang_geoip.php @@ -0,0 +1,30 @@ +_sModId)->isActive()) { + /** @var $oLocation d3geoip */ + $oLocation = oxNew(d3geoip::class); + $oLocation->setCountryLanguage(); + } + + parent::init(); + } +} \ No newline at end of file diff --git a/copy_this/modules/d3/d3geoip/modules/controllers/d3_oxshopcontrol_geoip.php b/copy_this/modules/d3/geoip/Modules/Controller/d3_oxshopcontrol_geoip.php similarity index 84% rename from copy_this/modules/d3/d3geoip/modules/controllers/d3_oxshopcontrol_geoip.php rename to copy_this/modules/d3/geoip/Modules/Controller/d3_oxshopcontrol_geoip.php index 7954aee..d2f71f8 100644 --- a/copy_this/modules/d3/d3geoip/modules/controllers/d3_oxshopcontrol_geoip.php +++ b/copy_this/modules/d3/geoip/Modules/Controller/d3_oxshopcontrol_geoip.php @@ -1,5 +1,4 @@ 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__); diff --git a/copy_this/modules/d3/d3geoip/setup/d3geoip_update.php b/copy_this/modules/d3/geoip/Setup/d3geoip_update.php similarity index 91% rename from copy_this/modules/d3/d3geoip/setup/d3geoip_update.php rename to copy_this/modules/d3/geoip/Setup/d3geoip_update.php index 079cbcf..6edbe16 100644 --- a/copy_this/modules/d3/d3geoip/setup/d3geoip_update.php +++ b/copy_this/modules/d3/geoip/Setup/d3geoip_update.php @@ -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; diff --git a/copy_this/modules/d3/geoip/composer.json b/copy_this/modules/d3/geoip/composer.json new file mode 100644 index 0000000..dc4e7a4 --- /dev/null +++ b/copy_this/modules/d3/geoip/composer.json @@ -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" + } + } +} \ No newline at end of file diff --git a/copy_this/modules/d3/d3geoip/menu.xml b/copy_this/modules/d3/geoip/menu.xml similarity index 100% rename from copy_this/modules/d3/d3geoip/menu.xml rename to copy_this/modules/d3/geoip/menu.xml diff --git a/copy_this/modules/d3/geoip/metadata.php b/copy_this/modules/d3/geoip/metadata.php new file mode 100644 index 0000000..fd62875 --- /dev/null +++ b/copy_this/modules/d3/geoip/metadata.php @@ -0,0 +1,69 @@ +getD3Logo() : 'D³'); + +/** + * Module information + */ +$aModule = array( + 'id' => 'd3geoip', + 'title' => $sD3Logo . ' GeoIP Vorauswahl', + 'description' => array( + 'de' => 'Begrüßen Sie Ihre Kunden in seiner Landessprache.', + 'en' => '', + ), + 'thumbnail' => 'picture.png', + 'version' => '3.1.0.0', + 'author' => 'D³ 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', + ), +); \ No newline at end of file diff --git a/copy_this/modules/d3/d3geoip/picture.png b/copy_this/modules/d3/geoip/picture.png similarity index 100% rename from copy_this/modules/d3/d3geoip/picture.png rename to copy_this/modules/d3/geoip/picture.png