Enable the view module in maintenance mode
- This allows to load the default theme CSS - Theme scripts have been updated to reflect the possibility they will be included in maintenance mode
This commit is contained in:
parent
ac56dcd50f
commit
1d94e2866a
|
@ -705,7 +705,8 @@ class App
|
||||||
// Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner
|
// Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner
|
||||||
$page['page_title'] = $moduleName;
|
$page['page_title'] = $moduleName;
|
||||||
|
|
||||||
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
|
// The "view" module is required to show the theme CSS
|
||||||
|
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'view') {
|
||||||
$module = $router->getModule(Maintenance::class);
|
$module = $router->getModule(Maintenance::class);
|
||||||
} else {
|
} else {
|
||||||
// determine the module class and save it to the module instance
|
// determine the module class and save it to the module instance
|
||||||
|
|
|
@ -25,13 +25,12 @@ if (file_exists("$THEMEPATH/style.css")) {
|
||||||
echo file_get_contents("$THEMEPATH/style.css");
|
echo file_get_contents("$THEMEPATH/style.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = $_REQUEST['puid'] ?? 0;
|
/*
|
||||||
|
* This script can be included when the maintenance mode is on, which requires us to avoid any config call
|
||||||
|
*/
|
||||||
|
if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
|
||||||
$s_colorset = DI::config()->get('duepuntozero', 'colorset');
|
$s_colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||||
$colorset = DI::pConfig()->get($uid, 'duepuntozero', 'colorset');
|
$colorset = DI::pConfig()->get($_REQUEST['puid'] ?? 0, 'duepuntozero', 'colorset', $s_colorset);
|
||||||
|
|
||||||
if (empty($colorset)) {
|
|
||||||
$colorset = $s_colorset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$setcss = '';
|
$setcss = '';
|
||||||
|
|
|
@ -23,13 +23,22 @@ use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
|
||||||
|
*/
|
||||||
|
|
||||||
function duepuntozero_init(App $a) {
|
function duepuntozero_init(App $a) {
|
||||||
|
|
||||||
Renderer::setActiveTemplateEngine('smarty3');
|
Renderer::setActiveTemplateEngine('smarty3');
|
||||||
|
|
||||||
|
$colorset = null;
|
||||||
|
|
||||||
|
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||||
$colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
$colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
||||||
if (!$colorset)
|
if (!$colorset)
|
||||||
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||||
|
}
|
||||||
|
|
||||||
if ($colorset) {
|
if ($colorset) {
|
||||||
if ($colorset == 'greenzero')
|
if ($colorset == 'greenzero')
|
||||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />' . "\n";
|
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />' . "\n";
|
||||||
|
|
|
@ -31,26 +31,39 @@ $schemecss = '';
|
||||||
$schemecssfile = false;
|
$schemecssfile = false;
|
||||||
$scheme_modified = 0;
|
$scheme_modified = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included when the maintenance mode is on, which requires us to avoid any config call and
|
||||||
|
* use the following hardcoded defaults
|
||||||
|
*/
|
||||||
|
$scheme = null;
|
||||||
|
$scheme_accent = FRIO_SCHEME_ACCENT_BLUE;
|
||||||
|
$nav_bg = '#708fa0';
|
||||||
|
$nav_icon_color = '#ffffff';
|
||||||
|
$link_color = '#6fdbe8';
|
||||||
|
$background_color = '#ededed';
|
||||||
|
$contentbg_transp = 100;
|
||||||
|
$background_image = 'img/none.png';
|
||||||
|
$bg_image_option = '';
|
||||||
|
$login_bg_image = '';
|
||||||
|
$login_bg_color = '';
|
||||||
|
$modified = time();
|
||||||
|
|
||||||
|
if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
|
||||||
DI::config()->load('frio');
|
DI::config()->load('frio');
|
||||||
|
|
||||||
// Default to hard-coded values for empty settings
|
// Default to hard-coded values for empty settings
|
||||||
$scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
|
$scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
|
||||||
$scheme_accent = DI::config()->get('frio', 'scheme_accent') ?: FRIO_SCHEME_ACCENT_BLUE;
|
$scheme_accent = DI::config()->get('frio', 'scheme_accent') ?: $scheme_accent;
|
||||||
$nav_bg = DI::config()->get('frio', 'nav_bg') ?: '#708fa0';
|
$nav_bg = DI::config()->get('frio', 'nav_bg') ?: $nav_bg;
|
||||||
$nav_icon_color = DI::config()->get('frio', 'nav_icon_color') ?: '#ffffff';
|
$nav_icon_color = DI::config()->get('frio', 'nav_icon_color') ?: $nav_icon_color;
|
||||||
$link_color = DI::config()->get('frio', 'link_color') ?: '#6fdbe8';
|
$link_color = DI::config()->get('frio', 'link_color') ?: $link_color;
|
||||||
$background_color = DI::config()->get('frio', 'background_color') ?: '#ededed';
|
$background_color = DI::config()->get('frio', 'background_color') ?: $background_color;
|
||||||
$contentbg_transp = DI::config()->get('frio', 'contentbg_transp') ?? 100;
|
$contentbg_transp = DI::config()->get('frio', 'contentbg_transp') ?? $contentbg_transp;
|
||||||
$background_image = DI::config()->get('frio', 'background_image') ?: 'img/none.png';
|
$background_image = DI::config()->get('frio', 'background_image') ?: $background_image;
|
||||||
$bg_image_option = DI::config()->get('frio', 'bg_image_option') ?: '';
|
$bg_image_option = DI::config()->get('frio', 'bg_image_option') ?: $bg_image_option;
|
||||||
$login_bg_image = DI::config()->get('frio', 'login_bg_image') ?: '';
|
$login_bg_image = DI::config()->get('frio', 'login_bg_image') ?: $login_bg_image;
|
||||||
$login_bg_color = DI::config()->get('frio', 'login_bg_color') ?: '';
|
$login_bg_color = DI::config()->get('frio', 'login_bg_color') ?: $login_bg_color;
|
||||||
$modified = DI::config()->get('frio', 'css_modified') ?: time();
|
$modified = DI::config()->get('frio', 'css_modified') ?: $modified;
|
||||||
|
|
||||||
if (!$login_bg_image && !$login_bg_color) {
|
|
||||||
$login_bg_image = 'img/login_bg.jpg';
|
|
||||||
}
|
|
||||||
$login_bg_color = $login_bg_color ?: '#ededed';
|
|
||||||
|
|
||||||
// Get the UID of the profile owner.
|
// Get the UID of the profile owner.
|
||||||
$uid = $_REQUEST['puid'] ?? 0;
|
$uid = $_REQUEST['puid'] ?? 0;
|
||||||
|
@ -69,6 +82,12 @@ if ($uid) {
|
||||||
$bg_image_option = DI::pConfig()->get($uid, 'frio', 'bg_image_option') ?: $bg_image_option;
|
$bg_image_option = DI::pConfig()->get($uid, 'frio', 'bg_image_option') ?: $bg_image_option;
|
||||||
$modified = DI::pConfig()->get($uid, 'frio', 'css_modified') ?: $modified;
|
$modified = DI::pConfig()->get($uid, 'frio', 'css_modified') ?: $modified;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$login_bg_image && !$login_bg_color) {
|
||||||
|
$login_bg_image = 'img/login_bg.jpg';
|
||||||
|
}
|
||||||
|
$login_bg_color = $login_bg_color ?: '#ededed';
|
||||||
|
|
||||||
// Now load the scheme. If a value is changed above, we'll keep the settings
|
// Now load the scheme. If a value is changed above, we'll keep the settings
|
||||||
// If not, we'll keep those defined by the scheme
|
// If not, we'll keep those defined by the scheme
|
||||||
|
@ -81,7 +100,7 @@ if (!empty($_REQUEST['scheme'])) {
|
||||||
|
|
||||||
$scheme = Strings::sanitizeFilePathItem($scheme ?? '');
|
$scheme = Strings::sanitizeFilePathItem($scheme ?? '');
|
||||||
|
|
||||||
if (($scheme) && ($scheme != '---')) {
|
if ($scheme && ($scheme != '---')) {
|
||||||
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
|
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
|
||||||
$schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
|
$schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
|
||||||
require_once $schemefile;
|
require_once $schemefile;
|
||||||
|
@ -104,7 +123,7 @@ if (!$scheme) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$contentbg_transp = ((isset($contentbg_transp) && $contentbg_transp != '') ? $contentbg_transp : 100);
|
$contentbg_transp = $contentbg_transp ?? 0 ?: 100;
|
||||||
|
|
||||||
// Calculate some colors in dependance of existing colors.
|
// Calculate some colors in dependance of existing colors.
|
||||||
// Some colors are calculated to don't have too many selection
|
// Some colors are calculated to don't have too many selection
|
||||||
|
|
|
@ -27,6 +27,10 @@ const FRIO_SCHEME_ACCENT_PURPLE = '#a54bad';
|
||||||
const FRIO_SCHEME_ACCENT_GREEN = '#218f39';
|
const FRIO_SCHEME_ACCENT_GREEN = '#218f39';
|
||||||
const FRIO_SCHEME_ACCENT_PINK = '#d900a9';
|
const FRIO_SCHEME_ACCENT_PINK = '#d900a9';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
|
||||||
|
*/
|
||||||
|
|
||||||
function frio_init(App $a)
|
function frio_init(App $a)
|
||||||
{
|
{
|
||||||
global $frio;
|
global $frio;
|
||||||
|
@ -191,7 +195,8 @@ function frio_contact_photo_menu(App $a, &$args)
|
||||||
*/
|
*/
|
||||||
function frio_remote_nav(App $a, array &$nav_info)
|
function frio_remote_nav(App $a, array &$nav_info)
|
||||||
{
|
{
|
||||||
// get the homelink from $_XSESSION
|
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||||
|
// get the homelink from $_SESSION
|
||||||
$homelink = Model\Profile::getMyURL();
|
$homelink = Model\Profile::getMyURL();
|
||||||
if (!$homelink) {
|
if (!$homelink) {
|
||||||
$homelink = Session::get('visitor_home', '');
|
$homelink = Session::get('visitor_home', '');
|
||||||
|
@ -237,6 +242,7 @@ function frio_remote_nav(App $a, array &$nav_info)
|
||||||
$nav_info['nav']['sitename'] = DI::config()->get('config', 'sitename');
|
$nav_info['nav']['sitename'] = DI::config()->get('config', 'sitename');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function frio_display_item(App $a, &$arr)
|
function frio_display_item(App $a, &$arr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,24 +21,27 @@
|
||||||
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included when the maintenance mode is on, which requires us to avoid any config call and
|
||||||
|
* use the following hardcoded defaults
|
||||||
|
*/
|
||||||
|
$color = 'dark';
|
||||||
|
$quattro_align = false;
|
||||||
|
$textarea_font_size = '20';
|
||||||
|
$post_font_size = '12';
|
||||||
|
|
||||||
|
if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
|
||||||
|
$site_color = DI::config()->get("quattro", "color", $color);
|
||||||
|
$site_quattro_align = DI::config()->get("quattro", "align", $quattro_align);
|
||||||
|
$site_textarea_font_size = DI::config()->get("quattro", "tfs", $textarea_font_size);
|
||||||
|
$site_post_font_size = DI::config()->get("quattro", "pfs", $post_font_size);
|
||||||
|
|
||||||
$uid = $_REQUEST['puid'] ?? 0;
|
$uid = $_REQUEST['puid'] ?? 0;
|
||||||
|
|
||||||
$color = false;
|
$color = DI::pConfig()->get($uid, "quattro", "color", $site_color);
|
||||||
$quattro_align = false;
|
$quattro_align = DI::pConfig()->get($uid, 'quattro', 'align', $site_quattro_align);
|
||||||
$site_color = DI::config()->get("quattro", "color", "dark");
|
$textarea_font_size = DI::pConfig()->get($uid, "quattro", "tfs", $site_textarea_font_size);
|
||||||
$site_quattro_align = DI::config()->get("quattro", "align", false);
|
$post_font_size = DI::pConfig()->get($uid, "quattro", "pfs", $site_post_font_size);
|
||||||
|
|
||||||
if ($uid) {
|
|
||||||
$color = DI::pConfig()->get($uid, "quattro", "color", false);
|
|
||||||
$quattro_align = DI::pConfig()->get($uid, 'quattro', 'align', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($color === false) {
|
|
||||||
$color = $site_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($quattro_align === false) {
|
|
||||||
$quattro_align = $site_quattro_align;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = \Friendica\Util\Strings::sanitizeFilePathItem($color);
|
$color = \Friendica\Util\Strings::sanitizeFilePathItem($color);
|
||||||
|
@ -59,24 +62,6 @@ if ($quattro_align == "center") {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$textarea_font_size = false;
|
|
||||||
$post_font_size = false;
|
|
||||||
|
|
||||||
$site_textarea_font_size = DI::config()->get("quattro", "tfs", "20");
|
|
||||||
$site_post_font_size = DI::config()->get("quattro", "pfs", "12");
|
|
||||||
|
|
||||||
if ($uid) {
|
|
||||||
$textarea_font_size = DI::pConfig()->get($uid, "quattro", "tfs", false);
|
|
||||||
$post_font_size = DI::pConfig()->get($uid, "quattro", "pfs", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($textarea_font_size === false) {
|
|
||||||
$textarea_font_size = $site_textarea_font_size;
|
|
||||||
}
|
|
||||||
if ($post_font_size === false) {
|
|
||||||
$post_font_size = $site_post_font_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
textarea { font-size: ${textarea_font_size}px; }
|
textarea { font-size: ${textarea_font_size}px; }
|
||||||
.wall-item-comment-wrapper .comment-edit-text-full { font-size: ${textarea_font_size}px; }
|
.wall-item-comment-wrapper .comment-edit-text-full { font-size: ${textarea_font_size}px; }
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
|
||||||
|
*/
|
||||||
|
|
||||||
function quattro_init(App $a) {
|
function quattro_init(App $a) {
|
||||||
DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>';
|
DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>';
|
||||||
DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';;
|
DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';;
|
||||||
|
|
|
@ -14,6 +14,10 @@ use Friendica\App;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
|
||||||
|
*/
|
||||||
|
|
||||||
function smoothly_init(App $a) {
|
function smoothly_init(App $a) {
|
||||||
Renderer::setActiveTemplateEngine('smarty3');
|
Renderer::setActiveTemplateEngine('smarty3');
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,16 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPException\NotModifiedException;
|
use Friendica\Network\HTTPException\NotModifiedException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
|
||||||
$uid = $_REQUEST['puid'] ?? 0;
|
$uid = $_REQUEST['puid'] ?? 0;
|
||||||
|
|
||||||
$style = DI::pConfig()->get($uid, 'vier', 'style');
|
$style = DI::pConfig()->get($uid, 'vier', 'style', DI::config()->get('vier', 'style', $style));
|
||||||
|
|
||||||
if (empty($style)) {
|
|
||||||
$style = DI::config()->get('vier', 'style');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($style)) {
|
|
||||||
$style = "plus";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$stylecss = '';
|
$stylecss = '';
|
||||||
|
|
|
@ -19,6 +19,10 @@ use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
|
||||||
|
*/
|
||||||
|
|
||||||
function vier_init(App $a)
|
function vier_init(App $a)
|
||||||
{
|
{
|
||||||
$a->setThemeInfoValue('events_in_profile', false);
|
$a->setThemeInfoValue('events_in_profile', false);
|
||||||
|
@ -27,7 +31,12 @@ function vier_init(App $a)
|
||||||
|
|
||||||
$args = DI::args();
|
$args = DI::args();
|
||||||
|
|
||||||
if ($args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '') || $args->get(0) === 'network' && local_user()
|
if (
|
||||||
|
DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
|
||||||
|
&& (
|
||||||
|
$args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
|
||||||
|
|| $args->get(0) === 'network' && local_user()
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
vier_community_info();
|
vier_community_info();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user