]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/config.php
55703474900bde34162288b7abf100611b18780e
[friendica.git] / view / theme / duepuntozero / config.php
1 <?php
2
3 /**
4  * Theme settings
5  */
6
7 use Friendica\App;
8 use Friendica\Core\System;
9
10 function theme_content(App $a) {
11         if (!local_user()) {
12                 return;
13         }
14
15         $colorset = get_pconfig( local_user(), 'duepuntozero', 'colorset');
16         $user = true;
17
18         return clean_form($a, $colorset, $user);
19 }
20
21 function theme_post(App $a) {
22         if (! local_user()) {
23                 return;
24         }
25
26         if (isset($_POST['duepuntozero-settings-submit'])){
27                 set_pconfig(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
28         }
29 }
30
31 function theme_admin(App $a) {
32         $colorset = get_config( 'duepuntozero', 'colorset');
33         $user = false;
34
35         return clean_form($a, $colorset, $user);
36 }
37
38 function theme_admin_post(App $a) {
39         if (isset($_POST['duepuntozero-settings-submit'])){
40                 set_config('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
41         }
42 }
43
44 /// @TODO $a is no longer used
45 function clean_form(App $a, &$colorset, $user) {
46         $colorset = array(
47                 'default'     =>t('default'),
48                 'greenzero'   =>t('greenzero'),
49                 'purplezero'  =>t('purplezero'),
50                 'easterbunny' =>t('easterbunny'),
51                 'darkzero'    =>t('darkzero'),
52                 'comix'       =>t('comix'),
53                 'slackr'      =>t('slackr'),
54         );
55
56         if ($user) {
57                 $color = get_pconfig(local_user(), 'duepuntozero', 'colorset');
58         } else {
59                 $color = get_config( 'duepuntozero', 'colorset');
60         }
61
62         $t = get_markup_template("theme_settings.tpl" );
63         /// @TODO No need for adding string here, $o is not defined
64         $o .= replace_macros($t, array(
65                 '$submit'   => t('Submit'),
66                 '$baseurl'  => System::baseUrl(),
67                 '$title'    => t("Theme settings"),
68                 '$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset),
69         ));
70
71         return $o;
72 }