1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare - Administration * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * This file written by Joseph Engo <jengo@phpgroupware.org> * |
---|
6 | * -------------------------------------------- * |
---|
7 | * This program is free software; you can redistribute it and/or modify it * |
---|
8 | * under the terms of the GNU General Public License as published by the * |
---|
9 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
10 | * option) any later version. * |
---|
11 | \**************************************************************************/ |
---|
12 | |
---|
13 | |
---|
14 | class bocurrentsessions |
---|
15 | { |
---|
16 | var $ui; |
---|
17 | var $so; |
---|
18 | var $public_functions = array( |
---|
19 | 'kill' => True |
---|
20 | ); |
---|
21 | |
---|
22 | function total() |
---|
23 | { |
---|
24 | return $GLOBALS['phpgw']->session->total(); |
---|
25 | } |
---|
26 | |
---|
27 | function list_sessions($start,$order,$sort) |
---|
28 | { |
---|
29 | $values = $GLOBALS['phpgw']->session->list_sessions($start,$sort,$order); |
---|
30 | |
---|
31 | while (list(,$value) = @each($values)) |
---|
32 | { |
---|
33 | if (preg_match('/@/',$value['session_lid'])) |
---|
34 | { |
---|
35 | $t = preg_split('/@/',$value['session_lid']); |
---|
36 | $session_lid = $t[0]; |
---|
37 | } |
---|
38 | else |
---|
39 | { |
---|
40 | $session_lid = $value['session_lid']; |
---|
41 | } |
---|
42 | $tmp = time() - $value['session_dla']; |
---|
43 | $secs = $tmp % 60; |
---|
44 | $mins = (($tmp - $secs) % 3600) / 60; |
---|
45 | $hours = ($tmp - ($mins * 60) - $secs) / 3600; |
---|
46 | $_values[] = array( |
---|
47 | 'session_id' => $value['session_id'], |
---|
48 | 'session_lid' => $session_lid, |
---|
49 | 'session_ip' => $value['session_ip'], |
---|
50 | 'session_logintime' => $GLOBALS['phpgw']->common->show_date($value['session_logintime']), |
---|
51 | 'session_action' => $value['session_action'], |
---|
52 | 'session_dla' => $value['session_dla'], |
---|
53 | 'session_idle' => str_pad($hours, 2, '0', STR_PAD_LEFT) . ':' . str_pad($mins, 2, '0', STR_PAD_LEFT) . ':' . str_pad($secs, 2, '0', STR_PAD_LEFT) |
---|
54 | ); |
---|
55 | } |
---|
56 | return $_values; |
---|
57 | } |
---|
58 | |
---|
59 | function kill() |
---|
60 | { |
---|
61 | if ($_GET['ksession'] && |
---|
62 | ($GLOBALS['sessionid'] != $_GET['ksession']) && |
---|
63 | ! $GLOBALS['phpgw']->acl->check('current_sessions_access',8,'admin')) |
---|
64 | { |
---|
65 | $GLOBALS['phpgw']->session->destroy($_GET['ksession'],0); |
---|
66 | } |
---|
67 | $this->ui = createobject('admin.uicurrentsessions'); |
---|
68 | $this->ui->list_sessions(); |
---|
69 | } |
---|
70 | } |
---|