create thread for group

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@436 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-03-24 23:50:38 +00:00
parent 11dcfdd91a
commit 52e0299375
3 changed files with 18 additions and 4 deletions

View File

@ -15,6 +15,7 @@
require_once('libs/common.php');
require_once('libs/chat.php');
require_once('libs/operator.php');
require_once('libs/groups.php');
require_once('libs/expand.php');
if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
@ -38,6 +39,18 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
exit;
}
loadsettings();
$groupid = "";
if($settings['enablegroups'] == '1') {
$groupid = verifyparam( "group", "/^\d{1,8}$/", "");
if($groupid) {
$group = group_by_id($groupid);
if(!$group) {
$groupid = "";
}
}
}
$referer = isset($_GET['url']) ? $_GET['url'] :
(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
if(isset($_GET['referrer']) && $_GET['referrer']) {
@ -51,7 +64,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
$userbrowser = $_SERVER['HTTP_USER_AGENT'];
$remoteHost = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr;
$visitor = visitor_from_request();
$thread = create_thread($visitor['name'], $remoteHost, $referer,$current_locale,$visitor['id'], $userbrowser);
$thread = create_thread($groupid,$visitor['name'], $remoteHost, $referer,$current_locale,$visitor['id'], $userbrowser);
$_SESSION['threadid'] = $thread['threadid'];
if( $referer ) {
post_message($thread['threadid'],$kind_for_agent,getstring2('chat.came.from',array($referer)));

View File

@ -6,6 +6,7 @@
[+] main page: warning if database is outdated (after install)
[+] "Updates" tab in settings: news, link to the latest version
[+] Create/edit/remove groups
[+] Statistics page
1.5.2
-----

View File

@ -432,13 +432,13 @@ function thread_by_id($id) {
return $thread;
}
function create_thread($username,$remoteHost,$referer,$lang,$userid,$userbrowser) {
function create_thread($groupid,$username,$remoteHost,$referer,$lang,$userid,$userbrowser) {
global $state_loading;
$link = connect();
$query = sprintf(
"insert into chatthread (userName,userid,ltoken,remote,referer,lrevision,locale,userAgent,dtmcreated,dtmmodified,istate) values ".
"('%s','%s',%s,'%s','%s',%s,'%s','%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,$state_loading)",
"insert into chatthread (userName,userid,ltoken,remote,referer,lrevision,locale,userAgent,dtmcreated,dtmmodified,istate".($groupid?",groupid":"").") values ".
"('%s','%s',%s,'%s','%s',%s,'%s','%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,$state_loading".($groupid?",$groupid":"").")",
mysql_real_escape_string($username),
mysql_real_escape_string($userid),
next_token(),