8
0
Fork 0

make comptaible to OXID 6.12 dependencies

Dieser Commit ist enthalten in:
Daniel Seifert 2022-09-29 12:09:34 +02:00
Ursprung ad55da9184
Commit f30d2c13a6
Signiert von: DanielS
GPG-Schlüssel-ID: 8A7C4C6ED1915C6F
8 geänderte Dateien mit 92 neuen und 60 gelöschten Zeilen

Datei anzeigen

@ -23,7 +23,6 @@ use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException; use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Application\Component\CurrencyComponent; use OxidEsales\Eshop\Application\Component\CurrencyComponent;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Controller\BaseController; use OxidEsales\Eshop\Core\Controller\BaseController;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -61,17 +60,16 @@ class GeoIpComponent extends BaseController
/** @var $oLocation d3geoip */ /** @var $oLocation d3geoip */
$oLocation = oxNew(d3geoip::class); $oLocation = oxNew(d3geoip::class);
$oLocation->setCountryCurrency(); $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(); // $oLocation->setCountryLanguage();
if (!isset($oBasket)) { if (!isset($oBasket)) {
$oBasket = $this->getSession()->getBasket(); $oBasket = Registry::getSession()->getBasket();
} }
// call component again, if curr is registered before we changed it // call component again, if curr is registered before we changed it
// reason: own component can added after default components only // reason: own component can added after default components only
if ($oLocation->hasNotSetCurrency($oBasket->getBasketCurrency())) { if ($oLocation->hasNotSetCurrency($oBasket->getBasketCurrency())) {
/** @var FrontendController $oActView */
$oActView = Registry::getConfig()->getActiveView(); $oActView = Registry::getConfig()->getActiveView();
$aComponents = $oActView->getComponents(); $aComponents = $oActView->getComponents();

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -68,7 +68,7 @@ $aLang = [
'D3_GEOIP_UPDATE_ITEMINSTALL' => 'Die umfangreiche IP-Liste kann leider nicht über die '. '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. '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. '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 "setup+doku/geoip-data_*". '.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.', 'Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
]; ];

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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