3 * @copyright Copyright (C) 2010-2023, 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;
26 function theme_content(App $a)
28 if (!DI::userSession()->getLocalUserId()) {
32 $colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
35 return clean_form($a, $colorset, $user);
38 function theme_post(App $a)
40 if (!DI::userSession()->getLocalUserId()) {
44 if (isset($_POST['duepuntozero-settings-submit'])) {
45 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
49 function theme_admin(App $a)
51 $colorset = DI::config()->get('duepuntozero', 'colorset');
54 return clean_form($a, $colorset, $user);
57 function theme_admin_post(App $a)
59 if (isset($_POST['duepuntozero-settings-submit'])) {
60 DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
64 /// @TODO $a is no longer used
65 function clean_form(App $a, &$colorset, $user)
68 'default' => DI::l10n()->t('default'),
69 'greenzero' => DI::l10n()->t('greenzero'),
70 'purplezero' => DI::l10n()->t('purplezero'),
71 'easterbunny' => DI::l10n()->t('easterbunny'),
72 'darkzero' => DI::l10n()->t('darkzero'),
73 'comix' => DI::l10n()->t('comix'),
74 'slackr' => DI::l10n()->t('slackr'),
78 $color = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
80 $color = DI::config()->get('duepuntozero', 'colorset');
83 $t = Renderer::getMarkupTemplate("theme_settings.tpl");
84 $o = Renderer::replaceMacros($t, [
85 '$submit' => DI::l10n()->t('Submit'),
86 '$title' => DI::l10n()->t("Theme settings"),
87 '$colorset' => ['duepuntozero_colorset', DI::l10n()->t('Variations'), $color, '', $colorset],