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