tiki-live_support_admin.php 2.55 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 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 12 13

require_once ('tiki-setup.php');
include_once ('lib/live_support/lsadminlib.php');
include_once ('lib/live_support/lslib.php');
14
$access->check_feature('feature_live_support');
sylvieg's avatar
sylvieg committed
15
if ($tiki_p_live_support_admin != 'y' && !$lsadminlib->is_operator($user)) {
16
	$smarty->assign('errortype', 401);
17
	$smarty->assign('msg', tra("You do not have permission to use this feature"));
18
	$smarty->display("error.tpl");
19
	die;
lrargerich's avatar
lrargerich committed
20
}
21 22
$smarty->assign('html', false);
if (isset($_REQUEST['show_html'])) {
23
	$html = '<a href="#" onclick=\'javascript:window.open("tiki-live_support_client.php","","menubar=,scrollbars=yes,resizable=yes,height=450,width=300");\'><img src="tiki-live_support_server.php?operators_online" alt="image" /></a>';
24
	$smarty->assign('html', $html);
lrargerich's avatar
lrargerich committed
25
}
26 27
if ($tiki_p_live_support_admin == 'y') {
	if (isset($_REQUEST['adduser'])) {
28
		check_ticket('ls-admin');
lrargerich's avatar
lrargerich committed
29 30
		$lsadminlib->add_operator($_REQUEST['user']);
	}
changi67's avatar
changi67 committed
31
	if (isset($_REQUEST['offline'])) {
32
		check_ticket('ls-offline');
changi67's avatar
changi67 committed
33 34
		$lslib->set_operator_status($_REQUEST['offline'], 'offline');
	}
35
	if (isset($_REQUEST['removeuser'])) {
36 37
		$access->check_authenticity();
		$lsadminlib->remove_operator($_REQUEST['removeuser']);
lrargerich's avatar
lrargerich committed
38
	}
lrargerich's avatar
lrargerich committed
39 40 41 42
}
// Get the list of operators
$online_operators = $lsadminlib->get_operators('online');
$offline_operators = $lsadminlib->get_operators('offline');
43 44
$smarty->assign_by_ref('online_operators', $online_operators);
$smarty->assign_by_ref('offline_operators', $offline_operators);
lrargerich's avatar
lrargerich committed
45
// Get the list of users
changi67's avatar
changi67 committed
46
if (!isset($_REQUEST['find_users'])) $_REQUEST['find_users'] = '';
47 48
$users = $userlib->get_users(0, -1, 'login_asc', $_REQUEST['find_users']);
$ok_users = array();
49 50
$temp_max = count($users['data']);
for ($i = 0; $i < $temp_max; $i++) {
51
	foreach ($online_operators as $op) {
52
		if ($op['user'] == $users['data'][$i]['user']) {
changi67's avatar
changi67 committed
53
			unset($users[$i]);
lrargerich's avatar
lrargerich committed
54 55
		}
	}
56
	foreach ($offline_operators as $op) {
57
		if (isset($users['data'][$i]) && $op['user'] == $users['data'][$i]['user']) {
changi67's avatar
changi67 committed
58
			unset($users['data'][$i]);
lrargerich's avatar
lrargerich committed
59 60
		}
	}
61 62
	if (isset($users['data'][$i])) {
		$ok_users[] = $users['data'][$i];
lrargerich's avatar
lrargerich committed
63 64
	}
}
65
$smarty->assign_by_ref('users', $ok_users);
66
ask_ticket('ls-admin');
67 68
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
69
// Display the template
70
$smarty->assign('mid', 'tiki-live_support_admin.tpl');
71
$smarty->display("tiki.tpl");