]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/config.php
f8209bb872b1c302597c6263989b1c7f3a3d10b9
[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     $colorset = get_pconfig( local_user(), 'duepuntozero', 'colorset');
13     $user = true;
14
15     return clean_form($a, $colorset, $user);
16 }
17
18 function theme_post(&$a){
19     if(! local_user())
20         return;
21     
22     if (isset($_POST['duepuntozero-settings-submit'])){
23         set_pconfig(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
24     }
25 }
26
27
28 function theme_admin(&$a){
29     $colorset = get_config( 'duepuntozero', 'colorset');
30     $user = false;
31
32     return clean_form($a, $colorset, $user);
33 }
34
35 function theme_admin_post(&$a){
36     if (isset($_POST['duepuntozero-settings-submit'])){
37         set_config('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
38     }
39 }
40
41
42 function clean_form(&$a, &$colorset, $user){
43     $colorset = array(
44         'default'=>t('default'), 
45         'greenzero'=>t('greenzero'),
46     );
47     if ($user) {
48         $color = get_pconfig(local_user(), 'duepuntozero', 'colorset');
49     } else {
50         $color = get_config( 'duepuntozero', 'colorset');
51     }
52     $t = get_markup_template("theme_settings.tpl" );
53     $o .= replace_macros($t, array(
54         '$submit' => t('Submit'),
55         '$baseurl' => $a->get_baseurl(),
56         '$title' => t("Theme settings"),
57         '$colorset' => array('duepuntozero_colorset', t('Color scheme'), $color, '', $colorset),
58     ));
59     return $o;
60 }