]> git.mxchange.org Git - friendica.git/blob - view/theme/vier/style.php
dba758ca24eb374fd7e661761789fd481ca3df0d
[friendica.git] / view / theme / vier / style.php
1 <?php
2 $uid = get_theme_uid();
3
4 $style = get_pconfig($uid, 'vier', 'style');
5
6 if ($style == "")
7         $style = get_config('vier', 'style');
8
9 if ($style == "")
10         $style = "plus";
11
12 if ($style == "flat")
13         $stylecssfile = 'view/theme/vier/flat.css';
14 else if ($style == "netcolour")
15         $stylecssfile = 'view/theme/vier/netcolour.css';
16 else if ($style == "breathe")
17         $stylecssfile = 'view/theme/vier/breathe.css';
18 else if ($style == "plus")
19         $stylecssfile = 'view/theme/vier/plus.css';
20 else if ($style == "dark")
21         $stylecssfile = 'view/theme/vier/dark.css';
22
23 if (file_exists($THEMEPATH."//style.css")) {
24         $stylecss = file_get_contents($THEMEPATH."//style.css")."\n";
25         $modified = filemtime($THEMEPATH."//style.css");
26 }
27
28 $stylemodified = filemtime($stylecssfile);
29 $stylecss .= file_get_contents($stylecssfile);
30
31 if ($stylemodified > $modified)
32         $modified = $stylemodified;
33
34 $modified = gmdate('r', $modified);
35
36 $etag = md5($stylecss);
37
38 // Only send the CSS file if it was changed
39 header('Cache-Control: public');
40 header('ETag: "'.$etag.'"');
41 header('Last-Modified: '.$modified);
42
43 if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
44
45         $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']));
46         $cached_etag = str_replace(array('"', "-gzip"), array('', ''),
47                                 stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
48
49         if (($cached_modified == $modified) && ($cached_etag == $etag)) {
50                 header('HTTP/1.1 304 Not Modified');
51                 exit();
52         }
53 }
54 echo $stylecss;