move geolocation to server

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@222 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-12-09 00:12:55 +00:00
parent 2443b4e0a5
commit 46ae187087
5 changed files with 15 additions and 13 deletions

View File

@ -128,9 +128,6 @@ var HtmlGenerationUtils = {
return '<td width="30" align="center">'+
HtmlGenerationUtils.popupLink( webimRoot+'/operator/ban.php?'+(banid ? 'id='+banid : 'thread='+id), localized[2], "ban"+id, '<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">', 550, 440, null)+
'</td>';
},
ipCell: function(ipaddr,iptext) {
return HtmlGenerationUtils.popupLink('http:/'+'/api.hostip.info/get_html.php?ip='+ipaddr, "GeoLocation", "ip"+ipaddr, iptext, 400, 100,null);
}
};
@ -212,12 +209,6 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
etc = '<td class="table">'+NodeUtils.getNodeValue(node,"reason")+'</td>';
}
var ipExpr = new RegExp("([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)");
if (ipExpr.exec(vaddr) != null) {
var currIp = RegExp.$1;
vaddr = HtmlGenerationUtils.ipCell(currIp, vaddr);
}
if(canban) {
etc += HtmlGenerationUtils.banCell(id,banid);
}

View File

@ -1 +1 @@
var myAgent="";var lk=0;var myRealAgent="";function ok(){var pk=["\157pe\162a","\u006d\163\151\145","saf\u0061\u0072i","\u0066i\162\u0065\u0066\157\170","n\u0065t\163c\u0061p\145","m\u006fzil\154a"];var gj=navigator.userAgent.toLowerCase();for(var i=0;i<pk.length;i++){var dk=pk[i];if(gj.indexOf(dk)!=-1){myAgent=dk;if(!window.RegExp)break;var ek=new RegExp(dk+"[ \/\135\u003f([\u0030\u002d9\135\053\050\.[\060-\u0039]\u002b\u0029\u003f)");if(ek.exec(gj)!=null){lk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107\145c\153o")myAgent="\155o\u007a";} ok();function getEl(name){return document.getElementById(name);}
var myAgent="";var uk=0;var myRealAgent="";function hk(){var ik=["\157pera","\u006ds\151\145","\u0073\u0061fa\162\151","\u0066\u0069r\u0065fox","n\u0065t\u0073cap\145","\u006d\u006fz\u0069l\154\u0061"];var dj=navigator.userAgent.toLowerCase();for(var i=0;i<ik.length;i++){var jk=ik[i];if(dj.indexOf(jk)!=-1){myAgent=jk;if(!window.RegExp)break;var kk=new RegExp(jk+"[ \/]\u003f(\u005b\060\055\071]\053\u0028\.\u005b0\u002d9]\u002b\u0029\u003f)");if(kk.exec(dj)!=null){uk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107e\u0063\153\u006f")myAgent="mo\u007a";} hk();function getEl(name){return document.getElementById(name);}

File diff suppressed because one or more lines are too long

View File

@ -443,7 +443,9 @@ $settings = array(
'usernamepattern' => '{name}',
'usercanchangename' => '1',
'chatstyle' => 'default',
'chattitle' => 'Live Support'
'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',
);
$settingsloaded = false;
$settings_in_db = array();

View File

@ -68,6 +68,15 @@ function get_useragent_version($userAgent) {
return $userAgent;
}
function get_user_addr($addr) {
global $settings;
if(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']);
}
return htmlspecialchars($addr);
}
function thread_to_xml($thread,$link) {
global $state_chatting, $threadstate_to_string, $threadstate_key,
$webim_encoding, $operator, $settings,
@ -100,7 +109,7 @@ function thread_to_xml($thread,$link) {
$result .= " state=\"$state\" typing=\"".$thread['userTyping']."\">";
$result .= "<name>".htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'],$thread['remote'], $thread['userid'])))."</name>";
$result .= "<addr>".htmlspecialchars(htmlspecialchars($thread['remote']))."</addr>";
$result .= "<addr>".htmlspecialchars(get_user_addr($thread['remote']))."</addr>";
$result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>";
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";
$result .= "<modified>".$thread['unix_timestamp(dtmmodified)']."000</modified>";