]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/config.php
Merge https://github.com/friendica/friendica into pull
[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         $close_pages = get_pconfig(local_user(), 'diabook', 'close_pages' );
21         $close_mapquery = get_pconfig(local_user(), 'diabook', 'close_mapquery' );
22         $close_profiles = get_pconfig(local_user(), 'diabook', 'close_profiles' );
23         $close_helpers = get_pconfig(local_user(), 'diabook', 'close_helpers' );
24         $close_services = get_pconfig(local_user(), 'diabook', 'close_services' );
25         $close_friends = get_pconfig(local_user(), 'diabook', 'close_friends' );
26         $close_twitter = get_pconfig(local_user(), 'diabook', 'close_twitter' );
27         $close_lastusers = get_pconfig(local_user(), 'diabook', 'close_lastusers' );
28         $close_lastphotos = get_pconfig(local_user(), 'diabook', 'close_lastphotos' );
29         $close_lastlikes = get_pconfig(local_user(), 'diabook', 'close_lastlikes' );
30         
31         
32         return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes);
33 }
34
35 function theme_post(&$a){
36         if(! local_user())
37                 return;
38         
39         if (isset($_POST['diabook-settings-submit'])){
40                 set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
41                 set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
42                 set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
43                 set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']); 
44                 set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);     
45                 set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);       
46                 set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);       
47                 set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);       
48                 set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
49                 set_pconfig(local_user(), 'diabook', 'close_pages', $_POST['diabook_close_pages']);
50                 set_pconfig(local_user(), 'diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
51                 set_pconfig(local_user(), 'diabook', 'close_profiles', $_POST['diabook_close_profiles']);
52                 set_pconfig(local_user(), 'diabook', 'close_helpers', $_POST['diabook_close_helpers']);
53                 set_pconfig(local_user(), 'diabook', 'close_services', $_POST['diabook_close_services']);
54                 set_pconfig(local_user(), 'diabook', 'close_friends', $_POST['diabook_close_friends']);
55                 set_pconfig(local_user(), 'diabook', 'close_twitter', $_POST['diabook_close_twitter']);
56                 set_pconfig(local_user(), 'diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
57                 set_pconfig(local_user(), 'diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
58                 set_pconfig(local_user(), 'diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
59                         
60         }
61 }
62
63
64 function theme_admin(&$a){
65         $font_size = get_config('diabook', 'font_size' );
66         $line_height = get_config('diabook', 'line_height' );
67         $resolution = get_config('diabook', 'resolution' );
68         $color = get_config('diabook', 'color' );       
69         $TSearchTerm = get_config('diabook', 'TSearchTerm' );   
70         $ELZoom = get_config('diabook', 'ELZoom' );
71         $ELPosX = get_config('diabook', 'ELPosX' );
72         $ELPosY = get_config('diabook', 'ELPosY' );
73         $close_pages = get_config('diabook', 'close_pages' );
74         $close_mapquery = get_config('diabook', 'close_mapquery' );
75         $close_profiles = get_config('diabook', 'close_profiles' );
76         $close_helpers = get_config('diabook', 'close_helpers' );
77         $close_services = get_config('diabook', 'close_services' );
78         $close_friends = get_config('diabook', 'close_friends' );
79         $close_twitter = get_config('diabook', 'close_twitter' );
80         $close_lastusers = get_config('diabook', 'close_lastusers' );
81         $close_lastphotos = get_config('diabook', 'close_lastphotos' );
82         $close_lastlikes = get_config('diabook', 'close_lastlikes' );
83         
84         return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes);
85 }
86
87 function theme_admin_post(&$a){
88         if (isset($_POST['diabook-settings-submit'])){
89                 set_config('diabook', 'font_size', $_POST['diabook_font_size']);
90                 set_config('diabook', 'line_height', $_POST['diabook_line_height']);
91                 set_config('diabook', 'resolution', $_POST['diabook_resolution']);
92                 set_config('diabook', 'color', $_POST['diabook_color']);
93                 set_config('diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
94                 set_config('diabook', 'ELZoom', $_POST['diabook_ELZoom']);
95                 set_config('diabook', 'ELPosX', $_POST['diabook_ELPosX']);
96                 set_config('diabook', 'close_pages', $_POST['diabook_close_pages']);
97                 set_config('diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
98                 set_config('diabook', 'close_profiles', $_POST['diabook_close_profiles']);
99                 set_config('diabook', 'close_helpers', $_POST['diabook_close_helpers']);
100                 set_config('diabook', 'close_services', $_POST['diabook_close_services']);
101                 set_config('diabook', 'close_friends', $_POST['diabook_close_friends']);
102                 set_config('diabook', 'close_twitter', $_POST['diabook_close_twitter']);
103                 set_config('diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
104                 set_config('diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
105                 set_config('diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
106                 
107         }
108 }
109
110
111 function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes){
112         $line_heights = array(
113                 "1.3"=>"1.3",
114                 "---"=>"---",
115                 "1.6"=>"1.6",                           
116                 "1.5"=>"1.5",           
117                 "1.4"=>"1.4",
118                 "1.2"=>"1.2",
119                 "1.1"=>"1.1",
120         );
121         
122         $font_sizes = array(
123                 '14'=>'14',
124                 "---"=>"---",
125                 "16"=>"16",             
126                 "15"=>"15",
127                 '13.5'=>'13.5',
128                 '13'=>'13',             
129                 '12.5'=>'12.5',
130                 '12'=>'12',
131                 );
132         $resolutions = array(
133                 'normal'=>'normal',
134                 'wide'=>'wide',         
135                 );
136         $colors = array(
137                 'diabook'=>'diabook',
138                 'aerith'=>'aerith',             
139                 'blue'=>'blue',         
140                 'green'=>'green',
141                 'pink'=>'pink', 
142                 'red'=>'red',
143                 'dark'=>'dark',                                         
144                 );
145         $close_pagesC = array(
146                 '0'=>'show',    
147                 '1'=>'hide',                                                    
148                 );
149         $close_mapqueryC = array(
150                 '0'=>'show',    
151                 '1'=>'hide',                                                                    
152                 );
153         $close_profilesC = array(
154                 '0'=>'show',    
155                 '1'=>'hide',                                                            
156                 );
157         $close_helpersC = array(
158            '0'=>'show', 
159                 '1'=>'hide',                                                                    
160                 );
161         $close_servicesC = array(
162                 '0'=>'show',    
163                 '1'=>'hide',                                                    
164                 );
165         $close_friendsC = array(
166                 '0'=>'show',    
167                 '1'=>'hide',                                                            
168                 );
169         $close_twitterC = array(
170                 '0'=>'show',    
171                 '1'=>'hide',                                                            
172                 );
173         $close_lastusersC = array(
174                 '0'=>'show',    
175                 '1'=>'hide',                                                                    
176                 );
177         $close_lastphotosC = array(
178                 '0'=>'show',    
179                 '1'=>'hide',                                                            
180                 );
181         $close_lastlikesC = array(
182                 '0'=>'show',    
183                 '1'=>'hide',                                                            
184                 );
185                 
186         
187         
188         $t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
189         $o .= replace_macros($t, array(
190                 '$submit' => t('Submit'),
191                 '$baseurl' => $a->get_baseurl(),
192                 '$title' => t("Theme settings"),
193                 '$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
194                 '$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
195                 '$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
196                 '$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors), 
197                 '$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm),   
198                 '$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),        
199                 '$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layers'), $ELPosX, '', $ELPosX),    
200                 '$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layers'), $ELPosY, '', $ELPosY),     
201                 '$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC),  
202                 '$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC),         
203                 '$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_profilesC),           
204                 '$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_helpersC),               
205                 '$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_servicesC),                     
206                 '$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_friendsC),                             
207                 '$close_twitter' => array('diabook_close_twitter', t('Last tweets'), $close_twitter, '', $close_twitterC),                              
208                 '$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_lastusersC),                               
209                 '$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_lastphotosC),                          
210                 '$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_lastlikesC),                               
211         ));
212         return $o;
213 }