diff --git a/.gitattributes b/.gitattributes index 4b9d3d6..ce78e33 100644 --- a/.gitattributes +++ b/.gitattributes @@ -32,6 +32,12 @@ setup+doku/geoip_data_parts/6.sql -text setup+doku/geoip_data_parts/7.sql -text setup+doku/geoip_data_parts/8.sql -text setup+doku/licence.txt -text +sources/CSVtoSQLconvert_perl.zip -text +sources/Doku/Drucken[!!-~]-[!!-~]Bartomedia[!!-~]-[!!-~]Web[!!-~]Design[!!-~]Distinction_[!!-~]Geo[!!-~]IP[!!-~]-[!!-~]install[!!-~]Maxmind[!!-~]GeoIP[!!-~]using[!!-~]PHP[!!-~]+[!!-~]MySQL.pdf -text svneol=unset#unset +sources/Doku/Drucken[!!-~]-[!!-~]Bartomedia[!!-~]-[!!-~]Web[!!-~]Design[!!-~]Distinction_[!!-~]Maxmind[!!-~]GeoIP[!!-~]install[!!-~]setup[!!-~]tutorial[!!-~]using[!!-~]PHPMyAdmin.pdf -text +sources/Doku/Drucken[!!-~]-[!!-~]MaxMind[!!-~]Forum[!!-~]•[!!-~]View[!!-~]topic[!!-~]-[!!-~]Fast[!!-~]SQL[!!-~]Queries[!!-~]Using[!!-~]the[!!-~]CSV[!!-~]Database.pdf -text +sources/Doku/Drucken[!!-~]-[!!-~]On[!!-~]efficiently[!!-~]geo-referencing[!!-~]IPs[!!-~]with[!!-~]MaxMind[!!-~]GeoIP[!!-~]and[!!-~]MySQL[!!-~]GIS[!!-~]«[!!-~]Jeremy[!!-~]Cole.pdf -text svneol=unset#unset +sources/Doku/Drucken[!!-~]-[!!-~]Vincent[!!-~]de[!!-~]Lau_[!!-~]HOW-TO[!!-~]Import[!!-~]the[!!-~]MaxMind[!!-~]GeoIP[!!-~]Free[!!-~]Country[!!-~]CSV[!!-~]file[!!-~]into[!!-~]MySQL[!!-~]and[!!-~]save[!!-~]diskspace.pdf -text svneol=unset#unset sources/GeoIP-Installation.docx -text sources/GeoIPCountryCSV.zip -text sources/GeoIPv6.csv/GeoIPv6-20120304.csv -text diff --git a/copy_this/admin/d3_country_geoip.php b/copy_this/admin/d3_country_geoip.php index e11d47b..15e2865 100644 --- a/copy_this/admin/d3_country_geoip.php +++ b/copy_this/admin/d3_country_geoip.php @@ -1,218 +1,218 @@ -_oSet = d3_cfg_mod::get($this->_sModId); - - $myConfig = $this->getConfig(); - - if ( !$myConfig->getConfigParam( 'blAllowSharedEdit' ) ) - $this->_aViewData['readonly'] = true; - - $ret = parent::render(); - - $soxId = oxConfig::getParameter( "oxid"); - // check if we right now saved a new entry - $sSavedID = oxConfig::getParameter( "saved_oxid"); - if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) { - $soxId = $sSavedID; - oxSession::deleteVar( "saved_oxid"); - $this->_aViewData["oxid"] = $soxId; - // for reloading upper frame - $this->_aViewData["updatelist"] = "1"; - } - - if ( $soxId != "-1" && isset( $soxId)) { - // load object - $oCountry = oxNew( "oxcountry" ); - $oCountry->loadInLang( $this->_iEditLang, $soxId ); - - if ($oCountry->isForeignCountry()) { - $this->_aViewData["blForeignCountry"] = true; - } else { - $this->_aViewData["blForeignCountry"] = false; - } - - $oOtherLang = $oCountry->getAvailableInLangs(); - if (!isset($oOtherLang[$this->_iEditLang])) { - // echo "language entry doesn't exist! using: ".key($oOtherLang); - $oCountry->loadInLang( key($oOtherLang), $soxId ); - } - $this->_aViewData["edit"] = $this->oCountry = $oCountry; - - // remove already created languages - $aLang = array_diff (oxLang::getInstance()->getLanguageNames(), $oOtherLang ); - if ( count( $aLang)) - $this->_aViewData["posslang"] = $aLang; - - foreach ( $oOtherLang as $id => $language) { - $oLang= new oxStdClass(); - $oLang->sLangDesc = $language; - $oLang->selected = ($id == $this->_iEditLang); - $this->_aViewData["otherlang"][$id] = clone $oLang; - } - } else { - $this->_aViewData["blForeignCountry"] = true; - } - - $this->oShopList = &oxNew('oxshoplist'); - $oShop = &oxNew('oxshop'); - $sSelect = "SELECT * FROM ".$oShop->getViewName()." WHERE ".$oShop->getSqlActiveSnippet(); - - $this->oShopList->selectString($sSelect); - - $this->getLangList(); - - return $ret; - } - - public function getModCfgValue($sIdent) - { - $this->_oSet = d3_cfg_mod::get($this->_sModId); - return $this->_oSet->getValue($sIdent); - } - - public function saveshop() - { - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $_POST['editval']['oxcountry__d3geoiplang'] = '-1'; - $_POST['editval']['oxcountry__d3geoipcur'] = '-1'; - } - - $this->save(); - } - - public function save() - { - $myConfig = $this->getConfig(); - - //allow malladmin only to perform this action - if ( !$myConfig->getConfigParam( 'blAllowSharedEdit' ) ) - 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); - $oCountry->setLanguage(0); - $oCountry->assign( $aParams ); - $oCountry->setLanguage($this->_iEditLang); - $oCountry = oxUtilsFile::getInstance()->processFiles( $oCountry ); - - $oCountry->save(); - $this->_aViewData["updatelist"] = "1"; - - // set oxid if inserted - if ( $soxId == "-1") - oxSession::setVar( "saved_oxid", $oCountry->oxcountry__oxid->value); - } - - public function getShopList() - { - return $this->oShopList; - } - - public function getCurList() - { - $aCurrencies = array(); - - $sQ = "select DECODE( oxvarvalue, '".$this->getConfig()->getConfigParam( 'sConfigKey' )."') as oxvarvalue from oxconfig where oxshopid = '".$this->oCountry->getFieldData('d3geoipshop')."' AND oxvarname = 'aCurrencies'"; - $sCurs = oxDb::getDb(1)->getOne($sQ); - foreach (unserialize($sCurs) as $sKey => $sValue) - { - $aFields = explode('@', $sValue); - $aCurrencies[$sKey]->id = $sKey; - $aCurrencies[$sKey]->name = $aFields[0]; - $aCurrencies[$sKey]->sign = $aFields[4]; - } - - return $aCurrencies; - } - - public function getLangList() - { - - $aLanguages = array(); - $aLangParams = $this->getConfig()->getShopConfVar('aLanguageParams', $this->oCountry->getFieldData('d3geoipshop')); - $aConfLanguages = $this->getConfig()->getShopConfVar('aLanguages', $this->oCountry->getFieldData('d3geoipshop')); - - if ( is_array( $aConfLanguages ) ) { - $i = 0; - reset( $aConfLanguages ); - while ( list( $key, $val ) = each( $aConfLanguages ) ) { - - if ( $blOnlyActive && is_array($aLangParams) ) { - //skipping non active languages - if ( !$aLangParams[$key]['active'] ) { - $i++; - continue; - } - } - - if ( $val) { - $oLang = new oxStdClass(); - if ( isset($aLangParams[$key]['baseId']) ) { - $oLang->id = $aLangParams[$key]['baseId']; - } else { - $oLang->id = $i; - } - $oLang->oxid = $key; - $oLang->abbr = $key; - $oLang->name = $val; - - if ( is_array($aLangParams) ) { - $oLang->active = $aLangParams[$key]['active']; - $oLang->sort = $aLangParams[$key]['sort']; - } - - if ( isset( $iLanguage ) && $oLang->id == $iLanguage ) { - $oLang->selected = 1; - } else { - $oLang->selected = 0; - } - if ($oLang->active) - $aLanguages[$oLang->id] = $oLang; - } - ++$i; - } - } - - if ( $blSort && is_array($aLangParams) ) { - uasort( $aLanguages, array($this, '_sortLanguagesCallback') ); - } - - return $aLanguages; - } - - 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; - - if ( $this->_sDefSortOrder == 'asc' ) { - return ($sVal1 < $sVal2) ? -1 : 1; - } else { - return ($sVal1 > $sVal2) ? -1 : 1; - } - } - +_oSet = d3_cfg_mod::get($this->_sModId); + + $myConfig = $this->getConfig(); + + if ( !$myConfig->getConfigParam( 'blAllowSharedEdit' ) ) + $this->_aViewData['readonly'] = true; + + $ret = parent::render(); + + $soxId = oxConfig::getParameter( "oxid"); + // check if we right now saved a new entry + $sSavedID = oxConfig::getParameter( "saved_oxid"); + if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) { + $soxId = $sSavedID; + oxSession::deleteVar( "saved_oxid"); + $this->_aViewData["oxid"] = $soxId; + // for reloading upper frame + $this->_aViewData["updatelist"] = "1"; + } + + if ( $soxId != "-1" && isset( $soxId)) { + // load object + $oCountry = oxNew( "oxcountry" ); + $oCountry->loadInLang( $this->_iEditLang, $soxId ); + + if ($oCountry->isForeignCountry()) { + $this->_aViewData["blForeignCountry"] = true; + } else { + $this->_aViewData["blForeignCountry"] = false; + } + + $oOtherLang = $oCountry->getAvailableInLangs(); + if (!isset($oOtherLang[$this->_iEditLang])) { + // echo "language entry doesn't exist! using: ".key($oOtherLang); + $oCountry->loadInLang( key($oOtherLang), $soxId ); + } + $this->_aViewData["edit"] = $this->oCountry = $oCountry; + + // remove already created languages + $aLang = array_diff (oxLang::getInstance()->getLanguageNames(), $oOtherLang ); + if ( count( $aLang)) + $this->_aViewData["posslang"] = $aLang; + + foreach ( $oOtherLang as $id => $language) { + $oLang= new oxStdClass(); + $oLang->sLangDesc = $language; + $oLang->selected = ($id == $this->_iEditLang); + $this->_aViewData["otherlang"][$id] = clone $oLang; + } + } else { + $this->_aViewData["blForeignCountry"] = true; + } + + $this->oShopList = &oxNew('oxshoplist'); + $oShop = &oxNew('oxshop'); + $sSelect = "SELECT * FROM ".$oShop->getViewName()." WHERE ".$oShop->getSqlActiveSnippet(); + + $this->oShopList->selectString($sSelect); + + $this->getLangList(); + + return $ret; + } + + public function getModCfgValue($sIdent) + { + $this->_oSet = d3_cfg_mod::get($this->_sModId); + return $this->_oSet->getValue($sIdent); + } + + public function saveshop() + { + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $_POST['editval']['oxcountry__d3geoiplang'] = '-1'; + $_POST['editval']['oxcountry__d3geoipcur'] = '-1'; + } + + $this->save(); + } + + public function save() + { + $myConfig = $this->getConfig(); + + //allow malladmin only to perform this action + if ( !$myConfig->getConfigParam( 'blAllowSharedEdit' ) ) + 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); + $oCountry->setLanguage(0); + $oCountry->assign( $aParams ); + $oCountry->setLanguage($this->_iEditLang); + $oCountry = oxUtilsFile::getInstance()->processFiles( $oCountry ); + + $oCountry->save(); + $this->_aViewData["updatelist"] = "1"; + + // set oxid if inserted + if ( $soxId == "-1") + oxSession::setVar( "saved_oxid", $oCountry->oxcountry__oxid->value); + } + + public function getShopList() + { + return $this->oShopList; + } + + public function getCurList() + { + $aCurrencies = array(); + + $sQ = "select DECODE( oxvarvalue, '".$this->getConfig()->getConfigParam( 'sConfigKey' )."') as oxvarvalue from oxconfig where oxshopid = '".$this->oCountry->getFieldData('d3geoipshop')."' AND oxvarname = 'aCurrencies'"; + $sCurs = oxDb::getDb(2)->getOne($sQ); + foreach (unserialize($sCurs) as $sKey => $sValue) + { + $aFields = explode('@', $sValue); + $aCurrencies[$sKey]->id = $sKey; + $aCurrencies[$sKey]->name = $aFields[0]; + $aCurrencies[$sKey]->sign = $aFields[4]; + } + + return $aCurrencies; + } + + public function getLangList() + { + + $aLanguages = array(); + $aLangParams = $this->getConfig()->getShopConfVar('aLanguageParams', $this->oCountry->getFieldData('d3geoipshop')); + $aConfLanguages = $this->getConfig()->getShopConfVar('aLanguages', $this->oCountry->getFieldData('d3geoipshop')); + + if ( is_array( $aConfLanguages ) ) { + $i = 0; + reset( $aConfLanguages ); + while ( list( $key, $val ) = each( $aConfLanguages ) ) { + + if ( $blOnlyActive && is_array($aLangParams) ) { + //skipping non active languages + if ( !$aLangParams[$key]['active'] ) { + $i++; + continue; + } + } + + if ( $val) { + $oLang = new oxStdClass(); + if ( isset($aLangParams[$key]['baseId']) ) { + $oLang->id = $aLangParams[$key]['baseId']; + } else { + $oLang->id = $i; + } + $oLang->oxid = $key; + $oLang->abbr = $key; + $oLang->name = $val; + + if ( is_array($aLangParams) ) { + $oLang->active = $aLangParams[$key]['active']; + $oLang->sort = $aLangParams[$key]['sort']; + } + + if ( isset( $iLanguage ) && $oLang->id == $iLanguage ) { + $oLang->selected = 1; + } else { + $oLang->selected = 0; + } + if ($oLang->active) + $aLanguages[$oLang->id] = $oLang; + } + ++$i; + } + } + + if ( $blSort && is_array($aLangParams) ) { + uasort( $aLanguages, array($this, '_sortLanguagesCallback') ); + } + + return $aLanguages; + } + + 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; + + if ( $this->_sDefSortOrder == 'asc' ) { + return ($sVal1 < $sVal2) ? -1 : 1; + } else { + return ($sVal1 > $sVal2) ? -1 : 1; + } + } + } \ No newline at end of file diff --git a/sources/CSVtoSQLconvert_perl.zip b/sources/CSVtoSQLconvert_perl.zip new file mode 100644 index 0000000..3a4898a Binary files /dev/null and b/sources/CSVtoSQLconvert_perl.zip differ diff --git a/sources/Doku/Drucken - Bartomedia - Web Design Distinction_ Geo IP - install Maxmind GeoIP using PHP + MySQL.pdf b/sources/Doku/Drucken - Bartomedia - Web Design Distinction_ Geo IP - install Maxmind GeoIP using PHP + MySQL.pdf new file mode 100644 index 0000000..2e536ff Binary files /dev/null and b/sources/Doku/Drucken - Bartomedia - Web Design Distinction_ Geo IP - install Maxmind GeoIP using PHP + MySQL.pdf differ diff --git a/sources/Doku/Drucken - Bartomedia - Web Design Distinction_ Maxmind GeoIP install setup tutorial using PHPMyAdmin.pdf b/sources/Doku/Drucken - Bartomedia - Web Design Distinction_ Maxmind GeoIP install setup tutorial using PHPMyAdmin.pdf new file mode 100644 index 0000000..d406031 Binary files /dev/null and b/sources/Doku/Drucken - Bartomedia - Web Design Distinction_ Maxmind GeoIP install setup tutorial using PHPMyAdmin.pdf differ diff --git a/sources/Doku/Drucken - MaxMind Forum • View topic - Fast SQL Queries Using the CSV Database.pdf b/sources/Doku/Drucken - MaxMind Forum • View topic - Fast SQL Queries Using the CSV Database.pdf new file mode 100644 index 0000000..88f47cc Binary files /dev/null and b/sources/Doku/Drucken - MaxMind Forum • View topic - Fast SQL Queries Using the CSV Database.pdf differ diff --git a/sources/Doku/Drucken - On efficiently geo-referencing IPs with MaxMind GeoIP and MySQL GIS « Jeremy Cole.pdf b/sources/Doku/Drucken - On efficiently geo-referencing IPs with MaxMind GeoIP and MySQL GIS « Jeremy Cole.pdf new file mode 100644 index 0000000..34b6138 Binary files /dev/null and b/sources/Doku/Drucken - On efficiently geo-referencing IPs with MaxMind GeoIP and MySQL GIS « Jeremy Cole.pdf differ diff --git a/sources/Doku/Drucken - Vincent de Lau_ HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.pdf b/sources/Doku/Drucken - Vincent de Lau_ HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.pdf new file mode 100644 index 0000000..8f207a3 Binary files /dev/null and b/sources/Doku/Drucken - Vincent de Lau_ HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.pdf differ