public function detectCountry() { try { $sql = 'SELECT `cc2` FROM `' . BOL_GeolocationIpToCountryDao::getInstance()->getTableName() . '` WHERE inet_aton(:ip) >= ipFrom AND inet_aton(:ip) <= ipTo'; return OW::getDbo()->queryForColumn($sql, array('ip' => OW::getRequest()->getRemoteAddress())); } catch (Exception $e) { return null; } }
private function __construct() { $this->countryDao = BOL_GeolocationCountryDao::getInstance(); $this->ipCountryDao = BOL_GeolocationIpToCountryDao::getInstance(); $this->isAvailable = $this->countryDao->doesTableExist(); }