diff --git a/src/messenger/webim/operator/agent.php b/src/messenger/webim/operator/agent.php
index c03bb727..23f414c8 100644
--- a/src/messenger/webim/operator/agent.php
+++ b/src/messenger/webim/operator/agent.php
@@ -22,7 +22,8 @@ $threadid = verifyparam( "thread", "/^\d{1,8}$/");
if( !isset($_GET['token']) ) {
- if( get_remote_level($_SERVER['HTTP_USER_AGENT']) != "ajaxed" ) {
+ $remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
+ if( $remote_level != "ajaxed" ) {
die("old browser is used, please update it");
}
@@ -31,11 +32,11 @@ if( !isset($_GET['token']) ) {
die("wrong thread");
}
- take_thread($thread,$operator);
+ take_thread($thread,$operator);
- $token = $thread['ltoken'];
- header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token");
- exit;
+ $token = $thread['ltoken'];
+ header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token&level=$remote_level");
+ exit;
}
$token = verifyparam( "token", "/^\d{1,8}$/");
@@ -49,7 +50,6 @@ setup_chatview_for_operator($thread, $operator);
start_html_output();
-
require('../view/chat_ajaxed.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/history.php b/src/messenger/webim/operator/history.php
index 6e49bcce..ce29949d 100644
--- a/src/messenger/webim/operator/history.php
+++ b/src/messenger/webim/operator/history.php
@@ -26,7 +26,7 @@ if($query !== false) {
$link = connect();
$result = mysql_query(
- "select DISTINCT unix_timestamp(chatthread.dtmcreated) as created, ".
+ "select DISTINCT unix_timestamp(chatthread.dtmcreated) as created, ".
"unix_timestamp(chatthread.dtmmodified) as modified, chatthread.threadid, ".
"chatthread.remote, chatthread.agentName, chatthread.userName, ".
"messageCount as size ".
@@ -34,7 +34,7 @@ if($query !== false) {
"where chatmessage.threadid = chatthread.threadid and ".
"((chatthread.userName LIKE '%%$query%%') or ".
" (chatmessage.tmessage LIKE '%%$query%%'))".
- "order by created DESC", $link)
+ "order by created DESC", $link)
or die(' Query failed: ' .mysql_error().": ".$query);
$foundThreads = array();
diff --git a/src/messenger/webim/operator/index.php b/src/messenger/webim/operator/index.php
index ce9fc8e9..d0eb3659 100644
--- a/src/messenger/webim/operator/index.php
+++ b/src/messenger/webim/operator/index.php
@@ -17,7 +17,7 @@ require_once('../libs/operator.php');
$operator = check_login();
-$page = array(
+$page = array(
'operator' => topage(get_operator_name($operator)),
'version' => $version,
'localeLinks' => get_locale_links("$webimroot/operator/index.php")
diff --git a/src/messenger/webim/operator/login.php b/src/messenger/webim/operator/login.php
index a20c899a..d094e899 100644
--- a/src/messenger/webim/operator/login.php
+++ b/src/messenger/webim/operator/login.php
@@ -1,4 +1,4 @@
- '');
$errors = array();
-
if( isset($_POST['login']) && isset($_POST['password']) ) {
$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", "");
$login = getparam('login');
@@ -29,7 +28,6 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
$localname = getparam('name');
$commonname = getparam('commonname');
-
if( !$localname )
$errors[] = no_field("form.field.agent_name");
@@ -49,15 +47,15 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
$errors[] = getlocal("my_settings.error.password_match");
$existing_operator = operator_by_login($login);
- if( (!$agentId && $existing_operator) ||
+ if( (!$agentId && $existing_operator) ||
( $agentId && $existing_operator && $agentId != $existing_operator['operatorid']) )
$errors[] = getlocal("page_agent.error.duplicate_login");
if( count($errors) == 0 ) {
if (!$agentId) {
- create_operator($login,$password,$localname,$commonname);
+ create_operator($login,$password,$localname,$commonname);
} else {
- update_operator($agentId,$login,$password,$localname,$commonname);
+ update_operator($agentId,$login,$password,$localname,$commonname);
}
header("Location: $webimroot/operator/operators.php");
exit;
diff --git a/src/messenger/webim/operator/threadprocessor.php b/src/messenger/webim/operator/threadprocessor.php
index 897f855d..a2fdf129 100644
--- a/src/messenger/webim/operator/threadprocessor.php
+++ b/src/messenger/webim/operator/threadprocessor.php
@@ -20,7 +20,6 @@ $operator = check_login();
$page = array( 'operator' => topage(get_operator_name($operator)) );
-
if( isset($_GET['threadid'])) {
$threadid = verifyparam( "threadid", "/^(\d{1,9})?$/", "");
$lastid = -1;
diff --git a/src/messenger/webim/operator/update.php b/src/messenger/webim/operator/update.php
index 8a3d4208..50525884 100644
--- a/src/messenger/webim/operator/update.php
+++ b/src/messenger/webim/operator/update.php
@@ -57,7 +57,7 @@ function thread_to_xml($thread) {
$result .= "".htmlspecialchars(htmlspecialchars($threadoperator))."";
$result .= "";
$result .= "".$thread['unix_timestamp(dtmmodified)']."000";
-
+
$result .= "";
return $result;
}
@@ -71,16 +71,14 @@ function print_pending_threads($since) {
$query = "select threadid, userName, agentName, unix_timestamp(dtmcreated), userTyping, ".
"unix_timestamp(dtmmodified), lrevision, istate, remote ".
"from chatthread where lrevision > $since ORDER BY threadid";
- $result = mysql_query($query,$link) or die(' Query failed: ' .mysql_error().": ".$query);
-
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
+ $rows = select_multi_assoc($query, $link);
+ foreach ($rows as $row) {
$thread = thread_to_xml($row);
$output[] = $thread;
if( $row['lrevision'] > $revision )
$revision = $row['lrevision'];
}
- mysql_free_result($result);
mysql_close($link);
start_xml_output();
@@ -91,8 +89,6 @@ function print_pending_threads($since) {
echo "";
}
-////////
-
$since = verifyparam( "since", "/^\d{1,9}$/", 0);
print_pending_threads($since);
diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php
index 3cf94650..d4d30b38 100644
--- a/src/messenger/webim/operator/users.php
+++ b/src/messenger/webim/operator/users.php
@@ -15,7 +15,6 @@
require_once('../libs/common.php');
require_once('../libs/operator.php');
-
$operator = check_login();
notify_operator_alive($operator['operatorid']);