mirror of
https://github.com/friendica/friendica
synced 2024-11-18 06:23:41 +00:00
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
10 changed files with 177 additions and 141 deletions
|
@ -705,7 +705,8 @@ class App
|
|||
// Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner
|
||||
$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);
|
||||
} else {
|
||||
// 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");
|
||||
}
|
||||
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
|
||||
$s_colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||
$colorset = DI::pConfig()->get($uid, 'duepuntozero', 'colorset');
|
||||
|
||||
if (empty($colorset)) {
|
||||
$colorset = $s_colorset;
|
||||
/*
|
||||
* 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');
|
||||
$colorset = DI::pConfig()->get($_REQUEST['puid'] ?? 0, 'duepuntozero', 'colorset', $s_colorset);
|
||||
}
|
||||
|
||||
$setcss = '';
|
||||
|
|
|
@ -23,26 +23,35 @@ use Friendica\App;
|
|||
use Friendica\Core\Renderer;
|
||||
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) {
|
||||
|
||||
Renderer::setActiveTemplateEngine('smarty3');
|
||||
Renderer::setActiveTemplateEngine('smarty3');
|
||||
|
||||
$colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
|
||||
$colorset = null;
|
||||
|
||||
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||
$colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
|
||||
if (!$colorset)
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
}
|
||||
|
||||
if ($colorset) {
|
||||
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";
|
||||
if ($colorset == 'purplezero')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n";
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />' . "\n";
|
||||
if ($colorset == 'easterbunny')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />' . "\n";
|
||||
if ($colorset == 'darkzero')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n";
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />' . "\n";
|
||||
if ($colorset == 'comix')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />' . "\n";
|
||||
if ($colorset == 'slackr')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />' . "\n";
|
||||
}
|
||||
DI::page()['htmlhead'] .= <<< EOT
|
||||
<script>
|
||||
|
|
|
@ -31,30 +31,43 @@ $schemecss = '';
|
|||
$schemecssfile = false;
|
||||
$scheme_modified = 0;
|
||||
|
||||
DI::config()->load('frio');
|
||||
/*
|
||||
* 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();
|
||||
|
||||
// Default to hard-coded values for empty settings
|
||||
$scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
|
||||
$scheme_accent = DI::config()->get('frio', 'scheme_accent') ?: FRIO_SCHEME_ACCENT_BLUE;
|
||||
$nav_bg = DI::config()->get('frio', 'nav_bg') ?: '#708fa0';
|
||||
$nav_icon_color = DI::config()->get('frio', 'nav_icon_color') ?: '#ffffff';
|
||||
$link_color = DI::config()->get('frio', 'link_color') ?: '#6fdbe8';
|
||||
$background_color = DI::config()->get('frio', 'background_color') ?: '#ededed';
|
||||
$contentbg_transp = DI::config()->get('frio', 'contentbg_transp') ?? 100;
|
||||
$background_image = DI::config()->get('frio', 'background_image') ?: 'img/none.png';
|
||||
$bg_image_option = DI::config()->get('frio', 'bg_image_option') ?: '';
|
||||
$login_bg_image = DI::config()->get('frio', 'login_bg_image') ?: '';
|
||||
$login_bg_color = DI::config()->get('frio', 'login_bg_color') ?: '';
|
||||
$modified = DI::config()->get('frio', 'css_modified') ?: time();
|
||||
if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
|
||||
DI::config()->load('frio');
|
||||
|
||||
if (!$login_bg_image && !$login_bg_color) {
|
||||
$login_bg_image = 'img/login_bg.jpg';
|
||||
}
|
||||
$login_bg_color = $login_bg_color ?: '#ededed';
|
||||
// Default to hard-coded values for empty settings
|
||||
$scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
|
||||
$scheme_accent = DI::config()->get('frio', 'scheme_accent') ?: $scheme_accent;
|
||||
$nav_bg = DI::config()->get('frio', 'nav_bg') ?: $nav_bg;
|
||||
$nav_icon_color = DI::config()->get('frio', 'nav_icon_color') ?: $nav_icon_color;
|
||||
$link_color = DI::config()->get('frio', 'link_color') ?: $link_color;
|
||||
$background_color = DI::config()->get('frio', 'background_color') ?: $background_color;
|
||||
$contentbg_transp = DI::config()->get('frio', 'contentbg_transp') ?? $contentbg_transp;
|
||||
$background_image = DI::config()->get('frio', 'background_image') ?: $background_image;
|
||||
$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;
|
||||
$login_bg_color = DI::config()->get('frio', 'login_bg_color') ?: $login_bg_color;
|
||||
$modified = DI::config()->get('frio', 'css_modified') ?: $modified;
|
||||
|
||||
// Get the UID of the profile owner.
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
if ($uid) {
|
||||
// Get the UID of the profile owner.
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
if ($uid) {
|
||||
DI::pConfig()->load($uid, 'frio');
|
||||
|
||||
// Only override display settings that have actually been set
|
||||
|
@ -68,8 +81,14 @@ if ($uid) {
|
|||
$background_image = DI::pConfig()->get($uid, 'frio', 'background_image') ?: $background_image;
|
||||
$bg_image_option = DI::pConfig()->get($uid, 'frio', 'bg_image_option') ?: $bg_image_option;
|
||||
$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
|
||||
// If not, we'll keep those defined by the scheme
|
||||
// Setting $scheme to '' wasn't working for some reason, so we'll check it's
|
||||
|
@ -81,7 +100,7 @@ if (!empty($_REQUEST['scheme'])) {
|
|||
|
||||
$scheme = Strings::sanitizeFilePathItem($scheme ?? '');
|
||||
|
||||
if (($scheme) && ($scheme != '---')) {
|
||||
if ($scheme && ($scheme != '---')) {
|
||||
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
|
||||
$schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
|
||||
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.
|
||||
// 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_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)
|
||||
{
|
||||
global $frio;
|
||||
|
@ -191,7 +195,8 @@ function frio_contact_photo_menu(App $a, &$args)
|
|||
*/
|
||||
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();
|
||||
if (!$homelink) {
|
||||
$homelink = Session::get('visitor_home', '');
|
||||
|
@ -236,6 +241,7 @@ function frio_remote_nav(App $a, array &$nav_info)
|
|||
$nav_info['nav']['contacts'] = [$server_url . '/contact', DI::l10n()->t('Contacts'), '', DI::l10n()->t('Manage/edit friends and contacts')];
|
||||
$nav_info['nav']['sitename'] = DI::config()->get('config', 'sitename');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function frio_display_item(App $a, &$arr)
|
||||
|
|
|
@ -21,24 +21,27 @@
|
|||
|
||||
use Friendica\DI;
|
||||
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
|
||||
$color = false;
|
||||
/*
|
||||
* 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;
|
||||
$site_color = DI::config()->get("quattro", "color", "dark");
|
||||
$site_quattro_align = DI::config()->get("quattro", "align", false);
|
||||
$textarea_font_size = '20';
|
||||
$post_font_size = '12';
|
||||
|
||||
if ($uid) {
|
||||
$color = DI::pConfig()->get($uid, "quattro", "color", false);
|
||||
$quattro_align = DI::pConfig()->get($uid, 'quattro', 'align', false);
|
||||
}
|
||||
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);
|
||||
|
||||
if ($color === false) {
|
||||
$color = $site_color;
|
||||
}
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
|
||||
if ($quattro_align === false) {
|
||||
$quattro_align = $site_quattro_align;
|
||||
$color = DI::pConfig()->get($uid, "quattro", "color", $site_color);
|
||||
$quattro_align = DI::pConfig()->get($uid, 'quattro', 'align', $site_quattro_align);
|
||||
$textarea_font_size = DI::pConfig()->get($uid, "quattro", "tfs", $site_textarea_font_size);
|
||||
$post_font_size = DI::pConfig()->get($uid, "quattro", "pfs", $site_post_font_size);
|
||||
}
|
||||
|
||||
$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 "
|
||||
textarea { 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\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) {
|
||||
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>';;
|
||||
|
|
|
@ -14,6 +14,10 @@ use Friendica\App;
|
|||
use Friendica\Core\Renderer;
|
||||
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) {
|
||||
Renderer::setActiveTemplateEngine('smarty3');
|
||||
|
||||
|
|
|
@ -23,16 +23,16 @@ use Friendica\Core\Logger;
|
|||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
|
||||
$uid = $_REQUEST['puid'] ?? 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 default
|
||||
*/
|
||||
$style = 'plus';
|
||||
|
||||
$style = DI::pConfig()->get($uid, 'vier', 'style');
|
||||
if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
|
||||
if (empty($style)) {
|
||||
$style = DI::config()->get('vier', 'style');
|
||||
}
|
||||
|
||||
if (empty($style)) {
|
||||
$style = "plus";
|
||||
$style = DI::pConfig()->get($uid, 'vier', 'style', DI::config()->get('vier', 'style', $style));
|
||||
}
|
||||
|
||||
$stylecss = '';
|
||||
|
|
|
@ -19,6 +19,10 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
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)
|
||||
{
|
||||
$a->setThemeInfoValue('events_in_profile', false);
|
||||
|
@ -27,7 +31,12 @@ function vier_init(App $a)
|
|||
|
||||
$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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue