From 4d29191044790361879a88a23bf42126b5b02dc1 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Fri, 3 Oct 2008 23:35:17 +0000 Subject: [PATCH] block visitors feature, turned off by default git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@154 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/js/users.js | 14 +- src/messenger/webim/images/ban.gif | Bin 0 -> 185 bytes .../webim/images/buttons/createban.gif | Bin 0 -> 1244 bytes src/messenger/webim/install/dbinfo.php | 10 ++ src/messenger/webim/js/brws.js | 2 +- src/messenger/webim/js/users.js | 2 +- src/messenger/webim/libs/chat.php | 4 + src/messenger/webim/libs/common.php | 3 +- .../webim/locales/en/images/delete.gif | Bin 0 -> 2524 bytes src/messenger/webim/locales/en/properties | 24 ++- .../webim/locales/ru/images/delete.gif | Bin 0 -> 2532 bytes src/messenger/webim/locales/ru/properties | 22 +++ src/messenger/webim/operator/ban.php | 119 ++++++++++++++ src/messenger/webim/operator/blocked.php | 57 +++++++ src/messenger/webim/operator/index.php | 4 +- src/messenger/webim/operator/settings.php | 4 + src/messenger/webim/operator/update.php | 9 ++ src/messenger/webim/view/ban.php | 117 ++++++++++++++ src/messenger/webim/view/blocked_visitors.php | 147 ++++++++++++++++++ src/messenger/webim/view/menu.php | 4 +- src/messenger/webim/view/settings.php | 4 + 21 files changed, 539 insertions(+), 7 deletions(-) create mode 100644 src/messenger/webim/images/ban.gif create mode 100644 src/messenger/webim/images/buttons/createban.gif create mode 100644 src/messenger/webim/locales/en/images/delete.gif create mode 100644 src/messenger/webim/locales/ru/images/delete.gif create mode 100644 src/messenger/webim/operator/ban.php create mode 100644 src/messenger/webim/operator/blocked.php create mode 100644 src/messenger/webim/view/ban.php create mode 100644 src/messenger/webim/view/blocked_visitors.php diff --git a/src/messenger/js/users.js b/src/messenger/js/users.js index 84abcf1f..ec21e839 100644 --- a/src/messenger/js/users.js +++ b/src/messenger/js/users.js @@ -119,6 +119,11 @@ var HtmlGenerationUtils = { gen += ''; } return HtmlGenerationUtils.generateOneRowTable(gen); + }, + banCell: function(id){ + return ''+ + HtmlGenerationUtils.popupLink( webimRoot+'/operator/ban.php?thread='+id, localized[2], "ban"+id, ''+localized[2]+'', 550, 440, null)+ + ''; } }; @@ -164,7 +169,8 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, { canopen = true; else if( attr.nodeName == "canview" ) canview = true; - + else if( attr.nodeName == "ban" ) + ban = attr.nodeValue; } function setcell(_table, row,id,pcontent) { @@ -190,6 +196,12 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, { var modified = NodeUtils.getNodeValue(node,"modified"); var message = NodeUtils.getNodeValue(node,"message"); var etc = ''+NodeUtils.getNodeValue(node,"useragent")+''; + + if(ban != null) { + etc = ''+NodeUtils.getNodeValue(node,"reason")+''; + } + + etc += HtmlGenerationUtils.banCell(id); etc = HtmlGenerationUtils.generateOneRowTable(etc); var startRow = CommonUtils.getRow(stateid, this.t); diff --git a/src/messenger/webim/images/ban.gif b/src/messenger/webim/images/ban.gif new file mode 100644 index 0000000000000000000000000000000000000000..bcc793d041b124c0b04a7e5fa26f8f3ab29eca6a GIT binary patch literal 185 zcmZ?wbhEHb__x*(8YFE{)(bk>Nv_;#s8TtLiBTKbPWCqUBYg|GLYazn&Tsf++(WeAA8C#j^HJR+CZ1$SES}DjNdJd;2?t4D~;f;)AL`c z=P{1pU#RE8-SrxJ&8yM!9e2YgiQg`d;45&hD~#VBdBz@k$A7x)9C5j1tLIUm<;33g z*5K(=q2(!i!%&~)r_l0mu<2c<=3S@e+vM!dMYI(xS}qd$#K(hua-=zdMxTR-@)+tLGzz-C(NcVyWj=oY{f9>@1Gpe7EZ(hT3bd z=_-rg9(~V?zwJVp;&-;|K9}NUtmiV1-!^WcPM_qF#O@+}&QG7@D{`(nl;SLn;5?P# zA%oXSoa7yBuW+*JMVsR{lHq{5>pGL+IFjJM-1Tg(=tr94Nu1**ir>xS_GYcUs>G-;P4h~I3c*&u}5VX5by%J40T+RWqk zR;1<}ak?IR%Q}|gHEf)5vFSW*m^N>pL73x6o8&clwY}T*IC!o9|Nj600000000000 z0000000000A^8LW008;`EC2ui02BZe000R80C(McA;*IUFs-UMiZCe;H6Yluc+sb? z1gmu=w)DX8ZHzcvcOtA=@u1!@F8W?*%a`R98!Ia=EJFcm!Jh^h3dCunFP^O+z=kza zk?0)(2c7~vD%1@|GG_Y7^caALU7b&i7Wrav1JMXsF%&?Hrq2zA0R_gv_@azJJ`gdA zp}6#@-6K{7f3(x-?@g8(dCfDlaif`uOxJ|uCb4^BEh z1#Z~Mr(%i-2oUlysHWqCyCeF3^=V+jgy3s4(mZe=xJ3#zVnXRVv?Rm`%E)l!1HgbX z5(VLA>5E`#K!$9B&lq3;K#$-92{@Fwp{1|M3>+dB1j=UsfcqBt4p0hjqnAE(J|0-8 zU?2?T?|I5f(1nZ G0RTJExNSZF literal 0 HcmV?d00001 diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php index 7bb18de8..bba7c4e9 100644 --- a/src/messenger/webim/install/dbinfo.php +++ b/src/messenger/webim/install/dbinfo.php @@ -60,6 +60,15 @@ $dbtables = array( "id" => "INT NOT NULL" ), + "chatban" => array( + "banid" => "INT NOT NULL auto_increment PRIMARY KEY", + "dtmcreated" => "datetime DEFAULT 0", + "dtmtill" => "datetime DEFAULT 0", + "address" => "varchar(255)", + "comment" => "varchar(255)", + "blockedCount" => "int DEFAULT 0" + ), + "chatconfig" => array ( "id" => "INT NOT NULL auto_increment PRIMARY KEY", "vckey" => "varchar(255)", @@ -72,6 +81,7 @@ $memtables = array(); $dbtables_can_update = array( "chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent"), "chatmessage" => array("agentId"), + "chatban" => array(), ); function show_install_err($text) { diff --git a/src/messenger/webim/js/brws.js b/src/messenger/webim/js/brws.js index dbbf770e..64167317 100644 --- a/src/messenger/webim/js/brws.js +++ b/src/messenger/webim/js/brws.js @@ -1 +1 @@ -var myAgent="";var rk=0;var myRealAgent="";function sk(){var tk=["\u006f\u0070\145\162\141","\155\u0073ie","\u0073\141fari","\146ir\u0065f\157x","n\145\164\163ca\160\145","mo\u007a\u0069\u006cl\141"];var lj=navigator.userAgent.toLowerCase();for(var i=0;i';} ,di:function(content){return'\074\u0074ab\u006c\145 w\u0069dth\075"\06100%"\040ce\u006cl\u0073\u0070a\143\u0069ng\u003d"\u0030"\u0020\u0063e\154\u006c\u0070\141dd\u0069\156g\u003d"\060"\040bo\162d\145\162\u003d"\u0030"\076\074\164r\u003e'+content+'\074/\164\141\142le>';} ,ei:function(fi,gi,id,ai,bi,ci,ct,vi){var wi=2;var link=gi+"\077\164\150\162e\141\u0064\075"+id;var xi='\074t\u0064\u0020c\154a\163s\075"ta\u0062l\u0065"\040\u0073\164\u0079le\u003d"\160a\144\u0064\151ng-\u006ce\u0066t\u003a0p\170\073\040\u0070\141\144ding-\162i\147\150t\072\u0030\u0070x\u003b"\076';xi+=si.ki((vi||!ai)?link:link+"\046\u0076\151ew\u006f\156\154y=\164ru\u0065",localized[bi?0:1],"I\155Ce\u006e\u0074er"+id,fi,01130,0644,ci);xi+='\074/\164d\076<\057\164d\u003e';if(bi){xi+='';xi+=si.ki(link,localized[0],"ImCe\156\u0074\145r"+id,'\074\151m\147\u0020sr\143\075"'+st+'\u002fi\u006dag\u0065\u0073\u002ft\142li\143\u006c\u0073\160\u0065ak\u002e\147i\146"\040\u0077i\u0064t\u0068\u003d"\061\065"\040\u0068\145\151\u0067\u0068\164\u003d"1\u0035" bo\u0072de\u0072="0"\040\141\154\164\u003d"'+localized[0]+'"\076',01130,0644,null);xi+='<\057\u0074d\076';wi++;} if(ai){xi+='';xi+=si.ki(link+"\046v\151\u0065wo\u006e\u006c\u0079=\u0074ru\u0065",localized[1],"\u0049\u006d\u0043\u0065n\164e\u0072"+id,'\074\u0069\u006d\u0067 \163\u0072\143="'+st+'\057\151m\141\147e\163\u002ft\u0062\154i\143lr\145a\144\056gif"\040\167\u0069d\u0074\150="\0615"\u0020\150e\u0069ght="\061\065" \u0062or\144\145\u0072\075"\u0030"\u0020\141\154t\075"'+localized[1]+'"\076',0x258,0644,null);xi+='\074/\164\144\076';wi++;} if(ct!=""){xi+='\074/tr>\074\164\u0072\u003e<\164\144\u0020\u0063\154\141s\u0073="\146\151rstme\u0073\163\141g\145"\u0020al\151\147n\u003d"r\u0069\u0067h\164"\040\143ols\160\u0061\156\u003d"'+wi+'">\074\141\u0020h\u0072\145f="\152\u0061v\u0061sc\u0072ipt:\166\157\u0069\u0064\0500\u0029"\040t\151\164\u006ce="'+ct+'" o\156\u0063l\151\u0063\153\075"a\u006ce\162\u0074\u0028t\150\u0069\u0073.\164\u0069\164\u006ce\u0029\073\u0072\145\u0074urn f\141\u006c\u0073\145;">';xi+=ct.length>036?ct.substring(0,0x1e)+'.\056\056':ct;xi+='<\u002fa><\057\u0074d>';} return si.di(xi);} } ;sq.yi=mn.nn();mn.sn(sq.yi,sq.lq,{qn:function(pq){this.oq(pq);this.pq.ri=this.ri.on(this);this.pq.iu=this.iu.on(this);this.pq.hu=this.hu.on(this);this.pq.zi=0;this.$i=new Object();this._i=0;this.t=this.pq.mj;this.nj=new sq.qi(this.pq);} ,ri:function(){return"\u0063\157\155p\u0061n\171\u003d"+this.pq.company+"&s\u0069\156c\u0065\075"+this.pq.zi;} ,$t:function(ku){this.pq.status.innerHTML=ku;} ,iu:function(s){this.$t(s);} ,qj:function(rh){var id,rj,sj,ai=false,bi=false,ci=null;for(var i=0;i=ej.rowIndex)){si.ui(this.t,ji.rowIndex+1);this.t.deleteRow(ji.rowIndex);this.$i[id]=null;ji=null;} if(ji==null){ji=this.t.insertRow(dj.rowIndex+1);si.ii(this.t,dj.rowIndex+2);ji.id="t\150\162"+id;this.$i[id]=new Array(kj,oj,rj);ls.insertCell(ji,"\u006e\141\155\u0065","ta\u0062\u006c\u0065",null,(27+3),si.ei(ij,this.pq.agentservl,id,ai,bi,ci,ct,rj!='\u0063\u0068\u0061\u0074'));si.ti(ji);ls.insertCell(ji,"c\u006f\156\164id","t\141\u0062\u006c\145","\143\u0065n\u0074e\u0072",null,jj);si.ti(ji);ls.insertCell(ji,"\u0073\u0074\141\u0074\u0065","\164\u0061b\154\u0065","\u0063\145\u006eter",null,sj);si.ti(ji);ls.insertCell(ji,"\u006f\160","ta\u0062\154e","c\145nt\u0065r",null,lj);si.ti(ji);ls.insertCell(ji,"\u0074\u0069\u006d\145","t\141ble","c\145\156\u0074\145r",null,this.fj(kj));si.ti(ji);ls.insertCell(ji,"\167\u0061it","\u0074a\u0062l\145","c\u0065\u006e\164\145r",null,(rj!='\143\150at'?this.fj(oj):'-'));si.ti(ji);ls.insertCell(ji,"\u0065\164c","ta\u0062\154\145","c\u0065nt\145\162",null,pj);if(rj=='\167\u0061\u0069\u0074'||rj=='\160\u0072i\157')return true;} else{this.$i[id]=new Array(kj,oj,rj);uj(this.t,ji,"\156\141\155\u0065",si.ei(ij,this.pq.agentservl,id,ai,bi,ci,ct,rj!='\143\150a\u0074'));uj(this.t,ji,"\u0063\157\u006e\u0074\u0069d",jj);uj(this.t,ji,"\163\164a\164e",sj);uj(this.t,ji,"\157p",lj);uj(this.t,ji,"\u0074\151\155\145",this.fj(kj));uj(this.t,ji,"\167\141\151\u0074",(rj!='\u0063ha\u0074'?this.fj(oj):'\u002d'));uj(this.t,ji,"e\164\u0063",pj);} return false;} ,gj:function(){function aj(t,id,bj){var dj=t.rows[id];var ej=t.rows[id+"\u0065nd"];if(dj==null||ej==null)return;var cj=ej.cells["\u0073\u0074at\u0075s"];if(cj==null)return;cj.innerHTML=(dj.rowIndex+1==ej.rowIndex)?bj:"";cj.height=(dj.rowIndex+1==ej.rowIndex)?036:012;} aj(this.t,"\u0077\141\u0069\164",this.pq.noclients);aj(this.t,"\u0070\162i\157",this.pq.noclients);aj(this.t,"\143\150\u0061\164",this.pq.noclients);} ,fj:function(vj){var wj=Math.floor(((new Date()).getTime()-vj-this._i)/(684+316));var xj=Math.floor(wj/0x3c);var yj="";wj=wj%074;if(wj<(7+3))wj="\u0030"+wj;if(xj>=074){var zj=Math.floor(xj/(54+6));xj=xj%0x3c;if(xj<012)xj="\u0030"+xj;yj=zj+":";} return yj+xj+":"+wj;} ,$j:function(){for(var i in this.$i){if(this.$i[i]!=null){var value=this.$i[i];var ji=ls.os("t\150r"+i,this.t);if(ji!=null){function uj(ds,ji,id,hj){var ws=ls.fs(id,ji,ds);if(ws)ws.innerHTML=hj;} uj(this.t,ji,"tim\145",this.fj(value[0]));uj(this.t,ji,"w\u0061i\u0074",(value[2]!='\143hat'?this.fj(value[1]):'\u002d'));} } } } ,hu:function(_j){var mk=false;if(_j.tagName=='t\u0068r\145\u0061\u0064s'){var nk=qs.ks(_j,"\164\u0069m\u0065");var qk=qs.ks(_j,"r\145\u0076\u0069s\151\157\u006e");if(nk)this._i=(new Date()).getTime()-nk;if(qk)this.pq.zi=qk;for(var i=0;i<_j.childNodes.length;i++){var rh=_j.childNodes[i];if(rh.tagName=='\164\150\u0072\u0065\u0061d')if(this.qj(rh))mk=true;} this.gj();this.$j();this.$t("U\u0070 \u0074o\u0020\144\u0061\u0074e");if(mk){xs(st+'\057\163o\u0075\u006eds\057n\u0065\167\137u\u0073\u0065\162\056\167\u0061\166');window.focus();} } else if(_j.tagName=='e\u0072\u0072o\162'){this.$t(qs.rs(_j,"d\145s\u0063r"));} else{this.$t("rec\157\u006e\156\145\u0063t\151\156\147");} } } );var st="";kr.lr(window,'\u006fnl\157\u0061d',function(){st=updaterOptions.wroot;new sq.yi(({mj:$("\164hre\u0061d\u006c\u0069st"),status:$("\u0063o\156n\u0073t\141\164u\u0073")} ).un(updaterOptions||{} ));} ); \ No newline at end of file +sq.qi=mn.nn();mn.sn(sq.qi,sq.lq,{qn:function(pq){this.oq(pq);this.pq.onComplete=this.ot.on(this);this.pq.jr=this.pt.on(this);this.pq.hr=this._q.on(this);this.pq.timeout=(3262+1738);this.frequency=(this.pq.frequency||2);this.dt={} ;this.xt();} ,pt:function(yt,zt){if(this.pq.iu)this.pq.iu("\u006fffli\156\u0065\054\040\162\u0065\143\u006f\156n\u0065c\u0074\151\156g");this._t();this.mu=setTimeout(this.xt.on(this),(723+277));} ,_q:function(yt){if(this.pq.iu)this.pq.iu("\164i\u006de\157\165\164\u002c\u0020\162\145c\157\u006e\156\u0065c\u0074i\u006e\147");this._t();this.mu=setTimeout(this.xt.on(this),(692+308));} ,_t:function(){if(this.dt.pq)this.dt.pq.onComplete=undefined;clearTimeout(this.mu);} ,xt:function(){if(this.pq.ri)this.pq.fq=(this.pq.ri)();this.dt=new sq.vq(this.pq.url,this.pq);} ,ot:function(ou){try{var uu=sq.uq(ou);if(uu){(this.pq.hu||sq.kq)(uu);} else{if(this.pq.iu)this.pq.iu("\u0072e\u0063onne\143\u0074\u0069\156\u0067");} } catch(e){} this.mu=setTimeout(this.xt.on(this),this.frequency*(667+333));} } );var si={ti:function(es){var ws=es.insertCell(-1);ws.style.backgroundImage='\u0075\u0072\154('+st+'/\151mag\145\163\057ta\142l\u0065\144i\u0076\u0033\056gi\146\u0029';ws.innerHTML='\u003ci\u006d\147\040src\075"'+st+'\057\u0069\155a\u0067es\u002f\u0066r\145\u0065\056\147\u0069\u0066"\040\u0077\151\144\u0074\u0068\075"\063"\040h\u0065\151\u0067\150t\u003d"\u0031"\u0020\142ord\145r="0"\040\u0061\154t\u003d""\u003e';} ,ui:function(ds,hi){ds.deleteRow(hi+2);ds.deleteRow(hi+1);ds.deleteRow(hi);} ,ii:function(ds,hi){var ji=ds.insertRow(hi);var ws=ji.insertCell(-1);ws.colSpan=015;ws.height=2;ji=ds.insertRow(hi);ws=ji.insertCell(-1);ws.colSpan=(12+1);ws.style.backgroundColor='\043\u00451E\u0031E1';ws.innerHTML='\u003c\u0069\155g \163\u0072\143\075"'+st+'/i\u006d\141\u0067\145\u0073/f\u0072\145e\u002e\u0067\u0069f" \u0077\u0069dt\u0068\075"\061"\040\150e\u0069g\u0068\164\u003d"\061" \142or\u0064e\u0072="\u0030" \u0061\154t=""\076';ji=ds.insertRow(hi);ws=ji.insertCell(-1);ws.colSpan=(9+4);ws.height=2;} ,ki:function(link,title,li,oi,width,height,pi){return'\074a \150r\u0065\u0066="'+link+'"'+(pi!=null?'\u0020\u0063l\141\163s\u003d"'+pi+'"':'')+' t\141\162\u0067e\164\075"\u005fb\u006can\153" \u0074i\u0074\154\145="'+title+'" onc\154i\u0063\u006b="\u0074\150\u0069s\056\156\145\u0077\127\151nd\157\167 \u003d \u0077i\156dow\u002e\157\160\145n\u0028\''+link+'\'\u002c\u0020\''+li+'\'\u002c\040\'\164oo\u006c\u0062a\u0072\075\060\054s\u0063\162\u006fl\154\u0062\u0061r\163\u003d\060,loc\141t\u0069on\u003d\u0030,s\u0074at\165s\075\061,\u006d\u0065\u006eu\142\141\162\u003d\u0030\054\u0077\u0069dt\u0068\075'+width+',\150eig\u0068\164='+height+',\162e\u0073i\172\u0061\142le\u003d\u0031\');\u0074h\u0069\u0073\056\u006eew\u0057ind\u006fw.\146\157c\165\163\u0028\u0029\u003bt\u0068\u0069\163\u002e\156\u0065\167\u0057\u0069\156d\157w\056o\u0070e\156e\162\u003d\167\151\u006e\u0064\157w;\u0072e\u0074urn \u0066\u0061\u006cs\u0065;"\u003e'+oi+'\074\u002f\u0061>';} ,di:function(content){return'\074\u0074ab\u006c\145 w\u0069dth\075"\06100%"\040ce\u006cl\u0073\u0070a\143\u0069ng\u003d"\u0030"\u0020\u0063e\154\u006c\u0070\141dd\u0069\156g\u003d"\060"\040bo\162d\145\162\u003d"\u0030"\076\074\164r\u003e'+content+'\074/\164\141\142le>';} ,ei:function(fi,gi,id,ai,bi,ci,ct,vi){var wi=2;var link=gi+"\077\164\150\162e\141\u0064\075"+id;var xi='\074t\u0064\u0020c\154a\163s\075"ta\u0062l\u0065"\040\u0073\164\u0079le\u003d"\160a\144\u0064\151ng-\u006ce\u0066t\u003a0p\170\073\040\u0070\141\144ding-\162i\147\150t\072\u0030\u0070x\u003b"\076';xi+=si.ki((vi||!ai)?link:link+"\046\u0076\151ew\u006f\156\154y=\164ru\u0065",localized[bi?0:1],"I\155Ce\u006e\u0074er"+id,fi,01130,0644,ci);xi+='\074/\164d\076<\057\164d\u003e';if(bi){xi+='';xi+=si.ki(link,localized[0],"ImCe\156\u0074\145r"+id,'\074\151m\147\u0020sr\143\075"'+st+'\u002fi\u006dag\u0065\u0073\u002ft\142li\143\u006c\u0073\160\u0065ak\u002e\147i\146"\040\u0077i\u0064t\u0068\u003d"\061\065"\040\u0068\145\151\u0067\u0068\164\u003d"1\u0035" bo\u0072de\u0072="0"\040\141\154\164\u003d"'+localized[0]+'"\076',01130,0644,null);xi+='<\057\u0074d\076';wi++;} if(ai){xi+='';xi+=si.ki(link+"\046v\151\u0065wo\u006e\u006c\u0079=\u0074ru\u0065",localized[1],"\u0049\u006d\u0043\u0065n\164e\u0072"+id,'\074\u0069\u006d\u0067 \163\u0072\143="'+st+'\057\151m\141\147e\163\u002ft\u0062\154i\143lr\145a\144\056gif"\040\167\u0069d\u0074\150="\0615"\u0020\150e\u0069ght="\061\065" \u0062or\144\145\u0072\075"\u0030"\u0020\141\154t\075"'+localized[1]+'"\076',0x258,0644,null);xi+='\074/\164\144\076';wi++;} if(ct!=""){xi+='\074/tr>\074\164\u0072\u003e<\164\144\u0020\u0063\154\141s\u0073="\146\151rstme\u0073\163\141g\145"\u0020al\151\147n\u003d"r\u0069\u0067h\164"\040\143ols\160\u0061\156\u003d"'+wi+'">\074\141\u0020h\u0072\145f="\152\u0061v\u0061sc\u0072ipt:\166\157\u0069\u0064\0500\u0029"\040t\151\164\u006ce="'+ct+'" o\156\u0063l\151\u0063\153\075"a\u006ce\162\u0074\u0028t\150\u0069\u0073.\164\u0069\164\u006ce\u0029\073\u0072\145\u0074urn f\141\u006c\u0073\145;">';xi+=ct.length>036?ct.substring(0,0x1e)+'.\056\056':ct;xi+='<\u002fa><\057\u0074d>';} return si.di(xi);} ,yi:function(id){return'<\u0074\144 \u0077i\144\u0074\u0068="\u0033\060"\u0020\141\u006c\u0069\u0067\156="\u0063e\156\u0074\145\162">'+si.ki(st+'\u002f\157\160\u0065\u0072\141t\157\162/\142a\156.\160\150p?\u0074\150r\u0065\u0061\u0064\075'+id,localized[2],"\142a\156"+id,'\u003ci\u006d\147\040\u0073\162\143="'+st+'\u002f\u0069\u006d\u0061g\u0065\u0073\057\u0062\u0061\156.\147\u0069f"\u0020\167id\u0074\150\u003d"\061\u0035" \u0068eigh\164\075"15"\u0020b\157r\144\145\u0072\u003d"\060"\u0020al\164="'+localized[2]+'">',0x226,0670,null)+'=fj.rowIndex)){si.ui(this.t,ji.rowIndex+1);this.t.deleteRow(ji.rowIndex);this._i[id]=null;ji=null;} if(ji==null){ji=this.t.insertRow(ej.rowIndex+1);si.ii(this.t,ej.rowIndex+2);ji.id="t\u0068\162"+id;this._i[id]=new Array(lj,pj,sj);ls.insertCell(ji,"\156\141m\145","\u0074ab\u006ce",null,036,si.ei(jj,this.pq.agentservl,id,ai,bi,ci,ct,sj!='\143h\141t'));si.ti(ji);ls.insertCell(ji,"\143ontid","\164\141bl\145","ce\u006et\u0065\162",null,kj);si.ti(ji);ls.insertCell(ji,"state","\u0074ab\u006ce","\u0063\u0065\156\u0074e\u0072",null,tj);si.ti(ji);ls.insertCell(ji,"\u006f\160","t\u0061\u0062l\145","c\u0065nt\145\162",null,oj);si.ti(ji);ls.insertCell(ji,"\164\u0069\155\145","\164a\u0062\154\u0065","c\145\u006e\u0074e\u0072",null,this.gj(lj));si.ti(ji);ls.insertCell(ji,"\u0077ai\u0074","\164ab\154\145","\u0063\u0065nt\u0065\u0072",null,(sj!='c\150a\164'?this.gj(pj):'\u002d'));si.ti(ji);ls.insertCell(ji,"etc","\u0074\141\142le","ce\u006eter",null,dj);if(sj=='w\141\u0069\164'||sj=='p\u0072i\157')return true;} else{this._i[id]=new Array(lj,pj,sj);hj(this.t,ji,"n\141\u006d\145",si.ei(jj,this.pq.agentservl,id,ai,bi,ci,ct,sj!='\143\u0068at'));hj(this.t,ji,"cont\u0069d",kj);hj(this.t,ji,"\u0073\164a\u0074\145",tj);hj(this.t,ji,"\157\u0070",oj);hj(this.t,ji,"\164\151m\u0065",this.gj(lj));hj(this.t,ji,"\u0077\u0061\151t",(sj!='c\150\u0061t'?this.gj(pj):'\055'));hj(this.t,ji,"\u0065\164c",dj);} return false;} ,aj:function(){function bj(t,id,cj){var ej=t.rows[id];var fj=t.rows[id+"end"];if(ej==null||fj==null)return;var vj=fj.cells["\163ta\u0074u\163"];if(vj==null)return;vj.innerHTML=(ej.rowIndex+1==fj.rowIndex)?cj:"";vj.height=(ej.rowIndex+1==fj.rowIndex)?(27+3):012;} bj(this.t,"\167\141it",this.pq.noclients);bj(this.t,"p\162io",this.pq.noclients);bj(this.t,"\u0063\u0068\u0061t",this.pq.noclients);} ,gj:function(wj){var xj=Math.floor(((new Date()).getTime()-wj-this.mj)/01750);var yj=Math.floor(xj/(55+5));var zj="";xj=xj%074;if(xj<(8+2))xj="\u0030"+xj;if(yj>=0x3c){var $j=Math.floor(yj/(41+19));yj=yj%074;if(yj<012)yj="0"+yj;zj=$j+"\u003a";} return zj+yj+"\u003a"+xj;} ,_j:function(){for(var i in this._i){if(this._i[i]!=null){var value=this._i[i];var ji=ls.os("\164\150\162"+i,this.t);if(ji!=null){function hj(ds,ji,id,ij){var ws=ls.fs(id,ji,ds);if(ws)ws.innerHTML=ij;} hj(this.t,ji,"\164i\155\u0065",this.gj(value[0]));hj(this.t,ji,"\167\u0061it",(value[2]!='cha\u0074'?this.gj(value[1]):'-'));} } } } ,hu:function(mk){var nk=false;if(mk.tagName=='\164\150r\145ads'){var qk=qs.ks(mk,"t\u0069\155\145");var rk=qs.ks(mk,"\u0072e\166\151si\u006f\u006e");if(qk)this.mj=(new Date()).getTime()-qk;if(rk)this.pq.$i=rk;for(var i=0;i unix_timestamp(CURRENT_TIMESTAMP) AND address = '".quote_smart($addr,$link)."'", $link ); +} + function thread_by_id($id) { $link = connect(); $thread = thread_by_id_($id,$link); diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index ac750407..8a86c873 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -425,7 +425,8 @@ $settings = array( 'email' => '', /* inbox for left messages */ 'title' => 'Company', 'hosturl' => 'http://webim.sourceforge.net', - 'logo' => '' + 'logo' => '', + 'enableban' => '0' ); $settingsloaded = false; $settings_in_db = array(); diff --git a/src/messenger/webim/locales/en/images/delete.gif b/src/messenger/webim/locales/en/images/delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..46a4218e3aa370656772a2bfb1a2c1521511d723 GIT binary patch literal 2524 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 empty to keep previous one. +form.field.address=Visitor's Address +form.field.address.description=Ex: 12.23.45.123 or todo.com +form.field.ban_days=Days +form.field.ban_days.description=How many days to ignore this address +form.field.ban_comment=Comment +form.field.ban_comment.description=Reason of block button.enter=Enter button.save=Save button.search=Search +button.delete=Delete tag.pagination.info=Page {0} of {1}, {2}-{3} from {4} tag.pagination.no_items=Found 0 elements +tag.pagination.no_items.elements=No elements image.chat.history=/locales/en/images/history.gif image.chat.message=/locales/en/images/message.gif image.button.login=/locales/en/images/login.gif image.button.save=/locales/en/images/save.gif image.button.search=/locales/en/images/search.gif +image.button.delete=/locales/en/images/delete.gif +page_bans.list=List of banned IPs: +page_bans.title=Blocked +page_bans.to=Till +page_bans.add=Add address +page_ban.title=Block address +page_ban.intro=Here you can block malicious visitors that affect you work by spam messages. +page_ban.sent=Address {0} is blocked for specified number of days. +page_ban.thread=You opened this window for "{0}" thread, Address field is already filled. Select number of days and click Send. admin.content.client_settings=Specify options affecting chat window and common system behavior app.title=Web Instant Messenger +ban.error.duplicate=Address {0} is already in the system, click here to edit it. chat.came.from=Vistor came from page {0} confirm.take.head=Change operator confirm.take.message=Visitor {0} is already served by {1}.
Are your really sure you wan't to start chatting the visitor? confirm.take.no=No, close the window confirm.take.yes=Yes, I'm sure +content.blocked=Here you can defend from malicious visitors. content.history=Search the dialogs history content.logoff=Log out of the system. errors.wrong_field=Please fill "{0}" correctly. @@ -193,6 +212,7 @@ leavemessage.title=Leave your message leftMenu.client_settings=Settings localeid=English (en) menu.agents=Agents list +menu.blocked=Blocked visitors menu.main=Main menu.operator=You are {0} no_such_operator=No such operator @@ -209,8 +229,10 @@ settings.company.title=Company title settings.company.title.description=Enter your company title 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.host=URL of your website -settings.host.description=Destination for you company name or logo link +settings.host.description=Destination for you company name or logo link settings.logo=Your company logo settings.logo.description=Enter http address of your company logo settings.no.title=Please enter your company title diff --git a/src/messenger/webim/locales/ru/images/delete.gif b/src/messenger/webim/locales/ru/images/delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b0f8f63a3d7395c941d45a115ba80b7282d42f9 GIT binary patch literal 2532 zcmVp_Xq$k^y9aJt~&;5vrMMUB-yjLjlw zv^|Q+bUQBx<(L=Jq9Qw>E&s z-QC?+qvtn$$vlb6Q=8;4cEVqg$1iTSN|D^{@bz1a#88{xTBhh8Vz4)Y$5EN%OPtt6 zl+vul;4XH)M3d4mc)%`rzdD4;NtxDUu=8TB@h5J$J%`Q7*y>cB8 z#jVHTL6FZLWU)Vn&^v_7X0!BTuktZ?!&j^0DssC|q1<4T$w-gcLXFcqh{;8U#X5z_ zHGjoAce^lhxh`?IB4@Ps_xJYp_WAkw^78WW@$u~J?CR?3{r&y!?(XgF?f?J(@bK{K z>+9&~=;`U{=H}+-=jY_)CxY|aR(=>p^($dns zy}e?V%PVxe;^N}@{Qms?{yKcXHGIbD?ef09zG=AlGkwE4fXndn_d0*VMvT}=me=d= z^!@(-mA2V3eZxtR&O?dSQla2apWIHG-$jtrK!3kBfyT<&>PVH?Oqbj7`28VhvnOe@ zWS7iWq3B$v>^XbC-|hHLpV~lvz}MsOtHa;y@bjz0;O+7D?(y|dm*F;l#jeNWV5;v+ zoYyF6vtX?7VXpC2p5{D)&Xcp)>+kX@ak?>l!ep4t%*@P9nA=vL=Qne>RHxuKgU3vq z*x~T{AZ4*3WwS1Hz(9-6OqkqClhE?^`9_t~Iefr5f5AqT)JK)pO_bkJquo)Y-pt(X zEp@)k+w3@j$~l6`H*>c-gUjFF-~9gnFnPf5@9*>T^Z5Aq^z`)l`uh9(`}Otp{QUfv zmzMwl00000A^8LW00930EC2ui0B!&y000R80RIUbNU)&6g9sBUT*$DY!-oU;q>+Q? z%^N&&((r-Ev7^V22-Dc9q{x64eD=H;*i*?)8jvt!$|M*EkfJdAa#q<{9lNqDBpu1r_EvZWpAOiw60Kf_ju6|KLA?oy!2n=65!9*@A zaMDOSOFB6nKmJ(gkFjihcTd3LEjy{RC}K(`rk=8RZ5Ci$D{92`bRnu2+&1RbK9T6* zN)4a1(tseRxOzk(gs|Xh9t%hSf)ID0(j;@x<-;$PRQ{`vz!-wpp?L*n757*t5 zS~y<(0nbq2AyXDLpV>+kqZcqbTh)f5>gmntxny~^>a06}9A=Z?3cE0P(t!`ZMM~G_on%T8bZ}$@%76J!`{rN)+it|So zv=G3@8Simn*a8p#g$TeQ8n7ulLB%B)0D&T$BLWnlK?8VEL08S;4{Ugc4vOK7AVA_t z{~$Kkx-55v)MhhcDB0D}lX0`l>HfZRf3ezubw z6aWVTK*lT*pd+t+0R})wR~v?~0(68R1s0HwlcvO$^Jxige}i8O<#szX`He+&^cLVM zR>#BPZGeG{fYz;2IA& zl!b6MF!97LQf6!lN-m`|-Z`yXj&t1qkk>~*262|R+=3W#S<77NvLBI>$~|0ggLvfP z1Z)sn9(F_jhcPQo30mIUGe)cT-sOUYOs-d?;#W>;pkca1-DfRWqCcrSOzzRQe!=0tjIM zUywlz^q_~o1SSBX@W36E;fE(l34I&VQqZiB)D>xJh7+w=@Q8OfAbRwFv@8QUvs%^0 zYIUn?Si>2%YKD}GH7W#{f(AHYglHgP0!TnY0Ro_b33ww2w~z&tinS=iC`&CnAs#njjhLT3MxR}61Y1~i;?DRnd3Lvcpri%d#D8Lp} zK!geE`W$(%=DXkxuXssg5Hys*FvAc=6dKWpJKUiW+z0|9-~o&aI7keMS&V)ivXwei zNEA7MgbzkA0uwyL0?~Am0p7CT1|MY*Shx^dh@~%kRK>vпустым, чтобы сохранить старый. +form.field.address=Адрес посетителя +form.field.address.description=Например: 12.23.45.123 или relay.info.ru +form.field.ban_days=Дни +form.field.ban_days.description=Количество дней,
на которое будет запрещен адрес +form.field.ban_comment=Комментарий +form.field.ban_comment.description=Причина запрета button.enter=Войти button.save=Сохранить button.search=Искать +button.delete=Удалить tag.pagination.info=Страница {0} из {1}, показаны {2}-{3} из {4} tag.pagination.no_items=Ничего не найдено +tag.pagination.no_items.elements=Нет элементов для отображения. image.chat.history=/locales/ru/images/history.gif image.chat.message=/locales/ru/images/message.gif image.button.login=/locales/ru/images/login.gif image.button.save=/locales/ru/images/save.gif image.button.search=/locales/ru/images/search.gif +image.button.delete=/locales/ru/images/delete.gif +page_bans.list=Список запрещенных адресов: +page_bans.title=Запреты +page_bans.to=До +page_bans.add=Добавить адрес +page_ban.title=Запрет адреса +page_ban.intro=С помощью механизма запрета Вы можете бороться с нежелательными посетителями, которые нарушают работу консультантов, открывая большое количество окон или присылая спам сообщения. +page_ban.sent=Адрес {0} запрещен на указанное число дней. +page_ban.thread=Вы открыли это окно для диалога с "{0}", поэтому поле Адрес уже заполнено. Выберите количество дней и нажмите Отправить. admin.content.client_settings=Вы можете задать опции влияющие на отображение чат окна и общее поведение системы app.title=Веб Мессенджер +ban.error.duplicate=Адрес {0} уже зарегестрирован в системе, нажмите здесь чтобы отредактировать его. chat.came.from=Посетитель пришел со страницы {0} confirm.take.head=Сменить оператора confirm.take.message=С посетителем {0} уже общается {1}.
Вы уверены что хотите сменить его? confirm.take.no=Нет, закрыть окно confirm.take.yes=Да, я уверен +content.blocked=Здесь можно защищаться от спама и вредных посетителей content.history=Поиск по истории диалогов content.logoff=Покинуть систему. errors.wrong_field=Неправильно заполнено поле "{0}" @@ -193,6 +212,7 @@ leavemessage.title= leftMenu.client_settings=Настройки localeid=Russian (ru) menu.agents=Список агентов +menu.blocked=Нежелательные посетители menu.main=Главная menu.operator=Вы {0} no_such_operator=Запрашиваемая учетная запись не существует @@ -209,6 +229,8 @@ settings.company.title= settings.company.title.description=Введите название Вашей компании settings.email=Адрес электронной почты settings.email.description=Введите адрес электронной почты для получения сообщений от системы +settings.enableban=Включить функцию "Нежелательные посетители" +settings.enableban.description=С ее помощью можно блокировать атаки с определенных адресов settings.host=Ссылка на ваш веб сайт settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне settings.logo=Лого компании diff --git a/src/messenger/webim/operator/ban.php b/src/messenger/webim/operator/ban.php new file mode 100644 index 00000000..47493a88 --- /dev/null +++ b/src/messenger/webim/operator/ban.php @@ -0,0 +1,119 @@ + '', 'operator' => topage(get_operator_name($operator)) ); +$page['saved'] = false; +$page['thread'] = ''; +$page['threadid'] = ''; +$errors = array(); + +if( isset($_POST['address']) ) { + $banId = verifyparam( "banId", "/^(\d{1,9})?$/", ""); + $address = getparam("address"); + $days = getparam("days"); + $comment = getparam('comment'); + $threadid = isset($_POST['threadid']) ? getparam('threadid') : ""; + + if( !preg_match( "/^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})$/", $address )) { + if( !preg_match("/^([a-z0-9-]+\.)+[a-z0-9-]+$/", $address)) { + $errors[] = wrong_field("form.field.address"); + } + } + + if( !preg_match( "/^\d+$/", $days )) { + $errors[] = wrong_field("form.field.ban_days"); + } + + if( !$comment ) { + $errors[] = no_field("form.field.ban_comment"); + } + + $link = connect(); + $existing_ban = ban_for_addr_($address,$link); + mysql_close($link); + + if( (!$banId && $existing_ban) || + ( $banId && $existing_ban && $banId != $existing_ban['banid']) ) { + $errors[] = getlocal2("ban.error.duplicate",array($address,$existing_ban['banid'])); + } + + if( count($errors) == 0 ) { + $link = connect(); + $utime = time() + $days * 24*60*60; + if (!$banId) { + $query = sprintf( + "insert into chatban (dtmcreated,dtmtill,address,comment) values (CURRENT_TIMESTAMP,%s,'%s','%s')", + "FROM_UNIXTIME($utime)", + quote_smart($address,$link), + quote_smart($comment,$link)); + perform_query($query,$link); + } else { + $query = sprintf( + "update chatban set dtmtill = %s,address = '%s',comment = '%s' where banid = $banId", + "FROM_UNIXTIME($utime)", + quote_smart($address,$link), + quote_smart($comment,$link)); + perform_query($query,$link); + } + mysql_close($link); + + if(!$threadid) { + header("Location: $webimroot/operator/blocked.php"); + exit; + } else { + $page['saved'] = true; + $page['address'] = $address; + } + } else { + $page['banId'] = topage($banId); + $page['formaddress'] = topage($address); + $page['formdays'] = topage($days); + $page['formcomment'] = topage($comment); + $page['threadid'] = $threadid; + } +} else if(isset($_GET['id'])) { + $banId = verifyparam( 'id', "/^\d{1,9}$/"); + $link = connect(); + $ban = select_one_row("select banid,(unix_timestamp(dtmtill)-unix_timestamp(CURRENT_TIMESTAMP)) as days,address,comment from chatban where banid = $banId", $link); + mysql_close($link); + + if( $ban ) { + $page['banId'] = topage($ban['banid']); + $page['formaddress'] = topage($ban['address']); + $page['formdays'] = topage(round($ban['days']/86400)); + $page['formcomment'] = topage($ban['comment']); + } else { + $errors[] = "Wrong id"; + } +} else if(isset($_GET['thread'])) { + $threadid = verifyparam( 'thread', "/^\d{1,9}$/"); + $thread = thread_by_id($threadid); + if( $thread ) { + $page['thread'] = topage($thread['userName']); + $page['threadid'] = $threadid; + $page['formaddress'] = topage($thread['remote']); + $page['formdays'] = 15; + } +} + +start_html_output(); +require('../view/ban.php'); +exit; +?> \ No newline at end of file diff --git a/src/messenger/webim/operator/blocked.php b/src/messenger/webim/operator/blocked.php new file mode 100644 index 00000000..00ddd334 --- /dev/null +++ b/src/messenger/webim/operator/blocked.php @@ -0,0 +1,57 @@ + \ No newline at end of file diff --git a/src/messenger/webim/operator/index.php b/src/messenger/webim/operator/index.php index 0d970159..a98194c5 100644 --- a/src/messenger/webim/operator/index.php +++ b/src/messenger/webim/operator/index.php @@ -16,11 +16,13 @@ require_once('../libs/common.php'); require_once('../libs/operator.php'); $operator = check_login(); +loadsettings(); $page = array( 'operator' => topage(get_operator_name($operator)), 'version' => $version, - 'localeLinks' => get_locale_links("$webimroot/operator/index.php") + 'localeLinks' => get_locale_links("$webimroot/operator/index.php"), + 'showban' => $settings['enableban'] == "1" ); start_html_output(); diff --git a/src/messenger/webim/operator/settings.php b/src/messenger/webim/operator/settings.php index 686bf4a0..fc7ac798 100644 --- a/src/messenger/webim/operator/settings.php +++ b/src/messenger/webim/operator/settings.php @@ -39,12 +39,14 @@ $email = $settings['email']; $title = $settings['title']; $logo = $settings['logo']; $hosturl = $settings['hosturl']; +$enableban = $settings['enableban']; 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"; if($email && !is_valid_email($email)) { $errors[] = getlocal("settings.wrong.email"); @@ -55,6 +57,7 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) { $settings['title'] = $title; $settings['logo'] = $logo; $settings['hosturl'] = $hosturl; + $settings['enableban'] = $enableban; update_settings(); header("Location: $webimroot/operator/index.php"); exit; @@ -66,6 +69,7 @@ $page['formemail'] = topage($email); $page['formtitle'] = topage($title); $page['formlogo'] = topage($logo); $page['formhosturl'] = topage($hosturl); +$page['formenableban'] = $enableban == "1"; start_html_output(); require('../view/settings.php'); diff --git a/src/messenger/webim/operator/update.php b/src/messenger/webim/operator/update.php index 5d444847..f0b22193 100644 --- a/src/messenger/webim/operator/update.php +++ b/src/messenger/webim/operator/update.php @@ -85,6 +85,11 @@ function thread_to_xml($thread,$link) { $result .= " canview=\"true\""; } + $banForThread = ban_for_addr_($thread['remote'],$link); + if($banForThread) { + $result .= " ban=\"blocked\""; + } + $result .= " state=\"$state\" typing=\"".$thread['userTyping']."\">"; $result .= "".htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'],$thread['remote'], $thread['userid']))).""; $result .= "".htmlspecialchars(htmlspecialchars($thread['remote'])).""; @@ -92,6 +97,10 @@ function thread_to_xml($thread,$link) { $result .= ""; $result .= "".$thread['unix_timestamp(dtmmodified)']."000"; + if($banForThread) { + $result .= "".$banForThread['comment'].""; + } + $userAgent = get_useragent_version($thread['userAgent']); $result .= "".$userAgent.""; if( $thread["shownmessageid"] != 0 ) { diff --git a/src/messenger/webim/view/ban.php b/src/messenger/webim/view/ban.php new file mode 100644 index 00000000..c0a6ac29 --- /dev/null +++ b/src/messenger/webim/view/ban.php @@ -0,0 +1,117 @@ + + + + + + + + + + + + <?php echo getlocal("app.title") ?> - <?php echo getlocal("page_ban.title") ?> + + +"> +"> + + + + + + + + +
+ +
+

+
|">|">
+ + + + + + + + + + +
+
+ + 0 ) { ?> + + + + + + +
+ 0 ) { + print getlocal("errors.header"); + foreach( $errors as $e ) { + print getlocal("errors.prefix"); + print $e; + print getlocal("errors.suffix"); + } + print getlocal("errors.footer"); + } ?> + +
+ + + +
+
+ + +
+
+ + + + + + + + + + + + + +
*
+ +
*
+ +
+ +
+ + + + +
+
+ +
+ + + + diff --git a/src/messenger/webim/view/blocked_visitors.php b/src/messenger/webim/view/blocked_visitors.php new file mode 100644 index 00000000..7c8fd817 --- /dev/null +++ b/src/messenger/webim/view/blocked_visitors.php @@ -0,0 +1,147 @@ + + + + + + + + + + + + <?php echo getlocal("app.title") ?> - <?php echo getlocal("page_bans.title") ?> + + +"> +"> + + + + + + + + +
+ +
+

+
|">
+ + + +
+
+ 0 ) { ?> + + + + + + +
+ 0 ) { + print getlocal("errors.header"); + foreach( $errors as $e ) { + print getlocal("errors.prefix"); + print $e; + print getlocal("errors.suffix"); + } + print getlocal("errors.footer"); + } ?> + +
+ + + + + + + + + + +
+ + + + + + +
<?php echo getlocal(">"> + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + 30 ) { ?> + ... + + + + + + + + +
+
+ + + +
+ +
+ + +
+ + + + diff --git a/src/messenger/webim/view/menu.php b/src/messenger/webim/view/menu.php index 2c8a4d64..77021100 100644 --- a/src/messenger/webim/view/menu.php +++ b/src/messenger/webim/view/menu.php @@ -53,7 +53,9 @@





- + +


+





diff --git a/src/messenger/webim/view/settings.php b/src/messenger/webim/view/settings.php index b28a8b1a..6257d54b 100644 --- a/src/messenger/webim/view/settings.php +++ b/src/messenger/webim/view/settings.php @@ -82,6 +82,10 @@ + + /> + +