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