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