X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Fvier%2Fstyle.php;h=74975893ce8ac6d17a288a2562d94ee58f6cfdad;hb=59268c600cc93591006b7f0f0e9de3a0344e7d4f;hp=8a7c2f67d11d610499b43d536871a963f49d66ec;hpb=409d9df4af3eabbef587873c6c225605b0ff3b95;p=friendica.git diff --git a/view/theme/vier/style.php b/view/theme/vier/style.php index 8a7c2f67d1..74975893ce 100644 --- a/view/theme/vier/style.php +++ b/view/theme/vier/style.php @@ -1,22 +1,38 @@ . + * */ -use Friendica\Core\Logger; -use Friendica\Core\Config; -use Friendica\Core\PConfig; -use Friendica\Model\Profile; -$uid = $_REQUEST['puid'] ?? 0; +use Friendica\Core\Logger; +use Friendica\DI; +use Friendica\Network\HTTPException\NotModifiedException; -$style = PConfig::get($uid, 'vier', 'style'); +/* + * This script can be included when the maintenance mode is on, which requires us to avoid any config call and + * use the following hardcoded default + */ +$style = 'plus'; -if (empty($style)) { - $style = Config::get('vier', 'style'); -} +if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) { + $uid = $_REQUEST['puid'] ?? 0; -if (empty($style)) { - $style = "plus"; + $style = DI::pConfig()->get($uid, 'vier', 'style', DI::config()->get('vier', 'style', $style)); } $stylecss = ''; @@ -33,8 +49,7 @@ foreach (['style', $style] as $file) { $modified = $stylemodified; } } else { - //TODO: use Logger::ERROR? - Logger::log('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')'); + Logger::warning('Missing CSS file', ['file' => $stylecssfile, 'uid' => $uid]); } } $modified = gmdate('r', $modified); @@ -46,14 +61,13 @@ header('Cache-Control: public'); header('ETag: "'.$etag.'"'); header('Last-Modified: '.$modified); -if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { +if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])); $cached_etag = str_replace(['"', "-gzip"], ['', ''], stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); if (($cached_modified == $modified) && ($cached_etag == $etag)) { - header('HTTP/1.1 304 Not Modified'); - exit(); + throw new NotModifiedException(); } } echo $stylecss;