friendica-github/src/Module/Theme.php

37 lines
866 B
PHP
Raw Normal View History

2019-05-18 21:23:12 +02:00
<?php
2024-08-24 15:27:00 +02:00
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2019-05-18 21:23:12 +02:00
namespace Friendica\Module;
use Friendica\BaseModule;
2022-05-18 02:13:54 +00:00
use Friendica\Core\System;
2019-05-18 21:23:12 +02:00
use Friendica\Util\Strings;
/**
* load view/theme/$current_theme/style.php with friendica context
*/
class Theme extends BaseModule
{
protected function rawContent(array $request = [])
2019-05-18 21:23:12 +02:00
{
2020-08-19 22:54:12 -04:00
header('Content-Type: text/css');
2019-05-18 21:23:12 +02:00
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
2019-05-18 21:23:12 +02:00
2020-08-19 22:54:12 -04:00
if (file_exists("view/theme/$theme/theme.php")) {
require_once "view/theme/$theme/theme.php";
}
2019-05-18 21:23:12 +02:00
2020-08-19 22:54:12 -04:00
// set the path for later use in the theme styles
$THEMEPATH = "view/theme/$theme";
2020-08-19 22:54:12 -04:00
if (file_exists("view/theme/$theme/style.php")) {
require_once "view/theme/$theme/style.php";
2019-05-18 21:23:12 +02:00
}
2022-05-18 02:13:54 +00:00
System::exit();
2019-05-18 21:23:12 +02:00
}
}