4 use Friendica\Core\Config;
5 use Friendica\Core\L10n;
6 use Friendica\Core\PConfig;
7 use Friendica\Core\System;
9 require_once 'view/theme/frio/php/Image.php';
11 function theme_post(App $a)
17 if (isset($_POST['frio-settings-submit'])) {
18 PConfig::set(local_user(), 'frio', 'scheme', $_POST['frio_scheme']);
19 PConfig::set(local_user(), 'frio', 'nav_bg', $_POST['frio_nav_bg']);
20 PConfig::set(local_user(), 'frio', 'nav_icon_color', $_POST['frio_nav_icon_color']);
21 PConfig::set(local_user(), 'frio', 'link_color', $_POST['frio_link_color']);
22 PConfig::set(local_user(), 'frio', 'background_color', $_POST['frio_background_color']);
23 PConfig::set(local_user(), 'frio', 'contentbg_transp', $_POST['frio_contentbg_transp']);
24 PConfig::set(local_user(), 'frio', 'background_image', $_POST['frio_background_image']);
25 PConfig::set(local_user(), 'frio', 'bg_image_option', $_POST['frio_bg_image_option']);
26 PConfig::set(local_user(), 'frio', 'css_modified', time());
30 function theme_admin_post(App $a)
36 if (isset($_POST['frio-settings-submit'])) {
37 Config::set('frio', 'scheme', $_POST['frio_scheme']);
38 Config::set('frio', 'nav_bg', $_POST['frio_nav_bg']);
39 Config::set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color']);
40 Config::set('frio', 'link_color', $_POST['frio_link_color']);
41 Config::set('frio', 'background_color', $_POST['frio_background_color']);
42 Config::set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp']);
43 Config::set('frio', 'background_image', $_POST['frio_background_image']);
44 Config::set('frio', 'bg_image_option', $_POST['frio_bg_image_option']);
45 Config::set('frio', 'login_bg_image', $_POST['frio_login_bg_image']);
46 Config::set('frio', 'login_bg_color', $_POST['frio_login_bg_color']);
47 Config::set('frio', 'css_modified', time());
51 function theme_content(App $a)
58 $arr['scheme'] = PConfig::get(local_user(), 'frio', 'scheme');
59 $arr['nav_bg'] = PConfig::get(local_user(), 'frio', 'nav_bg');
60 $arr['nav_icon_color'] = PConfig::get(local_user(), 'frio', 'nav_icon_color');
61 $arr['link_color'] = PConfig::get(local_user(), 'frio', 'link_color');
62 $arr['bgcolor'] = PConfig::get(local_user(), 'frio', 'background_color');
63 $arr['contentbg_transp'] = PConfig::get(local_user(), 'frio', 'contentbg_transp');
64 $arr['background_image'] = PConfig::get(local_user(), 'frio', 'background_image');
65 $arr['bg_image_option'] = PConfig::get(local_user(), 'frio', 'bg_image_option');
67 return frio_form($arr);
70 function theme_admin(App $a)
77 $arr['scheme'] = Config::get('frio', 'scheme');
78 $arr['nav_bg'] = Config::get('frio', 'nav_bg');
79 $arr['nav_icon_color'] = Config::get('frio', 'nav_icon_color');
80 $arr['link_color'] = Config::get('frio', 'link_color');
81 $arr['bgcolor'] = Config::get('frio', 'background_color');
82 $arr['contentbg_transp'] = Config::get('frio', 'contentbg_transp');
83 $arr['background_image'] = Config::get('frio', 'background_image');
84 $arr['bg_image_option'] = Config::get('frio', 'bg_image_option');
85 $arr['login_bg_image'] = Config::get('frio', 'login_bg_image');
86 $arr['login_bg_color'] = Config::get('frio', 'login_bg_color');
88 return frio_form($arr);
91 function frio_form($arr)
93 require_once 'view/theme/frio/php/scheme.php';
95 $scheme_info = get_scheme_info($arr['scheme']);
96 $disable = $scheme_info['overwrites'];
97 if (!is_array($disable)) {
101 $scheme_choices = [];
102 $scheme_choices['---'] = L10n::t('Default');
103 $files = glob('view/theme/frio/scheme/*.php');
105 foreach ($files as $file) {
106 $f = basename($file, '.php');
107 if ($f != 'default') {
109 $scheme_choices[$f] = $scheme_name;
114 $background_image_help = '<strong>' . L10n::t('Note') . ': </strong>' . L10n::t('Check image permissions if all users are allowed to visit the image');
116 $t = get_markup_template('theme_settings.tpl');
118 '$submit' => L10n::t('Submit'),
119 '$baseurl' => System::baseUrl(),
120 '$title' => L10n::t('Theme settings'),
121 '$scheme' => ['frio_scheme', L10n::t('Select scheme'), $arr['scheme'], '', $scheme_choices],
122 '$nav_bg' => array_key_exists('nav_bg', $disable) ? '' : ['frio_nav_bg', L10n::t('Navigation bar background color'), $arr['nav_bg'], '', false],
123 '$nav_icon_color' => array_key_exists('nav_icon_color', $disable) ? '' : ['frio_nav_icon_color', L10n::t('Navigation bar icon color '), $arr['nav_icon_color'], '', false],
124 '$link_color' => array_key_exists('link_color', $disable) ? '' : ['frio_link_color', L10n::t('Link color'), $arr['link_color'], '', false],
125 '$bgcolor' => array_key_exists('bgcolor', $disable) ? '' : ['frio_background_color', L10n::t('Set the background color'), $arr['bgcolor'], '', false],
126 '$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), ((isset($arr['contentbg_transp']) && $arr['contentbg_transp'] != '') ? $arr['contentbg_transp'] : 100), ''],
127 '$background_image' => array_key_exists('background_image', $disable) ? '' : ['frio_background_image', L10n::t('Set the background image'), $arr['background_image'], $background_image_help, false],
128 '$bg_image_options' => Image::get_options($arr),
131 if (array_key_exists('login_bg_image', $arr) && !array_key_exists('login_bg_image', $disable)) {
132 $ctx['$login_bg_image'] = ['frio_login_bg_image', L10n::t('Login page background image'), $arr['login_bg_image'], $background_image_help, false];
135 if (array_key_exists('login_bg_color', $arr) && !array_key_exists('login_bg_color', $disable)) {
136 $ctx['$login_bg_color'] = ['frio_login_bg_color', L10n::t('Login page background color'), $arr['login_bg_color'], L10n::t('Leave background image and color empty for theme defaults'), false];
139 $o = replace_macros($t, $ctx);