]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/config.php
6e5aca1badd2c65029a4bd7f144929023d777faa
[friendica.git] / view / theme / frio / config.php
1 <?php
2
3 use Friendica\App;
4 use Friendica\Core\System;
5
6 require_once('view/theme/frio/php/Image.php');
7
8 function theme_content(App $a) {
9         if (!local_user()) {
10                 return;
11         }
12         $arr = array();
13
14         $arr["schema"]          = get_pconfig(local_user(),'frio', 'schema');
15         $arr["nav_bg"]          = get_pconfig(local_user(),'frio', 'nav_bg' );
16         $arr["nav_icon_color"]  = get_pconfig(local_user(),'frio', 'nav_icon_color' );
17         $arr["link_color"]      = get_pconfig(local_user(),'frio', 'link_color' );
18         $arr["bgcolor"]         = get_pconfig(local_user(),'frio', 'background_color' );
19         $arr["contentbg_transp"] = get_pconfig(local_user(),'frio', 'contentbg_transp' );
20         $arr["background_image"] = get_pconfig(local_user(),'frio', 'background_image' );
21         $arr["bg_image_option"] = get_pconfig(local_user(),'frio', 'bg_image_option' );
22
23         return frio_form($arr);
24 }
25
26 function theme_post(App $a) {
27         if (!local_user()) {
28                 return;
29         }
30
31         if (isset($_POST['frio-settings-submit'])) {
32                 set_pconfig(local_user(), 'frio', 'schema',             $_POST["frio_schema"]);
33                 set_pconfig(local_user(), 'frio', 'nav_bg',             $_POST["frio_nav_bg"]);
34                 set_pconfig(local_user(), 'frio', 'nav_icon_color',     $_POST["frio_nav_icon_color"]);
35                 set_pconfig(local_user(), 'frio', 'link_color',         $_POST["frio_link_color"]);
36                 set_pconfig(local_user(), 'frio', 'background_color',   $_POST["frio_background_color"]);
37                 set_pconfig(local_user(), 'frio', 'contentbg_transp',   $_POST["frio_contentbg_transp"]);
38                 set_pconfig(local_user(), 'frio', 'background_image',   $_POST["frio_background_image"]);
39                 set_pconfig(local_user(), 'frio', 'bg_image_option',    $_POST["frio_bg_image_option"]);
40         }
41 }
42
43 function frio_form($arr) {
44         require_once("view/theme/frio/php/schema.php");
45
46         $scheme_info = get_schema_info($arr["schema"]);
47         $disable = $scheme_info["overwrites"];
48         if (!is_array($disable)) $disable = array();
49
50         $scheme_choices = array();
51         $scheme_choices["---"] = t("Default");
52         $files = glob('view/theme/frio/schema/*.php');
53         if($files) {
54                 foreach($files as $file) {
55                         $f = basename($file, ".php");
56                         if($f != 'default') {
57                                 $scheme_name = $f;
58                                 $scheme_choices[$f] = $scheme_name;
59                         }
60                 }
61         }
62
63         $background_image_help = "<strong>" . t("Note: "). "</strong>".t("Check image permissions if all users are allowed to visit the image");
64
65
66         $t = get_markup_template('theme_settings.tpl');
67         $o .= replace_macros($t, array(
68                 '$submit'               => t('Submit'),
69                 '$baseurl'              => System::baseUrl(),
70                 '$title'                => t("Theme settings"),
71                 '$schema'               => array('frio_schema',         t("Select scheme"),                     $arr["schema"], '', $scheme_choices),
72                 '$nav_bg'               => array_key_exists("nav_bg", $disable) ? "" : array('frio_nav_bg',             t('Navigation bar background color'),   $arr['nav_bg']),
73                 '$nav_icon_color'       => array_key_exists("nav_icon_color", $disable) ? "" : array('frio_nav_icon_color', t('Navigation bar icon color '),    $arr['nav_icon_color']),
74                 '$link_color'           => array_key_exists("link_color", $disable) ? "" : array('frio_link_color',     t('Link color'),                        $arr['link_color'],             '', $link_colors),
75                 '$bgcolor'              => array_key_exists("bgcolor", $disable) ? "" : array('frio_background_color', t('Set the background color'),   $arr['bgcolor']),
76                 '$contentbg_transp'     => array_key_exists("contentbg_transp", $disable) ? "" : array('frio_contentbg_transp', t("Content background transparency"), ($arr["contentbg_transp"] ? $arr["contentbg_transp"] : 0 )),
77                 '$background_image'     => array_key_exists("background_image", $disable ) ? "" : array('frio_background_image', t('Set the background image'), $arr['background_image'], $background_image_help),
78                 '$bg_image_options'     => Image::get_options($arr),
79         ));
80
81         return $o;
82 }