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