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