2001-08-16 03:38:14 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-01-27 00:26:19 +01:00
|
|
|
* eGroupWare - Administration *
|
|
|
|
* http://www.egroupware.org *
|
2001-08-16 03:38:14 +02:00
|
|
|
* This file written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
class bocurrentsessions
|
|
|
|
{
|
2001-09-05 04:13:27 +02:00
|
|
|
var $ui;
|
2001-08-16 03:38:14 +02:00
|
|
|
var $so;
|
2001-09-05 04:13:27 +02:00
|
|
|
var $public_functions = array(
|
2001-12-21 04:41:06 +01:00
|
|
|
'kill' => True
|
|
|
|
);
|
2001-08-16 03:38:14 +02:00
|
|
|
|
|
|
|
function total()
|
|
|
|
{
|
2008-08-08 10:20:53 +02:00
|
|
|
return $GLOBALS['egw']->session->session_count();
|
2001-08-16 03:38:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function list_sessions($start,$order,$sort)
|
|
|
|
{
|
2008-08-08 10:20:53 +02:00
|
|
|
$values = $GLOBALS['egw']->session->session_list($start,$sort,$order);
|
2001-08-16 03:38:14 +02:00
|
|
|
|
2002-01-04 01:39:00 +01:00
|
|
|
while (list(,$value) = @each($values))
|
2001-08-16 03:38:14 +02:00
|
|
|
{
|
|
|
|
if (ereg('@',$value['session_lid']))
|
|
|
|
{
|
2009-06-08 18:21:14 +02:00
|
|
|
$t = explode('@',$value['session_lid']);
|
2001-08-16 03:38:14 +02:00
|
|
|
$session_lid = $t[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$session_lid = $value['session_lid'];
|
|
|
|
}
|
2004-03-23 09:41:05 +01:00
|
|
|
$tmp = time() - $value['session_dla'];
|
|
|
|
$secs = $tmp % 60;
|
|
|
|
$mins = (($tmp - $secs) % 3600) / 60;
|
|
|
|
$hours = ($tmp - ($mins * 60) - $secs) / 3600;
|
2001-08-16 03:38:14 +02:00
|
|
|
$_values[] = array(
|
|
|
|
'session_id' => $value['session_id'],
|
|
|
|
'session_lid' => $session_lid,
|
|
|
|
'session_ip' => $value['session_ip'],
|
2005-10-14 19:03:16 +02:00
|
|
|
'session_logintime' => $GLOBALS['egw']->common->show_date($value['session_logintime']),
|
2001-08-16 03:38:14 +02:00
|
|
|
'session_action' => $value['session_action'],
|
|
|
|
'session_dla' => $value['session_dla'],
|
2004-03-23 09:34:00 +01:00
|
|
|
'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)
|
2001-08-16 03:38:14 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return $_values;
|
|
|
|
}
|
|
|
|
|
2001-09-05 04:13:27 +02:00
|
|
|
function kill()
|
|
|
|
{
|
2003-05-18 21:18:58 +02:00
|
|
|
if ($_GET['ksession'] &&
|
|
|
|
($GLOBALS['sessionid'] != $_GET['ksession']) &&
|
2005-10-14 19:03:16 +02:00
|
|
|
! $GLOBALS['egw']->acl->check('current_sessions_access',8,'admin'))
|
2001-09-05 04:13:27 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->session->destroy($_GET['ksession'],0);
|
2001-09-05 04:13:27 +02:00
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->ui =& CreateObject('admin.uicurrentsessions');
|
2001-09-05 04:13:27 +02:00
|
|
|
$this->ui->list_sessions();
|
|
|
|
}
|
2001-09-29 00:04:10 +02:00
|
|
|
}
|