mail fixes, visitors message count in history, loading state, pre 1.0.10

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@95 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-06-04 22:51:46 +00:00
parent 94fa454f92
commit 609e039950
18 changed files with 140 additions and 66 deletions

View File

@ -1,5 +1,5 @@
Web Instant Messenger 1.0.9 Web Instant Messenger 1.0.10
Copyright (c) 2005-2008 Web Messenger Creators Community. Copyright (c) 2005-2008 Web Messenger Creators Community.
This program and the accompanying materials are made available under This program and the accompanying materials are made available under

View File

@ -1,5 +1,5 @@
Web Instant Messenger 1.0.9 Web Instant Messenger 1.0.10
Copyright (c) 2005-2008 сообщество разработчиков Web Messenger. Copyright (c) 2005-2008 сообщество разработчиков Web Messenger.
Данное программное обеспечение и сопутствующие материалы подпадают под Данное программное обеспечение и сопутствующие материалы подпадают под

View File

@ -17,8 +17,9 @@ require_once('libs/operator.php');
$image = verifyparam("image","/^\w+$/", "webim"); $image = verifyparam("image","/^\w+$/", "webim");
$lang = verifyparam("lang", "/^[\w-]{2,5}$/", ""); $lang = verifyparam("lang", "/^[\w-]{2,5}$/", "");
if( !$lang || !in_array($lang,$available_locales) ) if(!$lang || !in_array($lang,$available_locales)) {
$lang = $current_locale; $lang = $current_locale;
}
$image_postfix = has_online_operators() ? "on" : "off"; $image_postfix = has_online_operators() ? "on" : "off";
$filename = "locales/${lang}/button/${image}_${image_postfix}.gif"; $filename = "locales/${lang}/button/${image}_${image_postfix}.gif";

View File

@ -31,7 +31,8 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
} }
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "";
$remoteHost = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR']; $extAddr = $_SERVER['REMOTE_ADDR'];
$remoteHost = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr;
$visitor = $remote_visitor(); $visitor = $remote_visitor();
$thread = create_thread($visitor['name'], $remoteHost, $referer,$current_locale); $thread = create_thread($visitor['name'], $remoteHost, $referer,$current_locale);
$_SESSION['threadid'] = $thread['threadid']; $_SESSION['threadid'] = $thread['threadid'];

View File

@ -30,6 +30,7 @@ $dbtables = array(
"lastpingagent" => "datetime DEFAULT 0", "lastpingagent" => "datetime DEFAULT 0",
"userTyping" => "int DEFAULT 0", "userTyping" => "int DEFAULT 0",
"agentTyping" => "int DEFAULT 0", "agentTyping" => "int DEFAULT 0",
"messageCount" => "varchar(16)"
), ),
"chatmessage" => array( "chatmessage" => array(
@ -59,7 +60,7 @@ $dbtables = array(
$memtables = array(); $memtables = array();
$dbtables_can_update = array( $dbtables_can_update = array(
"chatthread" => array("agentId", "userTyping", "agentTyping"), "chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount"),
"chatmessage" => array("agentId"), "chatmessage" => array("agentId"),
); );
@ -108,7 +109,7 @@ function create_table($id,$link) {
function get_tables($link) { function get_tables($link) {
global $mysqldb, $errors; global $mysqldb, $errors;
$result = mysql_query("SHOW TABLES FROM $mysqldb"); $result = mysql_query("SHOW TABLES FROM `$mysqldb`");
if( $result ) { if( $result ) {
$arr = array(); $arr = array();
while ($row = mysql_fetch_array($result, MYSQL_NUM)) { while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

View File

@ -80,6 +80,13 @@ if($act == "createdb") {
runsql("ALTER TABLE chatthread ADD userTyping int DEFAULT 0", $link); runsql("ALTER TABLE chatthread ADD userTyping int DEFAULT 0", $link);
} }
if( in_array("chatthread.messageCount", $absent) ) {
runsql("ALTER TABLE chatthread ADD messageCount varchar(16)", $link);
runsql("ALTER TABLE chatmessage ADD index idx_threadid_ikind (threadid, ikind)", $link);
runsql("UPDATE chatthread t SET t.messageCount = (SELECT COUNT(*) FROM chatmessage WHERE chatmessage.threadid = t.threadid AND ikind = 1)", $link);
runsql("ALTER TABLE chatmessage DROP INDEX idx_threadid_ikind", $link);
}
} }
} }

View File

@ -1,4 +1,15 @@
1.0.10
------
[+] Number of messages from visitor in history
[+] State "loading" (means user is still loading his window)
[!] Company logo link target is now an option in config
[!] Mail encoding fixed (separate option)
[!] Operator/user locale is stored in cookie
[!] localized dates
[!] fixed installing on DB with numeric name
1.0.9 1.0.9
----- -----

View File

@ -43,16 +43,10 @@ if( count($errors) > 0 ) {
exit; exit;
} }
// FIXME mail encoding $subject = getstring2_("leavemail.subject", array($visitor_name), $webim_messages_locale);
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message), $webim_messages_locale);
$subject = getstring2_("leavemail.subject", array($visitor_name), $webim_messages_encoding); webim_mail($webim_messages_mail, $email, $subject, $body);
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message), $webim_messages_encoding);
$headers = 'From: '.$webim_from_email."\r\n" .
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/'.phpversion();
mail($webim_messages_mail,$subject,wordwrap($body,70),$headers);
start_html_output(); start_html_output();

View File

@ -22,6 +22,7 @@ $state_queue = 0;
$state_waiting = 1; $state_waiting = 1;
$state_chatting = 2; $state_chatting = 2;
$state_closed = 3; $state_closed = 3;
$state_loading = 4;
$kind_user = 1; $kind_user = 1;
$kind_agent = 2; $kind_agent = 2;
@ -166,13 +167,14 @@ function print_thread_messages($thread, $token, $lastid, $isuser,$format) {
} }
} }
function get_user_name($username, $id="") { function get_user_name($username, $addr) {
global $presentable_name_pattern; global $presentable_name_pattern;
return str_replace("{id}", $id, str_replace("{name}", $username, $presentable_name_pattern)); return str_replace("{addr}", $addr,
str_replace("{name}", $username, $presentable_name_pattern));
} }
function setup_chatview_for_user($thread,$level) { function setup_chatview_for_user($thread,$level) {
global $page, $webimroot, $user_can_change_name, $company_logo_link, $company_name; global $page, $webimroot, $user_can_change_name, $company_logo_link, $company_name, $webim_host;
$page = array(); $page = array();
$page['agent'] = false; $page['agent'] = false;
$page['user'] = true; $page['user'] = true;
@ -192,22 +194,24 @@ function setup_chatview_for_user($thread,$level) {
$params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; $params = "thread=".$thread['threadid']."&token=".$thread['ltoken'];
$page['selfLink'] = "$webimroot/client.php?".$params."&level=".$level; $page['selfLink'] = "$webimroot/client.php?".$params."&level=".$level;
$page['webimHost'] = $webim_host;
} }
function setup_chatview_for_operator($thread,$operator) { function setup_chatview_for_operator($thread,$operator) {
global $page, $webimroot, $company_logo_link, $company_name; global $page, $webimroot, $company_logo_link, $company_name, $webim_host;
$page = array(); $page = array();
$page['agent'] = true; $page['agent'] = true;
$page['user'] = false; $page['user'] = false;
$page['canpost'] = true; $page['canpost'] = true;
$page['ct.chatThreadId'] = $thread['threadid']; $page['ct.chatThreadId'] = $thread['threadid'];
$page['ct.token'] = $thread['ltoken']; $page['ct.token'] = $thread['ltoken'];
$page['ct.user.name'] = topage(get_user_name($thread['userName'])); $page['ct.user.name'] = topage(get_user_name($thread['userName'],$thread['remote']));
$page['ct.company.name'] = topage($company_name); $page['ct.company.name'] = topage($company_name);
$page['ct.company.chatLogoURL'] = topage($company_logo_link); $page['ct.company.chatLogoURL'] = topage($company_logo_link);
$page['send_shortcut'] = "Ctrl-Enter"; $page['send_shortcut'] = "Ctrl-Enter";
$page['webimHost'] = $webim_host;
// TODO // TODO
$page['namePostfix'] = ""; $page['namePostfix'] = "";
@ -273,14 +277,21 @@ function update_thread_access($threadid, $params, $link) {
} }
function ping_thread($thread, $isuser,$istyping) { function ping_thread($thread, $isuser,$istyping) {
global $kind_for_agent, $state_chatting, $state_waiting, $kind_conn, $connection_timeout; global $kind_for_agent, $state_queue, $state_loading, $state_chatting, $state_waiting, $kind_conn, $connection_timeout;
$link = connect(); $link = connect();
$params = array(($isuser ? "lastpinguser" : "lastpingagent") => "CURRENT_TIMESTAMP", $params = array(($isuser ? "lastpinguser" : "lastpingagent") => "CURRENT_TIMESTAMP",
($isuser ? "userTyping" : "agentTyping") => ($istyping? "1" : "0") ); ($isuser ? "userTyping" : "agentTyping") => ($istyping? "1" : "0") );
$lastping = $thread[$isuser ? "lpagent" : "lpuser"]; $lastping = $thread[$isuser ? "lpagent" : "lpuser"];
$current = $thread['current']; $current = $thread['current'];
if( $thread['istate'] == $state_loading && $isuser) {
$params['istate'] = $state_queue;
commit_thread($thread['threadid'], $params, $link);
mysql_close($link);
return;
}
if( $lastping > 0 && abs($current-$lastping) > $connection_timeout ) { if( $lastping > 0 && abs($current-$lastping) > $connection_timeout ) {
$params[$isuser ? "lastpingagent" : "lastpinguser"] = "0"; $params[$isuser ? "lastpingagent" : "lastpinguser"] = "0";
if( !$isuser ) { if( !$isuser ) {
@ -302,7 +313,7 @@ function ping_thread($thread, $isuser,$istyping) {
} }
function commit_thread($threadid,$params,$link) { function commit_thread($threadid,$params,$link) {
$query = "update chatthread set lrevision = ".next_revision($link).", dtmmodified = CURRENT_TIMESTAMP"; $query = "update chatthread t set lrevision = ".next_revision($link).", dtmmodified = CURRENT_TIMESTAMP";
foreach( $params as $k => $v ) { foreach( $params as $k => $v ) {
$query .= ", ".$k."=".$v; $query .= ", ".$k."=".$v;
} }
@ -330,7 +341,8 @@ function close_thread($thread,$isuser) {
if( $thread['istate'] != $state_closed ) { if( $thread['istate'] != $state_closed ) {
$link = connect(); $link = connect();
commit_thread( $thread['threadid'], array('istate' => $state_closed), $link); commit_thread( $thread['threadid'], array('istate' => $state_closed,
'messageCount' => '(SELECT COUNT(*) FROM chatmessage WHERE chatmessage.threadid = t.threadid AND ikind = 1)'), $link);
mysql_close($link); mysql_close($link);
} }
@ -353,11 +365,12 @@ function thread_by_id($id) {
} }
function create_thread($username,$remoteHost,$referer,$lang) { function create_thread($username,$remoteHost,$referer,$lang) {
global $state_loading;
$link = connect(); $link = connect();
$query = sprintf( $query = sprintf(
"insert into chatthread (userName,"."ltoken,remote,referer,lrevision,locale,dtmcreated,dtmmodified) values ". "insert into chatthread (userName,"."ltoken,remote,referer,lrevision,locale,dtmcreated,dtmmodified,istate) values ".
"('%s',"."%s,'%s','%s',%s,'%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)", "('%s',"."%s,'%s','%s',%s,'%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,$state_loading)",
mysql_real_escape_string($username), mysql_real_escape_string($username),
next_token(), next_token(),
mysql_real_escape_string($remoteHost), mysql_real_escape_string($remoteHost),
@ -384,7 +397,7 @@ function do_take_thread($threadid,$operatorId,$operatorName) {
} }
function reopen_thread($threadid) { function reopen_thread($threadid) {
global $state_queue,$state_waiting,$state_chatting,$state_closed,$kind_events; global $state_queue,$state_loading,$state_waiting,$state_chatting,$state_closed,$kind_events;
$thread = thread_by_id($threadid); $thread = thread_by_id($threadid);
if( !$thread ) if( !$thread )
@ -393,7 +406,7 @@ function reopen_thread($threadid) {
if( $thread['istate'] == $state_closed ) if( $thread['istate'] == $state_closed )
return FALSE; return FALSE;
if( $thread['istate'] != $state_chatting && $thread['istate'] != $state_queue ) { if( $thread['istate'] != $state_chatting && $thread['istate'] != $state_queue && $thread['istate'] != $state_loading ) {
$link = connect(); $link = connect();
commit_thread( $threadid, commit_thread( $threadid,
array("istate" => $state_waiting ), $link); array("istate" => $state_waiting ), $link);
@ -405,7 +418,7 @@ function reopen_thread($threadid) {
} }
function take_thread($thread,$operator) { function take_thread($thread,$operator) {
global $state_queue, $state_waiting, $state_chatting, $kind_events, $home_locale; global $state_queue, $state_loading, $state_waiting, $state_chatting, $kind_events, $home_locale;
$state = $thread['istate']; $state = $thread['istate'];
$threadid = $thread['threadid']; $threadid = $thread['threadid'];
@ -413,7 +426,7 @@ function take_thread($thread,$operator) {
$operatorName = ($thread['locale'] == $home_locale) ? $operator['vclocalename'] : $operator['vccommonname']; $operatorName = ($thread['locale'] == $home_locale) ? $operator['vclocalename'] : $operator['vccommonname'];
if( $state == $state_queue || $state == $state_waiting) { if( $state == $state_queue || $state == $state_waiting || $state == $state_loading) {
do_take_thread($threadid, $operator['operatorid'], $operatorName); do_take_thread($threadid, $operator['operatorid'], $operatorName);
if( $state == $state_waiting ) { if( $state == $state_waiting ) {

View File

@ -17,7 +17,7 @@ session_start();
require_once(dirname(__FILE__).'/converter.php'); require_once(dirname(__FILE__).'/converter.php');
require_once(dirname(__FILE__).'/config.php'); require_once(dirname(__FILE__).'/config.php');
$version = 'v1.0.9'; $version = 'v1.0.10/pre1';
function myiconv($in_enc, $out_enc, $string) { function myiconv($in_enc, $out_enc, $string) {
global $_utf8win1251, $_win1251utf8; global $_utf8win1251, $_win1251utf8;
@ -69,6 +69,12 @@ function debugexit_print( $var ) {
function get_user_locale() { function get_user_locale() {
global $available_locales, $default_locale; global $available_locales, $default_locale;
if( isset($_COOKIE['webim_locale']) ) {
$requested_lang = $_COOKIE['webim_locale'];
if( in_array($requested_lang,$available_locales) )
return $requested_lang;
}
if( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) { if( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {
$requested_langs = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); $requested_langs = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach( $requested_langs as $requested_lang) { foreach( $requested_langs as $requested_lang) {
@ -87,12 +93,13 @@ function get_user_locale() {
} }
function get_locale() { function get_locale() {
global $available_locales; global $available_locales, $webimroot;
$locale = verifyparam("locale", "/^[\w-]{2,5}$/", ""); $locale = verifyparam("locale", "/^[\w-]{2,5}$/", "");
if( $locale && in_array($locale,$available_locales) ) { if( $locale && in_array($locale,$available_locales) ) {
$_SESSION['locale'] = $locale; $_SESSION['locale'] = $locale;
setcookie('webim_locale', $locale, time()+60*60*24*1000, "$webimroot/");
} else if( isset($_SESSION['locale']) ){ } else if( isset($_SESSION['locale']) ){
$locale = $_SESSION['locale']; $locale = $_SESSION['locale'];
} }
@ -102,13 +109,8 @@ function get_locale() {
return $locale; return $locale;
} }
function set_locale($locale) {
global $current_locale, $available_locales;
if( in_array($locale,$available_locales) )
$current_locale = $locale;
}
$current_locale = get_locale(); $current_locale = get_locale();
setlocale(LC_TIME, $current_locale);
$messages = array(); $messages = array();
$output_encoding = array(); $output_encoding = array();
@ -179,6 +181,11 @@ function getlocal($text) {
return myiconv($webim_encoding,getoutputenc(), getstring_($text,$current_locale)); return myiconv($webim_encoding,getoutputenc(), getstring_($text,$current_locale));
} }
function getlocal_($text,$locale) {
global $webim_encoding;
return myiconv($webim_encoding,getoutputenc(), getstring_($text,$locale));
}
function topage($text) { function topage($text) {
global $webim_encoding; global $webim_encoding;
return myiconv($webim_encoding,getoutputenc(), $text); return myiconv($webim_encoding,getoutputenc(), $text);
@ -350,8 +357,8 @@ function date_diff($seconds) {
} }
} }
function is_valid_email($mail) { function is_valid_email($email) {
return preg_match("/^[^@]+@[^\.]+(\.[^\.]+)*$/", $mail); return preg_match("/^[^@]+@[^\.]+(\.[^\.]+)*$/", $email);
} }
function quote_smart($value,$link) { function quote_smart($value,$link) {
@ -377,7 +384,7 @@ function get_month_selection($fromtime,$totime) {
$result = array(); $result = array();
do { do {
$current = mktime(0,0,0,$month,1,$year); $current = mktime(0,0,0,$month,1,$year);
$result[date("m.y",$current)] = date("M, Y",$current); $result[date("m.y",$current)] = strftime("%B, %Y",$current);
$month++; $month++;
if( $month > 12 ) { if( $month > 12 ) {
$month = 1; $month = 1;
@ -400,4 +407,17 @@ function set_form_date($utime,$prefix) {
$page["form${prefix}month"] = date("m.y", $utime); $page["form${prefix}month"] = date("m.y", $utime);
} }
function webim_mail($toaddr, $reply_to, $subject, $body) {
global $webim_encoding, $webim_from_email, $mail_encoding;
$headers = "From: $webim_from_email\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();
$real_subject = "=?".$mail_encoding."?B?".base64_encode(myiconv($webim_encoding,$mail_encoding,$subject))."?=";
mail($toaddr, $real_subject, wordwrap(myiconv($webim_encoding, $mail_encoding, $body),70), $headers);
}
?> ?>

View File

@ -40,6 +40,11 @@ $force_charset_in_connection = true;
*/ */
$compatibility_encoding = "cp1251"; $compatibility_encoding = "cp1251";
/*
* This encoding will be used for emails
*/
$mail_encoding = $webim_encoding;
/* /*
* From field in outgoing mail. * From field in outgoing mail.
*/ */
@ -49,7 +54,7 @@ $webim_from_email = "webim@yourdomain.com"; /* email from field */
* Inbox for left messages * Inbox for left messages
*/ */
$webim_messages_mail = "operators@yourdomain.com"; $webim_messages_mail = "operators@yourdomain.com";
$webim_messages_encoding = "en"; $webim_messages_locale = "en";
/* /*
* Company international name. * Company international name.
@ -61,6 +66,11 @@ $company_name = "My Company Ltd.";
*/ */
$company_logo_link = ""; $company_logo_link = "";
/*
* Web Messenger host
*/
$webim_host = "";
/* /*
* Locales * Locales
*/ */
@ -74,7 +84,7 @@ $default_locale = "en"; /* if user does not provide known la
$user_can_change_name = true; $user_can_change_name = true;
/* /*
* How to build presentable visitor name from {name}. Default: {name} * How to build presentable visitor name from {name} or {addr}. Default: {name}
*/ */
$presentable_name_pattern = "{name}"; $presentable_name_pattern = "{name}";

View File

@ -55,6 +55,7 @@ chat.thread.state_wait=In queue
chat.thread.state_wait_for_another_agent=Waiting for operator chat.thread.state_wait_for_another_agent=Waiting for operator
chat.thread.state_chatting_with_agent=In chat chat.thread.state_chatting_with_agent=In chat
chat.thread.state_closed=Closed chat.thread.state_closed=Closed
chat.thread.state_loading=Loading
clients.title=List of awaiting visitors clients.title=List of awaiting visitors
clients.no_clients=The list of awaiting visitors is empty clients.no_clients=The list of awaiting visitors is empty
clients.intro=The page displays list of awaiting visitors. clients.intro=The page displays list of awaiting visitors.
@ -79,6 +80,7 @@ page_analysis.search.title=Chats history
page.analysis.search.head_name=Name page.analysis.search.head_name=Name
page.analysis.search.head_host=Visitor's address page.analysis.search.head_host=Visitor's address
page.analysis.search.head_operator=Operator page.analysis.search.head_operator=Operator
page.analysis.search.head_messages=Visitor's messages
page.analysis.search.head_time=Time in chat page.analysis.search.head_time=Time in chat
common.asterisk_explanation=<b><font class="red">*</font></b> - mandatory fields common.asterisk_explanation=<b><font class="red">*</font></b> - mandatory fields
page_agents.title=Agents page_agents.title=Agents

View File

@ -13,9 +13,9 @@ page_login.remember=
page_login.error=Введен неправильный логин или пароль page_login.error=Введен неправильный логин или пароль
agent.not_logged_in=Ваша сессия устарела, войдите, пожалуйста, снова agent.not_logged_in=Ваша сессия устарела, войдите, пожалуйста, снова
page_client.pending_users=На этой странице можно просмотреть список ожидающих ответа посетителей. page_client.pending_users=На этой странице можно просмотреть список ожидающих ответа посетителей.
chat.window.title.agent=Вэб Мессенджер chat.window.title.agent=Веб Мессенджер
chat.window.title.user=Вэб Мессенджер chat.window.title.user=Веб Мессенджер
chat.window.product_name=Вэб <span class="grey">Мессенджер</span> chat.window.product_name=Веб <span class="grey">Мессенджер</span>
chat.window.close_title=Закрыть диалог chat.window.close_title=Закрыть диалог
chat.window.chatting_with=Вы общаетесь с: chat.window.chatting_with=Вы общаетесь с:
chat.window.poweredby=Предоставлено: chat.window.poweredby=Предоставлено:
@ -55,6 +55,7 @@ chat.thread.state_wait=
chat.thread.state_wait_for_another_agent=Ожидание оператора chat.thread.state_wait_for_another_agent=Ожидание оператора
chat.thread.state_chatting_with_agent=В диалоге chat.thread.state_chatting_with_agent=В диалоге
chat.thread.state_closed=Закрыто chat.thread.state_closed=Закрыто
chat.thread.state_loading=Загружается
clients.title=Список ожидающих посетителей clients.title=Список ожидающих посетителей
clients.no_clients=В этой очереди ожидающих посетителей нет clients.no_clients=В этой очереди ожидающих посетителей нет
clients.intro=На этой странице можно просмотреть список ожидающих ответа посетителей. clients.intro=На этой странице можно просмотреть список ожидающих ответа посетителей.
@ -79,6 +80,7 @@ page_analysis.search.title=
page.analysis.search.head_name=Имя page.analysis.search.head_name=Имя
page.analysis.search.head_host=Адрес посетителя page.analysis.search.head_host=Адрес посетителя
page.analysis.search.head_operator=Оператор page.analysis.search.head_operator=Оператор
page.analysis.search.head_messages=Сообщений посетителя
page.analysis.search.head_time=Время в диалоге page.analysis.search.head_time=Время в диалоге
common.asterisk_explanation=<b><font class="red">*</font></b> - поля, обязательные для заполнения common.asterisk_explanation=<b><font class="red">*</font></b> - поля, обязательные для заполнения
page_agents.title=Агенты page_agents.title=Агенты
@ -99,14 +101,14 @@ leftMenu.client_agents=
leftMenu.client_gen_button=Код кнопки leftMenu.client_gen_button=Код кнопки
admin.content.description=Набор функций, доступный только зарегистрированным операторам admin.content.description=Набор функций, доступный только зарегистрированным операторам
admin.content.client_agents=Создание, удаление агентов компании. Управление их правами и возможностями. admin.content.client_agents=Создание, удаление агентов компании. Управление их правами и возможностями.
admin.content.client_gen_button=Получение HTML-кода для кнопки "Вэб Мессенджера". admin.content.client_gen_button=Получение HTML-кода для кнопки "Веб Мессенджера".
page.gen_button.title=Получение HTML-кода кнопки page.gen_button.title=Получение HTML-кода кнопки
page.gen_button.intro=На этой странице Вы можете получить HTML-код кнопки "Вэб Мессенджера" для размещения на своем сайте. page.gen_button.intro=На этой странице Вы можете получить HTML-код кнопки "Веб Мессенджера" для размещения на своем сайте.
page.gen_button.code=HTML-код page.gen_button.code=HTML-код
page.gen_button.sample=Пример page.gen_button.sample=Пример
page.gen_button.code.description=<strong>Внимание!</strong> При внесении<br/> каких-либо изменений<br/> в этот код работоспособность<br/> кнопки не гарантируется! page.gen_button.code.description=<strong>Внимание!</strong> При внесении<br/> каких-либо изменений<br/> в этот код работоспособность<br/> кнопки не гарантируется!
mail.user.history.subject=Вэб Мессенджер: история диалога mail.user.history.subject=Веб Мессенджер: история диалога
mail.user.history.body=Здраствуйте, {0}!\n\nПо Вашему запросу, высылаем историю: \n\n{1}\n--- \nС уважением,\nВэб Мессенджер mail.user.history.body=Здраствуйте, {0}!\n\nПо Вашему запросу, высылаем историю: \n\n{1}\n--- \nС уважением,\nВеб Мессенджер
errors.header=<font color="#c13030"><b>Исправьте ошибки:</b><br/><ul> errors.header=<font color="#c13030"><b>Исправьте ошибки:</b><br/><ul>
errors.prefix=<li class="error"> errors.prefix=<li class="error">
errors.suffix=</li> errors.suffix=</li>
@ -130,7 +132,7 @@ image.chat.message=/locales/ru/images/message.gif
image.button.login=/locales/ru/images/login.gif image.button.login=/locales/ru/images/login.gif
image.button.save=/locales/ru/images/save.gif image.button.save=/locales/ru/images/save.gif
image.button.search=/locales/ru/images/search.gif image.button.search=/locales/ru/images/search.gif
app.title=Веб мессенджер app.title=Веб Мессенджер
chat.came.from=Посетитель пришел со страницы {0} chat.came.from=Посетитель пришел со страницы {0}
content.history=Поиск по истории диалогов content.history=Поиск по истории диалогов
content.logoff=Покинуть систему. content.logoff=Покинуть систему.
@ -162,7 +164,7 @@ install.title=
installed.login_link=Войти в систему installed.login_link=Войти в систему
installed.message=<b>Установка успешно завершена. </b> installed.message=<b>Установка успешно завершена. </b>
installed.notice=Вы можете войти в систему как admin с пустым паролем.<br/>В целях безопасности, удалите, пожалуйста, каталог /webim/install с вашего сервера и поменяйте пароль. installed.notice=Вы можете войти в систему как admin с пустым паролем.<br/>В целях безопасности, удалите, пожалуйста, каталог /webim/install с вашего сервера и поменяйте пароль.
leavemail.body=Ваш посетитель {0} оставил сообщение:\n\n{2}\n\nЕго email: {1}\n\n--- \nС уважением,\nВаш веб-мессенджер leavemail.body=Ваш посетитель '{0}' оставил сообщение:\n\n{2}\n\nЕmail: {1}\n\n--- \nС уважением,\nВаш Веб Мессенджер
leavemail.subject=Вопрос от {0} leavemail.subject=Вопрос от {0}
leavemessage.close=Закрыть leavemessage.close=Закрыть
leavemessage.descr=К сожалению, сейчас нет ни одного доступного оператора. Попробуйте обратиться позже или оставьте нам свой вопрос и мы свяжемся с Вами по оставленному адресу. leavemessage.descr=К сожалению, сейчас нет ни одного доступного оператора. Попробуйте обратиться позже или оставьте нам свой вопрос и мы свяжемся с Вами по оставленному адресу.

View File

@ -52,16 +52,10 @@ foreach( $output as $msg ) {
$history .= $msg; $history .= $msg;
} }
// FIXME mail encoding?
$subject = getstring("mail.user.history.subject"); $subject = getstring("mail.user.history.subject");
$body = getstring2("mail.user.history.body", array($thread['userName'],$history) ); $body = getstring2("mail.user.history.body", array($thread['userName'],$history) );
$headers = 'From: '.$webim_from_email."\r\n" . webim_mail($email, $webim_from_email, $subject, $body);
'Reply-To: '.$webim_from_email."\r\n" .
'X-Mailer: PHP/'.phpversion();
mail($email,$subject,wordwrap($body,70),$headers);
start_html_output(); start_html_output();
require('view/chat_mailsent.php'); require('view/chat_mailsent.php');

View File

@ -28,7 +28,8 @@ if($query !== false) {
$result = mysql_query( $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, ". "unix_timestamp(chatthread.dtmmodified) as modified, chatthread.threadid, ".
"chatthread.remote, chatthread.agentName, chatthread.userName ". "chatthread.remote, chatthread.agentName, chatthread.userName, ".
"messageCount as size ".
"from chatthread, chatmessage ". "from chatthread, chatmessage ".
"where chatmessage.threadid = chatthread.threadid and ". "where chatmessage.threadid = chatthread.threadid and ".
"((chatthread.userName LIKE '%%$query%%') or ". "((chatthread.userName LIKE '%%$query%%') or ".

View File

@ -27,14 +27,16 @@ $threadstate_to_string = array(
$state_queue => "wait", $state_queue => "wait",
$state_waiting => "prio", $state_waiting => "prio",
$state_chatting => "chat", $state_chatting => "chat",
$state_closed => "closed" $state_closed => "closed",
$state_loading => "wait"
); );
$threadstate_key = array( $threadstate_key = array(
$state_queue => "chat.thread.state_wait", $state_queue => "chat.thread.state_wait",
$state_waiting => "chat.thread.state_wait_for_another_agent", $state_waiting => "chat.thread.state_wait_for_another_agent",
$state_chatting => "chat.thread.state_chatting_with_agent", $state_chatting => "chat.thread.state_chatting_with_agent",
$state_closed => "chat.thread.state_closed" $state_closed => "chat.thread.state_closed",
$state_loading => "chat.thread.state_loading"
); );
function thread_to_xml($thread) { function thread_to_xml($thread) {
@ -50,7 +52,7 @@ function thread_to_xml($thread) {
$result .= " canopen=\"true\""; $result .= " canopen=\"true\"";
$result .= " state=\"$state\" typing=\"".$thread['userTyping']."\">"; $result .= " state=\"$state\" typing=\"".$thread['userTyping']."\">";
$result .= "<name>".htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'])))."</name>"; $result .= "<name>".htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'],$thread['remote'])))."</name>";
$result .= "<addr>".htmlspecialchars(htmlspecialchars($thread['remote']))."</addr>"; $result .= "<addr>".htmlspecialchars(htmlspecialchars($thread['remote']))."</addr>";
$result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>"; $result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>";
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>"; $result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";

View File

@ -45,7 +45,18 @@ var threadParams = { servl:"<?php echo $webimroot ?>/thread.php",wroot:"<?php ec
<td height="10"></td> <td height="10"></td>
</tr> </tr>
<tr> <tr>
<td align="center"><?php if( $page['ct.company.chatLogoURL'] ) { ?><a onclick="window.open('<?php echo getlocal("site.url") ?>');return false;" href="_blank"><img src="<?php echo $page['ct.company.chatLogoURL'] ?>" border="0" alt=""></a><?php } ?></td> <td align="center">
<?php if( $page['ct.company.chatLogoURL'] ) { ?>
<?php if( $page['webimHost'] ) { ?>
<a onclick="window.open('<?php echo $page['webimHost'] ?>');return false;" href="_blank">
<img src="<?php echo $page['ct.company.chatLogoURL'] ?>" border="0" alt="">
</a>
<?php } ?>
<?php if( !$page['webimHost'] ) { ?>
<img src="<?php echo $page['ct.company.chatLogoURL'] ?>" border="0" alt="">
<?php } ?>
<?php } ?>
</td>
</tr> </tr>
<tr> <tr>
<td height="5"></td> <td height="5"></td>

View File

@ -70,6 +70,7 @@
<td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_name") ?></span></td><td width='3'></td> <td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_name") ?></span></td><td width='3'></td>
<td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_host") ?></span></td><td width='3'></td> <td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_host") ?></span></td><td width='3'></td>
<td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_operator") ?></span></td><td width='3'></td> <td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_operator") ?></span></td><td width='3'></td>
<td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_messages") ?></span></td><td width='3'></td>
<td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_time") ?></span></td> <td class='table' bgcolor='#276db8' height='30'><span class='header'><?php echo getlocal("page.analysis.search.head_time") ?></span></td>
</tr> </tr>
<?php foreach( $page['pagination.items'] as $chatthread ) { ?> <?php foreach( $page['pagination.items'] as $chatthread ) { ?>
@ -84,10 +85,13 @@
<?php if( $chatthread['agentName'] ) { ?><?php echo topage(htmlspecialchars($chatthread['agentName'])) ?><?php } ?> <?php if( $chatthread['agentName'] ) { ?><?php echo topage(htmlspecialchars($chatthread['agentName'])) ?><?php } ?>
</td><td background='<?php echo $webimroot ?>/images/tablediv3.gif'><img width='3' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td> </td><td background='<?php echo $webimroot ?>/images/tablediv3.gif'><img width='3' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td>
<td height='30' class='table'> <td height='30' class='table'>
<?php echo date("d M Y H:i:s", $chatthread['created']) ?>, <?php echo date_diff($chatthread['modified']-$chatthread['created']) ?> <?php echo topage(htmlspecialchars($chatthread['size'])) ?>
</td><td background='<?php echo $webimroot ?>/images/tablediv3.gif'><img width='3' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td>
<td height='30' class='table'>
<?php echo strftime("%B, %d %Y %H:%M:%S", $chatthread['created']) ?>, <?php echo date_diff($chatthread['modified']-$chatthread['created']) ?>
</td> </td>
</tr> </tr>
<tr><td height='2' colspan='7'></td></tr><tr><td bgcolor='#e1e1e1' colspan='7'><img width='1' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td></tr><tr><td height='2' colspan='7'></td></tr> <tr><td height='2' colspan='9'></td></tr><tr><td bgcolor='#e1e1e1' colspan='9'><img width='1' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td></tr><tr><td height='2' colspan='9'></td></tr>
<?php } ?> <?php } ?>
</table> </table>
<br /> <br />