GetDb(); require(cms_join_path(dirname(__FILE__),'lib','page.functions.php')); // extract the stylesheet(s) $sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_id = ".$db->qstr($cssid); $row = $db->GetRow($sql); // calculate the new etag $etag = md5($row['css_text']); // update the hash cache $hash[$cssid] = $etag; csscache_hash_to_csvfile($hashfile,$hash); // add a comment at the start $css = "/* Start of CMSMS style sheet '{$row['css_name']}' */\n{$row['css_text']}\n/* End of '{$row['css_name']}' */\n\n"; // set encoding $encoding = ''; if ($config['admin_encoding'] != '') $encoding = $config['admin_encoding']; elseif ($config['default_encoding'] != '') $encoding = $config['default_encoding']; else $encoding = 'UTF-8'; // // Begin output // // postprocess if ($stripbackground) { #$css = preg_replace('/(\w*?background-color.*?\:\w*?).*?(;.*?)/', '', $css); $css = preg_replace('/(\w*?background-color.*?\:\w*?).*?(;.*?)/', '\\1transparent\\2', $css); $css = preg_replace('/(\w*?background-image.*?\:\w*?).*?(;.*?)/', '', $css); } if( isset($config['output_compression']) && ($config['output_compression']) && ($config['debug'] != true) ) { @ob_start('ob_gzhandler'); } $max_age = (int)get_site_preference('css_max_age',0); header("Content-Type: text/css; charset=$encoding"); $datestr = gmdate('D, d M Y H:i:s',$hashmtime).' GMT'; header("Last-Modified: ".$datestr); if( $max_age > 0 ) { $datestr = gmdate('D, d M Y H:i:s',$hashmtime+$max_age).' GMT'; header("Expires: ".$datestr); header("Cache-Control: must-revalidate"); // no caching? //header("Cache-Control: max-age=$max_age, s-max-age=$max_age, must-revalidate"); } header('Etag: "'.$etag.'"'); echo $css; // EOF ?>