mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
apply patch by Andrew Armstrong: available operators list (revised); remove odd eval code in common.js; fix obfuscation
This commit is contained in:
parent
ef92f51afd
commit
7de97c2a68
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd webim/js/source
|
||||
/usr/local/ant/bin/ant
|
||||
ant
|
||||
rm -rf bin
|
||||
|
@ -555,6 +555,13 @@ table.awaiting td.visitor {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* online operators */
|
||||
|
||||
#onlineoperators {
|
||||
padding-right: 10px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* search */
|
||||
|
||||
#searchtext {
|
||||
|
BIN
src/messenger/webim/images/opaway.gif
Normal file
BIN
src/messenger/webim/images/opaway.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
src/messenger/webim/images/oponline.gif
Normal file
BIN
src/messenger/webim/images/oponline.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -1 +0,0 @@
|
||||
var myAgent="";var $j=0;var myRealAgent="";function _j(){var mk=["opera","msie","safari","firefox","netscape","mozilla"];var tj=navigator.userAgent.toLowerCase();for(var i=0;i<mk.length;i++){var nk=mk[i];if(tj.indexOf(nk)!=-1){myAgent=nk;if(!window.RegExp)break;var qk=new RegExp(nk+"[ \/]?([0-9]+(\.[0-9]+)?)");if(qk.exec(tj)!=null){$j=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="Gecko")myAgent="moz";} _j();function getEl(name){return document.getElementById(name);}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
src/messenger/webim/js/164/brws.js
Normal file
1
src/messenger/webim/js/164/brws.js
Normal file
@ -0,0 +1 @@
|
||||
var myAgent="";var nk=0;var myRealAgent="";function qk(){var rk=["opera","msie","safari","firefox","netscape","mozilla"];var rj=navigator.userAgent.toLowerCase();for(var i=0;i<rk.length;i++){var sk=rk[i];if(rj.indexOf(sk)!=-1){myAgent=sk;if(!window.RegExp)break;var tk=new RegExp(sk+"[ \/]?([0-9]+(\.[0-9]+)?)");if(tk.exec(rj)!=null){nk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="Gecko")myAgent="moz";} qk();function getEl(name){return document.getElementById(name);}
|
1
src/messenger/webim/js/164/chat.js
Normal file
1
src/messenger/webim/js/164/chat.js
Normal file
File diff suppressed because one or more lines are too long
1
src/messenger/webim/js/164/common.js
Normal file
1
src/messenger/webim/js/164/common.js
Normal file
File diff suppressed because one or more lines are too long
1
src/messenger/webim/js/164/users.js
Normal file
1
src/messenger/webim/js/164/users.js
Normal file
File diff suppressed because one or more lines are too long
@ -128,7 +128,7 @@ public class JSO {
|
||||
|
||||
// Methods
|
||||
"add", "addBehavior", "AddFavorite", "addImport", "addRule", "alert",
|
||||
"appendChild", "applyElement", "assign", "attachEvent", "back", "blur",
|
||||
"appendChild", "apply", "applyElement", "assign", "attachEvent", "back", "blur",
|
||||
"clearAttributes", "clearData", "clearInterval", "clearRequest",
|
||||
"clearTimeout", "click", "cloneNode", "close", "collapse", "compareEndPoints",
|
||||
"componentFromPoint", "confirm", "contains", "createCaption", "createControlRange",
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
<project basedir="." default="update" name="Obfuscator">
|
||||
<property name="obfuscator.location" value="." />
|
||||
<property name="webim.location" value="../163" />
|
||||
<property name="webim.location" value="../164" />
|
||||
|
||||
<target name="update" depends="build">
|
||||
<java classname="JSO" fork="true" error="${obfuscator.location}/bin/obfuscation.log">
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//- localized
|
||||
|
||||
//- onComplete, obj, params, $apply$
|
||||
//- onComplete, showonline
|
||||
//- threadParams, servl, frequency, user, threadid, token, cssfile
|
||||
//- updaterOptions, url, company, agentservl, noclients, wroot, havemenu, showpopup, ignorectrl, istatus
|
||||
|
||||
@ -145,24 +145,6 @@ function $() {
|
||||
return elems;
|
||||
}
|
||||
|
||||
if (!Function.prototype.apply) {
|
||||
Function.prototype.apply = function(obj, params) {
|
||||
var parameterStrings = new Array();
|
||||
if (!obj) obj = window;
|
||||
if (!params) params = new Array();
|
||||
|
||||
for (var i = 0; i < params.length; i++)
|
||||
parameterStrings[i] = 'params[' + i + ']';
|
||||
|
||||
obj.$apply$ = this;
|
||||
var result = eval('obj.$apply$(' +
|
||||
parameterStrings.join(', ') + ')');
|
||||
obj.$apply$ = null;
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
var Ajax = {
|
||||
getTransport: function() {
|
||||
return Try.these(
|
||||
|
@ -117,7 +117,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
|
||||
},
|
||||
|
||||
updateParams: function() {
|
||||
return "since=" + this._options.lastrevision + "&status=" + this._options.istatus;
|
||||
return "since=" + this._options.lastrevision + "&status=" + this._options.istatus + (this._options.showonline ? "&showonline=1" : "");
|
||||
},
|
||||
|
||||
setStatus: function(msg) {
|
||||
@ -273,31 +273,66 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
|
||||
}
|
||||
},
|
||||
|
||||
updateContent: function(root) {
|
||||
updateThreads: function(root) {
|
||||
var newAdded = false;
|
||||
if( root.tagName == 'threads' ) {
|
||||
var _time = NodeUtils.getAttrValue(root, "time");
|
||||
var _revision = NodeUtils.getAttrValue(root, "revision" );
|
||||
var _time = NodeUtils.getAttrValue(root, "time");
|
||||
var _revision = NodeUtils.getAttrValue(root, "revision" );
|
||||
|
||||
if( _time )
|
||||
this.delta = (new Date()).getTime() - _time;
|
||||
if( _revision )
|
||||
this._options.lastrevision = _revision;
|
||||
if( _time )
|
||||
this.delta = (new Date()).getTime() - _time;
|
||||
if( _revision )
|
||||
this._options.lastrevision = _revision;
|
||||
|
||||
for( var i = 0; i < root.childNodes.length; i++ ) {
|
||||
var node = root.childNodes[i];
|
||||
if( node.tagName == 'thread' )
|
||||
if( this.updateThread(node) )
|
||||
newAdded = true;
|
||||
}
|
||||
this.updateQueueMessages();
|
||||
this.updateTimers();
|
||||
this.setStatus(this._options.istatus ? "Away" : "Up to date");
|
||||
if( newAdded ) {
|
||||
playSound(webimRoot+'/sounds/new_user.wav');
|
||||
window.focus();
|
||||
if(updaterOptions.showpopup) {
|
||||
alert(localized[5]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateOperators: function(root) {
|
||||
var div = $('onlineoperators');
|
||||
if (!div)
|
||||
return;
|
||||
|
||||
var names = [];
|
||||
|
||||
for( var i = 0; i < root.childNodes.length; i++ ) {
|
||||
var node = root.childNodes[i];
|
||||
if(node.tagName != 'operator')
|
||||
continue;
|
||||
|
||||
var name = NodeUtils.getAttrValue(node, 'name');
|
||||
var isAway = NodeUtils.getAttrValue(node, 'away') != null;
|
||||
|
||||
names[names.length] =
|
||||
'<img src="'+webimRoot+'/images/op'+(isAway ? 'away' : 'online')+
|
||||
'.gif" width="12" height="12" border="0" alt="'+localized[1]+'"> '+ name;
|
||||
}
|
||||
|
||||
div.innerHTML = names.join(', ');
|
||||
},
|
||||
|
||||
updateContent: function(root) {
|
||||
if( root.tagName == 'update' ) {
|
||||
for( var i = 0; i < root.childNodes.length; i++ ) {
|
||||
var node = root.childNodes[i];
|
||||
if( node.tagName == 'thread' )
|
||||
if( this.updateThread(node) )
|
||||
newAdded = true;
|
||||
}
|
||||
this.updateQueueMessages();
|
||||
this.updateTimers();
|
||||
this.setStatus(this._options.istatus ? "Away" : "Up to date");
|
||||
if( newAdded ) {
|
||||
playSound(webimRoot+'/sounds/new_user.wav');
|
||||
window.focus();
|
||||
if(updaterOptions.showpopup) {
|
||||
alert(localized[5]);
|
||||
|
||||
if (node.tagName == 'threads') {
|
||||
this.updateThreads(node);
|
||||
} else if (node.tagName == 'operators') {
|
||||
this.updateOperators(node);
|
||||
}
|
||||
}
|
||||
} else if( root.tagName == 'error' ) {
|
||||
|
@ -25,7 +25,7 @@ require_once(dirname(__FILE__).'/converter.php');
|
||||
require_once(dirname(__FILE__).'/config.php');
|
||||
|
||||
$version = '1.6.4';
|
||||
$jsver = "163";
|
||||
$jsver = "164";
|
||||
|
||||
function myiconv($in_enc, $out_enc, $string) {
|
||||
global $_utf8win1251, $_win1251utf8;
|
||||
@ -579,6 +579,7 @@ $settings = array(
|
||||
'surveyaskgroup' => '1',
|
||||
'surveyaskmessage' => '0',
|
||||
'enablepopupnotification' => '0',
|
||||
'showonlineoperators' => '0',
|
||||
'enablecaptcha' => '0',
|
||||
|
||||
'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */
|
||||
|
@ -61,6 +61,31 @@ function operator_by_id($id) {
|
||||
return $operator;
|
||||
}
|
||||
|
||||
function operator_get_all() {
|
||||
$link = connect();
|
||||
|
||||
$query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
|
||||
"from chatoperator order by vclogin";
|
||||
$operators = select_multi_assoc($query, $link);
|
||||
mysql_close($link);
|
||||
return $operators;
|
||||
}
|
||||
|
||||
function operator_is_online($operator) {
|
||||
global $settings;
|
||||
return $operator['time'] < $settings['online_timeout'];
|
||||
}
|
||||
|
||||
function operator_is_available($operator) {
|
||||
global $settings;
|
||||
return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : "";
|
||||
}
|
||||
|
||||
function operator_is_away($operator) {
|
||||
global $settings;
|
||||
return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : "";
|
||||
}
|
||||
|
||||
function update_operator($operatorid,$login,$email,$password,$localename,$commonname) {
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
|
@ -444,6 +444,8 @@ settings.popup_notification.description=Small dialog appears to attract your att
|
||||
settings.popup_notification=Enable "Popup dialog notification of the new visitor".
|
||||
settings.saved=Changes saved
|
||||
settings.sendmessagekey=Send messages with:
|
||||
settings.show_online_operators.description=Can slow down the update rate of the list
|
||||
settings.show_online_operators=Show online operators on "List of awaiting visitors" page
|
||||
settings.survey.askgroup.description=Show/hide department selection field in the survey
|
||||
settings.survey.askgroup=Allows visitor to choose department/group
|
||||
settings.survey.askmail.description=Show/hide email field in the survey
|
||||
|
@ -436,6 +436,8 @@ settings.popup_notification.description=
|
||||
settings.popup_notification=Показывать небольшой диалог при появлении новых посетителей в очереди.
|
||||
settings.saved=Изменения сохранены
|
||||
settings.sendmessagekey=Посылать сообщение по:
|
||||
settings.show_online_operators.description=Может замедлить обновление списка
|
||||
settings.show_online_operators=Показывать доступных операторов на странице ожидающих посетителей
|
||||
settings.survey.askgroup.description=Показать/спрятать выбор группы в диалоге перед началом чата
|
||||
settings.survey.askgroup=Позволять посетителю выбирать группу операторов
|
||||
settings.survey.askmail.description=Показать/спрятать поле ввода адреса электронной почты
|
||||
|
@ -32,7 +32,7 @@ $options = array(
|
||||
'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics',
|
||||
'enablessl', 'forcessl',
|
||||
'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage',
|
||||
'enablepopupnotification',
|
||||
'enablepopupnotification', 'showonlineoperators',
|
||||
'enablecaptcha');
|
||||
|
||||
loadsettings();
|
||||
|
@ -59,28 +59,8 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
|
||||
}
|
||||
}
|
||||
|
||||
function is_online($operator) {
|
||||
global $settings;
|
||||
return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : "";
|
||||
}
|
||||
|
||||
function is_away($operator) {
|
||||
global $settings;
|
||||
return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : "";
|
||||
}
|
||||
|
||||
function get_operators() {
|
||||
$link = connect();
|
||||
|
||||
$query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
|
||||
"from chatoperator order by vclogin";
|
||||
$operators = select_multi_assoc($query, $link);
|
||||
mysql_close($link);
|
||||
return $operators;
|
||||
}
|
||||
|
||||
$page = array();
|
||||
$page['allowedAgents'] = get_operators();
|
||||
$page['allowedAgents'] = operator_get_all();
|
||||
$page['canmodify'] = is_capable($can_administrate, $operator);
|
||||
|
||||
setlocale(LC_TIME, getstring("time.locale"));
|
||||
|
@ -140,7 +140,6 @@ function print_pending_threads($groupids,$since) {
|
||||
|
||||
mysql_close($link);
|
||||
|
||||
start_xml_output();
|
||||
echo "<threads revision=\"$revision\" time=\"".time()."000\">";
|
||||
foreach( $output as $thr ) {
|
||||
print myiconv($webim_encoding,"utf-8",$thr);
|
||||
@ -148,12 +147,37 @@ function print_pending_threads($groupids,$since) {
|
||||
echo "</threads>";
|
||||
}
|
||||
|
||||
function print_operators() {
|
||||
echo "<operators>";
|
||||
$operators = operator_get_all();
|
||||
$names = array();
|
||||
|
||||
foreach($operators as $operator) {
|
||||
if (!operator_is_online($operator))
|
||||
continue;
|
||||
|
||||
$name = htmlspecialchars(htmlspecialchars($operator['vclocalename']));
|
||||
$away = operator_is_away($operator) ? " away=\"1\"" : "";
|
||||
|
||||
echo "<operator name=\"$name\"$away/>";
|
||||
}
|
||||
echo "</operators>";
|
||||
}
|
||||
|
||||
$since = verifyparam( "since", "/^\d{1,9}$/", 0);
|
||||
$status = verifyparam( "status", "/^\d{1,2}$/", 0);
|
||||
$showonline = verifyparam( "showonline", "/^1$/", 0);
|
||||
|
||||
loadsettings();
|
||||
$groupids = $_SESSION['operatorgroups'];
|
||||
|
||||
start_xml_output();
|
||||
echo '<update>';
|
||||
if($showonline) {
|
||||
print_operators();
|
||||
}
|
||||
print_pending_threads($groupids,$since);
|
||||
echo '</update>';
|
||||
notify_operator_alive($operator['operatorid'], $status);
|
||||
exit;
|
||||
|
||||
|
@ -46,6 +46,7 @@ $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1";
|
||||
$page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0";
|
||||
$page['frequency'] = $settings['updatefrequency_operator'];
|
||||
$page['istatus'] = $status;
|
||||
$page['showonline'] = $settings['showonlineoperators'] == '1' ? "1" : "0";
|
||||
|
||||
prepare_menu($operator);
|
||||
start_html_output();
|
||||
|
@ -75,10 +75,10 @@ require_once('inc_errors.php');
|
||||
<td class="notlast">
|
||||
<?php echo htmlspecialchars(topage($a['vclocalename'])) ?> / <?php echo htmlspecialchars(topage($a['vccommonname'])) ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if(is_online($a)) { ?>
|
||||
<td class="notlast">
|
||||
<?php if(operator_is_available($a)) { ?>
|
||||
<?php echo getlocal("page_agents.isonline") ?>
|
||||
<?php } else if(is_away($a)) { ?>
|
||||
<?php } else if(operator_is_away($a)) { ?>
|
||||
<?php echo getlocal("page_agents.isaway") ?>
|
||||
<?php } else { ?>
|
||||
<?php echo date_to_text(time() - $a['time']) ?>
|
||||
|
@ -184,6 +184,15 @@ require_once('inc_errors.php');
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('settings.show_online_operators') ?></div>
|
||||
<div class="fvalue">
|
||||
<input type="checkbox" name="showonlineoperators" value="on"<?php echo form_value_cb('showonlineoperators') ? " checked=\"checked\"" : "" ?>/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo getlocal('settings.show_online_operators.description') ?></div>
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('settings.leavemessage_captcha') ?></div>
|
||||
<div class="fvalue">
|
||||
|
@ -39,7 +39,7 @@ var localized = new Array(
|
||||
var updaterOptions = {
|
||||
url:"<?php echo $webimroot ?>/operator/update.php",wroot:"<?php echo $webimroot ?>",
|
||||
agentservl:"<?php echo $webimroot ?>/operator/agent.php", frequency:<?php echo $page['frequency'] ?>, istatus:<?php echo $page['istatus'] ?>,
|
||||
noclients:"<?php echo getlocal("clients.no_clients") ?>", havemenu: <?php echo $page['havemenu'] ?>, showpopup: <?php echo $page['showpopup'] ?> };
|
||||
noclients:"<?php echo getlocal("clients.no_clients") ?>", havemenu: <?php echo $page['havemenu'] ?>, showpopup: <?php echo $page['showpopup'] ?>, showonline: <?php echo $page['showonline'] ?> };
|
||||
//--></script>
|
||||
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/<?php echo $jsver ?>/users.js"></script>
|
||||
<?php
|
||||
@ -96,6 +96,11 @@ function tpl_content() { global $page, $webimroot;
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php if($page['showonline'] == "1") { ?>
|
||||
<div id="onlineoperators">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
} /* content */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user