Remove built-in (and broken) geo location feature from the core

Fixes #173
This commit is contained in:
Fedor A. Fetisov 2016-12-23 17:35:42 +03:00
parent ffcdb223cc
commit 7041adcdfb
7 changed files with 4 additions and 72 deletions

View File

@ -137,19 +137,12 @@
},
/**
* Open window with geo information
* Open window with a tip for geolocation
*/
showGeoInfo: function() {
var ip = this.model.get('userIp');
if (ip) {
var page = Mibew.Objects.Models.page;
var geoLink = page.get('geoLink')
.replace("{ip}", ip);
Mibew.Popup.open(
geoLink,
'ip' + ip,
page.get('geoWindowParams')
);
Mibew.Utils.alert(Mibew.Localization.trans('No geolocation data available. We recommend you to install Mibew:GeoIp and Mibew:GoogleMaps plugins.'));
}
},

View File

@ -106,19 +106,12 @@
},
/**
* Open window with geo information
* Open window with a tip for geolocation
*/
showGeoInfo: function() {
var ip = this.model.get('userIp');
if (ip) {
var page = Mibew.Objects.Models.page;
var geoLink = page.get('geoLink')
.replace("{ip}", ip);
Mibew.Popup.open(
geoLink,
'ip' + ip,
page.get('geoWindowParams')
);
Mibew.Utils.alert(Mibew.Localization.trans('No geolocation data available. We recommend you to install Mibew:GeoIp and Mibew:GoogleMaps plugins.'));
}
}
}

View File

@ -58,8 +58,6 @@ class CommonController extends AbstractController
'hosturl',
'usernamepattern',
'chattitle',
'geolink',
'geolinkparams',
'sendmessagekey',
'cron_key',
'left_messages_locale',
@ -78,8 +76,6 @@ class CommonController extends AbstractController
$page['formtitle'] = $form->get('title', $params['title']);
$page['formlogo'] = $form->get('logo', $params['logo']);
$page['formhosturl'] = $form->get('hosturl', $params['hosturl']);
$page['formgeolink'] = $form->get('geolink', $params['geolink']);
$page['formgeolinkparams'] = $form->get('geolinkparams', $params['geolinkparams']);
$page['formusernamepattern'] = $form->get('usernamepattern', $params['usernamepattern']);
$page['formchatstyle'] = $form->get('chatstyle', ChatStyle::getDefaultStyle());
$page['formpagestyle'] = $form->get('pagestyle', PageStyle::getDefaultStyle());
@ -137,8 +133,6 @@ class CommonController extends AbstractController
$params['hosturl'] = $request->request->get('hosturl');
$params['usernamepattern'] = $request->request->get('usernamepattern');
$params['chattitle'] = $request->request->get('chattitle');
$params['geolink'] = $request->request->get('geolink');
$params['geolinkparams'] = $request->request->get('geolinkparams');
$params['cron_key'] = $request->request->get('cronkey');
$send_key = $request->request->get('sendmessagekey');
@ -156,20 +150,6 @@ class CommonController extends AbstractController
$errors[] = getlocal('Enter a valid email address');
}
if ($params['geolinkparams']) {
foreach (explode(',', $params['geolinkparams']) as $one_param) {
$wrong_param = !preg_match(
"/^\s*(toolbar|scrollbars|location|status|menubar|width|height|resizable)=\d{1,4}$/",
$one_param
);
if ($wrong_param) {
$errors[] = "Wrong link parameter: \"$one_param\", "
. "should be one of 'toolbar, scrollbars, location, "
. "status, menubar, width, height or resizable'";
}
}
}
if (preg_match("/^[0-9A-Za-z]*$/", $params['cron_key']) == 0) {
$errors[] = getlocal('Use only Latin letters(upper and lower case) and numbers in cron key.');
}

View File

@ -120,13 +120,11 @@ class UsersController extends AbstractController
'visitorTag' => $page_style_config['users']['visitor_tag'],
'agentLink' => $request->getBaseUrl() . '/operator/chat',
'geoLink' => Settings::get('geolink'),
'trackedLink' => $request->getBaseUrl() . '/operator/history/user-track',
'banLink' => $request->getBaseUrl() . '/operator/ban',
'inviteLink' => $request->getBaseUrl() . '/operator/invite',
'chatWindowParams' => $chat_style_config['chat']['window'],
'geoWindowParams' => Settings::get('geolinkparams'),
'trackedUserWindowParams' => $page_style_config['tracked']['user_window'],
'trackedVisitorWindowParams' => $page_style_config['tracked']['visitor_window'],
'banWindowParams' => $page_style_config['ban']['window'],

View File

@ -76,8 +76,6 @@ class Settings
'invitation_style' => 'default',
'page_style' => 'default',
'chattitle' => 'Live Support',
'geolink' => 'http://api.hostip.info/get_html.php?ip={ip}',
'geolinkparams' => 'width=440,height=100,toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1',
'max_uploaded_file_size' => 100000,
'max_connections_from_one_host' => 10,
'thread_lifetime' => 600,

View File

@ -33,17 +33,5 @@ function get_user_agent_version($user_agent)
function get_user_addr($addr)
{
if (Settings::get('geolink') && preg_match("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $addr, $matches)) {
$user_ip = $matches[1];
return get_popup(
str_replace("{ip}", $user_ip, Settings::get('geolink')),
'',
htmlspecialchars($addr),
"GeoLocation",
"ip$user_ip",
Settings::get('geolinkparams')
);
}
return htmlspecialchars($addr);
}

View File

@ -85,24 +85,6 @@
<br clear="all"/>
</div>
<div class="field">
<label for="geoip-link" class="field-label">{{l10n "Link to an external geolocation service"}}</label>
<div class="field-value">
<input id="geoip-link" type="text" name="geolink" size="40" value="{{formgeolink}}" class="field-input"/>
</div>
<label for="geoip-link" class="field-description"> &mdash; {{l10n "Each IP becomes a link opening in a new window. {ip} is substituted with a real IP."}}</label>
<br clear="all"/>
</div>
<div class="field">
<label for="geoip-link-params" class="field-label">{{l10n "Geolocation window options"}}</label>
<div class="field-value">
<input id="geoip-link-params" type="text" name="geolinkparams" size="40" value="{{formgeolinkparams}}" class="field-input"/>
</div>
<label for="geoip-link-params" class="field-description"> &mdash; {{l10n "Window size and toolbars hiding"}}</label>
<br clear="all"/>
</div>
<div class="field">
<label for="username-pattern" class="field-label">{{l10n "Visitor's identifier"}}</label>
<div class="field-value">