root/releases/0.9rc1/mod/template/css.php

Revision 1301, 1.0 kB (checked in by dramirez, 1 year ago)

Moved from units to mod:

  • profile
  • users
  • template

Updated .htaccess rules

  • Property svn:eol-style set to native
Line 
1 <?php
2
3 define('context', 'external');
4 require_once(dirname(dirname(__FILE__))."/../includes.php");
5
6 header("Content-type: text/css; charset=utf-8");
7
8 $template_id = optional_param('template');
9
10 // templates_draw() uses the global $template_name, not the 'template' array param, to choose a template
11 $template_name = $template_id;
12
13 $css = templates_draw(array(
14                           'template' => $template_id,
15                           'context' => 'css'
16                           )
17                     );
18
19 $etag = md5($css);
20
21 header('Cache-Control: public');
22 header('Pragma: ');
23
24 header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT");
25 header('ETag: ' . $etag . '');
26
27 // Send 304s where possible, rather than spitting out the file each time
28 if (array_key_exists('HTTP_IF_NONE_MATCH',$_SERVER)) {
29     $if_none_match = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_NONE_MATCH']);
30     if ($if_none_match == $etag) {
31         header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified");
32         exit;
33     }
34 }
35
36 echo $css;
37
38 ?>
Note: See TracBrowser for help on using the browser.