friendica_2021-01/config.php
2016-03-28 16:29:05 +02:00

66 lines
2.8 KiB
PHP

<?php
require_once('view/theme/frio/php/Image.php');
function theme_content(&$a) {
if(!local_user()) { return;}
$arr = array();
$arr["schema"] = get_pconfig(local_user(),'frio', 'schema');
$arr["nav_bg"] = get_pconfig(local_user(),'frio', 'nav_bg' );
$arr["nav_icon_color"] = get_pconfig(local_user(),'frio', 'nav_icon_color' );
$arr["link_color"] = get_pconfig(local_user(),'frio', 'link_color' );
$arr["bgcolor"] = get_pconfig(local_user(),'frio', 'background_color' );
$arr["contentbg_transp"] = get_pconfig(local_user(),'frio', 'contentbg_transp' );
$arr["background_image"] = get_pconfig(local_user(),'frio', 'background_image' );
$arr["bg_image_option"] = get_pconfig(local_user(),'frio', 'bg_image_option' );
return frio_form($a, $arr);
}
function theme_post(&$a) {
if(!local_user()) { return;}
if (isset($_POST['frio-settings-submit'])) {
set_pconfig(local_user(), 'frio', 'schema', $_POST["frio_schema"]);
set_pconfig(local_user(), 'frio', 'nav_bg', $_POST["frio_nav_bg"]);
set_pconfig(local_user(), 'frio', 'nav_icon_color', $_POST["frio_nav_icon_color"]);
set_pconfig(local_user(), 'frio', 'link_color', $_POST["frio_link_color"]);
set_pconfig(local_user(), 'frio', 'background_color', $_POST["frio_background_color"]);
set_pconfig(local_user(), 'frio', 'contentbg_transp', $_POST["frio_contentbg_transp"]);
set_pconfig(local_user(), 'frio', 'background_image', $_POST["frio_background_image"]);
set_pconfig(local_user(), 'frio', 'bg_image_option', $_POST["frio_bg_image_option"]);
}
}
function frio_form(&$a, $arr) {
$scheme_choices = array();
$scheme_choices["---"] = t("Default");
$files = glob('view/theme/frio/schema/*.php');
if($files) {
foreach($files as $file) {
$f = basename($file, ".php");
if($f != 'default') {
$scheme_name = $f;
$scheme_choices[$f] = $scheme_name;
}
}
}
$t = get_markup_template('theme_settings.tpl');
$o .= replace_macros($t, array(
'$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(),
'$title' => t("Theme settings"),
'$schema' => array('frio_schema', t("Select scheme"), $arr["schema"], '', $scheme_choices),
'$nav_bg' => array('frio_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
'$nav_icon_color' => array('frio_nav_icon_color', t('Navigation bar icon color '), $arr['nav_icon_color']),
'$link_color' => array('frio_link_color', t('Link color'), $arr['link_color'], '', $link_colors),
'$bgcolor' => array('frio_background_color', t('Set the background color'), $arr['bgcolor']),
'$contentbg_transp' => array('frio_contentbg_transp', t("Content background transparency"), ($arr["contentbg_transp"] ? $arr["contentbg_transp"] : 0 )),
'$background_image' => array('frio_background_image', t('Set the background image'), $arr['background_image']),
'$bg_image_options' => Image::get_options($arr),
));
return $o;
}