3 * @file view/theme/vier/style.php
5 use Friendica\Core\Config;
6 use Friendica\Core\PConfig;
7 use Friendica\Model\Profile;
9 $uid = Profile::getThemeUid();
11 $style = PConfig::get($uid, 'vier', 'style');
14 $style = Config::get('vier', 'style');
24 foreach (['style', $style] as $file) {
25 $stylecssfile = $THEMEPATH . DIRECTORY_SEPARATOR . $file .'.css';
26 if (file_exists($stylecssfile)) {
27 $stylecss .= file_get_contents($stylecssfile);
28 $stylemodified = filemtime($stylecssfile);
29 if ($stylemodified > $modified) {
30 $modified = $stylemodified;
33 //TODO: use LOGGER_ERROR?
34 logger('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')');
37 $modified = gmdate('r', $modified);
39 $etag = md5($stylecss);
41 // Only send the CSS file if it was changed
42 header('Cache-Control: public');
43 header('ETag: "'.$etag.'"');
44 header('Last-Modified: '.$modified);
46 if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
47 $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']));
48 $cached_etag = str_replace(['"', "-gzip"], ['', ''],
49 stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
51 if (($cached_modified == $modified) && ($cached_etag == $etag)) {
52 header('HTTP/1.1 304 Not Modified');