<?php
/**
- * Theme settings
+ * @copyright Copyright (C) 2010-2022, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
*/
use Friendica\App;
-use Friendica\Core\Config;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
-use Friendica\Core\System;
+use Friendica\Core\Session;
+use Friendica\DI;
require_once __DIR__ . '/theme.php';
function theme_content(App $a)
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
return;
}
- $style = PConfig::get(local_user(), 'vier', 'style');
+ $style = DI::pConfig()->get(Session::getLocalUser(), 'vier', 'style');
if ($style == "") {
- $style = Config::get('vier', 'style');
+ $style = DI::config()->get('vier', 'style');
}
if ($style == "") {
function theme_post(App $a)
{
- if (! local_user()) {
+ if (! Session::getLocalUser()) {
return;
}
if (isset($_POST['vier-settings-submit'])) {
- PConfig::set(local_user(), 'vier', 'style', $_POST['vier_style']);
- PConfig::set(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
- PConfig::set(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
- PConfig::set(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
- PConfig::set(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
- PConfig::set(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
- PConfig::set(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'style', $_POST['vier_style']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_pages', $_POST['vier_show_pages']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_services', $_POST['vier_show_services']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_friends', $_POST['vier_show_friends']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
}
}
if (!function_exists('get_vier_config'))
return;
- $style = Config::get('vier', 'style');
+ $style = DI::config()->get('vier', 'style');
- $helperlist = Config::get('vier', 'helperlist');
+ $helperlist = DI::config()->get('vier', 'helperlist');
if ($helperlist == "")
$helperlist = "https://forum.friendi.ca/profile/helpers";
$t = Renderer::getMarkupTemplate("theme_admin_settings.tpl");
$o = Renderer::replaceMacros($t, [
- '$helperlist' => ['vier_helperlist', L10n::t('Comma separated list of helper forums'), $helperlist, '', ''],
+ '$helperlist' => ['vier_helperlist', DI::l10n()->t('Comma separated list of helper forums'), $helperlist, '', ''],
]);
$show_pages = get_vier_config('show_pages', true, true);
function theme_admin_post(App $a) {
if (isset($_POST['vier-settings-submit'])){
- Config::set('vier', 'style', $_POST['vier_style']);
- Config::set('vier', 'show_pages', $_POST['vier_show_pages']);
- Config::set('vier', 'show_profiles', $_POST['vier_show_profiles']);
- Config::set('vier', 'show_helpers', $_POST['vier_show_helpers']);
- Config::set('vier', 'show_services', $_POST['vier_show_services']);
- Config::set('vier', 'show_friends', $_POST['vier_show_friends']);
- Config::set('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
- Config::set('vier', 'helperlist', $_POST['vier_helperlist']);
+ DI::config()->set('vier', 'style', $_POST['vier_style']);
+ DI::config()->set('vier', 'show_pages', $_POST['vier_show_pages']);
+ DI::config()->set('vier', 'show_profiles', $_POST['vier_show_profiles']);
+ DI::config()->set('vier', 'show_helpers', $_POST['vier_show_helpers']);
+ DI::config()->set('vier', 'show_services', $_POST['vier_show_services']);
+ DI::config()->set('vier', 'show_friends', $_POST['vier_show_friends']);
+ DI::config()->set('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
+ DI::config()->set('vier', 'helperlist', $_POST['vier_helperlist']);
}
}
"shadow"=>"Shadow"
];
- $show_or_not = ['0' => L10n::t("don't show"), '1' => L10n::t("show"),];
+ $show_or_not = ['0' => DI::l10n()->t("don't show"), '1' => DI::l10n()->t("show"),];
$t = Renderer::getMarkupTemplate("theme_settings.tpl");
$o = Renderer::replaceMacros($t, [
- '$submit' => L10n::t('Submit'),
- '$title' => L10n::t("Theme settings"),
- '$style' => ['vier_style', L10n::t('Set style'), $style, '', $styles],
- '$show_pages' => ['vier_show_pages', L10n::t('Community Pages'), $show_pages, '', $show_or_not],
- '$show_profiles' => ['vier_show_profiles', L10n::t('Community Profiles'), $show_profiles, '', $show_or_not],
- '$show_helpers' => ['vier_show_helpers', L10n::t('Help or @NewHere ?'), $show_helpers, '', $show_or_not],
- '$show_services' => ['vier_show_services', L10n::t('Connect Services'), $show_services, '', $show_or_not],
- '$show_friends' => ['vier_show_friends', L10n::t('Find Friends'), $show_friends, '', $show_or_not],
- '$show_lastusers' => ['vier_show_lastusers', L10n::t('Last users'), $show_lastusers, '', $show_or_not]
+ '$submit' => DI::l10n()->t('Submit'),
+ '$title' => DI::l10n()->t("Theme settings"),
+ '$style' => ['vier_style', DI::l10n()->t('Set style'), $style, '', $styles],
+ '$show_pages' => ['vier_show_pages', DI::l10n()->t('Community Pages'), $show_pages, '', $show_or_not],
+ '$show_profiles' => ['vier_show_profiles', DI::l10n()->t('Community Profiles'), $show_profiles, '', $show_or_not],
+ '$show_helpers' => ['vier_show_helpers', DI::l10n()->t('Help or @NewHere ?'), $show_helpers, '', $show_or_not],
+ '$show_services' => ['vier_show_services', DI::l10n()->t('Connect Services'), $show_services, '', $show_or_not],
+ '$show_friends' => ['vier_show_friends', DI::l10n()->t('Find Friends'), $show_friends, '', $show_or_not],
+ '$show_lastusers' => ['vier_show_lastusers', DI::l10n()->t('Last users'), $show_lastusers, '', $show_or_not]
]);
return $o;
}