make comptaible to OXID 6.12 dependencies

This commit is contained in:
Daniel Seifert 2022-09-29 12:09:34 +02:00
bovenliggende ad55da9184
commit f30d2c13a6
Getekend door: DanielS
GPG sleutel-ID: 8A7C4C6ED1915C6F
8 gewijzigde bestanden met toevoegingen van 92 en 60 verwijderingen

Bestand weergeven

@ -23,7 +23,6 @@ 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;
@ -61,17 +60,16 @@ class GeoIpComponent extends BaseController
/** @var $oLocation d3geoip */
$oLocation = oxNew(d3geoip::class);
$oLocation->setCountryCurrency();
// moved to oxcmp_lang extension because here it's to late
// moved to oxcmp_lang extension because here it's too late
// $oLocation->setCountryLanguage();
if (!isset($oBasket)) {
$oBasket = $this->getSession()->getBasket();
$oBasket = Registry::getSession()->getBasket();
}
// 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 FrontendController $oActView */
$oActView = Registry::getConfig()->getActiveView();
$aComponents = $oActView->getComponents();

Bestand weergeven

@ -41,6 +41,9 @@ class d3_country_geoip extends AdminDetailsController
/**
* @return string
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function render()
{
@ -245,7 +248,7 @@ class d3_country_geoip extends AdminDetailsController
if (is_array($aConfLanguages)) {
$i = 0;
reset($aConfLanguages);
while ((list($key, $val) = each($aConfLanguages))) {
foreach ($aConfLanguages as $key => $val) {
if (is_array($aLangParams)) {
//skipping non active languages
if (false == $aLangParams[$key]['active']) {

Bestand weergeven

@ -53,7 +53,7 @@ class d3geoip extends BaseModel
/**
* get oxcountry object by given IP address (optional)
*
* @param string $sIP optional
* @param string|null $sIP optional
*
* @return Country
* @throws d3ShopCompatibilityAdapterException
@ -63,7 +63,7 @@ class d3geoip extends BaseModel
* @throws DatabaseErrorException
* @throws StandardException
*/
public function getUserLocationCountryObject($sIP = null)
public function getUserLocationCountryObject(string $sIP = null)
{
if (!$this->oCountry) {
startProfile(__METHOD__);
@ -123,25 +123,15 @@ class d3geoip extends BaseModel
) {
$sIP = $this->_getModConfig()->getValue('sTestCountryIp');
} else {
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$sIP = $_SERVER['HTTP_CF_CONNECTING_IP'];
} else if (isset($_SERVER['HTTP_X_REAL_IP'])) {
$sIP = $_SERVER['HTTP_X_REAL_IP'];
} else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$sIP = $_SERVER['HTTP_CLIENT_IP'];
} else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$sIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if(isset($_SERVER['HTTP_X_FORWARDED'])) {
$sIP = $_SERVER['HTTP_X_FORWARDED'];
} else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$sIP = $_SERVER['HTTP_FORWARDED_FOR'];
} else if(isset($_SERVER['HTTP_FORWARDED'])) {
$sIP = $_SERVER['HTTP_FORWARDED'];
} else if(isset($_SERVER['REMOTE_ADDR'])) {
$sIP = $_SERVER['REMOTE_ADDR'];
} else {
$sIP = 'UNKNOWN';
}
$sIP = $_SERVER['HTTP_CF_CONNECTING_IP']
?? $_SERVER['HTTP_X_REAL_IP']
?? $_SERVER['HTTP_CLIENT_IP']
?? $_SERVER['HTTP_X_FORWARDED_FOR']
?? $_SERVER['HTTP_X_FORWARDED']
?? $_SERVER['HTTP_FORWARDED_FOR']
?? $_SERVER['HTTP_FORWARDED']
?? $_SERVER['REMOTE_ADDR']
?? 'UNKNOWN';
}
$sIP = str_replace(' ', '', $sIP);
@ -153,12 +143,12 @@ class d3geoip extends BaseModel
/**
* get ISO alpha 2 ID by IP address
*
* @param int $sIP IP address
* @param string $sIP IP address
*
* @return string
* @throws DatabaseConnectionException
*/
public function loadByIP($sIP)
public function loadByIP(string $sIP)
{
startProfile(__METHOD__);
@ -196,7 +186,7 @@ class d3geoip extends BaseModel
* @return Country
* @throws DatabaseConnectionException
*/
public function getCountryObject($sISOAlpha)
public function getCountryObject(string $sISOAlpha)
{
startProfile(__METHOD__);
@ -376,18 +366,18 @@ class d3geoip extends BaseModel
&& false == $this->isAdmin()
&& Registry::getUtils()->isSearchEngine() === false
&& $oCountry->getId()
&& $this->getConfig()->isMall()
&& Registry::getConfig()->isMall()
&& $iNewShop > -1 &&
(
$iNewShop != $this->getConfig()->getShopId()
|| strtolower($this->getConfig()->getActiveView()->getClassKey()) == 'mallstart'
$iNewShop != Registry::getConfig()->getShopId()
|| strtolower(Registry::getConfig()->getActiveView()->getClassKey()) == 'mallstart'
)
) {
$oNewConf = new Config();
$oNewConf->setShopId($iNewShop);
$oNewConf->init();
$this->getConfig()->onShopChange();
Registry::getConfig()->onShopChange();
if (!Registry::getSession()->getVariable('d3isSetLang')
&& $this->_getModConfig()->getValue('blChangeLang')
@ -502,7 +492,7 @@ class d3geoip extends BaseModel
$aShopUrls = array();
foreach ($oShoplist->arrayKeys() as $sId) {
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar('sMallShopURL', $sId);
$aShopUrls[$sId] = Registry::getConfig()->getShopConfVar('sMallShopURL', $sId);
}
stopProfile(__METHOD__);

Bestand weergeven

@ -68,7 +68,7 @@ $aLang = [
'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.
'Laden Sie bitte die aktuellen CSV-Daten des Anbieters Maxmind. In "docs/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 "docs/geoip-data_*". '.PHP_EOL.PHP_EOL.
'Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
];

Bestand weergeven

@ -30,7 +30,7 @@ function EditThis( sID)
function _groupExp(el) {
var _cur = el.parentNode;
if (_cur.className == "exp") _cur.className = "";
if (_cur.className === "exp") _cur.className = "";
else _cur.className = "exp";
}
@ -47,7 +47,7 @@ function showFormatSettings(sElemId, visible, blUseOldElem)
sOldSettingElem = sElemId;
}
if (visible == true) {
if (visible === true) {
document.getElementById(sElemId).style.display = 'block';
} else {
document.getElementById(sElemId).style.display = 'none';
@ -57,7 +57,7 @@ function showFormatSettings(sElemId, visible, blUseOldElem)
-->
</script>
<style type="text/css">
<style>
<!--
fieldset{
border: 1px inset black;
@ -104,9 +104,9 @@ td.edittext {
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="editval[d3_cfg_mod__oxid]" value="[{$oxid}]">
<table border="0" width="98%">
<table style="border: 0; width: 98%">
<tr>
<td valign="top" class="edittext">
<td style="vertical-align: top" class="edittext">
[{include file="d3_cfg_mod_active.tpl"}]
@ -224,9 +224,9 @@ td.edittext {
</div>
</div>
<table width="100%">
<table style="width: 100%">
<tr>
<td class="edittext ext_edittext" align="left">
<td class="edittext ext_edittext" style="text-align: left">
<span class="d3modcfg_btn icon status_ok">
<input type="submit" name="save" value="[{oxmultilang ident="D3_GENERAL_GEOIP_SAVE"}]">
<span></span>

Bestand weergeven

@ -22,16 +22,16 @@ use OxidEsales\Eshop\Core\Registry;
class d3_oxshopcontrol_geoip extends d3_oxshopcontrol_geoip_parent
{
/**
* @param null $sClass
* @param null $sFunction
* @param null $aParams
* @param null $aViewsChain
* @param null $controllerKey
* @param null $function
* @param null $parameters
* @param null $viewsChain
*/
public function start ($sClass = null, $sFunction = null, $aParams = null, $aViewsChain = null)
public function start ($controllerKey = null, $function = null, $parameters = null, $viewsChain = null)
{
$this->_d3AddGeoIpComponent();
parent::start($sClass, $sFunction, $aParams, $aViewsChain);
parent::start( $controllerKey, $function, $parameters, $viewsChain);
}
/**

Bestand weergeven

@ -16,16 +16,23 @@
namespace D3\GeoIp\Setup;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
use D3\ModCfg\Application\Model\Installwizzard\d3installdbfield;
use D3\ModCfg\Application\Model\Installwizzard\d3installdbtable;
use Doctrine\DBAL\DBALException;
use Exception;
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\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Facts\Facts;
use ReflectionException;
class d3geoip_update extends d3install_updatebase
{
@ -238,6 +245,9 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function checkGeoIpTableExist()
{
@ -246,12 +256,16 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function updateGeoIpTableExist()
{
$blRet = false;
if ($this->checkGeoIpTableExist()) {
$blRet = $this->_addTable2('d3geoip', $this->aFields, $this->aIndizes, 'GeoIP', 'InnoDB');
$blRet = $this->_addTable2('d3geoip', $this->aFields, $this->aIndizes, 'GeoIP');
}
return $blRet;
@ -315,12 +329,13 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
{
/** @var d3installdbtable $oDbTable */
$oDbTable = oxNew(d3installdbtable::class, $this);
$blRet = $oDbTable->changeTableEngine('d3geoip', 'InnoDB');
return $blRet;
return $oDbTable->changeTableEngine('d3geoip', 'InnoDB');
}
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
*/
public function checkGeoIpItems()
{
@ -328,9 +343,7 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
'D3ISO' => 'DE',
);
$blRet = $this->_checkTableItemNotExist('d3geoip', $aWhere);
return $blRet;
return $this->_checkTableItemNotExist('d3geoip', $aWhere);
}
/**
@ -369,6 +382,11 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws Exception
*/
public function updateModCfgItemExist()
{
@ -453,7 +471,7 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
),
array (
'fieldname' => 'OXSHOPVERSION',
'content' => Registry::getConfig()->getEdition(),
'content' => oxNew(Facts::class)->getEdition(),
'force_update' => true,
'use_quote' => true,
'use_multilang' => false,
@ -493,7 +511,12 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* change default value for shop id in EE
*
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function checkGeoIpFields()
{
@ -506,7 +529,12 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* change default value for shop id in EE
*
* @return bool
* @throws ConnectionException
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
public function fixGeoIpFields()
{
@ -519,6 +547,14 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws d3ParameterNotFoundException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
* @throws StandardException
* @throws ReflectionException
*/
public function hasUnregisteredFiles()
{
@ -527,6 +563,13 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
/**
* @return bool
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws ReflectionException
* @throws StandardException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
public function showUnregisteredFiles()
{
@ -602,10 +645,8 @@ XJ5U0QrUFZyUHFnNnNBdnZOa3ZRVUZVOWk=
" AND oxmodule = ".$oDb->quote($sModuleId);
$aResult = $oDb->getAll($sSelect);
$aUserComponents = is_array($aResult) && count($aResult)
return is_array($aResult) && count($aResult)
? Registry::getConfig()->decodeValue($aResult[0]['type'], $aResult[0]['value'])
: null;
return $aUserComponents;
}
}

Bestand weergeven

@ -33,7 +33,7 @@ $aModule = [
'version' => '4.0.4.2',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
'url' => 'https://www.oxidmodule.com/',
'extend' => [
LanguageComponent::class => d3_oxcmp_lang_geoip::class,
ShopControl::class => d3_oxshopcontrol_geoip::class