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