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