GetPreference("includeonlyscreencss",0)==1) {
$query.="AND (c.media_type LIKE '%screen%' OR c.media_type LIKE '%all%')";
}
$query.="ORDER BY ac.assoc_order ASC";
//echo $query;
$dbresult=$db->Execute($query,$params);
//echo $db->ErrorMsg();
//echo $dbresult;
if ($dbresult && $dbresult->RecordCount()>0) {
while($row=$dbresult->FetchRow()) {
//echo $row['css_text']."
";
$css.="/* Start of CMSMS style sheet '".$row['css_name']."' */\n"
.$row['css_text']."\n".
"/* End of '".$row['css_name']."' */\n";
}
}
//echo "hi";
header("Content-Type: text/css; charset=" .$encoding);
header("Content-Type: text/css; charset=" . (isset($result['encoding'])?$result['encoding']:'UTF-8'));
//Strip background
#$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);
#Do cache-control stuff but only if we are running Apache
if(function_exists('getallheaders')) {
$headers = getallheaders();
$hash = md5($css);
#if browser sent etag and it is the same then reply with 304
if (isset($headers['If-None-Match']) && $headers['If-None-Match'] == '"'.$hash.'"')
{
header('HTTP/1.1 304 Not Modified');
exit;
}
else {
header('ETag: "'.$hash.'"');
}
}
echo $css;
die;
?>