diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 1e1e1102..db6e4eb3 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -682,13 +682,14 @@ function take_thread($thread, $operator) $message_to_post = getstring2_("chat.status.operator.changed", array($operatorName, $thread['agentName']), $thread['locale']); } } else { - die("cannot take thread"); + return false; } if ($message_to_post) { post_message($threadid, $kind_events, $message_to_post); post_message($threadid, $kind_avatar, $operator['vcavatar'] ? $operator['vcavatar'] : ""); } + return true; } function check_for_reassign($thread, $operator) diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 8ca66249..a3ee69e8 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -542,6 +542,11 @@ tag.pagination.no_items=Found 0 elements tag.pagination.previous=previous thread.back_to_search=Go to search thread.chat_log=Chat log +thread.error.cannot_take=Cannot take thread +thread.error.cannot_take_over=Cannot take over +thread.error.cannot_view=Cannot view threads +thread.error.old_browser=Old browser is used, please update it +thread.error.wrong_thread=Wrong thread thread.intro=This page displays chat details and content. time.dateformat=%B %d, %Y time.locale=en_US diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 2bbd019d..f47fdf97 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -540,6 +540,11 @@ tag.pagination.no_items= tag.pagination.previous=предыдущая thread.back_to_search=Перейти в поиск thread.chat_log=Протокол разговора +thread.error.cannot_take=Невозможно установить диалог +thread.error.cannot_take_over=Вы не можете перехватывать диалоги +thread.error.cannot_view=Вы не можете просматривать диалоги +thread.error.old_browser=Вы используете устаревший браузер, пожалуйста, обновите его +thread.error.wrong_thread=Диалог не существует thread.intro=На данной странице Вы можете просмотреть диалог. time.dateformat=%d %B %Y, time.locale=ru_RU.UTF-8 diff --git a/src/messenger/webim/operator/agent.php b/src/messenger/webim/operator/agent.php index a7cf7a39..b1f61def 100644 --- a/src/messenger/webim/operator/agent.php +++ b/src/messenger/webim/operator/agent.php @@ -48,12 +48,18 @@ if (!isset($_GET['token'])) { $remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']); if ($remote_level != "ajaxed") { - die("old browser is used, please update it"); + $errors = array(getlocal("thread.error.old_browser")); + start_html_output(); + expand("../styles/dialogs", getchatstyle(), "error.tpl"); + exit; } $thread = thread_by_id($threadid); if (!$thread || !isset($thread['ltoken'])) { - die("wrong thread"); + $errors = array(getlocal("thread.error.wrong_thread")); + start_html_output(); + expand("../styles/dialogs", getchatstyle(), "error.tpl"); + exit; } $viewonly = verifyparam("viewonly", "/^true$/", false); @@ -62,7 +68,7 @@ if (!isset($_GET['token'])) { if (!$viewonly && $thread['istate'] == $state_chatting && $operator['operatorid'] != $thread['agentId']) { if (!is_capable($can_takeover, $operator)) { - $errors = array("Cannot take over"); + $errors = array(getlocal("thread.error.cannot_take_over")); start_html_output(); expand("../styles/dialogs", getchatstyle(), "error.tpl"); exit; @@ -79,9 +85,14 @@ if (!isset($_GET['token'])) { } if (!$viewonly) { - take_thread($thread, $operator); + if(! take_thread($thread, $operator)){ + $errors = array(getlocal("thread.error.cannot_take")); + start_html_output(); + expand("../styles/dialogs", getchatstyle(), "error.tpl"); + exit; + } } else if (!is_capable($can_viewthreads, $operator)) { - $errors = array("Cannot view threads"); + $errors = array(getlocal("thread.error.cannot_view")); start_html_output(); expand("../styles/dialogs", getchatstyle(), "error.tpl"); exit;