2012-03-30 15:45:23 +02:00
|
|
|
<?php
|
2017-04-30 06:01:26 +02:00
|
|
|
|
2012-03-30 15:45:23 +02:00
|
|
|
/**
|
|
|
|
* Theme settings
|
|
|
|
*/
|
|
|
|
|
2017-04-30 06:07:00 +02:00
|
|
|
use Friendica\App;
|
2017-08-26 08:04:21 +02:00
|
|
|
use Friendica\Core\System;
|
2017-04-30 06:07:00 +02:00
|
|
|
|
2017-01-09 13:06:08 +01:00
|
|
|
function theme_content(App $a) {
|
2016-12-20 11:56:34 +01:00
|
|
|
if (!local_user()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-30 15:45:23 +02:00
|
|
|
$align = get_pconfig(local_user(), 'quattro', 'align' );
|
2012-03-30 21:21:14 +02:00
|
|
|
$color = get_pconfig(local_user(), 'quattro', 'color' );
|
2016-12-20 11:56:34 +01:00
|
|
|
$tfs = get_pconfig(local_user(),"quattro","tfs");
|
|
|
|
$pfs = get_pconfig(local_user(),"quattro","pfs");
|
|
|
|
|
2012-10-01 14:58:05 +02:00
|
|
|
return quattro_form($a,$align, $color, $tfs, $pfs);
|
2012-04-13 11:21:15 +02:00
|
|
|
}
|
|
|
|
|
2017-01-09 13:06:08 +01:00
|
|
|
function theme_post(App $a) {
|
2016-12-20 11:56:34 +01:00
|
|
|
if (! local_user()) {
|
2012-04-13 11:21:15 +02:00
|
|
|
return;
|
2016-12-20 11:56:34 +01:00
|
|
|
}
|
|
|
|
|
2012-04-13 11:21:15 +02:00
|
|
|
if (isset($_POST['quattro-settings-submit'])){
|
|
|
|
set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']);
|
|
|
|
set_pconfig(local_user(), 'quattro', 'color', $_POST['quattro_color']);
|
2012-10-01 14:58:05 +02:00
|
|
|
set_pconfig(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
|
|
|
|
set_pconfig(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
|
2012-04-13 11:21:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-09 13:06:08 +01:00
|
|
|
function theme_admin(App $a) {
|
2012-04-13 11:21:15 +02:00
|
|
|
$align = get_config('quattro', 'align' );
|
|
|
|
$color = get_config('quattro', 'color' );
|
2016-12-22 11:37:23 +01:00
|
|
|
$tfs = get_config("quattro","tfs");
|
2016-12-30 21:48:09 +01:00
|
|
|
$pfs = get_config("quattro","pfs");
|
2012-10-01 14:58:05 +02:00
|
|
|
|
|
|
|
return quattro_form($a,$align, $color, $tfs, $pfs);
|
2012-04-13 11:21:15 +02:00
|
|
|
}
|
|
|
|
|
2017-01-09 13:06:08 +01:00
|
|
|
function theme_admin_post(App $a) {
|
2012-04-13 11:21:15 +02:00
|
|
|
if (isset($_POST['quattro-settings-submit'])){
|
|
|
|
set_config('quattro', 'align', $_POST['quattro_align']);
|
|
|
|
set_config('quattro', 'color', $_POST['quattro_color']);
|
2016-12-22 11:37:23 +01:00
|
|
|
set_config('quattro', 'tfs', $_POST['quattro_tfs']);
|
2012-10-01 14:58:05 +02:00
|
|
|
set_config('quattro', 'pfs', $_POST['quattro_pfs']);
|
2012-04-13 11:21:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-19 14:26:13 +01:00
|
|
|
/// @TODO $a is no longer used here
|
2017-01-09 13:06:08 +01:00
|
|
|
function quattro_form(App $a, $align, $color, $tfs, $pfs) {
|
2012-03-30 21:21:14 +02:00
|
|
|
$colors = array(
|
2016-12-22 11:37:23 +01:00
|
|
|
"dark" => "Quattro",
|
|
|
|
"lilac" => "Lilac",
|
|
|
|
"green" => "Green",
|
2012-03-30 21:21:14 +02:00
|
|
|
);
|
2016-12-22 11:37:23 +01:00
|
|
|
|
|
|
|
if ($tfs === false) {
|
|
|
|
$tfs = "20";
|
|
|
|
}
|
|
|
|
if ($pfs === false) {
|
|
|
|
$pfs = "12";
|
|
|
|
}
|
|
|
|
|
2012-12-22 20:57:29 +01:00
|
|
|
$t = get_markup_template("theme_settings.tpl" );
|
2012-12-25 19:48:02 +01:00
|
|
|
$o .= replace_macros($t, array(
|
2016-12-22 11:37:23 +01:00
|
|
|
'$submit' => t('Submit'),
|
2017-08-26 09:32:10 +02:00
|
|
|
'$baseurl' => System::baseUrl(),
|
2016-12-22 11:37:23 +01:00
|
|
|
'$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),
|
2016-12-30 21:48:09 +01:00
|
|
|
'$pfs' => array('quattro_pfs', t('Posts font size'), $pfs),
|
2017-04-08 16:57:24 +02:00
|
|
|
'$tfs' => array('quattro_tfs', t('Textareas font size'), $tfs),
|
2012-03-30 15:45:23 +02:00
|
|
|
));
|
|
|
|
return $o;
|
|
|
|
}
|