diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php
index e2fc3cc0..bf92fbea 100644
--- a/src/messenger/webim/libs/chat.php
+++ b/src/messenger/webim/libs/chat.php
@@ -87,23 +87,29 @@ function post_message($threadid, $kind, $message, $from = null, $agentid = null)
return $id;
}
-function prepare_html_message($text)
+function prepare_html_message($text, $allow_formating)
{
$escaped_text = htmlspecialchars($text);
$text_w_links = preg_replace('/(https?|ftp):\/\/\S*/', '$0', $escaped_text);
$multiline = str_replace("\n", "
", $text_w_links);
- return $multiline;
+ if (! $allow_formating) {
+ return $multiline;
+ }
+ $formated = preg_replace('/<(span|strong)>(.*)<\/\1>/U', '<$1>$2$1>', $multiline);
+ $formated = preg_replace('/<span class="(.*)">(.*)<\/span>/U', '$2', $formated);
+ return $formated;
}
function message_to_html($msg)
{
- global $kind_to_string, $kind_avatar;
+ global $kind_to_string, $kind_user, $kind_agent, $kind_avatar;
if ($msg['ikind'] == $kind_avatar) return "";
$message = "" . date("H:i:s", $msg['created']) . " ";
$kind = $kind_to_string{$msg['ikind']};
if ($msg['tname'])
$message .= "" . htmlspecialchars($msg['tname']) . ": ";
- $message .= "" . prepare_html_message($msg['tmessage']) . "
";
+ $allow_formating = ($msg['ikind'] != $kind_user && $msg['ikind'] != $kind_agent);
+ $message .= "" . prepare_html_message($msg['tmessage'], $allow_formating) . "
";
return $message;
}
diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties
index a3ee69e8..5a2eebb9 100644
--- a/src/messenger/webim/locales/en/properties
+++ b/src/messenger/webim/locales/en/properties
@@ -63,13 +63,13 @@ chat.redirected.closewindow=Click to close the window
chat.redirected.content=The visitor has been placed in the priorty queue of the operator {0}.
chat.redirected.group.content=The visitor has been placed in a priorty queue of the group {0}.
chat.redirected.title=The visitor has been redirected to another operator
-chat.status.operator.changed=Operator {0} changed operator {1}
+chat.status.operator.changed=Operator {0} changed operator {1}
chat.status.operator.dead=Your operator has connection issues. We have moved you to a priorty position in the queue. Sorry for keeping you waiting.
chat.status.operator.joined=Operator {0} joined the chat
chat.status.operator.left=Operator {0} left the chat
chat.status.operator.redirect=Operator {0} redirected you to another operator. Please wait a while.
chat.status.operator.returned=Operator {0} is back
-chat.status.user.changedname=The visitor changed their name {0} to {1}
+chat.status.user.changedname=The visitor changed their name {0} to {1}
chat.status.user.dead=Visitor closed chat window
chat.status.user.left=Visitor {0} left the chat
chat.status.user.reopenedthread=Visitor joined chat again
diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties
index f47fdf97..739997fe 100644
--- a/src/messenger/webim/locales/ru/properties
+++ b/src/messenger/webim/locales/ru/properties
@@ -63,13 +63,13 @@ chat.redirected.closewindow=
chat.redirected.content=Посетитель помещен в привелегированную очередь оператора {0}.
chat.redirected.group.content=Посетитель помещен в привелегированную очередь группы {0}.
chat.redirected.title=Посетитель переведен другому оператору
-chat.status.operator.changed=Оператор {0} сменил оператора {1}
+chat.status.operator.changed=Оператор {0} сменил оператора {1}
chat.status.operator.dead=У оператора возникли проблемы со связью, мы временно перевели Вас в приоритетную очередь. Приносим извинения за Ваше ожидание.
chat.status.operator.joined=Оператор {0} включился в разговор
chat.status.operator.left=Оператор {0} покинул диалог
chat.status.operator.redirect=Оператор {0} переключил Вас на другого оператора, пожалуйста, подождите немного
chat.status.operator.returned=Оператор {0} вернулся в диалог
-chat.status.user.changedname=Посетитель сменил имя {0} на {1}
+chat.status.user.changedname=Посетитель сменил имя {0} на {1}
chat.status.user.dead=Посетитель закрыл окно диалога
chat.status.user.left=Посетитель {0} покинул диалог
chat.status.user.reopenedthread=Посетитель заново вошел в диалог