Skip to content

Commit

Permalink
Disable to change city database location
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Dec 27, 2021
1 parent 1f67cf9 commit b280bea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Expand Up @@ -128,8 +128,8 @@
</p>

<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Location of city database'); ?></label>
<input class="form-control" type="text" name="CityGeoLocation" value="<?php isset($geo_data['max_mind_city_location']) && ($geo_data['max_mind_city_location'] != '') ? print htmlspecialchars($geo_data['max_mind_city_location']) : print 'var/external/geoip/GeoLite2-City.mmdb' ?>" />
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Location of city database. Make sure you uploaded file in this location.'); ?></label>
<input class="form-control" type="text" readonly value="<?php isset($geo_data['max_mind_city_location']) && ($geo_data['max_mind_city_location'] != '') ? print htmlspecialchars($geo_data['max_mind_city_location']) : print 'var/external/geoip/GeoLite2-City.mmdb' ?>" />
</div>

<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion lhc_web/ezcomponents/Base/src/file.php
Expand Up @@ -110,7 +110,7 @@ static protected function findRecursiveCallback( ezcBaseFileFindContext $context
* not be opened for reading.
* @return array
*/
static public function walkRecursive( $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), $callback, &$callbackContext )
static public function walkRecursive( $sourceDir, array $includeFilters, array $excludeFilters, $callback, &$callbackContext )
{
if ( !is_dir( $sourceDir ) )
{
Expand Down
4 changes: 2 additions & 2 deletions lhc_web/ezcomponents/ConsoleTools/src/input/option.php
Expand Up @@ -147,8 +147,8 @@ class ezcConsoleOption
* sign or contain whitespaces.
*/
public function __construct(
$short = '',
$long,
$short = '',
$long = '',
$type = ezcConsoleInput::TYPE_NONE,
$default = null,
$multiple = false,
Expand Down
9 changes: 3 additions & 6 deletions lhc_web/modules/lhchat/geoconfiguration.php
Expand Up @@ -109,9 +109,6 @@
'MaxMindDetectionType' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'string'
),
'CityGeoLocation' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'string'
),
'ipapi_key' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'string'
),
Expand Down Expand Up @@ -198,15 +195,15 @@
} elseif ($form->UseGeoIP == 'max_mind') {
$data['geo_service_identifier'] = 'max_mind';
$data['max_mind_detection_type'] = $form->hasValidData('MaxMindDetectionType') ? $form->MaxMindDetectionType : 'city';
$data['max_mind_city_location'] = $form->CityGeoLocation != '' ? $form->CityGeoLocation : 'var/external/geoip/GeoLite2-City.mmdb';
$data['max_mind_city_location'] = 'var/external/geoip/GeoLite2-City.mmdb';

if ($data['max_mind_detection_type'] == 'city' && !file_exists($data['max_mind_city_location'])) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','MaxMind city file does not exists!');
} elseif (!file_exists('var/external/geoip/GeoLite2-Country.mmdb')) {
$data['max_mind_detection_type'] = 'country';
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','MaxMind country file does not exists!');
}

if (empty($Errors)) {
$responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('max_mind','94.23.200.91',array('city_file' => $data['max_mind_city_location'],'detection_type' => $data['max_mind_detection_type']));
if ( $responseDetection == false || !isset($responseDetection->country_code) || !isset($responseDetection->country_name) ) {
Expand Down

0 comments on commit b280bea

Please sign in to comment.