phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] api class.admin.php,1.1.2.10,1.1.2.11


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] api class.admin.php,1.1.2.10,1.1.2.11
Date: Sun, 09 Nov 2003 19:27:06 +0000

Update of /cvsroot/phpgroupware/api
In directory subversions:/tmp/cvs-serv10041/api

Modified Files:
      Tag: proposal-branch
        class.admin.php 
Log Message:
Moved session reading into the sessions class


Index: class.admin.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.admin.php,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** class.admin.php     9 Nov 2003 15:51:49 -0000       1.1.2.10
--- class.admin.php     9 Nov 2003 19:27:04 -0000       1.1.2.11
***************
*** 96,113 ****
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
  
!                       $fh = fopen(get_cfg_var('session.save_path') . SEP . 
'sess_' . $args['vsid'],'r');
!                       if (! $fh)
!                       {
!                               $GLOBALS['msgbox']->add(lang('Could not open 
session file (%s)',get_cfg_var('session.save_path') . SEP . 'sess_' . 
$args['vsid']),__LINE__,__FILE__, 'error');
!                               return;
!                       }
! 
!                       while (! feof($fh))
!                       {
!                               $raw_data .= fgets($fh,4096);
!                       }
!                       fclose($fh);
  
!                       $data = 
unserialize(ereg_replace('phpgw_session\|','',$raw_data));
                        // If you want to see this data, comment out the 
follow.  I did this becuase at times this data was really way too big
                        // and looked like total shit in the browser. (jengo)
--- 96,102 ----
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
  
!                       $GLOBALS['phpgw_xml_apinode']->add_node('View session 
data','title');
  
!                       $data = 
$GLOBALS['phpgw']->session->read_other_session($args['vsid']);
                        // If you want to see this data, comment out the 
follow.  I did this becuase at times this data was really way too big
                        // and looked like total shit in the browser. (jengo)
***************
*** 158,245 ****
                }
  
!               function read_session_data($filename)
                {
!                       $sid = ereg_replace('sess_','',$filename);
! 
!                       $fh = fopen(get_cfg_var('session.save_path') . SEP . 
$filename,'r');
!                       if (! $fh)
!                       {
!                               $GLOBALS['msgbox']->add(lang('Could not open 
session file (%s)',get_cfg_var('session.save_path') . SEP . 
$filename),__LINE__,__FILE__, 'error');
!                               return;
!                       }
  
!                       while (! feof($fh))
                        {
!                               $raw_data .= fgets($fh,4096);
!                       }
!                       fclose($fh);
! 
!                       $data = 
unserialize(ereg_replace('phpgw_session\|','',$raw_data));
!                       list($app,$class,$method) = 
explode('.',$data['prevop']);
  
!                       if (! $app && ! $class && ! $method)
!                       {
!                               return False;
!                       }
  
!                       if (! file_exists(PHPGW_ROOT . SEP . $app . SEP . 
'class.' . $class . '.php'))
!                       {
!                               // Not sure if errors should be spit out here, 
its possiable a user was tring to access
!                               // something that doesn't exist ... that would 
prevent this method from working UNTIL
!                               // the session is updating or deleted.  So, for 
now, just ignore times like this.
!                               // Maybe in the future, add it to the debug log 
(jengo)
!                               return False;
!                       }
  
!                       require_once(PHPGW_ROOT . SEP . $app . SEP . 'class.' . 
$class . '.php');
  
!                       if (isset($GLOBALS['docs'][$app]['classes'][$app . '_' 
. $class]['functions'][$method]['title']))
!                       {
!                               $title = 
lang($GLOBALS['docs'][$app]['classes'][$app . '_' . 
$class]['functions'][$method]['title']);
!                       }
!                       else
!                       {
!                               $title = $data['prevop'];
                        }
  
!                       return array(
!                               'lid'        => $data['session_lid'],
!                               'action'     => $title,
!                               'ip'         => $data['ip_address'],
!                               'login_time' => 
strftime('%x',$data['login_time']) . date(' h:i:s a',$data['login_time']),
!                               'idle'       => gmdate('H:i:s',(time() - 
$data['session_dla'])),
!                               'sid'        => $sid
                        );
-               }
- 
-               function current_users()
-               {
-                       $GLOBALS['phpgw_xml_apinode']->add_node('Current 
Users','title');
- 
-                       // FIXME: This NEEDS to be moved into the session class 
(jengo)
-                       $dh = opendir(get_cfg_var('session.save_path'));
-                       while ($file = readdir($dh))
-                       {
-                               if (ereg('sess_',$file) && strlen($file) == 37)
-                               {
-                                       $session_values = 
$this->read_session_data($file);
- 
-                                       if (is_array($session_values))
-                                       {
-                                               $result['current_users'][] = 
array(
-                                                       'lid'        => 
$session_values['lid'],
-                                                       'action'     => 
$session_values['action'],
-                                                       'ip'         => 
$session_values['ip'],
-                                                       'login_time' => 
$session_values['login_time'],
-                                                       'idle'       => 
$session_values['idle'],
-                                                       'sid'        => 
$session_values['sid']
-                                               );
-                                       }
-                               }
-                       }
-                       closedir($dh);
- 
-                       $result['action_type'] = 'current_users';
-                       return $result;
                }
        }
--- 147,189 ----
                }
  
!               function current_users()
                {
!                       $GLOBALS['phpgw_xml_apinode']->add_node('Current 
Users','title');
  
!                       $sessions = 
$GLOBALS['phpgw']->session->read_all_sessions(0);
!                       $total    = count($sessions);
!                       for ($i=0; $i<$total; $i++)
                        {
!                               $sessions[$i]['login_time'] = 
strftime('%x',$sessions[$i]['login_time']) . date(' h:i:s 
a',$sessions[$i]['login_time']);
!                               $sessions[$i]['idle']       = 
gmdate('H:i:s',(time() - $sessions[$i]['dla']));
!                               list($app,$class,$method)   = 
explode('.',$sessions[$i]['action']);
  
!                               if (! $app && ! $class && ! $method)
!                               {
!                                       return False;
!                               }
  
!                               if (! file_exists(PHPGW_ROOT . SEP . $app . SEP 
. 'class.' . $class . '.php'))
!                               {
!                                       // Not sure if errors should be spit 
out here, its possiable a user was tring to access
!                                       // something that doesn't exist ... 
that would prevent this method from working UNTIL
!                                       // the session is updating or deleted.  
So, for now, just ignore times like this.
!                                       // Maybe in the future, add it to the 
debug log (jengo)
!                                       return False;
!                               }
  
!                               require_once(PHPGW_ROOT . SEP . $app . SEP . 
'class.' . $class . '.php');
  
!                               if 
(isset($GLOBALS['docs'][$app]['classes'][$app . '_' . 
$class]['functions'][$method]['title']))
!                               {
!                                       $sessions[$i]['action'] = 
lang($GLOBALS['docs'][$app]['classes'][$app . '_' . 
$class]['functions'][$method]['title']);
!                               }
                        }
  
!                       return array
!                       (
!                               'current_users' => $sessions,
!                               'action_type'   => 'current_users'
                        );
                }
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]