mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 21:40:28 +03:00
show group name on leave message page, pass group id and referrer through leavemessage, clear group if redirected to operator not from the group, improved leave message after survey
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@625 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
d9870f6835
commit
da0f99f530
@ -41,66 +41,67 @@ if($settings['enablessl'] == "1" && $settings['forcessl'] == "1") {
|
||||
|
||||
if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
|
||||
$chatstyle = verifyparam( "style", "/^\w+$/", "");
|
||||
$info = getgetparam('info');
|
||||
$email = getgetparam('email');
|
||||
$thread = NULL;
|
||||
$firstmessage = NULL;
|
||||
if( isset($_SESSION['threadid']) ) {
|
||||
$thread = reopen_thread($_SESSION['threadid']);
|
||||
}
|
||||
|
||||
if( !$thread ) {
|
||||
$groupid = "";
|
||||
$groupname = "";
|
||||
if($settings['enablegroups'] == '1') {
|
||||
$groupid = verifyparam( "group", "/^\d{1,8}$/", "");
|
||||
if($groupid) {
|
||||
$group = group_by_id($groupid);
|
||||
if(!$group) {
|
||||
$groupid = "";
|
||||
} else {
|
||||
$groupname = get_group_name($group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$visitor = visitor_from_request();
|
||||
|
||||
if(isset($_POST['survey']) && $_POST['survey'] == 'on') {
|
||||
$firstmessage = getparam("message");
|
||||
$info = getparam("info");
|
||||
$email = getparam("email");
|
||||
$referrer = urldecode(getparam("referrer"));
|
||||
|
||||
if($settings['usercanchangename'] == "1" && isset($_POST['name'])) {
|
||||
$newname = getparam("name");
|
||||
if($newname != $visitor['name']) {
|
||||
$data = strtr(base64_encode(myiconv($webim_encoding,"utf-8",$newname)), '+/=', '-_,');
|
||||
setcookie($namecookie, $data, time()+60*60*24*365);
|
||||
$visitor['name'] = $newname;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$firstmessage = NULL;
|
||||
$info = getgetparam('info');
|
||||
$email = getgetparam('email');
|
||||
$referrer = isset($_GET['url']) ? $_GET['url'] :
|
||||
(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
|
||||
if(isset($_GET['referrer']) && $_GET['referrer']) {
|
||||
$referrer .= "\n".$_GET['referrer'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!has_online_operators($groupid)) {
|
||||
$page = array();
|
||||
setup_logo();
|
||||
$page['formname'] = topage(getgetparam('name'));
|
||||
$page['formemail'] = topage($email);
|
||||
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" && can_show_captcha() ? "1" : "";
|
||||
$page['info'] = topage($info);
|
||||
setup_leavemessage($visitor['name'],$email,$firstmessage,$groupid,$groupname,$info,$referrer,can_show_captcha());
|
||||
expand("styles", getchatstyle(), "leavemessage.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
$visitor = visitor_from_request();
|
||||
$referer = isset($_GET['url']) ? $_GET['url'] :
|
||||
(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
|
||||
if(isset($_GET['referrer']) && $_GET['referrer']) {
|
||||
$referer .= "\n".$_GET['referrer'];
|
||||
}
|
||||
|
||||
if($settings['enablepresurvey'] == '1') {
|
||||
if(isset($_POST['survey']) && $_POST['survey'] == 'on') {
|
||||
$firstmessage = getparam("message");
|
||||
$info = getparam("info");
|
||||
$email = getparam("email");
|
||||
if($settings['usercanchangename'] == "1" && isset($_POST['name'])) {
|
||||
$newname = getparam("name");
|
||||
if($newname != $visitor['name']) {
|
||||
$data = strtr(base64_encode(myiconv($webim_encoding,"utf-8",$newname)), '+/=', '-_,');
|
||||
setcookie($namecookie, $data, time()+60*60*24*365);
|
||||
$visitor['name'] = $newname;
|
||||
}
|
||||
}
|
||||
$referer = urldecode(getparam("referrer"));
|
||||
} else {
|
||||
$page = array();
|
||||
setup_logo();
|
||||
setup_survey($visitor['name'], $email, $groupid, $info, $referer);
|
||||
expand("styles", getchatstyle(), "survey.tpl");
|
||||
exit;
|
||||
}
|
||||
if($settings['enablepresurvey'] == '1' && !(isset($_POST['survey']) && $_POST['survey'] == 'on')) {
|
||||
$page = array();
|
||||
setup_logo();
|
||||
setup_survey($visitor['name'], $email, $groupid, $info, $referrer);
|
||||
expand("styles", getchatstyle(), "survey.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
$remoteHost = get_remote_host();
|
||||
@ -111,11 +112,11 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
mysql_close($link);
|
||||
die("number of connections from your IP is exceeded, try again later");
|
||||
}
|
||||
$thread = create_thread($groupid,$visitor['name'], $remoteHost, $referer,$current_locale,$visitor['id'], $userbrowser,$state_loading,$link);
|
||||
$thread = create_thread($groupid,$visitor['name'], $remoteHost, $referrer,$current_locale,$visitor['id'], $userbrowser,$state_loading,$link);
|
||||
$_SESSION['threadid'] = $thread['threadid'];
|
||||
|
||||
if( $referer ) {
|
||||
post_message_($thread['threadid'],$kind_for_agent,getstring2('chat.came.from',array($referer)),$link);
|
||||
if( $referrer ) {
|
||||
post_message_($thread['threadid'],$kind_for_agent,getstring2('chat.came.from',array($referrer)),$link);
|
||||
}
|
||||
post_message_($thread['threadid'],$kind_info,getstring('chat.wait'),$link);
|
||||
if($email) {
|
||||
@ -133,6 +134,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
$threadid = $thread['threadid'];
|
||||
$token = $thread['ltoken'];
|
||||
$level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
|
||||
$chatstyle = verifyparam( "style", "/^\w+$/", "");
|
||||
header("Location: $webimroot/client.php?thread=$threadid&token=$token&level=$level".($chatstyle ? "&style=$chatstyle" : ""));
|
||||
exit;
|
||||
}
|
||||
|
@ -22,19 +22,22 @@
|
||||
require_once('libs/common.php');
|
||||
require_once('libs/chat.php');
|
||||
require_once('libs/expand.php');
|
||||
require_once('libs/groups.php');
|
||||
require_once('libs/captcha.php');
|
||||
|
||||
$errors = array();
|
||||
$page = array();
|
||||
|
||||
function store_message($name, $email, $info, $message) {
|
||||
function store_message($name, $email, $info, $message,$groupid,$referrer) {
|
||||
global $state_left, $current_locale, $kind_for_agent, $kind_user;
|
||||
$groupid = 0;
|
||||
$remoteHost = get_remote_host();
|
||||
$userbrowser = $_SERVER['HTTP_USER_AGENT'];
|
||||
$visitor = visitor_from_request();
|
||||
$link = connect();
|
||||
$thread = create_thread($groupid,$name,$remoteHost,"",$current_locale,$visitor['id'], $userbrowser,$state_left,$link);
|
||||
$thread = create_thread($groupid,$name,$remoteHost,$referrer,$current_locale,$visitor['id'], $userbrowser,$state_left,$link);
|
||||
if( $referrer ) {
|
||||
post_message_($thread['threadid'],$kind_for_agent,getstring2('chat.came.from',array($referrer)),$link);
|
||||
}
|
||||
if($email) {
|
||||
post_message_($thread['threadid'],$kind_for_agent,getstring2('chat.visitor.email',array($email)),$link);
|
||||
}
|
||||
@ -45,10 +48,26 @@ function store_message($name, $email, $info, $message) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
$groupid = "";
|
||||
$groupname = "";
|
||||
loadsettings();
|
||||
if($settings['enablegroups'] == '1') {
|
||||
$groupid = verifyparam( "group", "/^\d{1,8}$/", "");
|
||||
if($groupid) {
|
||||
$group = group_by_id($groupid);
|
||||
if(!$group) {
|
||||
$groupid = "";
|
||||
} else {
|
||||
$groupname = get_group_name($group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$email = getparam('email');
|
||||
$visitor_name = getparam('name');
|
||||
$message = getparam('message');
|
||||
$info = getparam('info');
|
||||
$referrer = urldecode(getparam("referrer"));
|
||||
|
||||
if( !$email ) {
|
||||
$errors[] = no_field("form.field.email");
|
||||
@ -62,7 +81,6 @@ if( !$email ) {
|
||||
}
|
||||
}
|
||||
|
||||
loadsettings();
|
||||
if($settings["enablecaptcha"] == "1" && can_show_captcha()) {
|
||||
$captcha = getparam('captcha');
|
||||
$original = $_SESSION['captcha'];
|
||||
@ -73,11 +91,7 @@ if($settings["enablecaptcha"] == "1" && can_show_captcha()) {
|
||||
}
|
||||
|
||||
if( count($errors) > 0 ) {
|
||||
$page['formname'] = topage($visitor_name);
|
||||
$page['formemail'] = $email;
|
||||
$page['formmessage'] = topage($message);
|
||||
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" && can_show_captcha() ? "1" : "";
|
||||
$page['info'] = topage($info);
|
||||
setup_leavemessage($visitor_name,$email,$message,$groupid,$groupname,$info,$referrer,can_show_captcha());
|
||||
setup_logo();
|
||||
expand("styles", getchatstyle(), "leavemessage.tpl");
|
||||
exit;
|
||||
@ -88,7 +102,7 @@ if(!locale_exists($message_locale)) {
|
||||
$message_locale = $home_locale;
|
||||
}
|
||||
|
||||
store_message($visitor_name, $email, $info, $message);
|
||||
store_message($visitor_name, $email, $info, $message, $groupid, $referrer);
|
||||
|
||||
$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale);
|
||||
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $message_locale);
|
||||
|
@ -280,6 +280,18 @@ function setup_logo() {
|
||||
$page['webimHost'] = topage($settings['hosturl']);
|
||||
}
|
||||
|
||||
function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info, $referrer,$canshowcaptcha) {
|
||||
global $settings, $page;
|
||||
$page['formname'] = topage($name);
|
||||
$page['formemail'] = topage($email);
|
||||
$page['formmessage'] = $message ? topage($message) : "";
|
||||
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" && $canshowcaptcha ? "1" : "";
|
||||
$page['formgroupid'] = $groupid;
|
||||
$page['formgroupname'] = $groupname;
|
||||
$page['forminfo'] = topage($info);
|
||||
$page['referrer'] = urlencode(topage($referrer));
|
||||
}
|
||||
|
||||
function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||
global $settings, $page;
|
||||
|
||||
@ -300,10 +312,11 @@ function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||
continue;
|
||||
}
|
||||
if($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) {
|
||||
$groupname .= " (online)";
|
||||
if(!$groupid) {
|
||||
$groupid = $k['groupid']; // select first online group
|
||||
}
|
||||
} else {
|
||||
$groupname .= " (offline)";
|
||||
}
|
||||
$isselected = $k['groupid'] == $groupid;
|
||||
$val .= "<option value=\"".$k['groupid']."\"".($isselected ? " selected=\"selected\"" : "").">$groupname</option>";
|
||||
|
@ -67,8 +67,13 @@ if(isset($_GET['nextGroup'])) {
|
||||
$page['message'] = getlocal2("chat.redirected.content",array(topage(get_operator_name($nextOperator))));
|
||||
if( $thread['istate'] == $state_chatting ) {
|
||||
$link = connect();
|
||||
commit_thread( $threadid,
|
||||
array("istate" => $state_waiting, "nextagent" => $nextid, "agentId" => 0), $link);
|
||||
$threadupdate = array("istate" => $state_waiting, "nextagent" => $nextid, "agentId" => 0);
|
||||
if($thread['groupid'] != 0) {
|
||||
if(FALSE === select_one_row("select groupid from chatgroupoperator where operatorid = $nextid and groupid = ".$thread['groupid'], $link)) {
|
||||
$threadupdate['groupid'] = 0;
|
||||
}
|
||||
}
|
||||
commit_thread( $threadid, $threadupdate, $link);
|
||||
post_message_($thread['threadid'], $kind_events,
|
||||
getstring2_("chat.status.operator.redirect",
|
||||
array(get_operator_name($operator)),$thread['locale']), $link);
|
||||
|
@ -44,6 +44,8 @@
|
||||
<form name="leaveMessageForm" method="post" action="${webimroot}/leavemessage.php">
|
||||
<input type="hidden" name="style" value="${styleid}"/>
|
||||
<input type="hidden" name="info" value="${page:info}"/>
|
||||
<input type="hidden" name="referrer" value="${page:referrer}"/>
|
||||
${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td valign="top" height="150" style="padding:5px">
|
||||
@ -68,7 +70,7 @@
|
||||
${endif:webimHost}
|
||||
${endif:ct.company.chatLogoURL}
|
||||
</td>
|
||||
<td nowrap="nowrap" style="padding-right:10px"><span style="font-size:16px;font-weight:bold;color:#525252">${msg:leavemessage.title}</span></td>
|
||||
<td nowrap="nowrap" style="padding-right:10px"><span style="font-size:16px;font-weight:bold;color:#525252">${if:formgroupname}${form:groupname}: ${endif:formgroupname}${msg:leavemessage.title}</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing="0" cellpadding="0" border="0" id="header" class="bg_domain">
|
||||
|
@ -29,12 +29,14 @@
|
||||
<form name="leaveMessageForm" method="post" action="${webimroot}/leavemessage.php">
|
||||
<input type="hidden" name="style" value="${styleid}"/>
|
||||
<input type="hidden" name="info" value="${page:info}"/>
|
||||
<input type="hidden" name="referrer" value="${page:referrer}"/>
|
||||
${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}
|
||||
<table width="100%" style="height:100%;" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr><td colspan="3" height="15"></td></tr>
|
||||
<tr>
|
||||
<td height="40"></td>
|
||||
<td class="window">
|
||||
<h1>${msg:leavemessage.title}</h1>
|
||||
<h1>${if:formgroupname}${form:groupname}: ${endif:formgroupname}${msg:leavemessage.title}</h1>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
@ -10,10 +10,12 @@
|
||||
<form name="leaveMessageForm" method="post" action="${webimroot}/leavemessage.php">
|
||||
<input type="hidden" name="style" value="${styleid}"/>
|
||||
<input type="hidden" name="info" value="${page:info}"/>
|
||||
<input type="hidden" name="referrer" value="${page:referrer}"/>
|
||||
${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}
|
||||
<table cellpadding="0" cellspacing="5" border="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h1>${msg:leavemessage.title}</h1>
|
||||
<h1>${if:formgroupname}${form:groupname}: ${endif:formgroupname}${msg:leavemessage.title}</h1>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user