3 * @copyright Copyright (C) 2010-2022, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 use Friendica\Core\Renderer;
24 use Friendica\Core\Session;
27 function theme_content(App $a)
29 if (!Session::getLocalUser()) {
33 $colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
36 return clean_form($a, $colorset, $user);
39 function theme_post(App $a)
41 if (! Session::getLocalUser()) {
45 if (isset($_POST['duepuntozero-settings-submit'])) {
46 DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
50 function theme_admin(App $a)
52 $colorset = DI::config()->get('duepuntozero', 'colorset');
55 return clean_form($a, $colorset, $user);
58 function theme_admin_post(App $a)
60 if (isset($_POST['duepuntozero-settings-submit'])) {
61 DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
65 /// @TODO $a is no longer used
66 function clean_form(App $a, &$colorset, $user)
69 'default' => DI::l10n()->t('default'),
70 'greenzero' => DI::l10n()->t('greenzero'),
71 'purplezero' => DI::l10n()->t('purplezero'),
72 'easterbunny' => DI::l10n()->t('easterbunny'),
73 'darkzero' => DI::l10n()->t('darkzero'),
74 'comix' => DI::l10n()->t('comix'),
75 'slackr' => DI::l10n()->t('slackr'),
79 $color = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
81 $color = DI::config()->get('duepuntozero', 'colorset');
84 $t = Renderer::getMarkupTemplate("theme_settings.tpl");
85 $o = Renderer::replaceMacros($t, [
86 '$submit' => DI::l10n()->t('Submit'),
87 '$title' => DI::l10n()->t("Theme settings"),
88 '$colorset' => ['duepuntozero_colorset', DI::l10n()->t('Variations'), $color, '', $colorset],