fix small issues

This commit is contained in:
Daniel Seifert 2020-06-10 10:28:16 +02:00
parent 3c82f793e6
commit bb54488989
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
13 changed files with 293 additions and 223 deletions

View File

@ -1,6 +1,6 @@
{
"name": "d3/geoip",
"description": "GeoIP preselection for oxid eShop v6",
"description": "GeoIP preselection",
"type": "oxideshop-module",
"authors": [
{
@ -19,6 +19,7 @@
"eShop",
"d3",
"GeoIp",
"language",
"country",
"countries",
"currency",
@ -36,7 +37,7 @@
},
"require": {
"php": ">=5.6",
"oxid-esales/oxideshop-ce": "6.0 - 6.3",
"oxid-esales/oxideshop-ce": "6.2 - 6.3",
"d3/modcfg": "^5.3.1.0"
},
"autoload": {

View File

@ -1,4 +1,5 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
@ -9,8 +10,8 @@
*
* http://www.shopmodule.com
*
* @copyright © Data Development, Thomas Dartsch
* @author D³ Data Development - Daniel Seifert <ds@shopmodule.com>
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
@ -21,6 +22,8 @@ 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\Application\Component\CurrencyComponent;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Controller\BaseController;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -39,14 +42,12 @@ class GeoIpComponent extends BaseController
private $_sModId = 'd3_geoip';
/**
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws ConnectionException
* @throws SystemComponentException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function init()
{
@ -70,11 +71,11 @@ class GeoIpComponent extends BaseController
// call component again, if curr is registered before we changed it
// reason: own component can added after default components only
if ($oLocation->hasNotSetCurrency($oBasket->getBasketCurrency())) {
/** @var oxUBase $oActView */
/** @var FrontendController $oActView */
$oActView = Registry::getConfig()->getActiveView();
$aComponents = $oActView->getComponents();
/** @var oxcmp_cur $oCurCmp */
/** @var CurrencyComponent $oCurCmp */
$oCurCmp = $aComponents['oxcmp_cur'];
$oCurCmp->init();
}

View File

@ -1,9 +1,5 @@
<?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.
@ -15,9 +11,14 @@ use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\GeoIp\Application\Controller\Admin;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
class d3_cfg_geoipset extends d3_cfg_mod_
{
/**

View File

@ -1,12 +1,5 @@
<?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.
@ -18,9 +11,23 @@ use OxidEsales\Eshop\Core\Registry;
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\GeoIp\Application\Controller\Admin;
use D3\GeoIp\Application\Model\d3geoip;
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Model\CountryList;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry;
class d3_cfg_geoipset_main extends d3_cfg_mod_main
{
protected $_sModId = 'd3_geoip';
@ -34,12 +41,12 @@ 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
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
*/
public function getIpCountry($sIP)
{

View File

@ -17,10 +17,15 @@
namespace D3\GeoIp\Application\Controller\Admin;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\Country;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Application\Model\ShopList;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use stdClass;
class d3_country_geoip extends AdminDetailsController
@ -29,9 +34,9 @@ class d3_country_geoip extends AdminDetailsController
protected $_sDefSortOrder = 'asc';
protected $_sThisTemplate = 'd3_country_geoip.tpl';
private $_sModId = 'd3_geoip';
/** @var oxcountry */
/** @var Country */
public $oCountry;
/** @var oxshoplist */
/** @var ShopList */
public $oShopList;
/**
@ -45,9 +50,9 @@ class d3_country_geoip extends AdminDetailsController
$ret = parent::render();
$soxId = Registry::get(Request::class)->getRequestParameter("oxid");
$soxId = Registry::getRequest()->getRequestEscapedParameter("oxid");
// check if we right now saved a new entry
$sSavedID = Registry::get(Request::class)->getRequestParameter("saved_oxid");
$sSavedID = Registry::getRequest()->getRequestEscapedParameter("saved_oxid");
if (($soxId == "-1" || !isset($soxId)) && isset($sSavedID)) {
$soxId = $sSavedID;
Registry::getSession()->deleteVariable("saved_oxid");
@ -58,8 +63,8 @@ class d3_country_geoip extends AdminDetailsController
if ($soxId != "-1" && isset($soxId)) {
// load object
/** @var $oCountry oxcountry */
$oCountry = oxNew("oxcountry");
/** @var $oCountry Country */
$oCountry = oxNew(Country::class);
$oCountry->loadInLang($this->_iEditLang, $soxId);
if ($oCountry->isForeignCountry()) {
@ -93,9 +98,9 @@ class d3_country_geoip extends AdminDetailsController
$this->addTplParam("blForeignCountry", true);
}
$this->oShopList = oxNew('oxshoplist');
/** @var $oShop oxshop */
$oShop = oxNew('oxshop');
$this->oShopList = oxNew(ShopList::class);
/** @var $oShop Shop */
$oShop = oxNew(Shop::class);
$sSelect = "SELECT * FROM ".$oShop->getViewName()." WHERE ".$oShop->getSqlActiveSnippet();
$this->oShopList->selectString($sSelect);
$this->getLangList();
@ -106,9 +111,9 @@ class d3_country_geoip extends AdminDetailsController
/**
* @param $sIdent
* @return mixed
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function getModCfgValue($sIdent)
{
@ -132,11 +137,11 @@ class d3_country_geoip extends AdminDetailsController
return;
}
$soxId = Registry::get(Request::class)->getRequestParameter("oxid");
$aParams = Registry::get(Request::class)->getRequestParameter("editval");
$soxId = Registry::getRequest()->getRequestEscapedParameter("oxid");
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
/** @var $oCountry oxcountry */
$oCountry = oxNew("oxcountry");
/** @var $oCountry Country */
$oCountry = oxNew(Country::class);
if ($soxId != "-1") {
$oCountry->loadInLang($this->_iEditLang, $soxId);
@ -159,7 +164,7 @@ class d3_country_geoip extends AdminDetailsController
}
/**
* @return oxshoplist
* @return ShopList
*/
public function getShopList()
{
@ -168,9 +173,9 @@ class d3_country_geoip extends AdminDetailsController
/**
* @return array
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function getCurList()
{
@ -204,9 +209,11 @@ class d3_country_geoip extends AdminDetailsController
if ($sCurrencies) {
foreach (unserialize($sCurrencies) as $sKey => $sValue) {
$aFields = explode('@', $sValue);
$aCurrencies[$sKey]->id = trim($sKey);
$aCurrencies[$sKey]->name = trim($aFields[0]);
$aCurrencies[$sKey]->sign = trim($aFields[4]);
$cur = new stdClass();
$cur->id = trim($sKey);
$cur->name = trim($aFields[0]);
$cur->sign = trim($aFields[4]);
$aCurrencies[$sKey] = $cur;
}
}
@ -216,9 +223,9 @@ class d3_country_geoip extends AdminDetailsController
/**
* ToDo: has to be refactored
* @return array
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function getLangList()
{

View File

@ -17,12 +17,19 @@
namespace D3\GeoIp\Application\Model;
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
use D3\ModCfg\Application\Model\d3str;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use D3\ModCfg\Application\Model\Log\d3log;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Model\Country;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Model\BaseModel;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
class d3geoip extends BaseModel
{
@ -45,13 +52,13 @@ class d3geoip extends BaseModel
*
* @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
* @return Country
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
*/
public function getUserLocationCountryObject($sIP = null)
{
@ -96,9 +103,9 @@ class d3geoip extends BaseModel
* 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
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function getIP()
{
@ -146,7 +153,7 @@ class d3geoip extends BaseModel
* @param int $sIP IP address
*
* @return string
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws DatabaseConnectionException
*/
public function loadByIP($sIP)
{
@ -184,7 +191,7 @@ class d3geoip extends BaseModel
* @param string $sISOAlpha
*
* @return Country
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws DatabaseConnectionException
*/
public function getCountryObject($sISOAlpha)
{
@ -206,10 +213,10 @@ class d3geoip extends BaseModel
/**
* 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
* @return Country
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function getCountryFallBackObject()
{
@ -220,7 +227,7 @@ class d3geoip extends BaseModel
if ($this->_getModConfig()->getValue('blUseFallback')
&& $this->_getModConfig()->getValue('sFallbackCountryId')
) {
$oCountry->Load($this->_getModConfig()->getValue('sFallbackCountryId'));
$oCountry->load($this->_getModConfig()->getValue('sFallbackCountryId'));
}
stopProfile(__METHOD__);
@ -231,14 +238,12 @@ class d3geoip extends BaseModel
/**
* 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
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function setCountryLanguage()
{
@ -280,14 +285,12 @@ class d3geoip extends BaseModel
/**
* 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
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function setCountryCurrency()
{
@ -322,14 +325,17 @@ class d3geoip extends BaseModel
stopProfile(__METHOD__);
}
/**
* @param $oCurr
*
* @return bool
* @throws d3_cfg_mod_exception
* @throws oxConnectionException
* @throws oxSystemComponentException
*/
/**
* @param $oCurr
*
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function hasNotSetCurrency($oCurr)
{
$oCountry = $this->getUserLocationCountryObject();
@ -345,14 +351,12 @@ class d3geoip extends BaseModel
/**
* 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
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function performShopSwitch()
{
@ -365,7 +369,7 @@ class d3geoip extends BaseModel
$oCountry = $this->getUserLocationCountryObject();
$iNewShop = $oCountry->getFieldData('d3geoipshop');
if (Registry::get(Request::class)->getRequestParameter('d3redirect') != 1
if (Registry::getRequest()->getRequestEscapedParameter('d3redirect') != 1
&& false == $this->isAdmin()
&& Registry::getUtils()->isSearchEngine() === false
&& $oCountry->getId()
@ -376,7 +380,7 @@ class d3geoip extends BaseModel
|| strtolower($this->getConfig()->getActiveView()->getClassKey()) == 'mallstart'
)
) {
$oNewConf = new oxConfig();
$oNewConf = new Config();
$oNewConf->setShopId($iNewShop);
$oNewConf->init();
@ -392,10 +396,10 @@ class d3geoip extends BaseModel
}
/** @var $oStr d3str */
$oStr = Registry::get('d3str');
$oStr = Registry::get(d3str::class);
$aParams = array(
'd3redirect' => '1',
'fnc' => Registry::get(Request::class)->getRequestParameter('fnc'),
'fnc' => Registry::getRequest()->getRequestEscapedParameter('fnc'),
'shp' => $iNewShop
);
$sUrl = str_replace(
@ -423,14 +427,12 @@ class d3geoip extends BaseModel
/**
* 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
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function performURLSwitch()
{
@ -470,9 +472,8 @@ class d3geoip extends BaseModel
/**
* get all shop urls
*
* @return array
* @throws oxSystemComponentException
*/
* @return array
*/
public function getShopUrls()
{
startProfile(__METHOD__);
@ -494,9 +495,9 @@ class d3geoip extends BaseModel
* get modcfg instance
*
* @return d3_cfg_mod
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
protected function _getModConfig()
{
@ -507,9 +508,9 @@ class d3geoip extends BaseModel
* get d3log instance
*
* @return d3log
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
protected function _getLog()
{

View File

@ -14,8 +14,16 @@
* @link http://www.oxidmodule.com
*/
/** */
class d3_oxcmp_cur_geoip_parent extends oxcmp_cur {}
namespace D3\GeoIp\Modules\Application\Component {
/** */
class d3_oxcmp_lang_geoip_parent extends oxcmp_lang {}
use OxidEsales\Eshop\Application\Component\LanguageComponent;
class d3_oxcmp_lang_geoip_parent extends LanguageComponent {}
}
namespace D3\GeoIp\Modules\Core {
use OxidEsales\Eshop\Core\ShopControl;
class d3_oxshopcontrol_geoip_parent extends ShopControl {}
}

View File

@ -1,21 +1,42 @@
<?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
*/
namespace D3\GeoIp\Modules\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\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
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
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
*/
public function init()
{

View File

@ -16,6 +16,7 @@
namespace D3\GeoIp\Modules\Core;
use D3\GeoIp\Application\Component\GeoIpComponent;
use OxidEsales\Eshop\Core\Registry;
class d3_oxshopcontrol_geoip extends d3_oxshopcontrol_geoip_parent
@ -41,8 +42,7 @@ class d3_oxshopcontrol_geoip extends d3_oxshopcontrol_geoip_parent
startProfile(__METHOD__);
$aUserComponentNames = Registry::getConfig()->getConfigParam('aUserComponentNames');
$sGeoIpCmpName = 'GeoIpComponent';
$sGeoIpCmpName = \D3\GeoIp\Application\Component\GeoIpComponent::class;
$sGeoIpCmpName = GeoIpComponent::class;
$blDontUseCache = 1;
if (false == is_array($aUserComponentNames)) {

49
src/Setup/Events.php Normal file
View File

@ -0,0 +1,49 @@
<?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 <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
// @codeCoverageIgnoreStart
namespace D3\GeoIp\Setup;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use D3\ModCfg\Application\Model\Install\d3install;
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
class Events
{
/**
* @throws d3ShopCompatibilityAdapterException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws SystemComponentException
*/
public static function onActivate()
{
d3install::checkUpdateStart();
}
public static function onDeactivate()
{
}
}
// @codeCoverageIgnoreEnd

View File

@ -1,5 +1,5 @@
<?php
/**
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
@ -9,8 +9,8 @@
*
* http://www.shopmodule.com
*
* @copyright © Data Development, Thomas Dartsch
* @author D³ Data Development - Daniel Seifert <ds@shopmodule.com>
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
@ -18,30 +18,31 @@ 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 Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\ConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException as DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Facts\Facts;
class d3geoip_update extends d3install_updatebase
{
public $sModKey = 'd3_geoip';
public $sModName = 'GeoIP';
public $sModVersion = '3.1.0.0';
public $sModRevision = '3100';
public $sBaseConf = '9qGv2==ZmhGbXhxSWUvZ25tSjFMV3J5aTExOTdhdWg2QkdrdHJBT09CajlXUzRDOGdMZ0YraEp1N0xPc
WkyOGhMZDBKMmwyUldaOXVrNDNjOWtMRW9BZEJ3VjY5NWQyMmZ3VG9qdHhRSVF4NXYvUGZqUmpxZm1Td
i9HbkxNZDRxVzNRRlZrRForU0RMSHVNR25hR1ROMkt0ZUM0SXpnKzBYUHJnc0Y1dDJYaDNIMEsrWE9uR
1FkbmJ4VUlMSGd1UEYxT0pPdGJhazQ4b1l6WDBBRElkM1dTWFM4VFg4S0didCs1aG1lNG9QYTh4YmVZe
XhDL3N0aXFncEhHWDJqNFFyQ0VDTFlkWUFVR20zU2RuZ05NUnREZythR2x1Z2VQOTYvbXNHZVVHMW9zN
UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
public $sModVersion = '4.0.0.0';
public $sModRevision = '4000';
public $sBaseConf = '3Ouv2==YmlyRktwdlovdEFuVDFsa2dPYmV6MGxYKzcrV3p1RVRBN1lIOUh5dnp1T2dCQmd4c0pJeVA1Z
WtrbnlIRC9Tc0Jud2N3VUFNbG1sVU15Yk9ZK2N1VVZWNHdmem9iV1AxeklXY1Bqa3k2UE5MVTN5NmVpR
m40TVBFQ3h2V3dsQmpXeVBXTTFQcm1VOGhiSFZxL0taUGgveWZXUlgwaVdrb2RyQ1V6Nk1wOXJsajVaM
UVoaHYwdml4N1IxVmp5QmZEUm8xS3VnQWxrTi9UeWtKRERlMjlwY29DTGd3bys3bkU1TXFOM3lXR3FOZ
1FyMkpCaFFBTXova2VkckIvQVlvdzVOeko5YWlpWUxXbHFjWFZKT2N1b0tSN016c3J2WEhqNnNPYTdpT
k11QjlHNmttejJjYkRxT0lNNWJ3aFRCMmY=';
public $sRequirements = '';
public $sBaseValue = '';
public $sMinModCfgVersion = '4.4.1.0';
public $sMinModCfgVersion = '5.3.1.0';
protected $_aUpdateMethods = array(
array('check' => 'checkGeoIpTableExist',
@ -66,7 +67,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
'do' => 'updateModCfgSameRevision'),
);
// Standardwerte für checkMultiLangTables() und fixRegisterMultiLangTables()
// default values for checkMultiLangTables() and fixRegisterMultiLangTables()
public $aMultiLangTables = array();
public $aFields = array(
@ -254,10 +255,12 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
return $blRet;
}
/**
* @return bool
* @throws oxSystemComponentException
*/
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function hasDeleteGeoIpTableFields()
{
/** @var d3installdbfield $oInstallDbField */
@ -265,10 +268,12 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
return $oInstallDbField->checkDeleteFields();
}
/**
* @return bool
* @throws oxSystemComponentException
*/
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function deleteGeoIpTableFields()
{
$blRet = false;
@ -281,10 +286,11 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
return $blRet;
}
/**
* @return bool true, if table has wrong engine
* @throws oxSystemComponentException
*/
/**
* @return bool true, if table has wrong engine
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function checkGeoIpTableEngine()
{
/** @var d3installdbtable $oDbTable */
@ -300,8 +306,8 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
/**
* @return bool
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function updateGeoIpTableEngine()
{
@ -335,14 +341,14 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
/**
* @return bool
* @throws \Doctrine\DBAL\DBALException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
*/
public function checkModCfgItemExist()
{
$blRet = false;
foreach ($this->getShopList() as $oShop) {
/** @var $oShop oxshop */
/** @var $oShop Shop */
$aWhere = array(
'oxmodid' => $this->sModKey,
'oxnewrevision' => $this->sModRevision,
@ -368,7 +374,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
if ($this->checkModCfgItemExist()) {
foreach ($this->getShopList() as $oShop) {
/** @var $oShop oxshop */
/** @var $oShop Shop */
$aWhere = array(
'oxmodid' => $this->sModKey,
'oxshopid' => $oShop->getId(),
@ -489,7 +495,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
*/
public function checkGeoIpFields()
{
/** @var $oShop oxshop */
/** @var $oShop Shop */
$oShop = $this->getShopList()->current();
$this->aFields['D3GEOIPSHOP']['sDefault'] = $oShop->getId();
@ -502,7 +508,7 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
*/
public function fixGeoIpFields()
{
/** @var $oShop oxshop */
/** @var $oShop Shop */
$oShop = $this->getShopList()->current();
$this->aFields['D3GEOIPSHOP']['sDefault'] = $oShop->getId();
@ -526,9 +532,11 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
}
/**
* @return bool
* @throws oxConnectionException
*/
* @return bool
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws ConnectionException
*/
public function checkRegisteredComponent()
{
/** @var $oShop Shop */
@ -545,16 +553,18 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
return false;
}
/**
* @return bool
* @throws oxConnectionException
*/
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function unregisterComponent()
{
$blRet = true;
$sVarName = 'aUserComponentNames';
/** @var $oShop oxshop */
/** @var $oShop Shop */
foreach ($this->getShopList() as $oShop) {
$aUserComponents = $this->_d3GetUserComponentsFromDb($oShop);
@ -576,8 +586,8 @@ UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
* @param Shop $oShop
*
* @return array|null
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
protected function _d3GetUserComponentsFromDb(Shop $oShop)
{

View File

@ -1,37 +0,0 @@
{
"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

@ -31,7 +31,7 @@ $aModule = array(
'en' => '',
),
'thumbnail' => 'picture.png',
'version' => '3.1.0.0',
'version' => '4.0.0.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
@ -65,5 +65,6 @@ $aModule = array(
'd3/geoip/IntelliSenseHelper.php',
'd3/geoip/metadata.php',
'd3/geoip/Application/views/admin/de/d3_geoip_lang.php',
'd3/geoip/Setup/Events.php'
),
);