mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
Converted over to the 3 tier design
This commit is contained in:
parent
b772afda7f
commit
1fc7368927
@ -1,108 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**************************************************************************\
|
|
||||||
* phpGroupWare - administration *
|
|
||||||
* http://www.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$ */
|
|
||||||
|
|
||||||
$phpgw_info['flags'] = array(
|
|
||||||
'currentapp' => 'admin',
|
|
||||||
'enable_nextmatchs_class' => True
|
|
||||||
);
|
|
||||||
include('../header.inc.php');
|
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
|
||||||
$p->set_file(array('current' => 'currentusers.tpl'));
|
|
||||||
$p->set_block('current','list','list');
|
|
||||||
$p->set_block('current','row','row');
|
|
||||||
|
|
||||||
if (! $start)
|
|
||||||
{
|
|
||||||
$start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$phpgw->db->query("select count(*) from phpgw_sessions where session_flags != 'A'",__LINE__,__FILE__);
|
|
||||||
$phpgw->db->next_record();
|
|
||||||
|
|
||||||
$total = $phpgw->db->f(0);
|
|
||||||
|
|
||||||
$p->set_var('lang_current_users',lang('List of current users'));
|
|
||||||
$p->set_var('bg_color',$phpgw_info['theme'][bg_color]);
|
|
||||||
$p->set_var('left_next_matchs',$phpgw->nextmatchs->left('/admin/currentusers.php',$start,$total));
|
|
||||||
$p->set_var('right_next_matchs',$phpgw->nextmatchs->right('/admin/currentusers.php',$start,$total));
|
|
||||||
$p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
|
||||||
|
|
||||||
$p->set_var('sort_loginid',$phpgw->nextmatchs->show_sort_order($sort,'session_lid',$order,
|
|
||||||
'/admin/currentusers.php',lang('LoginID')));
|
|
||||||
$p->set_var('sort_ip',$phpgw->nextmatchs->show_sort_order($sort,'session_ip',$order,
|
|
||||||
'/admin/currentusers.php',lang('IP')));
|
|
||||||
$p->set_var('sort_login_time',$phpgw->nextmatchs->show_sort_order($sort,'session_logintime',$order,
|
|
||||||
'/admin/currentusers.php',lang('Login Time')));
|
|
||||||
$p->set_var('sort_action',$phpgw->nextmatchs->show_sort_order($sort,'session_action',$order,
|
|
||||||
'/admin/currentusers.php',lang('Action')));
|
|
||||||
$p->set_var('sort_idle',$phpgw->nextmatchs->show_sort_order($sort,'session_dla',$order,
|
|
||||||
'/admin/currentusers.php',lang('idle')));
|
|
||||||
$p->set_var('lang_kill',lang('Kill'));
|
|
||||||
|
|
||||||
if ($order)
|
|
||||||
{
|
|
||||||
$ordermethod = "order by $order $sort";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ordermethod = 'order by session_dla asc';
|
|
||||||
}
|
|
||||||
|
|
||||||
$phpgw->db->limit_query("select * from phpgw_sessions where session_flags != 'A' $ordermethod ",$start,__LINE__,__FILE__);
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
while ($phpgw->db->next_record())
|
|
||||||
{
|
|
||||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
|
||||||
$p->set_var('tr_color',$tr_color);
|
|
||||||
|
|
||||||
if (ereg('@',$phpgw->db->f('session_lid')))
|
|
||||||
{
|
|
||||||
$t = split('@',$phpgw->db->f('session_lid'));
|
|
||||||
$loginid = $t[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$loginid = $phpgw->db->f('session_lid');
|
|
||||||
}
|
|
||||||
|
|
||||||
$p->set_var('row_loginid',$loginid);
|
|
||||||
$p->set_var('row_ip',$phpgw->db->f('session_ip'));
|
|
||||||
$p->set_var('row_logintime',$phpgw->common->show_date($phpgw->db->f('session_logintime')));
|
|
||||||
if($phpgw->db->f('session_action'))
|
|
||||||
{
|
|
||||||
$p->set_var('row_action',$phpgw->strip_html($phpgw->db->f('session_action')));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$p->set_var('row_action',' ');
|
|
||||||
}
|
|
||||||
$p->set_var('row_idle',gmdate('G:i:s',(time() - $phpgw->db->f('session_dla'))));
|
|
||||||
|
|
||||||
if ($phpgw->db->f('session_id') != $phpgw_info['user']['sessionid'])
|
|
||||||
{
|
|
||||||
$p->set_var('row_kill','<a href="' . $phpgw->link('/admin/killsession.php','ksession='
|
|
||||||
. $phpgw->db->f('session_id') . '&kill=true') . '">' . lang('Kill').'</a>');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$p->set_var('row_kill',' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
$p->parse('rows','row',True);
|
|
||||||
}
|
|
||||||
|
|
||||||
$p->pparse('out','list');
|
|
||||||
$phpgw->common->phpgw_footer();
|
|
||||||
?>
|
|
64
admin/inc/class.bocurrentsessions.inc.php
Normal file
64
admin/inc/class.bocurrentsessions.inc.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/**************************************************************************\
|
||||||
|
* phpGroupWare - Administration *
|
||||||
|
* http://www.phpgroupware.org *
|
||||||
|
* 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
|
||||||
|
{
|
||||||
|
var $so;
|
||||||
|
|
||||||
|
function bocurrentsessions()
|
||||||
|
{
|
||||||
|
$this->so = CreateObject('admin.socurrentsessions');
|
||||||
|
}
|
||||||
|
|
||||||
|
function total()
|
||||||
|
{
|
||||||
|
return $this->so->total();
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_sessions($start,$order,$sort)
|
||||||
|
{
|
||||||
|
// if (! $sort || ! $order)
|
||||||
|
// {
|
||||||
|
// $order = 'session_dla';
|
||||||
|
// $sort = 'asc';
|
||||||
|
// }
|
||||||
|
|
||||||
|
$values = $this->so->list_sessions($start,$sort,$order);
|
||||||
|
|
||||||
|
while (list(,$value) = each($values))
|
||||||
|
{
|
||||||
|
if (ereg('@',$value['session_lid']))
|
||||||
|
{
|
||||||
|
$t = split('@',$value['session_lid']);
|
||||||
|
$session_lid = $t[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$session_lid = $value['session_lid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$_values[] = array(
|
||||||
|
'session_id' => $value['session_id'],
|
||||||
|
'session_lid' => $session_lid,
|
||||||
|
'session_ip' => $value['session_ip'],
|
||||||
|
'session_logintime' => $GLOBALS['phpgw']->common->show_date($value['session_logintime']),
|
||||||
|
'session_action' => $value['session_action'],
|
||||||
|
'session_dla' => $value['session_dla'],
|
||||||
|
'session_idle' => gmdate('G:i:s',(time() - $value['session_dla']))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $_values;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
52
admin/inc/class.socurrentsessions.inc.php
Normal file
52
admin/inc/class.socurrentsessions.inc.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**************************************************************************\
|
||||||
|
* phpGroupWare - Administration *
|
||||||
|
* http://www.phpgroupware.org *
|
||||||
|
* 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 socurrentsessions
|
||||||
|
{
|
||||||
|
var $db;
|
||||||
|
|
||||||
|
function socurrentsessions()
|
||||||
|
{
|
||||||
|
$this->db = $GLOBALS['phpgw']->db;
|
||||||
|
}
|
||||||
|
|
||||||
|
function total()
|
||||||
|
{
|
||||||
|
$this->db->query("select count(*) from phpgw_sessions where session_flags != 'A'",__LINE__,__FILE__);
|
||||||
|
$this->db->next_record();
|
||||||
|
|
||||||
|
return $this->db->f(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_sessions($start,$order,$sort)
|
||||||
|
{
|
||||||
|
$ordermethod = 'order by session_dla asc';
|
||||||
|
|
||||||
|
$this->db->limit_query("select * from phpgw_sessions where session_flags != 'A' order by $sort $order",$start,__LINE__,__FILE__);
|
||||||
|
|
||||||
|
while ($this->db->next_record())
|
||||||
|
{
|
||||||
|
$values[] = array(
|
||||||
|
'session_id' => $this->db->f('session_id'),
|
||||||
|
'session_lid' => $this->db->f('session_lid'),
|
||||||
|
'session_ip' => $this->db->f('session_ip'),
|
||||||
|
'session_logintime' => $this->db->f('session_logintime'),
|
||||||
|
'session_action' => $this->db->f('session_action'),
|
||||||
|
'session_dla' => $this->db->f('session_dla')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
137
admin/inc/class.uicurrentsessions.inc.php
Normal file
137
admin/inc/class.uicurrentsessions.inc.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**************************************************************************\
|
||||||
|
* phpGroupWare - Administration *
|
||||||
|
* http://www.phpgroupware.org *
|
||||||
|
* 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 uicurrentsessions
|
||||||
|
{
|
||||||
|
var $template;
|
||||||
|
var $bo;
|
||||||
|
var $public_functions = array(
|
||||||
|
'list_sessions' => True
|
||||||
|
);
|
||||||
|
|
||||||
|
function uicurrentsessions()
|
||||||
|
{
|
||||||
|
$this->template = createobject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||||
|
$this->bo = createobject('admin.bocurrentsessions');
|
||||||
|
$this->nextmatchs = createobject('phpgwapi.nextmatchs');
|
||||||
|
}
|
||||||
|
|
||||||
|
function header()
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->common->phpgw_header();
|
||||||
|
echo parse_navbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
function store_location($info)
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->session->appsession('currentsessions_session_data','admin',$info);
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_sessions()
|
||||||
|
{
|
||||||
|
$info = $GLOBALS['phpgw']->session->appsession('currentsessions_session_data','admin');
|
||||||
|
if (! is_array($info))
|
||||||
|
{
|
||||||
|
$info = array(
|
||||||
|
'start' => 0,
|
||||||
|
'sort' => 'asc',
|
||||||
|
'order' => 'session_dla'
|
||||||
|
);
|
||||||
|
$this->store_location($info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($GLOBALS['start'] || $GLOBALS['sort'] || $GLOBALS['order'])
|
||||||
|
{
|
||||||
|
if ($GLOBALS['start'] == 0 || $GLOBALS['start'] && $GLOBALS['start'] != $info['start'])
|
||||||
|
{
|
||||||
|
$info['start'] = $GLOBALS['start'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($GLOBALS['sort'] && $GLOBALS['sort'] != $info['sort'])
|
||||||
|
{
|
||||||
|
$info['sort'] = $GLOBALS['sort'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($GLOBALS['order'] && $GLOBALS['order'] != $info['order'])
|
||||||
|
{
|
||||||
|
$info['order'] = $GLOBALS['order'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->store_location($info);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->header();
|
||||||
|
|
||||||
|
$this->template->set_file('current','currentusers.tpl');
|
||||||
|
$this->template->set_block('current','list','list');
|
||||||
|
$this->template->set_block('current','row','row');
|
||||||
|
|
||||||
|
$total = $this->bo->total();
|
||||||
|
|
||||||
|
$this->template->set_var('lang_current_users',lang('List of current users'));
|
||||||
|
$this->template->set_var('bg_color',$GLOBALS['phpgw_info']['theme']['bg_color']);
|
||||||
|
$this->template->set_var('left_next_matchs',$this->nextmatchs->left('/admin/currentusers.php',$info['start'],$total));
|
||||||
|
$this->template->set_var('right_next_matchs',$this->nextmatchs->right('/admin/currentusers.php',$info['start'],$total));
|
||||||
|
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
|
||||||
|
|
||||||
|
$this->template->set_var('sort_loginid',$this->nextmatchs->show_sort_order($info['sort'],'session_lid',$info['order'],
|
||||||
|
'/admin/currentusers.php',lang('LoginID')));
|
||||||
|
$this->template->set_var('sort_ip',$this->nextmatchs->show_sort_order($info['sort'],'session_ip',$info['order'],
|
||||||
|
'/admin/currentusers.php',lang('IP')));
|
||||||
|
$this->template->set_var('sort_login_time',$this->nextmatchs->show_sort_order($info['sort'],'session_logintime',$info['order'],
|
||||||
|
'/admin/currentusers.php',lang('Login Time')));
|
||||||
|
$this->template->set_var('sort_action',$this->nextmatchs->show_sort_order($info['sort'],'session_action',$info['order'],
|
||||||
|
'/admin/currentusers.php',lang('Action')));
|
||||||
|
$this->template->set_var('sort_idle',$this->nextmatchs->show_sort_order($info['sort'],'session_dla',$info['order'],
|
||||||
|
'/admin/currentusers.php',lang('idle')));
|
||||||
|
$this->template->set_var('lang_kill',lang('Kill'));
|
||||||
|
|
||||||
|
$values = $this->bo->list_sessions($info['start'],$info['order'],$info['sort']);
|
||||||
|
while (list(,$value) = each($values))
|
||||||
|
{
|
||||||
|
$this->nextmatchs->template_alternate_row_color(&$this->template);
|
||||||
|
|
||||||
|
$this->template->set_var('row_loginid',$value['session_lid']);
|
||||||
|
$this->template->set_var('row_ip',$value['session_ip']);
|
||||||
|
$this->template->set_var('row_logintime',$value['session_logintime']);
|
||||||
|
$this->template->set_var('row_idle',$value['session_idle']);
|
||||||
|
|
||||||
|
if ($value['session_action'])
|
||||||
|
{
|
||||||
|
$this->template->set_var('row_action',$GLOBALS['phpgw']->strip_html($value['session_action']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->template->set_var('row_action',' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($value['session_id'] != $GLOBALS['phpgw_info']['user']['sessionid'])
|
||||||
|
{
|
||||||
|
$this->template->set_var('row_kill','<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicurrentusers.kill_session&ksession='
|
||||||
|
. $value['session_id'] . '&kill=true') . '">' . lang('Kill').'</a>');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->template->set_var('row_kill',' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->parse('rows','row',True);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->pparse('out','list');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,33 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* phpGroupWare - administration *
|
* phpGroupWare - administration *
|
||||||
* http://www.phpgroupware.org *
|
* http://www.phpgroupware.org *
|
||||||
* -------------------------------------------- *
|
* -------------------------------------------- *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||||
* option) any later version. *
|
* option) any later version. *
|
||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
{
|
$file = array(
|
||||||
// Only Modify the $file and $title variables.....
|
'Site Configuration' => $phpgw->link('/admin/config.php','appname=admin'),
|
||||||
$title = $appname;
|
|
||||||
$file = Array(
|
|
||||||
'Site Configuration' => $phpgw->link('/admin/config.php','appname=' . $appname),
|
|
||||||
'Peer Servers' => $phpgw->link('/admin/servers.php'),
|
'Peer Servers' => $phpgw->link('/admin/servers.php'),
|
||||||
'User Accounts' => $phpgw->link('/admin/accounts.php'),
|
'User Accounts' => $phpgw->link('/admin/accounts.php'),
|
||||||
'User Groups' => $phpgw->link('/admin/groups.php'),
|
'User Groups' => $phpgw->link('/admin/groups.php'),
|
||||||
'Applications' => $phpgw->link('/admin/applications.php'),
|
'Applications' => $phpgw->link('/admin/applications.php'),
|
||||||
'Global Categories' => $phpgw->link('/admin/categories.php'),
|
'Global Categories' => $phpgw->link('/admin/categories.php'),
|
||||||
'Change Main Screen Message' => $phpgw->link('/admin/mainscreen_message.php'),
|
'Change Main Screen Message' => $phpgw->link('/admin/mainscreen_message.php'),
|
||||||
'View Sessions' => $phpgw->link('/admin/currentusers.php'),
|
'View Sessions' => $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions'),
|
||||||
'View Access Log' => $phpgw->link('/index.php','menuaction=admin.uiaccess_history.list_history'),
|
'View Access Log' => $phpgw->link('/index.php','menuaction=admin.uiaccess_history.list_history'),
|
||||||
'View Error Log' => $phpgw->link('/admin/log.php'),
|
'View Error Log' => $phpgw->link('/admin/log.php'),
|
||||||
'phpInfo' => $phpgw->link('/admin/phpinfo.php')
|
'phpInfo' => $phpgw->link('/admin/phpinfo.php')
|
||||||
);
|
);
|
||||||
//Do not modify below this line
|
|
||||||
display_section($appname,$title,$file);
|
//Do not modify below this line
|
||||||
}
|
display_section('admin','admin',$file);
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user