basic implementation
This commit is contained in:
parent
d951ed09c7
commit
5106a4ec0b
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -15,11 +15,8 @@ copy_this/modules/d3/d3geoip/picture.png -text
|
|||||||
copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php -text
|
copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php -text
|
||||||
copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl -text
|
copy_this/modules/d3/d3geoip/views/admin/tpl/d3_cfg_geoipset_main.tpl -text
|
||||||
copy_this/modules/d3/d3geoip/views/admin/tpl/d3_country_geoip.tpl -text
|
copy_this/modules/d3/d3geoip/views/admin/tpl/d3_country_geoip.tpl -text
|
||||||
setup+doku/EE/install.sql -text
|
|
||||||
setup+doku/EE/update.sql -text
|
|
||||||
setup+doku/Installation.pdf -text
|
setup+doku/Installation.pdf -text
|
||||||
setup+doku/PE/install.sql -text
|
setup+doku/d3precheck.php -text
|
||||||
setup+doku/PE/update.sql -text
|
|
||||||
setup+doku/geoip-Data_2011-10-13.sql -text
|
setup+doku/geoip-Data_2011-10-13.sql -text
|
||||||
setup+doku/geoip-Struktur.sql -text
|
setup+doku/geoip-Struktur.sql -text
|
||||||
setup+doku/geoip_data_parts/1.sql -text
|
setup+doku/geoip_data_parts/1.sql -text
|
||||||
|
@ -1,66 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// @copyright © D³ Data Development
|
/**
|
||||||
//
|
* This Software is the property of Data Development and is protected
|
||||||
// This Software is the property of Data Development and is protected
|
* by copyright law - it is NOT Freeware.
|
||||||
// by copyright law - it is NOT Freeware.
|
*
|
||||||
//
|
* Any unauthorized use of this software without a valid license
|
||||||
// Any unauthorized use of this software without a valid license key
|
* is a violation of the license agreement and will be prosecuted by
|
||||||
// is a violation of the license agreement and will be prosecuted by
|
* civil and criminal law.
|
||||||
// civil and criminal law.
|
*
|
||||||
//
|
* http://www.shopmodule.com
|
||||||
// http://www.shopmodule.com
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
// AUTOR Daniel Seifert <ds@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||||
|
* @link http://www.oxidmodule.com
|
||||||
|
*/
|
||||||
class d3_cfg_geoipset_main extends d3_cfg_mod_main
|
class d3_cfg_geoipset_main extends d3_cfg_mod_main
|
||||||
{
|
{
|
||||||
protected $_sModId = 'd3_geoip';
|
protected $_sModId = 'd3_geoip';
|
||||||
|
|
||||||
protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl";
|
protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl";
|
||||||
|
protected $_blHasDebugSwitch = TRUE;
|
||||||
|
protected $_sDebugHelpTextIdent = 'D3_GEOIP_SET_DEBUG_DESC';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $sIP
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getIpCountry($sIP)
|
public function getIpCountry($sIP)
|
||||||
{
|
{
|
||||||
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
|
/** @var $oD3GeoIP d3geoip */
|
||||||
$oD3GeoIP = oxNew('d3geoip');
|
$oD3GeoIP = oxNew('d3geoip');
|
||||||
$oCountry = $oD3GeoIP->getUserLocationCountryObject($sIP);
|
$oCountry = $oD3GeoIP->getUserLocationCountryObject($sIP);
|
||||||
|
|
||||||
if ($oCountry->getId())
|
if ($oCountry->getId())
|
||||||
|
{
|
||||||
$sTitle = $oCountry->getFieldData('oxtitle');
|
$sTitle = $oCountry->getFieldData('oxtitle');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$sTitle = oxLang::getInstance()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET');
|
{
|
||||||
|
$sTitle = oxRegistry::getLang()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET');
|
||||||
|
}
|
||||||
|
|
||||||
|
stopProfile(__METHOD__);
|
||||||
|
|
||||||
return $sTitle;
|
return $sTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return oxcountrylist
|
||||||
|
*/
|
||||||
public function getCountryList()
|
public function getCountryList()
|
||||||
{
|
{
|
||||||
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
|
/** @var $oCountryList oxcountrylist */
|
||||||
$oCountryList = oxNew('oxcountrylist');
|
$oCountryList = oxNew('oxcountrylist');
|
||||||
if ($oCountryList->getBaseObject()->isMultilang())
|
|
||||||
{
|
|
||||||
$oCountryList->getBaseObject()->setLanguage(oxLang::getInstance()->getTplLanguage());
|
|
||||||
}
|
|
||||||
$oListObject = $oCountryList->getBaseObject();
|
$oListObject = $oCountryList->getBaseObject();
|
||||||
$sFieldList = $oListObject->getSelectFields();
|
$sFieldList = $oListObject->getSelectFields();
|
||||||
$sQ = "select $sFieldList from " . $oListObject->getViewName();
|
$sQ = "select $sFieldList from " . $oListObject->getViewName();
|
||||||
$oCountryList->selectString($sQ);
|
$oCountryList->selectString($sQ);
|
||||||
|
|
||||||
|
stopProfile(__METHOD__);
|
||||||
|
|
||||||
return $oCountryList;
|
return $oCountryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return oxcountrylist
|
||||||
|
*/
|
||||||
public function getIPCountryList()
|
public function getIPCountryList()
|
||||||
{
|
{
|
||||||
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
|
/** @var $oGeoIp d3geoip */
|
||||||
$oGeoIp = oxNew('d3geoip');
|
$oGeoIp = oxNew('d3geoip');
|
||||||
|
/** @var $oCountryList oxcountrylist */
|
||||||
$oCountryList = oxNew('oxcountrylist');
|
$oCountryList = oxNew('oxcountrylist');
|
||||||
if ($oCountryList->getBaseObject()->isMultilang())
|
|
||||||
{
|
|
||||||
$oCountryList->getBaseObject()->setLanguage(oxLang::getInstance()->getTplLanguage());
|
|
||||||
}
|
|
||||||
$oListObject = $oCountryList->getBaseObject();
|
$oListObject = $oCountryList->getBaseObject();
|
||||||
$sFieldList = $oListObject->getSelectFields();
|
$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);
|
$oCountryList->selectString($sQ);
|
||||||
|
|
||||||
|
stopProfile(__METHOD__);
|
||||||
|
|
||||||
return $oCountryList;
|
return $oCountryList;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,85 +1,118 @@
|
|||||||
<?php
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
class d3_country_geoip extends oxAdminView
|
class d3_country_geoip extends oxAdminView
|
||||||
{
|
{
|
||||||
protected $_sDefSort = 'sort';
|
protected $_sDefSort = 'sort';
|
||||||
|
protected $_sDefSortOrder = 'asc';
|
||||||
protected $_sThisTemplate = 'd3_country_geoip.tpl';
|
protected $_sThisTemplate = 'd3_country_geoip.tpl';
|
||||||
|
|
||||||
private $_oSet;
|
|
||||||
|
|
||||||
private $_sModId = 'd3_geoip';
|
private $_sModId = 'd3_geoip';
|
||||||
|
/** @var oxcountry */
|
||||||
|
public $oCountry;
|
||||||
|
/** @var oxshoplist */
|
||||||
|
public $oShopList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$this->_oSet = d3_cfg_mod::get($this->_sModId);
|
if ( !oxRegistry::getConfig()->getConfigParam( 'blAllowSharedEdit' ) )
|
||||||
|
{
|
||||||
$myConfig = $this->getConfig();
|
$this->addTplParam('readonly', TRUE);
|
||||||
|
}
|
||||||
if ( !$myConfig->getConfigParam( 'blAllowSharedEdit' ) )
|
|
||||||
$this->_aViewData['readonly'] = true;
|
|
||||||
|
|
||||||
$ret = parent::render();
|
$ret = parent::render();
|
||||||
|
|
||||||
$soxId = oxConfig::getParameter( "oxid");
|
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
|
||||||
// check if we right now saved a new entry
|
// check if we right now saved a new entry
|
||||||
$sSavedID = oxConfig::getParameter( "saved_oxid");
|
$sSavedID = oxRegistry::getConfig()->getRequestParameter("saved_oxid");
|
||||||
if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
|
if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) )
|
||||||
|
{
|
||||||
$soxId = $sSavedID;
|
$soxId = $sSavedID;
|
||||||
oxSession::deleteVar( "saved_oxid");
|
oxRegistry::getSession()->deleteVariable("saved_oxid");
|
||||||
$this->_aViewData["oxid"] = $soxId;
|
$this->addTplParam("oxid",$soxId);
|
||||||
// for reloading upper frame
|
// for reloading upper frame
|
||||||
$this->_aViewData["updatelist"] = "1";
|
$this->addTplParam("updatelist", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $soxId != "-1" && isset( $soxId)) {
|
if ( $soxId != "-1" && isset( $soxId))
|
||||||
|
{
|
||||||
// load object
|
// load object
|
||||||
|
/** @var $oCountry oxcountry */
|
||||||
$oCountry = oxNew( "oxcountry" );
|
$oCountry = oxNew( "oxcountry" );
|
||||||
$oCountry->loadInLang( $this->_iEditLang, $soxId );
|
$oCountry->loadInLang( $this->_iEditLang, $soxId );
|
||||||
|
|
||||||
if ($oCountry->isForeignCountry()) {
|
if ($oCountry->isForeignCountry())
|
||||||
$this->_aViewData["blForeignCountry"] = true;
|
{
|
||||||
} else {
|
$this->addTplParam("blForeignCountry", TRUE);
|
||||||
$this->_aViewData["blForeignCountry"] = false;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->addTplParam("blForeignCountry", FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oOtherLang = $oCountry->getAvailableInLangs();
|
$oOtherLang = $oCountry->getAvailableInLangs();
|
||||||
if (!isset($oOtherLang[$this->_iEditLang])) {
|
if (!isset($oOtherLang[$this->_iEditLang]))
|
||||||
// echo "language entry doesn't exist! using: ".key($oOtherLang);
|
{
|
||||||
$oCountry->loadInLang( key($oOtherLang), $soxId );
|
$oCountry->loadInLang( key($oOtherLang), $soxId );
|
||||||
}
|
}
|
||||||
$this->_aViewData["edit"] = $this->oCountry = $oCountry;
|
|
||||||
|
$this->oCountry = $oCountry;
|
||||||
|
$this->addTplParam("edit", $oCountry);
|
||||||
|
|
||||||
// remove already created languages
|
// remove already created languages
|
||||||
$aLang = array_diff (oxLang::getInstance()->getLanguageNames(), $oOtherLang );
|
$aLang = array_diff (oxRegistry::getLang()->getLanguageNames(), $oOtherLang );
|
||||||
if ( count( $aLang))
|
|
||||||
$this->_aViewData["posslang"] = $aLang;
|
|
||||||
|
|
||||||
foreach ( $oOtherLang as $id => $language) {
|
if ( count( $aLang))
|
||||||
$oLang= new oxStdClass();
|
{
|
||||||
|
$this->addTplParam("posslang", $aLang);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $oOtherLang as $id => $language)
|
||||||
|
{
|
||||||
|
$oLang= new stdClass();
|
||||||
$oLang->sLangDesc = $language;
|
$oLang->sLangDesc = $language;
|
||||||
$oLang->selected = ($id == $this->_iEditLang);
|
$oLang->selected = ($id == $this->_iEditLang);
|
||||||
$this->_aViewData["otherlang"][$id] = clone $oLang;
|
$this->_aViewData["otherlang"][$id] = clone $oLang;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
$this->_aViewData["blForeignCountry"] = true;
|
else
|
||||||
|
{
|
||||||
|
$this->addTplParam("blForeignCountry", TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->oShopList = &oxNew('oxshoplist');
|
$this->oShopList = oxNew('oxshoplist');
|
||||||
$oShop = &oxNew('oxshop');
|
/** @var $oShop oxshop */
|
||||||
|
$oShop = oxNew('oxshop');
|
||||||
$sSelect = "SELECT * FROM ".$oShop->getViewName()." WHERE ".$oShop->getSqlActiveSnippet();
|
$sSelect = "SELECT * FROM ".$oShop->getViewName()." WHERE ".$oShop->getSqlActiveSnippet();
|
||||||
|
|
||||||
$this->oShopList->selectString($sSelect);
|
$this->oShopList->selectString($sSelect);
|
||||||
|
|
||||||
$this->getLangList();
|
$this->getLangList();
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $sIdent
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getModCfgValue($sIdent)
|
public function getModCfgValue($sIdent)
|
||||||
{
|
{
|
||||||
$this->_oSet = d3_cfg_mod::get($this->_sModId);
|
return d3_cfg_mod::get($this->_sModId)->getValue($sIdent);
|
||||||
return $this->_oSet->getValue($sIdent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveshop()
|
public function saveshop()
|
||||||
@ -94,42 +127,53 @@ class d3_country_geoip extends oxAdminView
|
|||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$myConfig = $this->getConfig();
|
|
||||||
|
|
||||||
//allow malladmin only to perform this action
|
//allow malladmin only to perform this action
|
||||||
if ( !$myConfig->getConfigParam( 'blAllowSharedEdit' ) )
|
if ( !oxRegistry::getConfig()->getConfigParam( 'blAllowSharedEdit' ) )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$soxId = oxConfig::getParameter( "oxid");
|
|
||||||
$aParams = oxConfig::getParameter( "editval" );
|
|
||||||
|
|
||||||
$oCountry = oxNew( "oxcountry" );
|
|
||||||
|
|
||||||
if ( $soxId != "-1") {
|
|
||||||
$oCountry->loadInLang( $this->_iEditLang, $soxId );
|
|
||||||
} else {
|
|
||||||
$aParams['oxcountry__oxid'] = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$aParams = $oCountry->ConvertNameArray2Idx( $aParams);
|
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
|
||||||
|
$aParams = oxRegistry::getConfig()->getRequestParameter("editval" );
|
||||||
|
|
||||||
|
/** @var $oCountry oxcountry */
|
||||||
|
$oCountry = oxNew( "oxcountry" );
|
||||||
|
|
||||||
|
if ( $soxId != "-1")
|
||||||
|
{
|
||||||
|
$oCountry->loadInLang( $this->_iEditLang, $soxId );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$aParams['oxcountry__oxid'] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
$oCountry->setLanguage(0);
|
$oCountry->setLanguage(0);
|
||||||
$oCountry->assign( $aParams );
|
$oCountry->assign( $aParams );
|
||||||
$oCountry->setLanguage($this->_iEditLang);
|
$oCountry->setLanguage($this->_iEditLang);
|
||||||
$oCountry = oxUtilsFile::getInstance()->processFiles( $oCountry );
|
$oCountry = oxRegistry::get('oxUtilsFile')->processFiles( $oCountry );
|
||||||
|
|
||||||
$oCountry->save();
|
$oCountry->save();
|
||||||
$this->_aViewData["updatelist"] = "1";
|
$this->addTplParam("updatelist", "1");
|
||||||
|
|
||||||
// set oxid if inserted
|
// set oxid if inserted
|
||||||
if ( $soxId == "-1")
|
if ( $soxId == "-1")
|
||||||
oxSession::setVar( "saved_oxid", $oCountry->oxcountry__oxid->value);
|
{
|
||||||
|
oxRegistry::getSession()->setVariable( "saved_oxid", $oCountry->getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return oxshoplist
|
||||||
|
*/
|
||||||
public function getShopList()
|
public function getShopList()
|
||||||
{
|
{
|
||||||
return $this->oShopList;
|
return $this->oShopList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getCurList()
|
public function getCurList()
|
||||||
{
|
{
|
||||||
$aCurrencies = array();
|
$aCurrencies = array();
|
||||||
@ -140,12 +184,13 @@ class d3_country_geoip extends oxAdminView
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sShopId = $this->getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
|
$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, '".$this->getConfig()->getConfigParam( 'sConfigKey' )."') as oxvarvalue from oxconfig where oxshopid = '".$sShopId."' AND oxvarname = 'aCurrencies'";
|
||||||
|
|
||||||
$sCurs = oxDb::getDb(2)->getOne($sQ);
|
$sCurs = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getOne($sQ);
|
||||||
|
|
||||||
foreach (unserialize($sCurs) as $sKey => $sValue)
|
foreach (unserialize($sCurs) as $sKey => $sValue)
|
||||||
{
|
{
|
||||||
$aFields = explode('@', $sValue);
|
$aFields = explode('@', $sValue);
|
||||||
@ -157,6 +202,10 @@ class d3_country_geoip extends oxAdminView
|
|||||||
return $aCurrencies;
|
return $aCurrencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ToDo: has to be refactored
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getLangList()
|
public function getLangList()
|
||||||
{
|
{
|
||||||
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop'))
|
if ($this->getModCfgValue('blChangeShop') && $this->oCountry->getFieldData('d3geoipshop'))
|
||||||
@ -165,45 +214,56 @@ class d3_country_geoip extends oxAdminView
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sShopId = $this->getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
|
$sShopId = oxRegistry::getConfig()->getActiveView()->getViewConfig()->getActiveShopId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$aLanguages = array();
|
$aLanguages = array();
|
||||||
$aLangParams = $this->getConfig()->getShopConfVar('aLanguageParams', $sShopId);
|
$aLangParams = oxRegistry::getConfig()->getShopConfVar('aLanguageParams', $sShopId);
|
||||||
$aConfLanguages = $this->getConfig()->getShopConfVar('aLanguages', $sShopId);
|
$aConfLanguages = oxRegistry::getConfig()->getShopConfVar('aLanguages', $sShopId);
|
||||||
|
|
||||||
if ( is_array( $aConfLanguages ) ) {
|
if ( is_array( $aConfLanguages ) )
|
||||||
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
reset( $aConfLanguages );
|
reset( $aConfLanguages );
|
||||||
while ( list( $key, $val ) = each( $aConfLanguages ) ) {
|
while ( list( $key, $val ) = each( $aConfLanguages ) )
|
||||||
|
{
|
||||||
if ( $blOnlyActive && is_array($aLangParams) ) {
|
if (is_array($aLangParams) )
|
||||||
|
{
|
||||||
//skipping non active languages
|
//skipping non active languages
|
||||||
if ( !$aLangParams[$key]['active'] ) {
|
if ( !$aLangParams[$key]['active'] )
|
||||||
|
{
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $val) {
|
if ( $val)
|
||||||
$oLang = new oxStdClass();
|
{
|
||||||
if ( isset($aLangParams[$key]['baseId']) ) {
|
$oLang = new stdClass();
|
||||||
|
if ( isset($aLangParams[$key]['baseId']) )
|
||||||
|
{
|
||||||
$oLang->id = $aLangParams[$key]['baseId'];
|
$oLang->id = $aLangParams[$key]['baseId'];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$oLang->id = $i;
|
$oLang->id = $i;
|
||||||
}
|
}
|
||||||
$oLang->oxid = $key;
|
$oLang->oxid = $key;
|
||||||
$oLang->abbr = $key;
|
$oLang->abbr = $key;
|
||||||
$oLang->name = $val;
|
$oLang->name = $val;
|
||||||
|
|
||||||
if ( is_array($aLangParams) ) {
|
if ( is_array($aLangParams) )
|
||||||
|
{
|
||||||
$oLang->active = $aLangParams[$key]['active'];
|
$oLang->active = $aLangParams[$key]['active'];
|
||||||
$oLang->sort = $aLangParams[$key]['sort'];
|
$oLang->sort = $aLangParams[$key]['sort'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $iLanguage ) && $oLang->id == $iLanguage ) {
|
if ( isset( $iLanguage ) && $oLang->id == $iLanguage )
|
||||||
|
{
|
||||||
$oLang->selected = 1;
|
$oLang->selected = 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$oLang->selected = 0;
|
$oLang->selected = 0;
|
||||||
}
|
}
|
||||||
if ($oLang->active)
|
if ($oLang->active)
|
||||||
@ -213,22 +273,30 @@ class d3_country_geoip extends oxAdminView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $blSort && is_array($aLangParams) ) {
|
if (is_array($aLangParams) ) {
|
||||||
uasort( $aLanguages, array($this, '_sortLanguagesCallback') );
|
uasort( $aLanguages, array($this, '_sortLanguagesCallback') );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $aLanguages;
|
return $aLanguages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $oLang1
|
||||||
|
* @param $oLang2
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function _sortLanguagesCallback( $oLang1, $oLang2 )
|
protected function _sortLanguagesCallback( $oLang1, $oLang2 )
|
||||||
{
|
{
|
||||||
$sSortParam = $this->_sDefSort;
|
$sSortParam = $this->_sDefSort;
|
||||||
$sVal1 = is_string($oLang1->$sSortParam) ? strtolower( $oLang1->$sSortParam ) : $oLang1->$sSortParam;
|
$sVal1 = is_string($oLang1->$sSortParam) ? strtolower( $oLang1->$sSortParam ) : $oLang1->$sSortParam;
|
||||||
$sVal2 = is_string($oLang2->$sSortParam) ? strtolower( $oLang2->$sSortParam ) : $oLang2->$sSortParam;
|
$sVal2 = is_string($oLang2->$sSortParam) ? strtolower( $oLang2->$sSortParam ) : $oLang2->$sSortParam;
|
||||||
|
|
||||||
if ( $this->_sDefSortOrder == 'asc' ) {
|
if ( $this->_sDefSortOrder == 'asc' )
|
||||||
|
{
|
||||||
return ($sVal1 < $sVal2) ? -1 : 1;
|
return ($sVal1 < $sVal2) ? -1 : 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return ($sVal1 > $sVal2) ? -1 : 1;
|
return ($sVal1 > $sVal2) ? -1 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// @copyright © D³ Data Development
|
/**
|
||||||
//
|
* This Software is the property of Data Development and is protected
|
||||||
// This Software is the property of Data Development and is protected
|
* by copyright law - it is NOT Freeware.
|
||||||
// by copyright law - it is NOT Freeware.
|
*
|
||||||
//
|
* Any unauthorized use of this software without a valid license
|
||||||
// Any unauthorized use of this software without a valid license key
|
* is a violation of the license agreement and will be prosecuted by
|
||||||
// is a violation of the license agreement and will be prosecuted by
|
* civil and criminal law.
|
||||||
// civil and criminal law.
|
*
|
||||||
//
|
* http://www.shopmodule.com
|
||||||
// http://www.shopmodule.com
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
// AUTOR Daniel Seifert <ds@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||||
|
* @link http://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
class d3GeoIP extends oxI18n
|
class d3GeoIP extends oxI18n
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Current class name
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $_sClassName = 'd3geoip';
|
protected $_sClassName = 'd3geoip';
|
||||||
|
|
||||||
/**
|
|
||||||
* ModCfg ID
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_sModId = 'd3_geoip';
|
private $_sModId = 'd3_geoip';
|
||||||
|
public $oCountry;
|
||||||
|
public $oD3Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor, initiates parent constructor (parent::oxI18n()).
|
* Class constructor, initiates parent constructor (parent::oxI18n()).
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -44,26 +35,28 @@ class d3GeoIP extends oxI18n
|
|||||||
* get oxcountry object by given IP address (optional)
|
* get oxcountry object by given IP address (optional)
|
||||||
*
|
*
|
||||||
* @param string $sIP optional
|
* @param string $sIP optional
|
||||||
* @return object
|
* @return oxcountry
|
||||||
*/
|
*/
|
||||||
public function getUserLocationCountryObject($sIP = false)
|
public function getUserLocationCountryObject($sIP = null)
|
||||||
{
|
{
|
||||||
if (!$this->oCountry)
|
if (!$this->oCountry)
|
||||||
{
|
{
|
||||||
if (!$sIP)
|
if (!$sIP)
|
||||||
|
{
|
||||||
$sIP = $this->getIP();
|
$sIP = $this->getIP();
|
||||||
|
}
|
||||||
|
|
||||||
$iIPNum = $this->_getNumIp($sIP);
|
$iIPNum = $this->_getNumIp($sIP);
|
||||||
$sISOAlpha = $this->LoadByIPNum($iIPNum);
|
$sISOAlpha = $this->LoadByIPNum($iIPNum);
|
||||||
|
|
||||||
if (!$sISOAlpha)
|
if (!$sISOAlpha)
|
||||||
{
|
{
|
||||||
$this->_getLog()->setLog('error', __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
|
$this->_getLog()->log('error', __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
|
||||||
$this->oCountry = $this->getCountryFallBackObject();
|
$this->oCountry = $this->getCountryFallBackObject();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->_getLog()->setLog('info', __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP', $sIP." => ".$sISOAlpha);
|
$this->_getLog()->log('info', __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP', $sIP." => ".$sISOAlpha);
|
||||||
$this->oCountry = $this->getCountryObject($sISOAlpha);
|
$this->oCountry = $this->getCountryObject($sISOAlpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,12 +72,18 @@ class d3GeoIP extends oxI18n
|
|||||||
public function getIP()
|
public function getIP()
|
||||||
{
|
{
|
||||||
if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp'))
|
if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp'))
|
||||||
|
{
|
||||||
return $this->_getModConfig()->getValue('sTestIp');
|
return $this->_getModConfig()->getValue('sTestIp');
|
||||||
|
}
|
||||||
elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp'))
|
elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp'))
|
||||||
|
{
|
||||||
return $this->_getModConfig()->getValue('sTestCountryIp');
|
return $this->_getModConfig()->getValue('sTestCountryIp');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
return $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get IP number by IP address
|
* get IP number by IP address
|
||||||
@ -115,7 +114,7 @@ class d3GeoIP extends oxI18n
|
|||||||
* get oxcountry object by ISO alpha 2 ID
|
* get oxcountry object by ISO alpha 2 ID
|
||||||
*
|
*
|
||||||
* @param string $sISOAlpha
|
* @param string $sISOAlpha
|
||||||
* @return object
|
* @return oxcountry
|
||||||
*/
|
*/
|
||||||
public function getCountryObject($sISOAlpha)
|
public function getCountryObject($sISOAlpha)
|
||||||
{
|
{
|
||||||
@ -144,21 +143,6 @@ class d3GeoIP extends oxI18n
|
|||||||
return $oCountry;
|
return $oCountry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public function setUserCountry()
|
|
||||||
{
|
|
||||||
if (!$this->getUser()) {
|
|
||||||
$oCountry = $this->getUserLocationCountryObject();
|
|
||||||
$oUser = &oxNew('oxuser');
|
|
||||||
$oUser->oxuser__oxcountryid = oxNew('oxfield');
|
|
||||||
$oUser->oxuser__oxcountryid->setValue($oCountry->getId());
|
|
||||||
$this->setUser($oUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check module active state and set user country specific language
|
* check module active state and set user country specific language
|
||||||
*
|
*
|
||||||
@ -168,17 +152,17 @@ class d3GeoIP extends oxI18n
|
|||||||
$this->performURLSwitch();
|
$this->performURLSwitch();
|
||||||
$this->performShopSwitch();
|
$this->performShopSwitch();
|
||||||
|
|
||||||
if (!$this->_getModConfig()->getFieldData('oxactive') || !$this->_getModConfig()->getValue('blChangeLang'))
|
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeLang'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$oCountry = $this->getUserLocationCountryObject();
|
$oCountry = $this->getUserLocationCountryObject();
|
||||||
|
|
||||||
if (!$this->isAdmin() && oxUtils::getInstance()->isSearchEngine() === false && $this->getSession()->getVar('d3isSetLang') === null && $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1)
|
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && oxRegistry::getSession()->getVariable('d3isSetLang') === null && $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1)
|
||||||
{
|
{
|
||||||
$this->_getLog()->setLog('info', __CLASS__, __FUNCTION__, __LINE__, 'set language', $this->getIP().' => '.$oCountry->getFieldData('d3geoiplang'));
|
$this->_getLog()->log('info', __CLASS__, __FUNCTION__, __LINE__, 'set language', $this->getIP().' => '.$oCountry->getFieldData('d3geoiplang'));
|
||||||
oxLang::getInstance()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
oxRegistry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
||||||
oxLang::getInstance()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
oxRegistry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
|
||||||
$this->getSession()->setVar('d3isSetLang', true);
|
oxRegistry::getSession()->setVariable('d3isSetLang', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,16 +172,16 @@ class d3GeoIP extends oxI18n
|
|||||||
*/
|
*/
|
||||||
public function setCountryCurrency()
|
public function setCountryCurrency()
|
||||||
{
|
{
|
||||||
if (!$this->_getModConfig()->getFieldData('oxactive') || !$this->_getModConfig()->getValue('blChangeCurr'))
|
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeCurr'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$oCountry = $this->getUserLocationCountryObject();
|
$oCountry = $this->getUserLocationCountryObject();
|
||||||
|
|
||||||
if (!$this->isAdmin() && oxUtils::getInstance()->isSearchEngine() === false && !$this->getSession()->getVar('d3isSetCurr') && $oCountry->getId() && $oCountry->getFieldData('d3geoipcur') > -1)
|
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && !oxRegistry::getSession()->getVariable('d3isSetCurr') && $oCountry->getId() && $oCountry->getFieldData('d3geoipcur') > -1)
|
||||||
{
|
{
|
||||||
$this->_getLog()->setLog('info', __CLASS__, __FUNCTION__, __LINE__, 'set currency', $this->getIP().' => '.$oCountry->getFieldData('d3geoipcur'));
|
$this->_getLog()->log('info', __CLASS__, __FUNCTION__, __LINE__, 'set currency', $this->getIP().' => '.$oCountry->getFieldData('d3geoipcur'));
|
||||||
$this->getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
|
oxRegistry::getConfig()->setActShopCurrency((int) $oCountry->getFieldData('d3geoipcur'));
|
||||||
$this->getSession()->setVar('d3isSetCurr', true);
|
oxRegistry::getSession()->setVariable('d3isSetCurr', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,16 +191,14 @@ class d3GeoIP extends oxI18n
|
|||||||
*/
|
*/
|
||||||
public function performShopSwitch()
|
public function performShopSwitch()
|
||||||
{
|
{
|
||||||
if (!$this->_getModConfig()->getFieldData('oxactive') || !$this->_getModConfig()->getValue('blChangeShop'))
|
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$oCountry = $this->getUserLocationCountryObject();
|
$oCountry = $this->getUserLocationCountryObject();
|
||||||
|
|
||||||
$iNewShop = $oCountry->getFieldData('d3geoipshop');
|
$iNewShop = $oCountry->getFieldData('d3geoipshop');
|
||||||
|
|
||||||
$aShopLinks = $this->getShopUrls();
|
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && $oCountry->getId() && $this->getConfig()->isMall() && $iNewShop > -1 && $iNewShop != $this->getConfig()->getShopId())
|
||||||
|
|
||||||
if (!$this->isAdmin() && oxUtils::getInstance()->isSearchEngine() === false && $oCountry->getId() && $this->getConfig()->isMall() && $iNewShop > -1 && $iNewShop != $this->getConfig()->getShopId())
|
|
||||||
{
|
{
|
||||||
$oNewConf = new oxConfig();
|
$oNewConf = new oxConfig();
|
||||||
$oNewConf->setShopId($iNewShop);
|
$oNewConf->setShopId($iNewShop);
|
||||||
@ -224,12 +206,16 @@ class d3GeoIP extends oxI18n
|
|||||||
|
|
||||||
$this->getConfig()->onShopChange();
|
$this->getConfig()->onShopChange();
|
||||||
|
|
||||||
if (!$this->getSession()->getVar('d3isSetLang') && $oCountry->getFieldData('d3geoiplang') > -1)
|
if (!oxRegistry::getSession()->getVariable('d3isSetLang') && $oCountry->getFieldData('d3geoiplang') > -1)
|
||||||
|
{
|
||||||
$sLangId = $oCountry->getFieldData('d3geoiplang');
|
$sLangId = $oCountry->getFieldData('d3geoiplang');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$sLangId = '';
|
$sLangId = '';
|
||||||
|
}
|
||||||
|
|
||||||
$this->_getLog()->setLog('info', __CLASS__, __FUNCTION__, __LINE__, 'change shop', $this->getIP().' => '.$oNewConf->getShopHomeUrl($sLangId));
|
$this->_getLog()->log('info', __CLASS__, __FUNCTION__, __LINE__, 'change shop', $this->getIP().' => '.$oNewConf->getShopHomeUrl($sLangId));
|
||||||
|
|
||||||
header("Location: ".$oNewConf->getShopHomeUrl($sLangId));
|
header("Location: ".$oNewConf->getShopHomeUrl($sLangId));
|
||||||
exit();
|
exit();
|
||||||
@ -242,16 +228,18 @@ class d3GeoIP extends oxI18n
|
|||||||
*/
|
*/
|
||||||
public function performURLSwitch()
|
public function performURLSwitch()
|
||||||
{
|
{
|
||||||
if (!$this->_getModConfig()->getFieldData('oxactive') || !$this->_getModConfig()->getValue('blChangeURL'))
|
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeURL'))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$oCountry = $this->getUserLocationCountryObject();
|
$oCountry = $this->getUserLocationCountryObject();
|
||||||
|
|
||||||
if (!$this->isAdmin() && oxUtils::getInstance()->isSearchEngine() === false && $oCountry->getId() && $oCountry->getFieldData('d3geoipurl') && strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0)
|
if (!$this->isAdmin() && oxRegistry::getUtils()->isSearchEngine() === false && $oCountry->getId() && $oCountry->getFieldData('d3geoipurl') && strlen(trim($oCountry->getFieldData('d3geoipurl'))) > 0)
|
||||||
{
|
{
|
||||||
$sNewUrl = $oCountry->getFieldData('d3geoipurl');
|
$sNewUrl = $oCountry->getFieldData('d3geoipurl');
|
||||||
|
|
||||||
$this->_getLog()->setLog('info', __CLASS__, __FUNCTION__, __LINE__, 'change url', $this->getIP().' => '.$oCountry->getFieldData('d3geoipurl'));
|
$this->_getLog()->log('info', __CLASS__, __FUNCTION__, __LINE__, 'change url', $this->getIP().' => '.$oCountry->getFieldData('d3geoipurl'));
|
||||||
|
|
||||||
header("Location: ".$sNewUrl);
|
header("Location: ".$sNewUrl);
|
||||||
exit();
|
exit();
|
||||||
@ -268,7 +256,8 @@ class d3GeoIP extends oxI18n
|
|||||||
$oShoplist = oxNew( 'oxshoplist' );
|
$oShoplist = oxNew( 'oxshoplist' );
|
||||||
$oShoplist->getList();
|
$oShoplist->getList();
|
||||||
$aShopUrls = array();
|
$aShopUrls = array();
|
||||||
foreach ( $oShoplist as $sId => $oShop ) {
|
foreach ( $oShoplist as $sId => $oShop )
|
||||||
|
{
|
||||||
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar( 'sMallShopURL', $sId );
|
$aShopUrls[$sId] = $this->getConfig()->getShopConfVar( 'sMallShopURL', $sId );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +267,7 @@ class d3GeoIP extends oxI18n
|
|||||||
/**
|
/**
|
||||||
* get modcfg instance
|
* get modcfg instance
|
||||||
*
|
*
|
||||||
* @return object
|
* @return d3_cfg_mod
|
||||||
*/
|
*/
|
||||||
protected function _getModConfig()
|
protected function _getModConfig()
|
||||||
{
|
{
|
||||||
@ -288,12 +277,14 @@ class d3GeoIP extends oxI18n
|
|||||||
/**
|
/**
|
||||||
* get d3log instance
|
* get d3log instance
|
||||||
*
|
*
|
||||||
* @return object
|
* @return d3log
|
||||||
*/
|
*/
|
||||||
protected function _getLog()
|
protected function _getLog()
|
||||||
{
|
{
|
||||||
if (!$this->oD3Log)
|
if (!$this->oD3Log)
|
||||||
$this->oD3Log = $this->_getModConfig()->getLogInstance();
|
{
|
||||||
|
$this->oD3Log = $this->_getModConfig()->getLog();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->oD3Log;
|
return $this->oD3Log;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ nc9';
|
|||||||
'do' => 'updateModCfgItemExist'),
|
'do' => 'updateModCfgItemExist'),
|
||||||
array('check' => 'checkFields',
|
array('check' => 'checkFields',
|
||||||
'do' => 'fixFields'),
|
'do' => 'fixFields'),
|
||||||
|
array('check' => 'checkIndizes',
|
||||||
|
'do' => 'fixIndizes'),
|
||||||
array('check' => 'checkModCfgSameRevision',
|
array('check' => 'checkModCfgSameRevision',
|
||||||
'do' => 'updateModCfgSameRevision'),
|
'do' => 'updateModCfgSameRevision'),
|
||||||
);
|
);
|
||||||
@ -149,6 +151,23 @@ nc9';
|
|||||||
);
|
);
|
||||||
|
|
||||||
public $aIndizes = array(
|
public $aIndizes = array(
|
||||||
|
'IPNUM' => array(
|
||||||
|
'sTableName' => 'd3geoip',
|
||||||
|
'sType' => 'INDEX',
|
||||||
|
'sName' => 'IPNUM',
|
||||||
|
'aFields' => array(
|
||||||
|
'D3STARTIPNUM' => 'D3STARTIPNUM',
|
||||||
|
'D3ENDIPNUM' => 'D3ENDIPNUM',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'D3ISO' => array(
|
||||||
|
'sTableName' => 'd3geoip',
|
||||||
|
'sType' => 'INDEX',
|
||||||
|
'sName' => 'D3ISO',
|
||||||
|
'aFields' => array(
|
||||||
|
'D3ISO' => 'D3ISO',
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +1,41 @@
|
|||||||
<?php
|
<?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
|
||||||
|
*/
|
||||||
class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
|
class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
|
||||||
{
|
{
|
||||||
private $_sModId = 'd3_geoip';
|
private $_sModId = 'd3_geoip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
if (d3_cfg_mod::get($this->_sModId)->getValue('blDebugmodeGlobal'))
|
if (d3_cfg_mod::get($this->_sModId)->isActive())
|
||||||
{
|
{
|
||||||
|
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode())
|
||||||
|
{
|
||||||
|
/** @var $oGeoIp d3geoip */
|
||||||
$oGeoIp = oxNew('d3geoip');
|
$oGeoIp = oxNew('d3geoip');
|
||||||
echo $oGeoIp->getIP();
|
echo $oGeoIp->getIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var $oLocation d3geoip */
|
||||||
$oLocation = oxNew('d3geoip');
|
$oLocation = oxNew('d3geoip');
|
||||||
//$oLocation->setUserCountry();
|
|
||||||
$oLocation->setCountryCurrency();
|
$oLocation->setCountryCurrency();
|
||||||
|
}
|
||||||
|
|
||||||
return parent::init();
|
return parent::init();
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,34 @@
|
|||||||
<?php
|
<?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
|
||||||
|
*/
|
||||||
class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
|
class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
|
||||||
{
|
{
|
||||||
|
private $_sModId = "d3_geoip";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
if (d3_cfg_mod::get($this->_sModId)->isActive())
|
||||||
|
{
|
||||||
|
/** @var $oLocation d3geoip */
|
||||||
$oLocation = oxNew('d3geoip');
|
$oLocation = oxNew('d3geoip');
|
||||||
//$oLocation->setUserCountry();
|
|
||||||
$oLocation->setCountryLanguage();
|
$oLocation->setCountryLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
return parent::init();
|
return parent::init();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
|
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="[{$oViewConf->getResourceUrl() }]d3_mod_cfg.css">
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
[{ if $updatelist == 1}]
|
[{ if $updatelist == 1}]
|
||||||
@ -137,69 +135,7 @@ td.edittext {
|
|||||||
<tr>
|
<tr>
|
||||||
<td valign="top" class="edittext">
|
<td valign="top" class="edittext">
|
||||||
|
|
||||||
<table style="width: 100%">
|
[{include file="d3_cfg_mod_active.tpl"}]
|
||||||
<tr>
|
|
||||||
<td style="width:50%; border-right: 1px solid #999;">
|
|
||||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
|
||||||
<tr>
|
|
||||||
<td class="edittext ext_edittext">
|
|
||||||
[{oxmultilang ident="D3_CFG_MOD_GENERAL_MODULEACTIVE"}]
|
|
||||||
</td>
|
|
||||||
<td class="edittext ext_edittext">
|
|
||||||
<input type="hidden" name="editval[d3_cfg_mod__oxactive]" value='0'>
|
|
||||||
<input class="edittext ext_edittext" type="checkbox" name="editval[d3_cfg_mod__oxactive]" value='1' [{if $edit->d3_cfg_mod__oxactive->value == 1}]checked[{/if}]>
|
|
||||||
[{oxinputhelp ident="D3_CFG_MOD_GENERAL_MODULEACTIVE_DESC"}]
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="edittext ext_edittext">
|
|
||||||
</td>
|
|
||||||
<td class="edittext ext_edittext">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="edittext ext_edittext">
|
|
||||||
[{if $edit->getValue('blDebugmodeGlobal') == 1}]<span style="font-weight: bold; color: #CD0210;">[{/if}][{oxmultilang ident="D3_CFG_MOD_GENERAL_DEBUGACTIVE"}][{if $edit->getValue('blDebugmodeGlobal') == 1}]</span>[{/if}]
|
|
||||||
</td>
|
|
||||||
<td class="edittext ext_edittext">
|
|
||||||
<input type="hidden" name="value[blDebugmodeGlobal]" value="0">
|
|
||||||
<input class="edittext ext_edittext" type="checkbox" name="value[blDebugmodeGlobal]" value='1' [{if $edit->getValue('blDebugmodeGlobal') == 1}]checked[{/if}]>
|
|
||||||
[{oxinputhelp ident="D3_GEOIP_SET_DEBUG_DESC"}]
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[{assign var="blD3HasLog" value=$oView->checkD3Log() }]
|
|
||||||
<table cellspacing="0" cellpadding="0" border="0">
|
|
||||||
<tr>
|
|
||||||
<td class="edittext ext_edittext" style="width: 100%;">
|
|
||||||
[{if $blD3HasLog}]
|
|
||||||
[{oxmultilang ident="D3_CFG_MOD_GENERAL_MODULELOGGING"}]
|
|
||||||
[{/if}]
|
|
||||||
</td>
|
|
||||||
<td class="edittext ext_edittext" align="left">
|
|
||||||
[{if $blD3HasLog}]
|
|
||||||
<select name="editval[d3_cfg_mod__oxismodulelog]" class="edittext">
|
|
||||||
<option value="0" [{if $edit->d3_cfg_mod__oxismodulelog->value == 0}]selected[{/if}]>[{oxmultilang ident="D3_CFG_MOD_GENERAL_MODULELOGGING_NONE"}]</option>
|
|
||||||
<option value="1" [{if $edit->d3_cfg_mod__oxismodulelog->value == 1}]selected[{/if}]>[{oxmultilang ident="D3_CFG_MOD_GENERAL_MODULELOGGING_ALL"}]</option>
|
|
||||||
<option value="2" [{if $edit->d3_cfg_mod__oxismodulelog->value == 2}]selected[{/if}]>[{oxmultilang ident="D3_CFG_MOD_GENERAL_MODULELOGGING_ERRORS"}]</option>
|
|
||||||
</select>
|
|
||||||
[{/if}]
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="edittext ext_edittext" style="width: 100%;">
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td class="edittext ext_edittext" align="left">
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="groupExp">
|
<div class="groupExp">
|
||||||
<div class="">
|
<div class="">
|
||||||
@ -339,5 +275,14 @@ td.edittext {
|
|||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
[{include file="d3_cfg_mod_inc.tpl"}]
|
||||||
|
|
||||||
[{include file="bottomitem.tpl"}]
|
<script type="text/javascript">
|
||||||
|
if (parent.parent) {
|
||||||
|
parent.parent.sShopTitle = "[{$actshopobj->oxshops__oxname->getRawValue()|oxaddslashes}]";
|
||||||
|
parent.parent.sMenuItem = "[{oxmultilang ident="d3mxgeoip"}]";
|
||||||
|
parent.parent.sMenuSubItem = "[{oxmultilang ident="d3mxgeoip_settings"}]";
|
||||||
|
parent.parent.sWorkArea = "[{$_act}]";
|
||||||
|
parent.parent.setTitle();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 1, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.2', 'EE4', 0, '', '', '', '', 26);
|
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 2, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.2', 'EE4', 0, '', '', '', '', 26);
|
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 3, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.2', 'EE4', 0, '', '', '', '', 26);
|
|
||||||
|
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT '-1',
|
|
||||||
ADD `D3GEOIPLANG` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
|
||||||
ADD `D3GEOIPCUR` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
|
||||||
ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
|
||||||
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXREVISION` = `OXNEWREVISION` WHERE `OXMODID` = 'd3_geoip';
|
|
@ -1,22 +0,0 @@
|
|||||||
# ==== 1.0 EE4 => 1.1 EE4 ====
|
|
||||||
ALTER TABLE `d3geoip` CHANGE `D3STARTIPNUM` `D3STARTIPNUM` INT( 10 ) UNSIGNED NOT NULL ,
|
|
||||||
CHANGE `D3ENDIPNUM` `D3ENDIPNUM` INT( 10 ) UNSIGNED NOT NULL
|
|
||||||
|
|
||||||
# ==== 1.1 EE4 => 2.0.0 EE4 ====
|
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 1, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 2, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 3, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
|
||||||
|
|
||||||
# ==== 2.0.0 PE4 => 2.1.0 PE4 ====
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.0', `OXREVISION` = '18', `OXNEWREVISION` = '18' WHERE OXMODID = 'd3_geoip';
|
|
||||||
|
|
||||||
# ==== 2.1.0 PE4 => 2.1.1 PE4 ====
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.1', `OXREVISION` = '24', `OXNEWREVISION` = '24' WHERE OXMODID = 'd3_geoip';
|
|
||||||
|
|
||||||
# ==== 2.1.1 PE4 => 2.1.2 PE4 ====
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.2', `OXNEWREVISION` = '26' WHERE OXMODID = 'd3_geoip';
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXREVISION` = `OXNEWREVISION` WHERE `OXMODID` = 'd3_geoip';
|
|
@ -1,9 +0,0 @@
|
|||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 'oxbaseshop', 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.2', 'PE4', 0, '', '', '', '', 26);
|
|
||||||
|
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT 'oxbaseshop',
|
|
||||||
ADD `D3GEOIPLANG` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
|
||||||
ADD `D3GEOIPCUR` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
|
||||||
ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
|
||||||
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXREVISION` = `OXNEWREVISION` WHERE `OXMODID` = 'd3_geoip';
|
|
@ -1,24 +0,0 @@
|
|||||||
# ==== 1.0 PE4 => 1.1 PE4 ====
|
|
||||||
ALTER TABLE `d3geoip` CHANGE `D3STARTIPNUM` `D3STARTIPNUM` INT( 10 ) UNSIGNED NOT NULL ,
|
|
||||||
CHANGE `D3ENDIPNUM` `D3ENDIPNUM` INT( 10 ) UNSIGNED NOT NULL
|
|
||||||
|
|
||||||
# ==== 1.1 PE4 => 2.0.0 PE4 ====
|
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
|
||||||
(MD5(RAND()), 'oxbaseshop', 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'PE4', 0, '', '', '', '', 14, 14);
|
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
|
||||||
|
|
||||||
# ==== 2.0.0 PE4 => 2.1.0 PE4 ====
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.0', `OXNEWREVISION` = '18' WHERE OXMODID = 'd3_geoip';
|
|
||||||
ALTER TABLE `oxcountry` CHANGE `D3GEOIPSHOP` `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT 'oxbaseshop';
|
|
||||||
UPDATE `oxcountry` SET `D3GEOIPSHOP` = 'oxbaseshop' WHERE `D3GEOIPSHOP` = '-1';
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXREVISION` = `OXNEWREVISION` WHERE OXMODID = 'd3_geoip';
|
|
||||||
|
|
||||||
# ==== 2.1.0 PE4 => 2.1.1 PE4 ====
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.1', `OXNEWREVISION` = '24' WHERE OXMODID = 'd3_geoip';
|
|
||||||
ALTER TABLE `oxcountry` CHANGE `D3GEOIPSHOP` `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT 'oxbaseshop';
|
|
||||||
UPDATE `oxcountry` SET `D3GEOIPSHOP` = 'oxbaseshop' WHERE `D3GEOIPSHOP` = '-1';
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXREVISION` = `OXNEWREVISION` WHERE OXMODID = 'd3_geoip';
|
|
||||||
|
|
||||||
# ==== 2.1.1 PE4 => 2.1.2 PE4 ====
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.2', `OXNEWREVISION` = '26' WHERE OXMODID = 'd3_geoip';
|
|
||||||
UPDATE `d3_cfg_mod` SET `OXREVISION` = `OXNEWREVISION` WHERE `OXMODID` = 'd3_geoip';
|
|
625
setup+doku/d3precheck.php
Normal file
625
setup+doku/d3precheck.php
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user