[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
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 /* $Id: class.uicurrentsessions.inc.php 21456 2006-04-25 19:11:13Z ralfbecker $ */ 14 15 class uicurrentsessions 16 { 17 var $template; 18 var $bo; 19 var $public_functions = array( 20 'list_sessions' => True, 21 'kill' => True 22 ); 23 24 function uicurrentsessions() 25 { 26 if ($GLOBALS['egw']->acl->check('current_sessions_access',1,'admin')) 27 { 28 $GLOBALS['egw']->redirect_link('/index.php'); 29 } 30 $this->template =& CreateObject('phpgwapi.Template',EGW_APP_TPL); 31 $this->bo =& CreateObject('admin.bocurrentsessions'); 32 $this->nextmatchs =& CreateObject('phpgwapi.nextmatchs'); 33 } 34 35 function header() 36 { 37 if(!@is_object($GLOBALS['egw']->js)) 38 { 39 $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); 40 } 41 $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); 42 $GLOBALS['egw']->common->egw_header(); 43 echo parse_navbar(); 44 } 45 46 function store_location($info) 47 { 48 $GLOBALS['egw']->session->appsession('currentsessions_session_data','admin',$info); 49 } 50 51 function list_sessions() 52 { 53 $info = $GLOBALS['egw']->session->appsession('currentsessions_session_data','admin'); 54 if (! is_array($info)) 55 { 56 $info = array( 57 'start' => 0, 58 'sort' => 'asc', 59 'order' => 'session_dla' 60 ); 61 $this->store_location($info); 62 } 63 64 if ($_REQUEST['start'] || $_REQUEST['sort'] || $_REQUEST['order']) 65 { 66 if ($_REQUEST['start'] == 0 || $_REQUEST['start'] && $_REQUEST['start'] != $info['start']) 67 { 68 $info['start'] = $_REQUEST['start']; 69 } 70 71 if ($_REQUEST['sort'] && $_REQUEST['sort'] != $info['sort']) 72 { 73 $info['sort'] = $_REQUEST['sort']; 74 } 75 76 if ($_REQUEST['order'] && $_REQUEST['order'] != $info['order']) 77 { 78 $info['order'] = $_REQUEST['order']; 79 } 80 81 $this->store_location($info); 82 } 83 84 $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('List of current users'); 85 $this->header(); 86 87 $this->template->set_file('current','currentusers.tpl'); 88 $this->template->set_block('current','list','list'); 89 $this->template->set_block('current','row','row'); 90 91 $can_view_action = !$GLOBALS['egw']->acl->check('current_sessions_access',2,'admin'); 92 $can_view_ip = !$GLOBALS['egw']->acl->check('current_sessions_access',4,'admin'); 93 $can_kill = !$GLOBALS['egw']->acl->check('current_sessions_access',8,'admin'); 94 95 $total = $this->bo->total(); 96 97 $this->template->set_var('bg_color',$GLOBALS['egw_info']['theme']['bg_color']); 98 $this->template->set_var('left_next_matchs',$this->nextmatchs->left('/admin/currentusers.php',$info['start'],$total)); 99 $this->template->set_var('right_next_matchs',$this->nextmatchs->right('/admin/currentusers.php',$info['start'],$total)); 100 $this->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']); 101 102 $this->template->set_var('sort_loginid',$this->nextmatchs->show_sort_order($info['sort'],'session_lid',$info['order'], 103 '/admin/currentusers.php',lang('LoginID'))); 104 $this->template->set_var('sort_ip',$this->nextmatchs->show_sort_order($info['sort'],'session_ip',$info['order'], 105 '/admin/currentusers.php',lang('IP'))); 106 $this->template->set_var('sort_login_time',$this->nextmatchs->show_sort_order($info['sort'],'session_logintime',$info['order'], 107 '/admin/currentusers.php',lang('Login Time'))); 108 $this->template->set_var('sort_action',$this->nextmatchs->show_sort_order($info['sort'],'session_action',$info['order'], 109 '/admin/currentusers.php',lang('Action'))); 110 $this->template->set_var('sort_idle',$this->nextmatchs->show_sort_order($info['sort'],'session_dla',$info['order'], 111 '/admin/currentusers.php',lang('idle'))); 112 $this->template->set_var('lang_kill',lang('Kill')); 113 114 $values = $this->bo->list_sessions($info['start'],$info['order'],$info['sort']); 115 116 while (list(,$value) = @each($values)) 117 { 118 $this->nextmatchs->template_alternate_row_color($this->template); 119 120 $this->template->set_var('row_loginid',$value['session_lid']); 121 122 $this->template->set_var('row_ip',$can_view_ip?$value['session_ip']:' '); 123 124 $this->template->set_var('row_logintime',$value['session_logintime']); 125 $this->template->set_var('row_idle',$value['session_idle']); 126 127 if ($value['session_action'] && $can_view_action) 128 { 129 $this->template->set_var('row_action',$GLOBALS['egw']->strip_html($value['session_action'])); 130 } 131 else 132 { 133 $this->template->set_var('row_action',' '); 134 } 135 136 if ($value['session_id'] != $GLOBALS['egw_info']['user']['sessionid'] && $can_kill) 137 { 138 $this->template->set_var('row_kill','<a href="' . $GLOBALS['egw']->link('/index.php','menuaction=admin.uicurrentsessions.kill&ksession=' 139 . $value['session_id'] . '&kill=true') . '">' . lang('Kill').'</a>'); 140 } 141 else 142 { 143 $this->template->set_var('row_kill',' '); 144 } 145 146 $this->template->parse('rows','row',True); 147 } 148 149 $this->template->pfp('out','list'); 150 } 151 152 function kill() 153 { 154 if ($GLOBALS['egw']->acl->check('current_sessions_access',8,'admin')) 155 { 156 $GLOBALS['egw']->redirect_link('/index.php'); 157 } 158 $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Kill session'); 159 $this->header(); 160 $this->template->set_file('form','kill_session.tpl'); 161 162 $this->template->set_var('lang_message',lang('Are you sure you want to kill this session ?')); 163 $this->template->set_var('link_no','<a href="' . $GLOBALS['egw']->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions') . '">' . lang('No') . '</a>'); 164 $this->template->set_var('link_yes','<a href="' . $GLOBALS['egw']->link('/index.php','menuaction=admin.bocurrentsessions.kill&ksession=' . $_GET['ksession']) . '">' . lang('Yes') . '</a>'); 165 166 $this->template->pfp('out','form'); 167 } 168 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |