tiki-live_support_chat_window.php 1.75 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
6
// 
7 8
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
changi67's avatar
changi67 committed
9
// $Id$
10

11
$section = 'livesupport';
12 13
require_once ('tiki-setup.php');
include_once ('lib/live_support/lslib.php');
changi67's avatar
changi67 committed
14 15 16
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
lrargerich's avatar
lrargerich committed
17
header("Cache-Control: post-check=0, pre-check=0", false);
changi67's avatar
changi67 committed
18
header("Pragma: no-cache"); // HTTP/1.0
19
$access->check_feature('feature_live_support');
lrargerich's avatar
lrargerich committed
20 21 22 23 24 25
// This is a generic chat window used by users, operators and observers
// should receive the following parameters
// reqId: the requestId
// role: the role of the user can be (operator,user,other)
// We should receive the reqId here
$senderId = md5(uniqId('.'));
26 27 28 29 30 31 32 33
$smarty->assign('senderId', $senderId);
if ($_REQUEST['role'] == 'operator') {
	$lslib->operator_accept($_REQUEST['reqId'], $user, $senderId);
	$lslib->set_operator_id($_REQUEST['reqId'], $senderId);
}
if ($_REQUEST['role'] == 'user') {
	$lslib->set_user_id($_REQUEST['reqId'], $senderId);
	$lslib->set_request_status($_REQUEST['reqId'], 'op_accepted');
lrargerich's avatar
lrargerich committed
34
}
35 36 37
$smarty->assign('role', $_REQUEST['role']);
$smarty->assign('req_info', $lslib->get_request($_REQUEST['reqId']));
$smarty->assign('reqId', $_REQUEST['reqId']);
changi67's avatar
changi67 committed
38
$smarty->assign('IP', $tikilib->get_ip_address());
39 40
if (!isset($user)) {
	$smarty->assign('username', 'anonymous');
lrargerich's avatar
lrargerich committed
41
} else {
42
	$smarty->assign('username', $user);
lrargerich's avatar
lrargerich committed
43 44 45
}
// Display the template
$smarty->display("tiki-live_support_chat_window.tpl");