]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/config.php
Merge branch 'ac'
[friendica.git] / view / theme / diabook / 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         $font_size = get_pconfig(local_user(), 'diabook', 'font_size' );
13         $line_height = get_pconfig(local_user(), 'diabook', 'line_height' );
14         $resolution = get_pconfig(local_user(), 'diabook', 'resolution' );
15         $color = get_pconfig(local_user(), 'diabook', 'color' );
16         $TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm' );
17         $ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
18         $ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
19         $ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
20         
21         return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY);
22 }
23
24 function theme_post(&$a){
25         if(! local_user())
26                 return;
27         
28         if (isset($_POST['diabook-settings-submit'])){
29                 set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
30                 set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
31                 set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
32                 set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']); 
33                 set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);     
34                 set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);       
35                 set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);       
36                 set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);       
37         }
38 }
39
40
41 function theme_admin(&$a){
42         $font_size = get_config('diabook', 'font_size' );
43         $line_height = get_config('diabook', 'line_height' );
44         $resolution = get_config('diabook', 'resolution' );
45         $color = get_config('diabook', 'color' );       
46         $TSearchTerm = get_config('diabook', 'TSearchTerm' );   
47         $ELZoom = get_config('diabook', 'ELZoom' );
48         $ELPosX = get_config('diabook', 'ELPosX' );
49         $ELPosY = get_config('diabook', 'ELPosY' );
50         
51         return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY);
52 }
53
54 function theme_admin_post(&$a){
55         if (isset($_POST['diabook-settings-submit'])){
56                 set_config('diabook', 'font_size', $_POST['diabook_font_size']);
57                 set_config('diabook', 'line_height', $_POST['diabook_line_height']);
58                 set_config('diabook', 'resolution', $_POST['diabook_resolution']);
59                 set_config('diabook', 'color', $_POST['diabook_color']);
60                 set_config('diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
61                 set_config('diabook', 'ELZoom', $_POST['diabook_ELZoom']);
62                 set_config('diabook', 'ELPosX', $_POST['diabook_ELPosX']);
63                 set_config('diabook', 'ELPosY', $_POST['diabook_ELPosY']);
64         }
65 }
66
67
68 function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY){
69         $line_heights = array(
70                 "1.3"=>"1.3",
71                 "---"=>"---",
72                 "1.6"=>"1.6",                           
73                 "1.5"=>"1.5",           
74                 "1.4"=>"1.4",
75                 "1.2"=>"1.2",
76                 "1.1"=>"1.1",
77         );
78         
79         $font_sizes = array(
80                 '14'=>'14',
81                 "---"=>"---",
82                 "16"=>"16",             
83                 "15"=>"15",
84                 '13.5'=>'13.5',
85                 '13'=>'13',             
86                 '12.5'=>'12.5',
87                 '12'=>'12',
88                 );
89         $resolutions = array(
90                 'normal'=>'normal',
91                 'wide'=>'wide',         
92                 );
93         $colors = array(
94                 'diabook'=>'diabook',
95                 'aerith'=>'aerith',             
96                 'blue'=>'blue',         
97                 'green'=>'green',
98                 'pink'=>'pink', 
99                 'red'=>'red',
100                 'dark'=>'dark',                                         
101                 );
102         
103         
104         
105         $t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
106         $o .= replace_macros($t, array(
107                 '$submit' => t('Submit'),
108                 '$baseurl' => $a->get_baseurl(),
109                 '$title' => t("Theme settings"),
110                 '$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
111                 '$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
112                 '$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
113                 '$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors), 
114                 '$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm),   
115                 '$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),        
116                 '$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX),     
117                 '$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY),      
118         ));
119         return $o;
120 }