Changeset 5274 in subversion


Ignore:
Timestamp:
Sep 23, 2011 6:11:27 AM (20 months ago)
Author:
alec
Message:
  • Make the whole PHP output non-cacheable (#1487797)
Location:
trunk/roundcubemail
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/index.php

    r5124 r5274  
    3333// init application, start session, init output class, etc. 
    3434$RCMAIL = rcmail::get_instance(); 
     35 
     36// Make the whole PHP output non-cacheable (#1487797) 
     37send_nocacheing_headers(); 
    3538 
    3639// turn on output buffering 
     
    178181    ); 
    179182  } 
    180    
     183 
    181184  if ($session_error || $_REQUEST['_err'] == 'session') 
    182185    $OUTPUT->show_message('sessionerror', 'error', null, true, -1); 
  • trunk/roundcubemail/program/include/rcube_shared.inc

    r4710 r5274  
    2323/** 
    2424 * Roundcube shared functions 
    25  *  
     25 * 
    2626 * @package Core 
    2727 */ 
     
    7171 
    7272/** 
    73  * Check request for If-Modified-Since and send an according response. 
    74  * This will terminate the current script if headers match the given values 
    75  * 
    76  * @param int Modified date as unix timestamp 
    77  * @param string Etag value for caching 
    78  */ 
    79 function send_modified_header($mdate, $etag=null, $skip_check=false) 
    80 { 
    81   if (headers_sent()) 
    82     return; 
    83      
    84   $iscached = false; 
    85   $etag = $etag ? "\"$etag\"" : null; 
    86  
    87   if (!$skip_check) 
    88   { 
    89     if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate) 
    90       $iscached = true; 
    91    
    92     if ($etag) 
    93       $iscached = ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag); 
    94   } 
    95    
    96   if ($iscached) 
    97     header("HTTP/1.x 304 Not Modified"); 
    98   else 
    99     header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mdate)." GMT"); 
    100    
    101   header("Cache-Control: private, must-revalidate, max-age=0"); 
    102   header("Expires: "); 
    103   header("Pragma: "); 
    104    
    105   if ($etag) 
    106     header("Etag: $etag"); 
    107    
    108   if ($iscached) 
    109     { 
    110     ob_end_clean(); 
    111     exit; 
    112     } 
    113 } 
    114  
    115  
    116 /** 
    11773 * Similar function as in_array() but case-insensitive 
    11874 * 
     
    12783    if ($needle===mb_strtolower($value)) 
    12884      return true; 
    129    
     85 
    13086  return false; 
    13187} 
     
    219175  $host_url = $base_url; 
    220176  $abs_path = $path; 
    221    
     177 
    222178  // check if path is an absolute URL 
    223179  if (preg_match('/^[fhtps]+:\/\//', $path)) 
     
    326282 
    327283  return $hdrs[$key]; 
    328   } 
     284} 
    329285 
    330286 
     
    345301  return preg_replace('/\/$/', '', $str); 
    346302} 
    347    
     303 
    348304 
    349305/** 
     
    375331 */ 
    376332function get_offset_time($offset_str, $factor=1) 
    377   { 
     333{ 
    378334  if (preg_match('/^([0-9]+)\s*([smhdw])/i', $offset_str, $regs)) 
    379335  { 
     
    386342    $unit = 's'; 
    387343  } 
    388      
     344 
    389345  $ts = mktime(); 
    390346  switch ($unit) 
     
    419375{ 
    420376  $length = mb_strlen($str); 
    421    
     377 
    422378  if ($length > $maxlength) 
    423379  { 
     
    433389  return $str; 
    434390} 
     391 
    435392 
    436393/** 
     
    548505    return $input; 
    549506  } 
    550    
     507 
    551508  if (!is_string($input) || $input == '') 
    552509    return $input; 
     
    570527    '|\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF]'.       // UTF8-4 
    571528    ')$/'; 
    572    
     529 
    573530  $seq = ''; 
    574531  $out = ''; 
     
    641598    } 
    642599  } 
    643    
     600 
    644601  $result[] = substr($string, $p); 
    645602  return $result; 
     
    656613{ 
    657614  $keys = array(); 
    658    
     615 
    659616  if (!empty($array)) 
    660617    foreach ($array as $key => $child) { 
  • trunk/roundcubemail/program/steps/addressbook/export.inc

    r5012 r5274  
    6767 
    6868// send downlaod headers 
    69 send_nocacheing_headers(); 
    7069header('Content-Type: text/x-vcard; charset='.RCMAIL_CHARSET); 
    7170header('Content-Disposition: attachment; filename="rcube_contacts.vcf"'); 
  • trunk/roundcubemail/program/steps/mail/get.inc

    r5143 r5274  
    6464  $MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); 
    6565} 
    66  
    67 send_nocacheing_headers(); 
    6866 
    6967// show part page 
  • trunk/roundcubemail/program/steps/mail/show.inc

    r5233 r5274  
    3131  } 
    3232 
    33   send_nocacheing_headers(); 
    34  
    3533  $mbox_name = $IMAP->get_mailbox_name(); 
    3634 
Note: See TracChangeset for help on using the changeset viewer.