X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Fquattro%2Fconfig.php;h=5af58a18da612ac9aa98dcec19628c408e7805ce;hb=b4bad926579c7804bed5935d45e03ef300a10b0f;hp=c9ab3a4a149f461293ff717804bfaa1075827c42;hpb=aace55df0ad279d74c5e612078c3f29d114389dc;p=friendica.git diff --git a/view/theme/quattro/config.php b/view/theme/quattro/config.php index c9ab3a4a14..5af58a18da 100644 --- a/view/theme/quattro/config.php +++ b/view/theme/quattro/config.php @@ -3,37 +3,74 @@ * Theme settings */ +function theme_content(App $a) { + if (!local_user()) { + return; + } - -function theme_content(&$a){ - if(!local_user()) - return; - $align = get_pconfig(local_user(), 'quattro', 'align' ); $color = get_pconfig(local_user(), 'quattro', 'color' ); - $colors = array( - "dark"=>"Quattro", - "green"=>"Green" - ); - - $t = file_get_contents( dirname(__file__). "/theme_settings.tpl" ); - $o .= replace_macros($t, array( - '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(), - '$title' => t("Theme settings"), - '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))), - '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors), - )); - return $o; + $tfs = get_pconfig(local_user(),"quattro","tfs"); + $pfs = get_pconfig(local_user(),"quattro","pfs"); + + return quattro_form($a,$align, $color, $tfs, $pfs); } -function theme_post(&$a){ - if(! local_user()) +function theme_post(App $a) { + if (! local_user()) { return; - + } + if (isset($_POST['quattro-settings-submit'])){ set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']); set_pconfig(local_user(), 'quattro', 'color', $_POST['quattro_color']); + set_pconfig(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']); + set_pconfig(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']); + } +} + +function theme_admin(App $a) { + $align = get_config('quattro', 'align' ); + $color = get_config('quattro', 'color' ); + $tfs = get_config("quattro","tfs"); + $pfs = get_config("quattro","pfs"); + + return quattro_form($a,$align, $color, $tfs, $pfs); +} + +function theme_admin_post(App $a) { + if (isset($_POST['quattro-settings-submit'])){ + set_config('quattro', 'align', $_POST['quattro_align']); + set_config('quattro', 'color', $_POST['quattro_color']); + set_config('quattro', 'tfs', $_POST['quattro_tfs']); + set_config('quattro', 'pfs', $_POST['quattro_pfs']); } } +/// @TODO $a is no longer used here +function quattro_form(App $a, $align, $color, $tfs, $pfs) { + $colors = array( + "dark" => "Quattro", + "lilac" => "Lilac", + "green" => "Green", + ); + + if ($tfs === false) { + $tfs = "20"; + } + if ($pfs === false) { + $pfs = "12"; + } + + $t = get_markup_template("theme_settings.tpl" ); + $o .= replace_macros($t, array( + '$submit' => t('Submit'), + '$baseurl' => App::get_baseurl(), + '$title' => t("Theme settings"), + '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))), + '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors), + '$pfs' => array('quattro_pfs', t('Posts font size'), $pfs), + '$tfs' => array('quattro_tfs',t('Textareas font size'), $tfs), + )); + return $o; +}