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) {
27 if (!DI::userSession()->getLocalUserId()) {
31 $align = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'quattro', 'align' );
32 $color = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'quattro', 'color' );
33 $tfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","tfs");
34 $pfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","pfs");
36 return quattro_form($a,$align, $color, $tfs, $pfs);
39 function theme_post(App $a) {
40 if (!DI::userSession()->getLocalUserId()) {
44 if (isset($_POST['quattro-settings-submit'])){
45 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'align', $_POST['quattro_align']);
46 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'color', $_POST['quattro_color']);
47 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'tfs', $_POST['quattro_tfs']);
48 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'pfs', $_POST['quattro_pfs']);
52 function theme_admin(App $a) {
53 $align = DI::config()->get('quattro', 'align' );
54 $color = DI::config()->get('quattro', 'color' );
55 $tfs = DI::config()->get("quattro","tfs");
56 $pfs = DI::config()->get("quattro","pfs");
58 return quattro_form($a,$align, $color, $tfs, $pfs);
61 function theme_admin_post(App $a) {
62 if (isset($_POST['quattro-settings-submit'])){
63 DI::config()->set('quattro', 'align', $_POST['quattro_align']);
64 DI::config()->set('quattro', 'color', $_POST['quattro_color']);
65 DI::config()->set('quattro', 'tfs', $_POST['quattro_tfs']);
66 DI::config()->set('quattro', 'pfs', $_POST['quattro_pfs']);
70 /// @TODO $a is no longer used here
71 function quattro_form(App $a, $align, $color, $tfs, $pfs) {
85 $t = Renderer::getMarkupTemplate("theme_settings.tpl" );
86 $o = Renderer::replaceMacros($t, [
87 '$submit' => DI::l10n()->t('Submit'),
88 '$title' => DI::l10n()->t("Theme settings"),
89 '$align' => ['quattro_align', DI::l10n()->t('Alignment'), $align, '', ['left' => DI::l10n()->t('Left'), 'center' => DI::l10n()->t('Center')]],
90 '$color' => ['quattro_color', DI::l10n()->t('Color scheme'), $color, '', $colors],
91 '$pfs' => ['quattro_pfs', DI::l10n()->t('Posts font size'), $pfs],
92 '$tfs' => ['quattro_tfs', DI::l10n()->t('Textareas font size'), $tfs],