mirror of
https://github.com/Mibew/design.git
synced 2024-11-16 01:44:11 +03:00
settings for geolocation link
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@223 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
46ae187087
commit
fa3e71779f
@ -445,7 +445,7 @@ $settings = array(
|
||||
'chatstyle' => 'default',
|
||||
'chattitle' => 'Live Support',
|
||||
'geolink' => 'http://api.hostip.info/get_html.php?ip={ip}',
|
||||
'geolinkparams' => 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=440,height=100,resizable=1',
|
||||
'geolinkparams' => 'width=440,height=100,toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1',
|
||||
);
|
||||
$settingsloaded = false;
|
||||
$settings_in_db = array();
|
||||
|
@ -281,6 +281,10 @@ settings.email=Email
|
||||
settings.email.description=Enter email to receive system messages
|
||||
settings.enableban=Enable feature "Malicious Visitors"
|
||||
settings.enableban.description=Using it you can block attacks from specific IPs
|
||||
settings.geolink=Link to an external geolocation service
|
||||
settings.geolink.description=Each IP becomes a link opening in new window. {ip} is substituted with a real ip.
|
||||
settings.geolinkparams=Geolocation window options
|
||||
settings.geolinkparams.description=Window size and toolbars hiding
|
||||
settings.host=URL of your website
|
||||
settings.host.description=Destination for you company name or logo link
|
||||
settings.logo=Your company logo
|
||||
|
@ -281,6 +281,10 @@ settings.email=
|
||||
settings.email.description=Введите адрес электронной почты для получения сообщений от системы
|
||||
settings.enableban=Включить функцию "Нежелательные посетители"
|
||||
settings.enableban.description=С ее помощью можно блокировать атаки с определенных адресов
|
||||
settings.geolink=Ссылка на внешний geolocation сервис
|
||||
settings.geolink.description=На любом IP адресе можно будет открыть небольшое окно с геоинформацией. Можно использовать {ip}.
|
||||
settings.geolinkparams=Опции для окна с геоинформацией
|
||||
settings.geolinkparams.description=Размер окна и наличие тулбаров
|
||||
settings.host=Ссылка на ваш веб сайт
|
||||
settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне
|
||||
settings.logo=Лого компании
|
||||
|
@ -45,62 +45,67 @@ if($handle = opendir($stylesfolder)) {
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'email', 'title', 'logo', 'hosturl', 'enableban', 'usernamepattern', 'usercanchangename',
|
||||
'chatstyle', 'chattitle', 'geolink', 'geolinkparams');
|
||||
|
||||
loadsettings();
|
||||
$email = $settings['email'];
|
||||
$title = $settings['title'];
|
||||
$logo = $settings['logo'];
|
||||
$hosturl = $settings['hosturl'];
|
||||
$enableban = $settings['enableban'];
|
||||
$usernamepattern = $settings['usernamepattern'];
|
||||
$usercanchangename = $settings['usercanchangename'];
|
||||
$chatstyle = $settings['chatstyle'];
|
||||
$chattitle = $settings['chattitle'];
|
||||
$params = array();
|
||||
foreach($options as $opt) {
|
||||
$params[$opt] = $settings[$opt];
|
||||
}
|
||||
|
||||
if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
|
||||
$email = getparam('email');
|
||||
$title = getparam('title');
|
||||
$logo = getparam('logo');
|
||||
$hosturl = getparam('hosturl');
|
||||
$enableban = verifyparam("enableban","/^on$/", "") == "on" ? "1" : "0";
|
||||
$usernamepattern = getparam('usernamepattern');
|
||||
$usercanchangename = verifyparam("usercanchangename", "/^on$/", "") == "on" ? "1" : "0";
|
||||
$chattitle = getparam('chattitle');
|
||||
$params['email'] = getparam('email');
|
||||
$params['title'] = getparam('title');
|
||||
$params['logo'] = getparam('logo');
|
||||
$params['hosturl'] = getparam('hosturl');
|
||||
$params['enableban'] = verifyparam("enableban","/^on$/", "") == "on" ? "1" : "0";
|
||||
$params['usernamepattern'] = getparam('usernamepattern');
|
||||
$params['usercanchangename'] = verifyparam("usercanchangename", "/^on$/", "") == "on" ? "1" : "0";
|
||||
$params['chattitle'] = getparam('chattitle');
|
||||
$params['geolink'] = getparam('geolink');
|
||||
$params['geolinkparams'] = getparam('geolinkparams');
|
||||
|
||||
$chatstyle = verifyparam("chatstyle","/^\w+$/", $chatstyle);
|
||||
if(!in_array($chatstyle, $stylelist)) {
|
||||
$chatstyle = $stylelist[0];
|
||||
$params['chatstyle'] = verifyparam("chatstyle","/^\w+$/", $params['chatstyle']);
|
||||
if(!in_array($params['chatstyle'], $stylelist)) {
|
||||
$params['chatstyle'] = $stylelist[0];
|
||||
}
|
||||
|
||||
if($email && !is_valid_email($email)) {
|
||||
if($params['email'] && !is_valid_email($params['email'])) {
|
||||
$errors[] = getlocal("settings.wrong.email");
|
||||
}
|
||||
|
||||
if($params['geolinkparams']) {
|
||||
foreach(split(",", $params['geolinkparams']) as $oneparam) {
|
||||
if(!preg_match("/^\s*(toolbar|scrollbars|location|status|menubar|width|height|resizable)=\d{1,4}$/", $oneparam)) {
|
||||
$errors[] = "Wrong link parameter: \"$oneparam\", should be one of 'toolbar, scrollbars, location, status, menubar, width, height or resizable'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors) == 0) {
|
||||
$settings['email'] = $email;
|
||||
$settings['title'] = $title;
|
||||
$settings['logo'] = $logo;
|
||||
$settings['hosturl'] = $hosturl;
|
||||
$settings['enableban'] = $enableban;
|
||||
$settings['usernamepattern'] = $usernamepattern;
|
||||
$settings['usercanchangename'] = $usercanchangename;
|
||||
$settings['chatstyle'] = $chatstyle;
|
||||
$settings['chattitle'] = $chattitle;
|
||||
update_settings();
|
||||
foreach($options as $opt) {
|
||||
$settings[$opt] = $params[$opt];
|
||||
}
|
||||
update_settings();
|
||||
header("Location: $webimroot/operator/index.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$page['operator'] = topage(get_operator_name($operator));
|
||||
$page['formemail'] = topage($email);
|
||||
$page['formtitle'] = topage($title);
|
||||
$page['formlogo'] = topage($logo);
|
||||
$page['formhosturl'] = topage($hosturl);
|
||||
$page['formenableban'] = $enableban == "1";
|
||||
$page['formusernamepattern'] = topage($usernamepattern);
|
||||
$page['formusercanchangename'] = $usercanchangename == "1";
|
||||
$page['formchatstyle'] = $chatstyle;
|
||||
$page['formchattitle'] = topage($chattitle);
|
||||
$page['formemail'] = topage($params['email']);
|
||||
$page['formtitle'] = topage($params['title']);
|
||||
$page['formlogo'] = topage($params['logo']);
|
||||
$page['formhosturl'] = topage($params['hosturl']);
|
||||
$page['formgeolink'] = topage($params['geolink']);
|
||||
$page['formgeolinkparams'] = topage($params['geolinkparams']);
|
||||
$page['formenableban'] = $params['enableban'] == "1";
|
||||
$page['formusernamepattern'] = topage($params['usernamepattern']);
|
||||
$page['formusercanchangename'] = $params['usercanchangename'] == "1";
|
||||
$page['formchatstyle'] = $params['chatstyle'];
|
||||
$page['formchattitle'] = topage($params['chattitle']);
|
||||
$page['availableStyles'] = $stylelist;
|
||||
|
||||
start_html_output();
|
||||
|
@ -70,7 +70,7 @@ function get_useragent_version($userAgent) {
|
||||
|
||||
function get_user_addr($addr) {
|
||||
global $settings;
|
||||
if(preg_match( "/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $addr, $matches )) {
|
||||
if($settings['geolink'] && preg_match( "/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $addr, $matches )) {
|
||||
$userip = $matches[1];
|
||||
return get_popup(str_replace("{ip}", $userip, $settings['geolink']), htmlspecialchars($addr), "GeoLocation", "ip$userip", $settings['geolinkparams']);
|
||||
}
|
||||
|
@ -86,6 +86,14 @@
|
||||
<input type="text" name="hosturl" size="40" value="<?php echo form_value('hosturl') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('settings.host.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td class='formauth'><?php echo getlocal('settings.geolink') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="text" name="geolink" size="40" value="<?php echo form_value('geolink') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('settings.geolink.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td class='formauth'><?php echo getlocal('settings.geolinkparams') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="text" name="geolinkparams" size="40" value="<?php echo form_value('geolinkparams') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('settings.geolinkparams.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td class='formauth'><?php echo getlocal('settings.usernamepattern') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="text" name="usernamepattern" size="40" value="<?php echo form_value('usernamepattern') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('settings.usernamepattern.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user