- Timestamp:
- 03/26/10 18:07:45 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.sessions_php4.inc.php
r2 r2357 125 125 else 126 126 { 127 $sessions = $this->list_sessions(0,'','',True); 128 129 if (isset($sessions[$sessionid])) 130 { 131 //echo "<p>session_php4::destroy($session_id): unlink('".$sessions[$sessionid]['php_session_file'].")</p>\n"; 132 @unlink($sessions[$sessionid]['php_session_file']); 127 if(@opendir($path = ini_get('session.save_path'))){ 128 $session_file = $path."/sess_".$sessionid; 129 if (file_exists($session_file)) 130 @unlink($session_file); 133 131 } 134 132 } … … 199 197 function list_sessions($start,$order,$sort,$all_no_sort = False) 200 198 { 201 //echo "<p>session_php4::list_sessions($start,'$order','$sort',$all)</p>\n";202 $session_cache = $this->appsession('php4_session_cache','phpgwapi');203 204 199 $values = array(); 205 200 $maxmatchs = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; … … 211 206 while ($file = readdir($dir)) 212 207 { 213 if (substr($file,0,5) != 'sess_' )208 if (substr($file,0,5) != 'sess_' || !is_readable($path. '/' . $file)) 214 209 { 215 210 continue; 216 211 } 217 if (isset($session_cache[$file])) // use copy from cache 218 { 219 $session = $session_cache[$file]; 220 221 if ($session['session_flags'] == 'A' || !$session['session_id'] || 222 $session['session_install_id'] != $GLOBALS['phpgw_info']['server']['install_id']) 223 { 224 continue; // no anonymous sessions or other domains or installations 225 } 226 if (!$all_no_sort) // we need the up-to-date data --> unset and reread it 227 { 228 unset($session_cache[$file]); 229 } 230 } 231 if (!isset($session_cache[$file])) // not in cache, read and cache it 232 { 233 if (!is_readable($path. '/' . $file)) 234 { 235 continue; // happens if webserver runs multiple user-ids 236 } 237 $session = ''; 238 if (($fd = fopen ($path . '/' . $file,'r'))) 239 { 240 $session = ($size = filesize ($path . '/' . $file)) ? @fread ($fd, $size) : 0; 241 fclose ($fd); 242 } 243 if (substr($session,0,14) != 'phpgw_session|') 244 { 245 continue; 246 } 247 $session = unserialize(substr($session,14)); 248 unset($session['phpgw_app_sessions']); // not needed, saves memory 249 $session_cache[$file] = $session; 250 } 251 if($session['session_flags'] == 'A' || !$session['session_id'] || 252 $session['session_install_id'] != $GLOBALS['phpgw_info']['server']['install_id']) 253 { 254 continue; // no anonymous sessions or other domains or installations 255 } 256 //echo "file='$file'=<pre>"; print_r($session); echo "</pre>"; 257 258 $session['php_session_file'] = $path . '/' . $file; 212 213 $session = ''; 214 if (($fd = fopen ($path . '/' . $file,'r'))) 215 { 216 $session = ($size = filesize ($path . '/' . $file)) ? @fread ($fd, $size) : 0; 217 fclose ($fd); 218 } 219 $session = unserialize(substr($session,14)); 259 220 $values[$session['session_id']] = $session; 260 221 } … … 280 241 reset($values); 281 242 } 282 $this->appsession('php4_session_cache','phpgwapi',$session_cache);283 243 284 244 return $values;
Note: See TracChangeset
for help on using the changeset viewer.