Changeset 339 in subversion


Ignore:
Timestamp:
Sep 8, 2006 8:03:22 AM (7 years ago)
Author:
thomasb
Message:

Fixed safe_mode issues

Location:
trunk/roundcubemail/program
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/main.inc

    r338 r339  
    824824 
    825825 
    826 // remove temp files of a session 
    827 function rcmail_clear_session_temp($sess_id) 
    828   { 
    829   global $CONFIG; 
    830  
    831   $temp_dir = slashify($CONFIG['temp_dir']); 
    832   $cache_dir = $temp_dir.$sess_id; 
    833  
    834   if (is_dir($cache_dir)) 
    835     { 
    836     clear_directory($cache_dir); 
    837     rmdir($cache_dir); 
    838     }   
     826// remove temp files older than two day 
     827function rcmail_temp_gc() 
     828  { 
     829  $tmp = unslashify($CONFIG['temp_dir']); 
     830  $expire = mktime() - 172800;  // expire in 48 hours 
     831 
     832  if ($dir = opendir($tmp)) 
     833    { 
     834    while (($fname = readdir($dir)) !== false) 
     835      { 
     836      if ($fname{0} == '.') 
     837        continue; 
     838 
     839      if (filemtime($tmp.'/'.$fname) < $expire) 
     840        @unlink($tmp.'/'.$fname); 
     841      } 
     842 
     843    closedir($dir); 
     844    } 
    839845  } 
    840846 
  • trunk/roundcubemail/program/include/session.inc

    r338 r339  
    106106              $key); 
    107107 
    108   rcmail_clear_session_temp($key); 
    109108  return TRUE; 
    110109  } 
     
    138137    } 
    139138 
    140   // remove session specific temp dirs 
    141   foreach ($a_exp_sessions as $key) 
    142     rcmail_clear_session_temp($key); 
    143  
    144139  // also run message cache GC 
    145140  rcmail_message_cache_gc(); 
     141  rcmail_temp_gc(); 
    146142 
    147143  return TRUE; 
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r337 r339  
    498498function rcmail_write_compose_attachments(&$message) 
    499499  { 
    500   global $IMAP; 
    501      
    502   $temp_dir = rcmail_create_compose_tempdir(); 
     500  global $IMAP, $CONFIG; 
     501 
     502  $temp_dir = unslashify($CONFIG['temp_dir']); 
    503503 
    504504  if (!is_array($_SESSION['compose']['attachments'])) 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r338 r339  
    13851385 
    13861386 
    1387 // create temp dir for attachments 
    1388 function rcmail_create_compose_tempdir() 
    1389   { 
    1390   global $CONFIG; 
    1391    
    1392   if ($_SESSION['compose']['temp_dir']) 
    1393     return $_SESSION['compose']['temp_dir']; 
    1394    
    1395   if (!empty($CONFIG['temp_dir'])) 
    1396     $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '').$_SESSION['compose']['id']; 
    1397  
    1398   // create temp-dir for uploaded attachments 
    1399   if (!empty($CONFIG['temp_dir']) && is_writeable($CONFIG['temp_dir'])) 
    1400     { 
    1401     mkdir($temp_dir); 
    1402     $_SESSION['compose']['temp_dir'] = $temp_dir; 
    1403     } 
    1404  
    1405   return $_SESSION['compose']['temp_dir']; 
    1406   } 
    1407  
    1408  
    14091387// clear message composing settings 
    14101388function rcmail_compose_cleanup() 
     
    14121390  if (!isset($_SESSION['compose'])) 
    14131391    return; 
    1414    
     1392 
    14151393  // remove attachment files from temp dir 
    14161394  if (is_array($_SESSION['compose']['attachments'])) 
    14171395    foreach ($_SESSION['compose']['attachments'] as $attachment) 
    14181396      @unlink($attachment['path']); 
    1419  
    1420   // kill temp dir 
    1421   if ($_SESSION['compose']['temp_dir']) 
    1422     @rmdir($_SESSION['compose']['temp_dir']); 
    14231397   
    14241398  unset($_SESSION['compose']); 
  • trunk/roundcubemail/program/steps/mail/upload.inc

    r297 r339  
    2727 
    2828 
    29 // create temp dir for file uploads 
    30 $temp_dir = rcmail_create_compose_tempdir(); 
     29// use common temp dir for file uploads 
     30$temp_dir = unslashify($CONFIG['temp_dir']); 
    3131 
    3232 
Note: See TracChangeset for help on using the changeset viewer.