phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api/sessions class.sessions_php.php, 1.1.1.1.2.4, 1.


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] api/sessions class.sessions_php.php, 1.1.1.1.2.4, 1.1.1.1.2.5
Date: Sun, 09 Nov 2003 19:27:06 +0000

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

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


Index: class.sessions_php.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/sessions/class.sessions_php.php,v
retrieving revision 1.1.1.1.2.4
retrieving revision 1.1.1.1.2.5
diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.5
*** class.sessions_php.php      9 Nov 2003 15:47:42 -0000       1.1.1.1.2.4
--- class.sessions_php.php      9 Nov 2003 19:27:04 -0000       1.1.1.1.2.5
***************
*** 4,8 ****
--- 4,10 ----
        * http://www.phpgroupware.org                                           
   *
        * This file written by Dan Kuykendall <address@hidden>                 *
+       *                      Joseph Engo <address@hidden>                *
        * Copyright (C) 2003 Dan Kuykendall                                     
   *
+       * Copyright (C) 2003 Joseph Engo                                        
   *
        * 
-------------------------------------------------------------------------*
        * This library is part of the phpGroupWare API                          
   *
***************
*** 151,154 ****
--- 153,211 ----
                        }
                }
+ 
+               function read_all_sessions()
+               {
+                       $args = new safe_args();
+                       $args->set('start','##REQUIRED##','int');
+                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ 
+                       $dh = opendir(get_cfg_var('session.save_path'));
+                       while ($file = readdir($dh))
+                       {
+                               if (ereg('sess_',$file) && strlen($file) == 37)
+                               {
+                                       $sid            = 
ereg_replace('sess_','',$file);
+                                       $session_values = 
$this->read_other_session($sid);
+ 
+                                       if (is_array($session_values))
+                                       {
+                                               $result[] = array(
+                                                       'lid'        => 
$session_values['session_lid'],
+                                                       'action'     => 
$session_values['prevop'],
+                                                       'ip'         => 
$session_values['ip_address'],
+                                                       'login_time' => 
$session_values['login_time'],
+                                                       'dla'        => 
$session_values['session_dla'],
+                                                       'sid'        => $sid
+                                               );
+                                       }
+                               }
+                       }
+                       closedir($dh);
+ 
+                       return $result;
+               }
+ 
+               function read_other_session()
+               {
+                       $args = new safe_args();
+                       $args->set('sessionid','##REQUIRED##','string');
+                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ 
+                       $fh = fopen(get_cfg_var('session.save_path') . SEP . 
'sess_' . $args['sessionid'],'r');
+                       if (! $fh)
+                       {
+                               $GLOBALS['msgbox']->add(lang('Could not open 
session file (%s)',get_cfg_var('session.save_path') . SEP . 'sess_' . 
$args['sessionid']),__LINE__,__FILE__, 'error');
+                               return;
+                       }
+ 
+                       while (! feof($fh))
+                       {
+                               $raw_data .= fgets($fh,4096);
+                       }
+                       fclose($fh);
+ 
+                       return 
unserialize(ereg_replace('phpgw_session\|','',$raw_data));
+               }
        }
+ 
  





reply via email to

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