code syntax improved

This commit is contained in:
Daniel Seifert 2015-06-23 09:29:07 +00:00
parent 475405dbb8
commit 177b6ebce6
13 changed files with 287 additions and 287 deletions

2
.gitattributes vendored
View File

@ -1,12 +1,12 @@
* text=auto !eol
/Doxyfile -text
copy_this/.noencode -text
copy_this/modules/d3/d3geoip/IntelliSenseHelper.php -text
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php -text
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php -text
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php -text
copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php -text
copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php -text
copy_this/modules/d3/d3geoip/d3_geoip_stub.php -text
copy_this/modules/d3/d3geoip/menu.xml -text
copy_this/modules/d3/d3geoip/metadata.php -text
copy_this/modules/d3/d3geoip/models/d3geoip.php -text

View File

@ -18,7 +18,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
{
protected $_sModId = 'd3_geoip';
protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl";
protected $_blHasDebugSwitch = TRUE;
protected $_blHasDebugSwitch = true;
protected $_sDebugHelpTextIdent = 'D3_GEOIP_SET_DEBUG_DESC';
/**
@ -33,12 +33,9 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
$oD3GeoIP = oxNew('d3geoip');
$oCountry = $oD3GeoIP->getUserLocationCountryObject($sIP);
if ($oCountry->getId())
{
if ($oCountry->getId()) {
$sTitle = $oCountry->getFieldData('oxtitle');
}
else
{
} else {
$sTitle = oxRegistry::getLang()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET');
}
@ -79,7 +76,9 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
$oCountryList = oxNew('oxcountrylist');
$oListObject = $oCountryList->getBaseObject();
$sFieldList = $oListObject->getSelectFields();
$sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName()." WHERE D3ISO = " .$oListObject->getViewName(). ".oxisoalpha2 LIMIT 1) as IP, $sFieldList from " . $oListObject->getViewName();
$sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName().
" WHERE D3ISO = " .$oListObject->getViewName(). ".
oxisoalpha2 LIMIT 1) as IP, $sFieldList from " . $oListObject->getViewName();
$oCountryList->selectString($sQ);

View File

@ -31,9 +31,8 @@ class d3_country_geoip extends oxAdminView
*/
public function render()
{
if ( !oxRegistry::getConfig()->getConfigParam( 'blAllowSharedEdit' ) )
{
$this->addTplParam('readonly', TRUE);
if (false == oxRegistry::getConfig()->getConfigParam('blAllowSharedEdit')) {
$this->addTplParam('readonly', true);
}
$ret = parent::render();
@ -41,59 +40,49 @@ class d3_country_geoip extends oxAdminView
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
// check if we right now saved a new entry
$sSavedID = oxRegistry::getConfig()->getRequestParameter("saved_oxid");
if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) )
{
if (($soxId == "-1" || !isset($soxId)) && isset($sSavedID)) {
$soxId = $sSavedID;
oxRegistry::getSession()->deleteVariable("saved_oxid");
$this->addTplParam("oxid",$soxId);
$this->addTplParam("oxid", $soxId);
// for reloading upper frame
$this->addTplParam("updatelist", "1");
}
if ( $soxId != "-1" && isset( $soxId))
{
if ($soxId != "-1" && isset($soxId)) {
// load object
/** @var $oCountry oxcountry */
$oCountry = oxNew( "oxcountry" );
$oCountry->loadInLang( $this->_iEditLang, $soxId );
$oCountry = oxNew("oxcountry");
$oCountry->loadInLang($this->_iEditLang, $soxId);
if ($oCountry->isForeignCountry())
{
$this->addTplParam("blForeignCountry", TRUE);
}
else
{
$this->addTplParam("blForeignCountry", FALSE);
if ($oCountry->isForeignCountry()) {
$this->addTplParam("blForeignCountry", true);
} else {
$this->addTplParam("blForeignCountry", false);
}
$oOtherLang = $oCountry->getAvailableInLangs();
if (!isset($oOtherLang[$this->_iEditLang]))
{
$oCountry->loadInLang( key($oOtherLang), $soxId );
if (!isset($oOtherLang[$this->_iEditLang])) {
$oCountry->loadInLang(key($oOtherLang), $soxId);
}
$this->oCountry = $oCountry;
$this->addTplParam("edit", $oCountry);
// remove already created languages
$aLang = array_diff (oxRegistry::getLang()->getLanguageNames(), $oOtherLang );
$aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
if ( count( $aLang))
{
if (count($aLang)) {
$this->addTplParam("posslang", $aLang);
}
foreach ( $oOtherLang as $id => $language)
{
foreach ($oOtherLang as $id => $language) {
$oLang= new stdClass();
$oLang->sLangDesc = $language;
$oLang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $oLang;
}
}
else
{
$this->addTplParam("blForeignCountry", TRUE);
} else {
$this->addTplParam("blForeignCountry", true);
}
$this->oShopList = oxNew('oxshoplist');
@ -128,38 +117,33 @@ class d3_country_geoip extends oxAdminView
public function save()
{
//allow malladmin only to perform this action
if ( !oxRegistry::getConfig()->getConfigParam( 'blAllowSharedEdit' ) )
{
if (false == oxRegistry::getConfig()->getConfigParam('blAllowSharedEdit')) {
return;
}
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
$aParams = oxRegistry::getConfig()->getRequestParameter("editval" );
$aParams = oxRegistry::getConfig()->getRequestParameter("editval");
/** @var $oCountry oxcountry */
$oCountry = oxNew( "oxcountry" );
$oCountry = oxNew("oxcountry");
if ( $soxId != "-1")
{
$oCountry->loadInLang( $this->_iEditLang, $soxId );
}
else
{
$aParams['oxcountry__oxid'] = NULL;
if ($soxId != "-1") {
$oCountry->loadInLang($this->_iEditLang, $soxId);
} else {
$aParams['oxcountry__oxid'] = null;
}
$oCountry->setLanguage(0);
$oCountry->assign( $aParams );
$oCountry->assign($aParams);
$oCountry->setLanguage($this->_iEditLang);
$oCountry = oxRegistry::get('oxUtilsFile')->processFiles( $oCountry );
$oCountry = oxRegistry::get('oxUtilsFile')->processFiles($oCountry);
$oCountry->save();
$this->addTplParam("updatelist", "1");
// set oxid if inserted
if ( $soxId == "-1")
{
oxRegistry::getSession()->setVariable( "saved_oxid", $oCountry->getId());
if ($soxId == "-1") {
oxRegistry::getSession()->setVariable("saved_oxid", $oCountry->getId());
}
}
@ -178,23 +162,19 @@ class d3_country_geoip extends oxAdminView
{
$aCurrencies = array();
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop'))
{
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop')) {
$sShopId = $this->oCountry->getFieldData('d3geoipshop');
}
else
{
} else {
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
}
$sQ = "select DECODE( oxvarvalue, '".$this->getConfig()->getConfigParam( 'sConfigKey' )."') as oxvarvalue from oxconfig where oxshopid = '".$sShopId."' AND oxvarname = 'aCurrencies'";
$sQ = "select DECODE( oxvarvalue, '".oxRegistry::getConfig()->getConfigParam('sConfigKey').
"') as oxvarvalue from oxconfig where oxshopid = '".$sShopId."' AND oxvarname = 'aCurrencies'";
$sCurs = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getOne($sQ);
if ($sCurs)
{
foreach (unserialize($sCurs) as $sKey => $sValue)
{
if ($sCurs) {
foreach (unserialize($sCurs) as $sKey => $sValue) {
$aFields = explode('@', $sValue);
$aCurrencies[$sKey]->id = $sKey;
$aCurrencies[$sKey]->name = $aFields[0];
@ -211,12 +191,9 @@ class d3_country_geoip extends oxAdminView
*/
public function getLangList()
{
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop'))
{
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop')) {
$sShopId = $this->oCountry->getFieldData('d3geoipshop');
}
else
{
} else {
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
}
@ -224,60 +201,50 @@ class d3_country_geoip extends oxAdminView
$aLangParams = oxRegistry::getConfig()->getShopConfVar('aLanguageParams', $sShopId);
$aConfLanguages = oxRegistry::getConfig()->getShopConfVar('aLanguages', $sShopId);
if ( is_array( $aConfLanguages ) )
{
if (is_array($aConfLanguages)) {
$i = 0;
reset( $aConfLanguages );
while ( list( $key, $val ) = each( $aConfLanguages ) )
{
if (is_array($aLangParams) )
{
reset($aConfLanguages);
while ((list($key, $val) = each($aConfLanguages))) {
if (is_array($aLangParams)) {
//skipping non active languages
if ( !$aLangParams[$key]['active'] )
{
if (false == $aLangParams[$key]['active']) {
$i++;
continue;
continue;
}
}
if ( $val)
{
if ($val) {
$oLang = new stdClass();
if ( isset($aLangParams[$key]['baseId']) )
{
if (isset($aLangParams[$key]['baseId'])) {
$oLang->id = $aLangParams[$key]['baseId'];
}
else
{
} else {
$oLang->id = $i;
}
$oLang->oxid = $key;
$oLang->abbr = $key;
$oLang->name = $val;
if ( is_array($aLangParams) )
{
if (is_array($aLangParams)) {
$oLang->active = $aLangParams[$key]['active'];
$oLang->sort = $aLangParams[$key]['sort'];
}
if ( isset( $iLanguage ) && $oLang->id == $iLanguage )
{
if (isset($iLanguage) && $oLang->id == $iLanguage) {
$oLang->selected = 1;
}
else
{
} else {
$oLang->selected = 0;
}
if ($oLang->active)
if ($oLang->active) {
$aLanguages[$oLang->id] = $oLang;
}
}
++$i;
}
}
if (is_array($aLangParams) ) {
uasort( $aLanguages, array($this, '_sortLanguagesCallback') );
if (is_array($aLangParams)) {
uasort($aLanguages, array($this, '_sortLanguagesCallback'));
}
return $aLanguages;
@ -288,20 +255,16 @@ class d3_country_geoip extends oxAdminView
* @param $oLang2
* @return int
*/
protected function _sortLanguagesCallback( $oLang1, $oLang2 )
protected function _sortLanguagesCallback($oLang1, $oLang2)
{
$sSortParam = $this->_sDefSort;
$sVal1 = is_string($oLang1->$sSortParam) ? strtolower( $oLang1->$sSortParam ) : $oLang1->$sSortParam;
$sVal2 = is_string($oLang2->$sSortParam) ? strtolower( $oLang2->$sSortParam ) : $oLang2->$sSortParam;
$sVal1 = is_string($oLang1->$sSortParam) ? strtolower($oLang1->$sSortParam) : $oLang1->$sSortParam;
$sVal2 = is_string($oLang2->$sSortParam) ? strtolower($oLang2->$sSortParam) : $oLang2->$sSortParam;
if ( $this->_sDefSortOrder == 'asc' )
{
if ($this->_sDefSortOrder == 'asc') {
return ($sVal1 < $sVal2) ? -1 : 1;
}
else
{
} else {
return ($sVal1 > $sVal2) ? -1 : 1;
}
}
}

View File

@ -39,12 +39,10 @@ class d3GeoIP extends oxbase
*/
public function getUserLocationCountryObject($sIP = null)
{
if (!$this->oCountry)
{
if (!$this->oCountry) {
startProfile(__METHOD__);
if (!$sIP)
{
if (!$sIP) {
$sIP = $this->getIP();
}
@ -56,14 +54,25 @@ class d3GeoIP extends oxbase
$sISOAlpha = $this->loadByIPNum($iIPNum);
if (!$sISOAlpha)
{
$this->_getLog()->log(d3log::ERROR, __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
if (!$sISOAlpha) {
$this->_getLog()->log(
d3log::ERROR,
__CLASS__,
__FUNCTION__,
__LINE__,
'get ISO by IP failed',
$sIP
);
$this->oCountry = $this->getCountryFallBackObject();
}
else
{
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP', $sIP." => ".$sISOAlpha);
} else {
$this->_getLog()->log(
d3log::INFO,
__CLASS__,
__FUNCTION__,
__LINE__,
'get ISO by IP',
$sIP." => ".$sISOAlpha
);
$this->oCountry = $this->getCountryObject($sISOAlpha);
}
@ -82,16 +91,15 @@ class d3GeoIP extends oxbase
{
startProfile(__METHOD__);
if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp'))
{
if ($this->_getModConfig()->getValue('blUseTestIp')
&& $this->_getModConfig()->getValue('sTestIp')
) {
$sIP = $this->_getModConfig()->getValue('sTestIp');
}
elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp'))
{
} elseif ($this->_getModConfig()->getValue('blUseTestCountry')
&& $this->_getModConfig()->getValue('sTestCountryIp')
) {
$sIP = $this->_getModConfig()->getValue('sTestCountryIp');
}
else
{
} else {
// ToDo: use $_SERVER['X-Forwared-For'] && Client-IP in case of proxy
$sIP = $_SERVER['REMOTE_ADDR'];
}
@ -110,33 +118,30 @@ class d3GeoIP extends oxbase
protected function _getNumIp($sIP)
{
// make sure it is an ip
if (filter_var($sIP, FILTER_VALIDATE_IP) === FALSE)
return FALSE;
if (filter_var($sIP, FILTER_VALIDATE_IP) === false) {
return false;
}
startProfile(__METHOD__);
$parts = unpack('N*', inet_pton($sIP));
if (strpos($sIP, '.') !== FALSE)
{
if (strpos($sIP, '.') !== false) {
$parts = array(1=>0, 2=>0, 3=>0, 4=>$parts[1]);
}
foreach ($parts as &$part)
{
if ($part < 0)
foreach ($parts as &$part) {
if ($part < 0) {
$part += 4294967296;
}
}
if (function_exists('bcadd'))
{
if (function_exists('bcadd')) {
$dIP = $parts[4];
$dIP = bcadd($dIP, bcmul($parts[3], '4294967296'));
$dIP = bcadd($dIP, bcmul($parts[2], '18446744073709551616'));
$dIP = bcadd($dIP, bcmul($parts[1], '79228162514264337593543950336'));
}
else
{
} else {
throw new Exception('extension BCMath is required');
}
@ -153,7 +158,7 @@ class d3GeoIP extends oxbase
* @param int $iIPNum IP number
* @return string
*/
public function LoadByIPNum($iIPNum)
public function loadByIPNum($iIPNum)
{
startProfile(__METHOD__);
@ -176,7 +181,8 @@ class d3GeoIP extends oxbase
startProfile(__METHOD__);
$oCountry = oxNew('oxcountry');
$sSelect = "SELECT oxid FROM ".$oCountry->getViewName()." WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'";
$sSelect = "SELECT oxid FROM ".$oCountry->getViewName().
" WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'";
$oCountry->load(oxDb::getDb()->getOne($sSelect));
@ -196,8 +202,9 @@ class d3GeoIP extends oxbase
$oCountry = oxNew('oxcountry');
if ($this->_getModConfig()->getValue('blUseFallback') && $this->_getModConfig()->getValue('sFallbackCountryId'))
{
if ($this->_getModConfig()->getValue('blUseFallback')
&& $this->_getModConfig()->getValue('sFallbackCountryId')
) {
$oCountry->Load($this->_getModConfig()->getValue('sFallbackCountryId'));
}
@ -217,17 +224,27 @@ class d3GeoIP extends oxbase
$this->performURLSwitch();
$this->performShopSwitch();
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeLang'))
{
if (!$this->_getModConfig()->isActive()
|| false == $this->_getModConfig()->getValue('blChangeLang')) {
stopProfile(__METHOD__);
return;
}
$oCountry = $this->getUserLocationCountryObject();
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && oxRegistry::getSession()->getVariable('d3isSetLang') === null && $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1)
{
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'set language', $this->getIP().' => '.$oCountry->getFieldData('d3geoiplang'));
if (!$this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& oxRegistry::getSession()->getVariable('d3isSetLang') === null
&& $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1
) {
$this->_getLog()->log(
d3log::INFO,
__CLASS__,
__FUNCTION__,
__LINE__,
'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);
@ -242,16 +259,30 @@ class d3GeoIP extends oxbase
*/
public function setCountryCurrency()
{
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeCurr'))
if (!$this->_getModConfig()->isActive()
|| false == $this->_getModConfig()->getValue('blChangeCurr')
) {
return;
}
startProfile(__METHOD__);
$oCountry = $this->getUserLocationCountryObject();
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && !oxRegistry::getSession()->getVariable('d3isSetCurr') && $oCountry->getId() && $oCountry->getFieldData('d3geoipcur') > -1)
{
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'set currency', $this->getIP().' => '.$oCountry->getFieldData('d3geoipcur'));
if (!$this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& !oxRegistry::getSession()->getVariable('d3isSetCurr')
&& $oCountry->getId()
&& $oCountry->getFieldData('d3geoipcur') > -1
) {
$this->_getLog()->log(
d3log::INFO,
__CLASS__,
__FUNCTION__,
__LINE__,
'set currency',
$this->getIP().' => '.$oCountry->getFieldData('d3geoipcur')
);
oxRegistry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
oxRegistry::getSession()->setVariable('d3isSetCurr', true);
}
@ -265,40 +296,38 @@ class d3GeoIP extends oxbase
*/
public function performShopSwitch()
{
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop'))
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop')) {
return;
}
startProfile(__METHOD__);
$oCountry = $this->getUserLocationCountryObject();
$iNewShop = $oCountry->getFieldData('d3geoipshop');
if (oxRegistry::getConfig()->getRequestParameter('d3redirect') != 1 &&
!$this->isAdmin() &&
oxRegistry::getUtils()->isSearchEngine() === false &&
$oCountry->getId() &&
$this->getConfig()->isMall() &&
$iNewShop > -1 &&
if (oxRegistry::getConfig()->getRequestParameter('d3redirect') != 1
&& false == $this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& $oCountry->getId()
&& $this->getConfig()->isMall()
&& $iNewShop > -1 &&
(
$iNewShop != $this->getConfig()->getShopId() ||
strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
$iNewShop != $this->getConfig()->getShopId()
|| strtolower($this->getConfig()->getActiveView()->getClassName()) == 'mallstart'
)
)
{
) {
$oNewConf = new oxConfig();
$oNewConf->setShopId($iNewShop);
$oNewConf->init();
$this->getConfig()->onShopChange();
if (!oxRegistry::getSession()->getVariable('d3isSetLang') &&
$this->_getModConfig()->getValue('blChangeLang') &&
$oCountry->getFieldData('d3geoiplang') > -1)
{
if (!oxRegistry::getSession()->getVariable('d3isSetLang')
&& $this->_getModConfig()->getValue('blChangeLang')
&& $oCountry->getFieldData('d3geoiplang') > -1
) {
$sLangId = $oCountry->getFieldData('d3geoiplang');
}
else
{
} else {
$sLangId = '';
}
@ -309,9 +338,20 @@ class d3GeoIP extends oxbase
'fnc' => oxRegistry::getConfig()->getRequestParameter('fnc'),
'shp' => $iNewShop
);
$sUrl = str_replace('&amp;', '&', $oStr->generateParameterUrl($oNewConf->getShopHomeUrl($sLangId), $aParams));
$sUrl = str_replace(
'&amp;',
'&',
$oStr->generateParameterUrl($oNewConf->getShopHomeUrl($sLangId), $aParams)
);
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'change shop', $this->getIP().' => '.$sUrl);
$this->_getLog()->log(
d3log::INFO,
__CLASS__,
__FUNCTION__,
__LINE__,
'change shop',
$this->getIP().' => '.$sUrl
);
header("Location: ".$sUrl);
exit();
@ -326,8 +366,8 @@ class d3GeoIP extends oxbase
*/
public function performURLSwitch()
{
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeURL'))
{
if (!$this->_getModConfig()->isActive()
|| false == $this->_getModConfig()->getValue('blChangeURL')) {
return;
}
@ -335,16 +375,22 @@ class d3GeoIP extends oxbase
$oCountry = $this->getUserLocationCountryObject();
if (!$this->isAdmin() &&
oxRegistry::getUtils()->isSearchEngine() === false &&
$oCountry->getId() &&
$oCountry->getFieldData('d3geoipurl') &&
strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
)
{
if (false == $this->isAdmin()
&& oxRegistry::getUtils()->isSearchEngine() === false
&& $oCountry->getId()
&& $oCountry->getFieldData('d3geoipurl')
&& strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0
) {
$sNewUrl = $oCountry->getFieldData('d3geoipurl');
$this->_getLog()->log(d3log::INFO, __CLASS__, __FUNCTION__, __LINE__, 'change url', $this->getIP().' => '.$oCountry->getFieldData('d3geoipurl'));
$this->_getLog()->log(
d3log::INFO,
__CLASS__,
__FUNCTION__,
__LINE__,
'change url',
$this->getIP().' => '.$oCountry->getFieldData('d3geoipurl')
);
header("Location: ".$sNewUrl);
exit();
@ -362,12 +408,12 @@ class d3GeoIP extends oxbase
{
startProfile(__METHOD__);
$oShoplist = oxNew( 'oxshoplist' );
$oShoplist = oxNew('oxshoplist');
$oShoplist->getList();
$aShopUrls = array();
foreach ( $oShoplist as $sId => $oShop )
{
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar( 'sMallShopURL', $sId );
foreach (array_keys($oShoplist) as $sId) {
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar('sMallShopURL', $sId);
}
stopProfile(__METHOD__);
@ -392,9 +438,8 @@ class d3GeoIP extends oxbase
*/
protected function _getLog()
{
if (!$this->oD3Log)
{
$this->oD3Log = $this->_getModConfig()->getLog();
if (!$this->oD3Log) {
$this->oD3Log = $this->_getModConfig()->d3getLog();
}
return $this->oD3Log;

View File

@ -23,10 +23,8 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
*/
public function init()
{
if (d3_cfg_mod::get($this->_sModId)->isActive())
{
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode())
{
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
/** @var $oGeoIp d3geoip */
$oGeoIp = oxNew('d3geoip');
echo $oGeoIp->getIP();
@ -39,5 +37,4 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
return parent::init();
}
}

View File

@ -23,8 +23,7 @@ class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
*/
public function init()
{
if (d3_cfg_mod::get($this->_sModId)->isActive())
{
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
/** @var $oLocation d3geoip */
$oLocation = oxNew('d3geoip');
$oLocation->setCountryLanguage();

View File

@ -20,46 +20,44 @@ $iLangNr = 0;
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
'charset' => 'ISO-8859-15',
'd3mxgeoip' => 'GeoIP',
'd3mxgeoip_settings' => 'Einstellungen',
'd3tbclgeoip_settings_main' => 'Grundeinstellungen',
'tbclcountry_geoip' => 'GeoIP-Kundenumleitungen',
'charset' => 'ISO-8859-15',
'd3mxgeoip' => 'GeoIP',
'd3mxgeoip_settings' => 'Einstellungen',
'd3tbclgeoip_settings_main' => 'Grundeinstellungen',
'tbclcountry_geoip' => 'GeoIP-Kundenumleitungen',
'D3_GEOIP_TRANSL' => '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_SET_DEBUG_DESC' => 'Mit aktiviertem Debug-Modus wird im Frontend die aktuelle IP-Adresse des Shopbesuchers gezeigt. Beachten Sie, dass Umleitungen, die auf Weiterleitungen basieren, dann nicht ausgeführt werden können.',
'D3_GEOIP_SET_OPTIONS' => 'Optionen',
'D3_GEOIP_SET_OPTIONS_CHANGESHOP' => 'Mandant wechseln, wenn eingestellt (nur EE)',
'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
'D3_GEOIP_SET_OPTIONS_NOCOUNTRY' => 'Shop verwendet die Einstellung dieses Landes, wenn IP nicht zuzuordnen ist',
'D3_GEOIP_SET_IP' => 'IP-Einstellungen',
'D3_GEOIP_SET_IP_TESTIP' => 'statt Kunden-IP immer diese IP-Adresse verwenden',
'D3_GEOIP_SET_IP_TESTCOUNTRY' => 'statt Kunden-IP immer eine IP-Adresse dieses Landes verwenden',
'D3_GEOIP_SET_IP_TESTCOUNTRY_INACTIVE' => '(inaktiv)',
'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen',
'D3_GEOIP_SET_IP_CHECKIP_NOTSET' => 'IP nicht zugewiesen oder Land nicht aktiv',
'D3_GENERAL_GEOIP_SAVE' => 'Speichern',
'D3_GEOIP_SELSHOP' => 'zuständiger Shop',
'D3_GEOIP_SELLANG' => 'vorgewählte Sprache',
'D3_GEOIP_SELCUR' => 'vorgewählte Währung',
'D3_GEOIP_CUSTSELSHOP' => ' - vom Kunden gewählter Shop - ',
'D3_GEOIP_CUSTSELLANG' => ' - vom Kunden gewählte Sprache - ',
'D3_GEOIP_CUSTSELCUR' => ' - vom Kunden gewählte Währung - ',
'D3_GEOIP_OR' => 'oder',
'D3_GEOIP_DISABLED' => '(deaktiviert)',
'D3_GEOIP_SELURL' => 'zu wechselnde URL',
'D3_GEOIP_SELURL_DESC' => 'Sobald im URL-Feld eine Eingabe vorhanden ist, wird bei passenden Kunden versucht, zur hinterlegten URL zu wechseln. Möchten Sie den Mandanten, die Währung und / oder die Sprache einstellen, entfernen Sie die URL.<br><br>Aktivieren / deaktivieren Sie den URL-Wechsel zusätzlich in den Modul-Grundeinstellungen.',
'D3_GEOIP_SELSHOP' => 'zuständiger Shop',
'D3_GEOIP_SELLANG' => 'vorgewählte Sprache',
'D3_GEOIP_SELCUR' => 'vorgewählte Währung',
'D3_GEOIP_CUSTSELSHOP' => ' - vom Kunden gewählter Shop - ',
'D3_GEOIP_CUSTSELLANG' => ' - vom Kunden gewählte Sprache - ',
'D3_GEOIP_CUSTSELCUR' => ' - vom Kunden gewählte Währung - ',
'D3_GEOIP_OR' => 'oder',
'D3_GEOIP_DISABLED' => '(deaktiviert)',
'D3_GEOIP_SELURL' => 'zu wechselnde URL',
'D3_GEOIP_SELURL_DESC' => 'Sobald im URL-Feld eine Eingabe vorhanden ist, wird bei passenden Kunden versucht, zur hinterlegten URL zu wechseln. Möchten Sie den Mandanten, die Währung und / oder die Sprache einstellen, entfernen Sie die URL.<br><br>Aktivieren / deaktivieren Sie den URL-Wechsel zusätzlich in den Modul-Grundeinstellungen.',
'D3_GEOIP_METADATA_TITLE' => 'D³ GeoIP Vorauswahl',
'D3_GEOIP_METADATA_DESC' => 'Begrüßen Sie Ihre Kunden in seiner Landessprache.',
'D3_GEOIP_UPDATE_ITEMINSTALL' => 'Die umfangreiche IP-Liste kann leider nicht über die automatische Installation eingebunden werden. Bitte installieren Sie diese manuell. '.PHP_EOL.PHP_EOL.'Die erforderlichen Daten finden Sie im Installationspaket des Moduls unter "setup+doku/geoip-Data_IPv4_*.sql" ("setup+doku/geoip-Data_IPv6_*.sql" für IPv6-Adressen) oder als handlichere SQL-Dateien unter "setup+doku/geoip_data_parts/". '.PHP_EOL.PHP_EOL.'Sie benötigen entweder die Komplettdateien oder die Sammlung kleinerer Daten. Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
'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.'Die erforderlichen Daten finden Sie im Installationspaket des Moduls unter "setup+doku/geoip-Data_IPv4_*.sql" ("setup+doku/geoip-Data_IPv6_*.sql" für IPv6-Adressen) oder als handlichere SQL-Dateien unter "setup+doku/geoip_data_parts/". '.PHP_EOL.PHP_EOL.'Sie benötigen entweder die Komplettdateien oder die Sammlung kleinerer Daten. Führen Sie die SQL-Datei(en) bitte in Ihrer Datenbank aus.',
);
/*

View File

@ -2,9 +2,9 @@
<script type="text/javascript">
<!--
[{ if $updatelist == 1}]
UpdateList('[{ $oxid }]');
[{ /if}]
[{if $updatelist == 1}]
UpdateList('[{$oxid}]');
[{/if}]
function UpdateList( sID)
{
@ -47,11 +47,11 @@ function showFormatSettings(sElemId, visible, blUseOldElem)
sOldSettingElem = sElemId;
}
if (visible == true)
if (visible == true) {
document.getElementById(sElemId).style.display = 'block';
else
} else {
document.getElementById(sElemId).style.display = 'none';
}
}
-->
@ -110,26 +110,26 @@ td.edittext {
-->
</style>
[{ if $readonly}]
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
<form name="transfer" id="transfer" action="[{ $oViewConf->getSelfLink() }]" method="post">
[{ $oViewConf->getHiddenSid() }]
<input type="hidden" name="oxid" value="[{ $oxid }]">
<form name="transfer" id="transfer" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="actshop" value="[{ $shop->id }]">
<input type="hidden" name="editlanguage" value="[{ $editlanguage }]">
<input type="hidden" name="actshop" value="[{$shop->id}]">
<input type="hidden" name="editlanguage" value="[{$editlanguage}]">
</form>
<form name="myedit" id="myedit" action="[{ $oViewConf->getSelfLink() }]" method="post">
[{ $oViewConf->getHiddenSid() }]
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="save">
<input type="hidden" name="oxid" value="[{ $oxid }]">
<input type="hidden" name="editval[d3_cfg_mod__oxid]" value="[{ $oxid }]">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="editval[d3_cfg_mod__oxid]" value="[{$oxid}]">
<table border="0" width="98%">
<tr>
@ -151,7 +151,7 @@ td.edittext {
<dd>
<input type="hidden" name="value[blChangeShop]" value="0">
<input class="edittext ext_edittext" type="checkbox" name="value[blChangeShop]" value='1' [{if $edit->getValue('blChangeShop') == 1}]checked[{/if}]>
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGESHOP_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGESHOP_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -162,7 +162,7 @@ td.edittext {
<dd>
<input type="hidden" name="value[blChangeCurr]" value="0">
<input class="edittext ext_edittext" type="checkbox" name="value[blChangeCurr]" value='1' [{if $edit->getValue('blChangeCurr') == 1}]checked[{/if}]>
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGECURR_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGECURR_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -173,7 +173,7 @@ td.edittext {
<dd>
<input type="hidden" name="value[blChangeLang]" value="0">
<input class="edittext ext_edittext" type="checkbox" name="value[blChangeLang]" value='1' [{if $edit->getValue('blChangeLang') == 1}]checked[{/if}]>
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGELANG_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGELANG_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -184,7 +184,7 @@ td.edittext {
<dd>
<input type="hidden" name="value[blChangeURL]" value="0">
<input class="edittext ext_edittext" type="checkbox" name="value[blChangeURL]" value='1' [{if $edit->getValue('blChangeURL') == 1}]checked[{/if}]>
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGEURL_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_OPTIONS_CHANGEURL_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -200,7 +200,7 @@ td.edittext {
<option value="[{$oCountry->getId()}]" [{if $edit->getValue('sFallbackCountryId') == $oCountry->getId()}] selected[{/if}]>[{$oCountry->oxcountry__oxtitle->value}]</option>
[{/foreach}]
</select>
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_NOCOUNTRY_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_OPTIONS_NOCOUNTRY_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -222,7 +222,7 @@ td.edittext {
</dt>
<dd>
<input type="text" maxlength="39" size="17" name="value[sTestIp]" value="[{$edit->getValue('sTestIp')}]">
[{ oxinputhelp ident="D3_GEOIP_SET_IP_TESTIP_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_IP_TESTIP_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -238,7 +238,7 @@ td.edittext {
<option value="[{$oCountry->getFieldData('IP')}]" [{if $edit->getValue('sTestCountryIp') == $oCountry->getFieldData('IP')}] selected[{/if}]>[{$oCountry->getFieldData('oxtitle')}][{if !$oCountry->getFieldData('oxactive')}] [{oxmultilang ident="D3_GEOIP_SET_IP_TESTCOUNTRY_INACTIVE"}][{/if}]</option>
[{/foreach}]
</select>
[{ oxinputhelp ident="D3_GEOIP_SET_IP_TESTCOUNTRY_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_IP_TESTCOUNTRY_DESC"}]
</dd>
<div class="spacer"></div>
</dl>
@ -248,7 +248,7 @@ td.edittext {
</dt>
<dd>
<input type="text" maxlength="39" size="17" name="value[sCheckIp]" value="[{$edit->getValue('sCheckIp')}]">
[{ oxinputhelp ident="D3_GEOIP_SET_IP_CHECKIP_DESC" }]
[{oxinputhelp ident="D3_GEOIP_SET_IP_CHECKIP_DESC"}]
[{if $edit->getValue('sCheckIp')}]
[{$oView->getIpCountry($edit->getValue('sCheckIp'))}]
@ -259,12 +259,11 @@ td.edittext {
</div>
</div>
<table width="100%">
<tr>
<td class="edittext ext_edittext" align="left">
<td class="edittext ext_edittext" align="left">
<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"}]">
<div></div>
</span>
</td>

View File

@ -2,40 +2,40 @@
<script type="text/javascript">
<!--
window.onload = function ()
{
[{ if $updatelist == 1}]
top.oxid.admin.updateList('[{ $oxid }]');
[{ /if}]
var oField = top.oxid.admin.getLockTarget();
oField.onchange = oField.onkeyup = oField.onmouseout = top.oxid.admin.unlockSave;
}
window.onload = function ()
{
[{if $updatelist == 1}]
top.oxid.admin.updateList('[{$oxid}]');
[{/if}]
var oField = top.oxid.admin.getLockTarget();
oField.onchange = oField.onkeyup = oField.onmouseout = top.oxid.admin.unlockSave;
}
//-->
</script>
[{ if $readonly }]
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
<form name="transfer" id="transfer" action="[{ $oViewConf->getSelfLink() }]" method="post">
[{ $oViewConf->getHiddenSid() }]
<input type="hidden" name="oxid" value="[{ $oxid }]">
<input type="hidden" name="oxidCopy" value="[{ $oxid }]">
<form name="transfer" id="transfer" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="oxidCopy" value="[{$oxid}]">
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="language" value="[{ $actlang }]">
<input type="hidden" name="language" value="[{$actlang}]">
</form>
<form name="myedit" id="myedit" action="[{ $oViewConf->getSelfLink() }]" method="post">
[{ $oViewConf->getHiddenSid() }]
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="">
<input type="hidden" name="oxid" value="[{ $oxid }]">
<input type="hidden" name="voxid" value="[{ $oxid }]">
<input type="hidden" name="oxparentid" value="[{ $oxparentid }]">
<input type="hidden" name="editval[oxcountry__oxid]" value="[{ $oxid }]">
<input type="hidden" name="language" value="[{ $actlang }]">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="voxid" value="[{$oxid}]">
<input type="hidden" name="oxparentid" value="[{$oxparentid}]">
<input type="hidden" name="editval[oxcountry__oxid]" value="[{$oxid}]">
<input type="hidden" name="language" value="[{$actlang}]">
<table cellspacing="0" cellpadding="0" border="0" width="98%">
<tr>
@ -85,7 +85,7 @@ window.onload = function ()
<td class="edittext"><br><br>
</td>
<td class="edittext"><br><br>
<input type="submit" class="edittext" id="oLockButton" name="saveArticle" value="[{ oxmultilang ident="GENERAL_SAVE" }]" onClick="Javascript:document.myedit.fnc.value='save'"" [{ $readonly }] [{ if !$edit->oxcountry__oxtitle->value && !$oxparentid }]disabled[{/if}]><br>
<input type="submit" class="edittext" id="oLockButton" name="saveArticle" value="[{oxmultilang ident="GENERAL_SAVE"}]" onClick="Javascript:document.myedit.fnc.value='save'"" [{$readonly}] [{if !$edit->oxcountry__oxtitle->value && !$oxparentid}]disabled[{/if}]><br>
</td>
</tr>
</table>