From c2d0852e83e76cf2452e9d07dcb7d0fd43bc6e3d Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 8 Mar 2009 20:53:16 +0000 Subject: [PATCH] update from branch (1.5.2) git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@399 c66351dc-e62f-0410-b875-e3a5c0b9693f --- .../org.eclipse.core.resources.prefs | 3 +- src/messenger/js/chat.js | 21 +++- src/messenger/webim/INSTALL_RUS.txt | 49 --------- src/messenger/webim/client.php | 11 +- src/messenger/webim/install/whatsnew.txt | 6 ++ src/messenger/webim/js/brws.js | 2 +- src/messenger/webim/js/chat.js | 2 +- src/messenger/webim/js/users.js | 2 +- src/messenger/webim/leavemessage.php | 13 ++- src/messenger/webim/libs/chat.php | 22 ++-- src/messenger/webim/libs/common.php | 57 ++++++++-- src/messenger/webim/libs/config.php | 42 ++------ src/messenger/webim/libs/pagination.php | 9 +- src/messenger/webim/locales/en/properties | 14 ++- src/messenger/webim/mail.php | 3 +- src/messenger/webim/operator/features.php | 12 +-- src/messenger/webim/operator/translate.php | 98 +++++++++++++++--- .../webim/styles/default/images/wmchat.png | Bin 3066 -> 3602 bytes .../webim/styles/default/templates/chat.tpl | 70 +++++++------ .../styles/default/templates/chatsimple.tpl | 2 +- .../webim/styles/original/images/wmchat.png | Bin 3780 -> 4457 bytes .../webim/styles/original/templates/chat.tpl | 17 ++- .../styles/original/templates/chatsimple.tpl | 2 +- src/messenger/webim/view/features.php | 4 + src/messenger/webim/view/pending_users.php | 4 +- src/messenger/webim/view/translatelist.php | 20 +++- 26 files changed, 311 insertions(+), 174 deletions(-) delete mode 100644 src/messenger/webim/INSTALL_RUS.txt diff --git a/src/messenger/.settings/org.eclipse.core.resources.prefs b/src/messenger/.settings/org.eclipse.core.resources.prefs index f52ddc20..9751eeb3 100644 --- a/src/messenger/.settings/org.eclipse.core.resources.prefs +++ b/src/messenger/.settings/org.eclipse.core.resources.prefs @@ -1,6 +1,5 @@ -#Thu Dec 18 15:36:01 CET 2008 +#Sun Mar 08 21:44:45 CET 2009 eclipse.preferences.version=1 -encoding//webim/INSTALL_RUS.txt=cp1251 encoding//webim/locales/fr/properties=ISO-8859-1 encoding//webim/locales/names/properties=utf-8 encoding//webim/locales/ru=cp1251 diff --git a/src/messenger/js/chat.js b/src/messenger/js/chat.js index 6735784a..75b33011 100644 --- a/src/messenger/js/chat.js +++ b/src/messenger/js/chat.js @@ -239,7 +239,10 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, { if( haveMessage ) { FrameUtils.scrollDown(this._options.container); if(!this.skipNextsound) { - playSound(Chat.webimRoot+'/sounds/new_message.wav'); + var tsound = $('soundimg'); + if(tsound == null || tsound.className.match(new RegExp("\\bisound\\b")) ) { + playSound(Chat.webimRoot+'/sounds/new_message.wav'); + } } if( !this.focused ) { window.focus(); @@ -402,6 +405,22 @@ Behaviour.register({ Chat.threadUpdater.update(); }; }, + 'a#togglesound' : function(el) { + el.onclick = function() { + var tsound = $('soundimg'); + if(!tsound) { + return; + } + if(tsound.className.match(new RegExp("\\bisound\\b"))) { + tsound.className = "tplimage inosound"; + } else { + tsound.className = "tplimage isound"; + } + var messagePane = $('msgwnd'); + if(messagePane) + messagePane.focus(); + }; + }, 'a.closethread' : function(el) { el.onclick = function() { Chat.threadUpdater.closeThread(); diff --git a/src/messenger/webim/INSTALL_RUS.txt b/src/messenger/webim/INSTALL_RUS.txt deleted file mode 100644 index 63d72608..00000000 --- a/src/messenger/webim/INSTALL_RUS.txt +++ /dev/null @@ -1,49 +0,0 @@ - -Open Web Messenger -Copyright (c) 2005-2009 сообщество разработчиков Web Messenger. - -Все права защищены. Данное программное обеспечение и сопутствующие материалы -подпадают под условия Eclipse Public License v1.0, доступной по адресу -http://www.eclipse.org/legal/epl-v10.html - -СИСТЕМНЫЕ ТРЕБОВАНИЯ - - * Apache сервер версии 1.3.34 или выше - * MySQL версии 5.0 или выше - * PHP версии 4.x или выше - -БЫСТРАЯ УСТАНОВКА - -1. Создайте папку с именем 'webim' в корневом каталоге вашего сайта на сервере. -2. Распакуйте и выгрузите содержимое архива с системой (сохраняя структуру директорий) - в созданную папку на сервере. -3. Отредактируйте конфигурационный файл /webim/libs/config.php и выставьте правильные параметры - соединения с базой данных. -4. Используя веб браузер, перейдите на страницу http://<ваш домен>/webim/install/ и - нажмите 'Create tables' ('Создать таблицы') -5. После того, как необходимые таблицы будут созданы, удалите папку /webim/install/ на вашем сервере. -6. Войдите в систему по адресу http://<ваш домен>/webim/operator/login.php, используя следующие данные: - пользователь: admin - пароль: <пустой> -7. Получите код кнопки по адресу http://<ваш домен>/webim/operator/getcode.php и расположите ее - на странице вашего сайта. -8. Измените пароль и имя пользователя по адресу http://<ваш домен>/webim/operator/operators.php. -9. Просматривайте и обслуживайте посетителей, нажавших на кнопку на странце 'Pending users' - ('Посетители') по адресу http://<ваш домен>/webim/operator/users.php. - -На unix/linux платформах измените владельца папки /webim/images/avatar на пользователя, -под которым запущен веб сервер (например, chown www /webim/images/avatar). Владелец должен иметь все -права на папку /webim/images/avatar (chmod 700 /webim/images/avatar). - -ОБНОВЛЕНИЕ СИСТЕМЫ - -1. Скопируйте /webim/libs/config.php в безопасное место, чтобы не потерять настройки. -2. Скопируйте папку /webim/images/avatar в безопасное место, чтобы не потерять ее содержимое. -3. Очистите папку 'webim' в корневом каталоге вашего сайта. -4. Распакуйте и выгрузите содержимое архива с системой (сохраняя структуру директорий) - в папку 'webim'. -5. Отредактируйте config.php в соответствии с настройками вашего сервера. -6. Используя веб браузер, перейдите на страницу http://<ваш домен>/webim/install/index.php и следуйте - указаниям по обновлению базы данных (если потребуется). -7. После того, как необходимые таблицы будут созданы, удалите папку /webim/install/ на вашем сервере. -8. Восстановите содержимое папки /webim/images/avatar. diff --git a/src/messenger/webim/client.php b/src/messenger/webim/client.php index 0932c63e..fd5e3ef6 100644 --- a/src/messenger/webim/client.php +++ b/src/messenger/webim/client.php @@ -20,7 +20,8 @@ require_once('libs/expand.php'); if( !isset($_GET['token']) || !isset($_GET['thread']) ) { $chatstyle = verifyparam( "style", "/^\w+$/", ""); - $info = isset($_GET['info']) ? $_GET['info'] : ""; + $info = getgetparam('info'); + $email = getgetparam('email'); $thread = NULL; if( isset($_SESSION['threadid']) ) { $thread = reopen_thread($_SESSION['threadid']); @@ -28,7 +29,10 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { if( !$thread ) { if(!has_online_operators()) { + $page = array(); setup_logo(); + $page['formname'] = topage(getgetparam('name')); + $page['formemail'] = topage($email); $page['info'] = topage($info); expand("styles", getchatstyle(), "leavemessage.tpl"); exit; @@ -46,13 +50,16 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { } $userbrowser = $_SERVER['HTTP_USER_AGENT']; $remoteHost = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr; - $visitor = $remote_visitor(); + $visitor = visitor_from_request(); $thread = create_thread($visitor['name'], $remoteHost, $referer,$current_locale,$visitor['id'], $userbrowser); $_SESSION['threadid'] = $thread['threadid']; if( $referer ) { post_message($thread['threadid'],$kind_for_agent,getstring2('chat.came.from',array($referer))); } post_message($thread['threadid'],$kind_info,getstring('chat.wait')); + if($email) { + post_message($thread['threadid'],$kind_for_agent,getstring2('chat.visitor.email',array($email))); + } if($info) { post_message($thread['threadid'],$kind_for_agent,getstring2('chat.visitor.info',array($info))); } diff --git a/src/messenger/webim/install/whatsnew.txt b/src/messenger/webim/install/whatsnew.txt index bc1b6cab..cccecb1e 100644 --- a/src/messenger/webim/install/whatsnew.txt +++ b/src/messenger/webim/install/whatsnew.txt @@ -1,7 +1,13 @@ 1.5.2 ----- + [+] Ability to disable sound notifications for chat (toolbar button) + [+] Switch to SSL in chat (should be enabled in "Settings -> Optional Services") [!] lost query parameters after login redirect [+] added referrer into button code + [+] ability to add text for operator into button code, define visitor's name and email + [!] geolocation on IPs in history + [!] Translation UI: added sorting, filters, fixed several problems + [+] New chat buttons 1.5.1 ----- diff --git a/src/messenger/webim/js/brws.js b/src/messenger/webim/js/brws.js index 9509bd85..1c6a561f 100644 --- a/src/messenger/webim/js/brws.js +++ b/src/messenger/webim/js/brws.js @@ -1 +1 @@ -var myAgent="";var jk=0;var myRealAgent="";function kk(){var lk=["\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");tt.write("\u003c\u0074\u0061\142l\145\040wi\144th\075'1\u00300\045'\040\u0063el\u006csp\u0061\u0063ing='\060' ce\u006c\154p\u0061\144\144\u0069ng='0'\040b\u006fr\144\145\162\075'\u0030'>\u003ct\162\076\u003ctd\u0020\166al\u0069\u0067\156\u003d'to\u0070'\040cl\141\163s='mes\163ag\u0065'\040\151\u0064\075'\u0063\u006f\156\u0074e\156t'\u003e\u003c\u002f\u0074d><\u0061\040\151\u0064\u003d'\u0062o\u0074t\u006f\u006d'/\076");tt.write("":"";} } ,ku:function(ju){var nh=false;var qh=this.pq.yt;var rh=qs.ks(ju,"l\141\u0073\164\151\u0064");if(rh){this.pq.uu=rh;} var sh=qs.ks(ju,"\164\u0079\160\u0069\156g");if(sh){this.yu(sh=='\061');} var th=qs.ks(ju,"c\141n\u0070o\163t");if(th){if(th=='\061'&&!this.wt||this.wt&&th!='\061'){window.location.href=window.location.href;} } for(var i=0;i=0){var iu="\u0075\u0070\u0064ate\u0064";if(this.at>0){var hh=((new Date()).getTime()-this.at)/01750;iu=iu+"\054\u0020"+hh+"\u0020\163\u0065\u0063\u0073";if(hh>012){alert(iu);} } this.at=(new Date()).getTime();this.nu(iu);} else{this.ih();} if(nh){nt.jt(this.pq.yt);if(!this.ct){$s(ut.ht+'/so\165\u006e\144\163/ne\u0077_m\145ssa\u0067\u0065.\u0077\141\u0076');} if(!this.vt){window.focus();} } } ,zt:function(k){if(k){jh=k.ctrlKey;k=k.which;} else{k=event.keyCode;jh=event.ctrlKey;} if(this.pq.xt&&((k==015&&(jh||myRealAgent=='\157p\145ra'))||(k==012))){var kh=this.pq.xt.value;if(myRealAgent=='o\u0070er\u0061'){kh=kh.replace(/[\r\n]+$/,'');} this.ou(kh);return false;} return true;} ,lu:function(hq,ju,lh){if(ju&&ju.tagName=='\145rr\157\u0072'){this.nu(qs.rs(ju,"\u0064esc\162"));} else{this.nu("\u0072ec\u006f\156ne\u0063ti\156g");} } ,oh:function(k){if($("\145\156gi\u006e\145\151nf\157")){$("\u0065n\u0067\u0069\u006ee\u0069n\146\157").style.display='\151nl\u0069\u006e\145';$("\145\u006eg\151\156ei\156f\157").innerHTML=k;} } ,nu:function(k){if(this.ph)clearTimeout(this.ph);this.oh(k);this.ph=setTimeout(this.ih.on(this),0xfa0);} ,ih:function(){$("engin\u0065\u0069\156fo").style.display='\u006eo\u006e\u0065';} } );dh=mn.nn();dh.prototype={qn:function(pq){this.pq=pq;this.eh=0;if(this.pq.fh&&this.pq.gh&&this.pq.ah){this.pq.ah.onmousedown=this.bh.on(this);this.pq.ah.onmouseup=this.ch.on(this);this.pq.ah.onmousemove=this.vh.on(this);} } ,bh:function(e){var or=e||event;if(this.pq.ah.setCapture)this.pq.ah.setCapture();this.wh=this.pq.fh.style.pixelHeight||this.pq.fh.clientHeight;this.xh=or.screenY;this.pq.yh=this.pq.fh.style.pixelHeight+this.pq.gh.clientHeight-this.pq.zh;this.eh=1;} ,ch:function(){if(this.eh){if(this.pq.ah.releaseCapture)this.pq.ah.releaseCapture();this.eh=0;} } ,vh:function(e){var or=e||event;if(this.eh){var $h=this.wh-(or.screenY-this.xh);if($h>this.pq.yh)$h=this.pq.yh;else if($h");tt.write("\u003c\u0074\u0061\142l\145\040wi\144th\075'1\u00300\045'\040\u0063el\u006csp\u0061\u0063ing='\060' ce\u006c\154p\u0061\144\144\u0069ng='0'\040b\u006fr\144\145\162\075'\u0030'>\u003ct\162\076\u003ctd\u0020\166al\u0069\u0067\156\u003d'to\u0070'\040cl\141\163s='mes\163ag\u0065'\040\151\u0064\075'\u0063\u006f\156\u0074e\156t'\u003e\u003c\u002f\u0074d><\u0061\040\151\u0064\u003d'\u0062o\u0074t\u006f\u006d'/\076");tt.write("":"";} } ,ku:function(ju){var nh=false;var qh=this.pq.yt;var rh=qs.ks(ju,"l\141\u0073\164\151\u0064");if(rh){this.pq.uu=rh;} var sh=qs.ks(ju,"\164\u0079\160\u0069\156g");if(sh){this.yu(sh=='\061');} var th=qs.ks(ju,"c\141n\u0070o\163t");if(th){if(th=='\061'&&!this.wt||this.wt&&th!='\061'){window.location.href=window.location.href;} } for(var i=0;i=0){var iu="\u0075\u0070\u0064ate\u0064";if(this.at>0){var hh=((new Date()).getTime()-this.at)/01750;iu=iu+"\054\u0020"+hh+"\u0020\163\u0065\u0063\u0073";if(hh>012){alert(iu);} } this.at=(new Date()).getTime();this.nu(iu);} else{this.ih();} if(nh){nt.jt(this.pq.yt);if(!this.ct){var jh=$('s\157u\156\u0064\151\155\147');if(jh==null||jh.className.match(new RegExp("\\bisound\\b"))){$s(ut.ht+'/\u0073ou\156ds\u002f\u006ee\167\u005fm\u0065\163\163a\147e\056\u0077av');} } if(!this.vt){window.focus();} } } ,zt:function(k){if(k){kh=k.ctrlKey;k=k.which;} else{k=event.keyCode;kh=event.ctrlKey;} if(this.pq.xt&&((k==015&&(kh||myRealAgent=='o\160er\141'))||(k==012))){var lh=this.pq.xt.value;if(myRealAgent=='\u006f\160er\141'){lh=lh.replace(/[\r\n]+$/,'');} this.ou(lh);return false;} return true;} ,lu:function(hq,ju,oh){if(ju&&ju.tagName=='\u0065rr\u006f\162'){this.nu(qs.rs(ju,"d\u0065sc\162"));} else{this.nu("r\145\143on\u006e\145\143ti\156\147");} } ,ph:function(k){if($("e\u006e\u0067\u0069n\u0065i\156\146\u006f")){$("en\u0067\u0069\156\u0065i\u006ef\157").style.display='\151n\154i\156\u0065';$("engi\u006e\u0065\151nf\u006f").innerHTML=k;} } ,nu:function(k){if(this.dh)clearTimeout(this.dh);this.ph(k);this.dh=setTimeout(this.ih.on(this),07640);} ,ih:function(){$("\u0065\u006eg\u0069\156e\151\156f\u006f").style.display='n\157\u006ee';} } );eh=mn.nn();eh.prototype={qn:function(pq){this.pq=pq;this.fh=0;if(this.pq.gh&&this.pq.ah&&this.pq.bh){this.pq.bh.onmousedown=this.ch.on(this);this.pq.bh.onmouseup=this.vh.on(this);this.pq.bh.onmousemove=this.wh.on(this);} } ,ch:function(e){var or=e||event;if(this.pq.bh.setCapture)this.pq.bh.setCapture();this.xh=this.pq.gh.style.pixelHeight||this.pq.gh.clientHeight;this.yh=or.screenY;this.pq.zh=this.pq.gh.style.pixelHeight+this.pq.ah.clientHeight-this.pq.$h;this.fh=1;} ,vh:function(){if(this.fh){if(this.pq.bh.releaseCapture)this.pq.bh.releaseCapture();this.fh=0;} } ,wh:function(e){var or=e||event;if(this.fh){var _h=this.xh-(or.screenY-this.yh);if(_h>this.pq.zh)_h=this.pq.zh;else if(_h';oi=ds.insertRow(ki);ws=oi.insertCell(-1);ws.colSpan=015;ws.height=2;} ,pi:function(link,title,di,ei,width,height,fi){return'\u003c\u0061 \150\162e\146="'+link+'"'+(fi!=null?'\u0020c\u006ca\163\163\u003d"'+fi+'"':'')+'\040\u0074a\u0072g\145\u0074\075"_\u0062\u006c\141\156k" \164i\u0074le\u003d"'+title+'"\u0020o\156\u0063li\143k\075"\164\150\u0069\u0073\u002e\156\145\167\u0057\u0069\u006ed\157w\040=\u0020\167ind\157w.\157p\145n(\''+link+'\',\u0020\''+di+'\'\054\u0020\'too\u006cb\u0061\162=\u0030\u002c\163\143\u0072\157l\u006cbar\u0073=0\u002cl\157\143\u0061\164\u0069o\u006e=\060\054\u0073\u0074a\u0074\165\u0073\u003d1\054\155\145\u006eu\142a\162\u003d\060,\u0077\u0069dt\150\u003d'+width+'\u002cheig\u0068\u0074\u003d'+height+'\u002cre\u0073\u0069z\u0061\u0062\u006ce\u003d1\'\051\u003bt\150is\056ne\167\u0057ind\157w.fo\u0063u\u0073\050\u0029;\164\150\u0069\u0073.\156\145\u0077\u0057\151nd\u006f\167\u002e\u006fpe\156er\075\167\151\u006e\144\u006f\u0077;r\u0065tur\u006e fals\145\073">'+ei+'\074/a>';} ,gi:function(content){return'',(600+40),0740,null);$i+='<\u002f\164d\076';zi++;} if(vi){$i+='',01200,(457+23),null);$i+='<\u002ftd\076';zi++;} if(xt!=""){$i+='036?xt.substring(0,036)+'.\u002e.':xt;$i+='\u003c\u002f\141>\074\057\u0074\144>';} return hi.gi($i);} ,_i:function(id,mj){return'\u003ct\u0064\u0020\u0077\151d\u0074h="\063\u0030"\040a\u006c\151\147n="c\u0065n\u0074\u0065r"\u003e'+hi.pi(ht+'/\157\160\145r\u0061\164\157\u0072/\u0062\u0061\u006e\056\u0070\u0068\u0070?'+(mj?'\u0069d='+mj:'t\150\162\u0065\u0061\144\075'+id),localized[2],"b\u0061n"+id,'\074\151\u006dg\u0020\u0073r\u0063\075"'+ht+'\u002f\u0069m\u0061ges\u002fb\141n\u002egif" w\u0069dt\u0068\u003d"\0615"\040he\151\147\150\u0074\075"\061\u0035" \u0062o\u0072d\145\162\u003d"\060"\040\141\154t\075"'+localized[2]+'"\u003e',(371+179),(318+122),null)+'<\u002ft\144>';} } ;sq.nj=mn.nn();mn.sn(sq.nj,sq.lq,{qn:function(pq){this.oq(pq);this.pq.ui=this.ui.on(this);this.pq.lu=this.lu.on(this);this.pq.ku=this.ku.on(this);this.pq.qj=0;this.rj=new Object();this.sj=0;this.t=this.pq.tj;this.uj=new sq.ti(this.pq);} ,ui:function(){return"c\157\155p\141\u006e\u0079\u003d"+this.pq.company+"&\163\151n\143\145="+this.pq.qj;} ,nu:function(pu){this.pq.status.innerHTML=pu;} ,lu:function(s){this.nu(s);} ,hj:function(uh){var id,ij,jj,vi=false,wi=false,kj=false,xi=null,mj=null;for(var i=0;i'+qs.rs(uh,"\162\145\u0061\163\157n")+'\u003c\057\164\144\u003e';} if(kj){bj+=hi._i(id,mj);} bj=hi.gi(bj);var cj=ls.os(ij,this.t);var vj=ls.os(ij+"end",this.t);if(oi!=null&&(oi.rowIndex<=cj.rowIndex||oi.rowIndex>=vj.rowIndex)){hi.ji(this.t,oi.rowIndex+1);this.t.deleteRow(oi.rowIndex);this.rj[id]=null;oi=null;} if(oi==null){oi=this.t.insertRow(cj.rowIndex+1);hi.li(this.t,cj.rowIndex+2);oi.id="t\150r"+id;this.rj[id]=new Array(fj,aj,ij);ls.insertCell(oi,"\156a\u006de","tab\154\u0065",null,036,hi.ai(dj,this.pq.agentservl,id,vi,wi,xi,xt,ij!='\143\u0068a\164'));hi.ii(oi);ls.insertCell(oi,"c\157\u006e\164i\144","\164a\142le","\u0063e\u006e\u0074er",null,ej);hi.ii(oi);ls.insertCell(oi,"\u0073t\141t\u0065","\164\141b\u006c\u0065","\u0063\145n\164\145\u0072",null,jj);hi.ii(oi);ls.insertCell(oi,"\u006fp","\u0074\141ble","ce\156te\u0072",null,gj);hi.ii(oi);ls.insertCell(oi,"\164i\155\145","t\141bl\145","cent\u0065\u0072",null,this.wj(fj));hi.ii(oi);ls.insertCell(oi,"\167\141\151\164","\164\u0061bl\145","\143\u0065\156\164\145r",null,(ij!='\143\150\u0061\u0074'?this.wj(aj):'\u002d'));hi.ii(oi);ls.insertCell(oi,"et\u0063","ta\u0062l\145","\143\145n\164er",null,bj);if(ij=='\167\u0061\151\164'||ij=='\u0070r\151\157')return true;} else{this.rj[id]=new Array(fj,aj,ij);oj(this.t,oi,"n\u0061\u006d\u0065",hi.ai(dj,this.pq.agentservl,id,vi,wi,xi,xt,ij!='\u0063hat'));oj(this.t,oi,"\143o\156\u0074\151\144",ej);oj(this.t,oi,"st\141\164\u0065",jj);oj(this.t,oi,"\u006f\u0070",gj);oj(this.t,oi,"t\151me",this.wj(fj));oj(this.t,oi,"\167\141it",(ij!='c\150\u0061t'?this.wj(aj):'\u002d'));oj(this.t,oi,"\145t\143",bj);} return false;} ,xj:function(){function yj(t,id,zj){var cj=t.rows[id];var vj=t.rows[id+"e\u006e\u0064"];if(cj==null||vj==null)return;var $j=vj.cells["sta\u0074\u0075\163"];if($j==null)return;$j.innerHTML=(cj.rowIndex+1==vj.rowIndex)?zj:"";$j.height=(cj.rowIndex+1==vj.rowIndex)?(18+12):012;} yj(this.t,"w\141\151t",this.pq.noclients);yj(this.t,"\160r\151o",this.pq.noclients);yj(this.t,"\143h\u0061\164",this.pq.noclients);} ,wj:function(_j){var mk=Math.floor(((new Date()).getTime()-_j-this.sj)/01750);var nk=Math.floor(mk/0x3c);var qk="";mk=mk%074;if(mk<(8+2))mk="\u0030"+mk;if(nk>=074){var rk=Math.floor(nk/074);nk=nk%074;if(nk<012)nk="\u0030"+nk;qk=rk+":";} return qk+nk+"\u003a"+mk;} ,sk:function(){for(var i in this.rj){if(this.rj[i]!=null){var value=this.rj[i];var oi=ls.os("\u0074h\162"+i,this.t);if(oi!=null){function oj(ds,oi,id,pj){var ws=ls.fs(id,oi,ds);if(ws)ws.innerHTML=pj;} oj(this.t,oi,"\164\151m\u0065",this.wj(value[0]));oj(this.t,oi,"\167ai\164",(value[2]!='\u0063\150\u0061\u0074'?this.wj(value[1]):'\055'));} } } } ,ku:function(tk){var uk=false;if(tk.tagName=='t\u0068re\u0061\u0064\163'){var hk=qs.ks(tk,"\164i\u006d\145");var ik=qs.ks(tk,"\u0072\u0065visio\u006e");if(hk)this.sj=(new Date()).getTime()-hk;if(ik)this.pq.qj=ik;for(var i=0;i'+content+'';} mj+='\074\u002f\u0074d\u003e\074\u0074\144\u003e\074\u0069mg\u0020\163\u0072c\075"'+ht+'/\u0069\u006d\u0061\147\u0065s/\146\u0072ee.gif" \167\u0069dt\u0068\075"5"\u0020\150\145i\147\u0068t="\061"\040\u0062\u006frde\162\075"0" \141l\u0074\u003d""\076\u003c/\u0074\u0064\u003e';if(yi){mj+='\u003ct\144\u0020\167\u0069\u0064\u0074\150\075"\u0033\060" \141\u006c\151\147\156\075"\u0063\145\u006e\164e\162">';mj+=ji.ei(link,localized[0],"I\155\u0043enter"+id,'\074\151\u006dg\u0020\163r\143\u003d"'+ht+'/\151\u006dage\163\057tbl\151\143l\163\160\u0065a\153\u002e\u0067i\146" w\151d\u0074h\u003d"1\065"\040he\151\u0067ht\075"15"\040\142\u006f\u0072\u0064er="0"\u0020\u0061\154\164\u003d"'+localized[0]+'">',0x280,(413+67),null);mj+='(23+7)?xt.substring(0,(19+11))+'..\056':xt;mj+='\u003c\057a\076\074\057\164\u0064\u003e';} return ji.bi(mj);} ,nj:function(id,qj){return'\u003ct\u0064\040\u0077\u0069\144\u0074h="\u0033\060" \u0061\154ign="c\u0065nt\u0065\u0072"\076'+ji.ei(ht+'/\157per\141\164\157\u0072\057\142\u0061n\u002ep\u0068p\u003f'+(qj?'\u0069\u0064='+qj:'\164\u0068r\145ad='+id),localized[2],"\u0062an"+id,'<\u0069\155\147 \163r\143="'+ht+'\057\u0069\u006d\u0061\147\u0065s\057b\141\156\056g\151f"\040\u0077\151\u0064\u0074\150\075"15" h\145i\u0067\u0068t="\u0031\065" b\u006f\u0072\144e\u0072\u003d"0" \141\u006ct\u003d"'+localized[2]+'"\076',(386+164),0x1b8,null)+'<\u002f\u0074\u0064\u003e';} } ;sq.rj=mn.nn();mn.sn(sq.rj,sq.lq,{qn:function(pq){this.oq(pq);this.pq.ii=this.ii.on(this);this.pq.lu=this.lu.on(this);this.pq.ku=this.ku.on(this);this.pq.sj=0;this.tj=new Object();this.uj=0;this.t=this.pq.hj;this.ij=new sq.hi(this.pq);} ,ii:function(){return"\u0063\157m\160\141n\171\u003d"+this.pq.company+"&\163\151\156c\145\u003d"+this.pq.sj;} ,nu:function(pu){this.pq.status.innerHTML=pu;} ,lu:function(s){this.nu(s);} ,jj:function(uh){var id,kj,lj,xi=false,yi=false,oj=false,zi=null,qj=null;for(var i=0;i'+qs.rs(uh,"\u0072\145ason")+'\074/\164\144\076';} if(oj){vj+=ji.nj(id,qj);} vj=ji.bi(vj);var wj=ls.os(kj,this.t);var xj=ls.os(kj+"\u0065n\144",this.t);if(di!=null&&(di.rowIndex<=wj.rowIndex||di.rowIndex>=xj.rowIndex)){ji.li(this.t,di.rowIndex+1);this.t.deleteRow(di.rowIndex);this.tj[id]=null;di=null;} if(di==null){di=this.t.insertRow(wj.rowIndex+1);ji.pi(this.t,wj.rowIndex+2);di.id="\164hr"+id;this.tj[id]=new Array(aj,cj,kj);ls.insertCell(di,"\u006e\u0061\u006de","t\141\142\u006ce",null,036,ji.ci(fj,this.pq.agentservl,id,xi,yi,zi,xt,kj!='ch\141\u0074'));ji.ki(di);ls.insertCell(di,"\u0063\157\156\164i\144","\164\u0061\u0062\154\u0065","c\u0065nte\u0072",null,gj);ji.ki(di);ls.insertCell(di,"\163t\141\164e","tabl\145","\u0063e\156\u0074\145\162",null,lj);ji.ki(di);ls.insertCell(di,"\157p","\164\u0061\u0062\u006ce","ce\156t\145\u0072",null,bj);ji.ki(di);ls.insertCell(di,"t\151\155e","t\141\u0062\154\u0065","\143\145nt\u0065r",null,this.yj(aj));ji.ki(di);ls.insertCell(di,"wait","\164\u0061b\154\u0065","ce\156\164\u0065\u0072",null,(kj!='cha\u0074'?this.yj(cj):'\u002d'));ji.ki(di);ls.insertCell(di,"etc","ta\142\154e","\143e\156te\162",null,vj);if(kj=='\u0077\141\u0069\164'||kj=='\u0070\u0072\151o')return true;} else{this.tj[id]=new Array(aj,cj,kj);dj(this.t,di,"\156a\155\145",ji.ci(fj,this.pq.agentservl,id,xi,yi,zi,xt,kj!='\143\150a\164'));dj(this.t,di,"co\u006e\164\151d",gj);dj(this.t,di,"\163ta\u0074\145",lj);dj(this.t,di,"\u006f\u0070",bj);dj(this.t,di,"\164im\u0065",this.yj(aj));dj(this.t,di,"w\u0061\u0069\164",(kj!='\143h\u0061\164'?this.yj(cj):'\u002d'));dj(this.t,di,"\145tc",vj);} return false;} ,zj:function(){function $j(t,id,_j){var wj=t.rows[id];var xj=t.rows[id+"e\u006e\144"];if(wj==null||xj==null)return;var mk=xj.cells["s\164\u0061\u0074\165s"];if(mk==null)return;mk.innerHTML=(wj.rowIndex+1==xj.rowIndex)?_j:"";mk.height=(wj.rowIndex+1==xj.rowIndex)?0x1e:(8+2);} $j(this.t,"\u0077\u0061i\u0074",this.pq.noclients);$j(this.t,"pr\151\u006f",this.pq.noclients);$j(this.t,"\u0063hat",this.pq.noclients);} ,yj:function(nk){var qk=Math.floor(((new Date()).getTime()-nk-this.uj)/01750);var rk=Math.floor(qk/074);var sk="";qk=qk%(47+13);if(qk<012)qk="\u0030"+qk;if(rk>=(50+10)){var tk=Math.floor(rk/074);rk=rk%074;if(rk<(9+1))rk="0"+rk;sk=tk+"\072";} return sk+rk+":"+qk;} ,uk:function(){for(var i in this.tj){if(this.tj[i]!=null){var value=this.tj[i];var di=ls.os("\164\150r"+i,this.t);if(di!=null){function dj(ds,di,id,ej){var ws=ls.fs(id,di,ds);if(ws)ws.innerHTML=ej;} dj(this.t,di,"\u0074im\u0065",this.yj(value[0]));dj(this.t,di,"\167\141\u0069t",(value[2]!='c\150a\u0074'?this.yj(value[1]):'\055'));} } } } ,ku:function(hk){var ik=false;if(hk.tagName=='\u0074\u0068read\u0073'){var jk=qs.ks(hk,"\u0074\u0069\u006de");var kk=qs.ks(hk,"\162e\u0076\151\u0073\151o\u006e");if(jk)this.uj=(new Date()).getTime()-jk;if(kk)this.pq.sj=kk;for(var i=0;i 0 ) { $page['formname'] = topage($visitor_name); $page['formemail'] = $email; $page['formmessage'] = topage($message); - $page['info'] = $info; + $page['info'] = topage($info); setup_logo(); expand("styles", getchatstyle(), "leavemessage.tpl"); exit; } -$subject = getstring2_("leavemail.subject", array($visitor_name), $webim_messages_locale); -$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $webim_messages_locale); - loadsettings(); +$message_locale = $settings['left_messages_locale']; +if(!locale_exists($message_locale)) { + $message_locale = $home_locale; +} + +$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale); +$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $message_locale); + $inbox_mail = $settings['email']; if($inbox_mail) { diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 692c1b1c..caf3b152 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -15,8 +15,7 @@ $connection_timeout = 30; // sec -$simplenamecookie = "WEBIM_Name"; // 1.0.8 and earlier -$namecookie = "WEBIM_Data"; // 1.0.9+ +$namecookie = "WEBIM_Data"; $usercookie = "WEBIM_UserID"; $state_queue = 0; @@ -286,6 +285,11 @@ function setup_chatview_for_user($thread,$level) { $params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; $page['mailLink'] = "$webimroot/client.php?".$params."&level=$level&act=mailthread"; + + if($settings['enablessl'] == "1" && !is_secure_request()) { + $page['sslLink'] = get_app_location(true, true)."/client.php?".$params."&level=$level"; + } + $page['isOpera95'] = is_agent_opera95(); $page['neediframesrc'] = needsFramesrc(); @@ -305,6 +309,9 @@ function setup_chatview_for_operator($thread,$operator) { setup_logo(); $page['send_shortcut'] = "Ctrl-Enter"; + if($settings['enablessl'] == "1" && !is_secure_request()) { + $page['sslLink'] = get_app_location(true, true)."/operator/agent.php?thread=".$thread['threadid']."&token=".$thread['ltoken']; + } $page['isOpera95'] = is_agent_opera95(); $page['neediframesrc'] = needsFramesrc(); $page['historyParams'] = array("userid" => "".$thread['userid']); @@ -535,15 +542,18 @@ function check_for_reassign($thread,$operator) { } function visitor_from_request() { - global $namecookie, $simplenamecookie, $compatibility_encoding, $webim_encoding, $usercookie; - $userName = getstring("chat.default.username"); + global $namecookie, $webim_encoding, $usercookie; + $defaultName = getstring("chat.default.username"); + $userName = $defaultName; if( isset($_COOKIE[$namecookie]) ) { $data = base64_decode(strtr($_COOKIE[$namecookie],'-_,', '+/=')); if( strlen($data) > 0 ) { $userName = myiconv("utf-8",$webim_encoding,$data); } - } else if( isset($_COOKIE[$simplenamecookie]) && isset($compatibility_encoding) ) { - $userName = myiconv($compatibility_encoding,$webim_encoding,$_COOKIE[$simplenamecookie]); + } + + if($userName == $defaultName) { + $userName = getgetparam('name', $userName); } $userId = ""; diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index 44d04e0e..d0d3426e 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -17,7 +17,7 @@ session_start(); require_once(dirname(__FILE__).'/converter.php'); require_once(dirname(__FILE__).'/config.php'); -$version = '1.5.1'; +$version = '1.5.2'; function myiconv($in_enc, $out_enc, $string) { global $_utf8win1251, $_win1251utf8; @@ -408,6 +408,36 @@ function quote_smart($value,$link) { return mysql_real_escape_string($value,$link); } +function unicode_urldecode($url) { + preg_match_all('/%u([[:alnum:]]{4})/', $url, $a); + + foreach ($a[1] as $uniord) { + $dec = hexdec($uniord); + $utf = ''; + + if ($dec < 128) { + $utf = chr($dec); + } else if ($dec < 2048) { + $utf = chr(192 + (($dec - ($dec % 64)) / 64)); + $utf .= chr(128 + ($dec % 64)); + } else { + $utf = chr(224 + (($dec - ($dec % 4096)) / 4096)); + $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64)); + $utf .= chr(128 + ($dec % 64)); + } + $url = str_replace('%u'.$uniord, $utf, $url); + } + return urldecode($url); +} + +function getgetparam($name,$default='') { + global $webim_encoding; + if( !isset($_GET[$name]) || !$_GET[$name] ) { + return $default; + } + return myiconv("utf-8", $webim_encoding, unicode_urldecode($_GET[$name])); +} + function get_app_location($showhost,$issecure) { global $webimroot; if( $showhost ) { @@ -417,6 +447,13 @@ function get_app_location($showhost,$issecure) { } } +function is_secure_request() { + return + isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' + || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" + || isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on"; +} + function get_month_selection($fromtime,$totime) { $start = getdate($fromtime); $month = $start['mon']; @@ -448,9 +485,9 @@ function set_form_date($utime,$prefix) { } function webim_mail($toaddr, $reply_to, $subject, $body) { - global $webim_encoding, $webim_from_email, $mail_encoding; + global $webim_encoding, $webim_mailbox, $mail_encoding; - $headers = "From: $webim_from_email\r\n" + $headers = "From: $webim_mailbox\r\n" ."Reply-To: ".myiconv($webim_encoding, $mail_encoding, $reply_to)."\r\n" ."Content-Type: text/plain; charset=$mail_encoding\r\n" .'X-Mailer: PHP/'.phpversion(); @@ -460,23 +497,27 @@ function webim_mail($toaddr, $reply_to, $subject, $body) { mail($toaddr, $real_subject, wordwrap(myiconv($webim_encoding, $mail_encoding, $body),70), $headers); } -$dbversion = '1.5.1'; +$dbversion = '1.5.2'; $settings = array( 'dbversion' => 0, - 'email' => '', /* inbox for left messages */ 'title' => 'Your Company', - 'hosturl' => 'http://webim.sourceforge.net', + 'hosturl' => 'http://openwebim.org', 'logo' => '', - 'enableban' => '0', 'usernamepattern' => '{name}', - 'usercanchangename' => '1', 'chatstyle' => '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', 'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */ 'max_uploaded_file_size' => 100000, + + 'email' => '', /* inbox for left messages */ + 'left_messages_locale' => $home_locale, + + 'enableban' => '0', + 'enablessl' => '0', + 'usercanchangename' => '1', ); $settingsloaded = false; $settings_in_db = array(); diff --git a/src/messenger/webim/libs/config.php b/src/messenger/webim/libs/config.php index 07c875da..14722040 100644 --- a/src/messenger/webim/libs/config.php +++ b/src/messenger/webim/libs/config.php @@ -13,10 +13,15 @@ */ /* - * Application path on server + * Application path on server */ $webimroot = "/webim"; +/* + * Internal encoding + */ +$webim_encoding = "utf-8"; + /* * MySQL Database parameters */ @@ -25,46 +30,19 @@ $mysqldb = "webim_db"; $mysqllogin = "webim_lite"; $mysqlpass = "123"; -/* - * Localization parameters - */ - -/* Use UTF-8 database */ $dbencoding = "utf8"; -$webim_encoding = "utf-8"; $force_charset_in_connection = true; /* - * Web Messenger 1.0.8 an earlier stored user name in cookie in "webim_encoding". If - * you used this versions of webim set your previous encoding here. + * Mailbox */ -$compatibility_encoding = "cp1251"; +$webim_mailbox = "webim@yourdomain.com"; +$mail_encoding = "utf-8"; /* - * This encoding will be used for emails - */ -$mail_encoding = $webim_encoding; - -/* - * From field in outgoing mail. - */ -$webim_from_email = "webim@yourdomain.com"; /* email from field */ - -/* - * Inbox for left messages encoding - */ -$webim_messages_locale = "en"; - -/* - * Locales + * Locales */ $home_locale = "en"; /* native name will be used in this locale */ $default_locale = "en"; /* if user does not provide known lang */ -/* - * Method of getting information about remote user. For example, you could - * have user name or id in session. Default value: visitor_from_request - */ -$remote_visitor = 'visitor_from_request'; - ?> diff --git a/src/messenger/webim/libs/pagination.php b/src/messenger/webim/libs/pagination.php index 793bf767..3212bd3c 100644 --- a/src/messenger/webim/libs/pagination.php +++ b/src/messenger/webim/libs/pagination.php @@ -61,13 +61,18 @@ function setup_empty_pagination() { $page['pagination'] = false; } -function generate_pagination($pagination) { +function generate_pagination($pagination,$bottom=true) { global $pagination_spacing, $links_on_page; $result = getlocal2("tag.pagination.info", array($pagination['page'],$pagination['total'],$pagination['start']+1,$pagination['end'],$pagination['count']))."
"; if( $pagination['total'] > 1 ) { - $result.="