]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/config.php
749a377fc66d3e650b04ca0c8506e127a42d6cfd
[friendica.git] / view / theme / duepuntozero / config.php
1 <?php
2 /**
3  * Theme settings
4  */
5
6
7
8 function theme_content(&$a){
9         if (!local_user()) {
10                 return;
11         }
12
13         $colorset = get_pconfig( local_user(), 'duepuntozero', 'colorset');
14         $user = true;
15
16         return clean_form($a, $colorset, $user);
17 }
18
19 function theme_post(&$a){
20
21         if (! local_user()) {
22                 return;
23         }
24
25         if (isset($_POST['duepuntozero-settings-submit'])){
26                 set_pconfig(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
27         }
28 }
29
30
31 function theme_admin(&$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(&$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(&$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'  => App::get_baseurl(),
67                 '$title'=> t("Theme settings"),
68                 '$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset),
69         ));
70
71         return $o;
72 }