tiki-live_support_chat_window.php 1.93 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
2 3 4

// $Header$

5
// Copyright (c) 2002-2007, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
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.

lrargerich's avatar
lrargerich committed
9
// Initialization
10
$section = 'livesupport';
11 12 13 14 15 16
require_once ('tiki-setup.php');

include_once ('lib/live_support/lslib.php');
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);
18
header ("Pragma: no-cache");                                   // HTTP/1.0
lrargerich's avatar
lrargerich committed
19

20
if ($prefs['feature_live_support'] != 'y') {
21
	$smarty->assign('msg', tra("This feature is disabled").": feature_live_support");
lrargerich's avatar
lrargerich committed
22

23
	$smarty->display("error.tpl");
24 25
	die;
}
lrargerich's avatar
lrargerich committed
26

lrargerich's avatar
lrargerich committed
27 28 29 30 31 32 33
// 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('.'));
34 35 36 37 38 39 40 41 42 43 44 45
$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
46 47
}

48 49 50
$smarty->assign('role', $_REQUEST['role']);

$smarty->assign('req_info', $lslib->get_request($_REQUEST['reqId']));
lrargerich's avatar
lrargerich committed
51

52
$smarty->assign('reqId', $_REQUEST['reqId']);
lrargerich's avatar
lrargerich committed
53

54
$smarty->assign('IP',$tikilib->get_ip_address());
55

56 57
if (!isset($user)) {
	$smarty->assign('username', 'anonymous');
lrargerich's avatar
lrargerich committed
58
} else {
59
	$smarty->assign('username', $user);
lrargerich's avatar
lrargerich committed
60 61 62 63
}

// Display the template
$smarty->display("tiki-live_support_chat_window.tpl");
64

65
?>