2014-02-23 09:57:27 -05:00
|
|
|
<?php
|
2017-04-30 00:07:00 -04:00
|
|
|
|
2014-02-23 09:57:27 -05:00
|
|
|
/**
|
|
|
|
* Theme settings
|
|
|
|
*/
|
|
|
|
|
2017-04-30 00:07:00 -04:00
|
|
|
use Friendica\App;
|
2017-08-26 02:04:21 -04:00
|
|
|
use Friendica\Core\System;
|
2014-02-23 09:57:27 -05: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()) {
|
2014-02-23 09:57:27 -05:00
|
|
|
return;
|
2016-12-20 05:56:34 -05:00
|
|
|
}
|
2014-02-23 09:57:27 -05:00
|
|
|
|
2016-12-20 05:56:34 -05:00
|
|
|
if (!function_exists('get_vier_config')) {
|
2015-10-05 11:38:57 -04:00
|
|
|
return;
|
2016-12-20 05:56:34 -05:00
|
|
|
}
|
2015-10-05 11:38:57 -04:00
|
|
|
|
2014-02-23 09:57:27 -05:00
|
|
|
$style = get_pconfig(local_user(), 'vier', 'style');
|
|
|
|
|
2016-12-20 05:56:34 -05:00
|
|
|
if ($style == "") {
|
2014-06-15 18:00:05 -04:00
|
|
|
$style = get_config('vier', 'style');
|
2016-12-20 05:56:34 -05:00
|
|
|
}
|
2014-06-15 18:00:05 -04:00
|
|
|
|
2016-12-20 05:56:34 -05:00
|
|
|
if ($style == "") {
|
2015-02-21 03:44:13 -05:00
|
|
|
$style = "plus";
|
2016-12-20 05:56:34 -05:00
|
|
|
}
|
2015-02-21 03:44:13 -05:00
|
|
|
|
2015-10-04 08:40:02 -04:00
|
|
|
$show_pages = get_vier_config('show_pages', true);
|
|
|
|
$show_profiles = get_vier_config('show_profiles', true);
|
|
|
|
$show_helpers = get_vier_config('show_helpers', true);
|
|
|
|
$show_services = get_vier_config('show_services', true);
|
|
|
|
$show_friends = get_vier_config('show_friends', true);
|
|
|
|
$show_lastusers = get_vier_config('show_lastusers', true);
|
2015-10-03 06:55:55 -04:00
|
|
|
|
|
|
|
return vier_form($a,$style, $show_pages, $show_profiles, $show_helpers,
|
|
|
|
$show_services, $show_friends, $show_lastusers);
|
2014-02-23 09:57:27 -05: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()) {
|
2014-02-23 09:57:27 -05:00
|
|
|
return;
|
2016-12-20 05:56:34 -05:00
|
|
|
}
|
2014-02-23 09:57:27 -05:00
|
|
|
|
|
|
|
if (isset($_POST['vier-settings-submit'])){
|
|
|
|
set_pconfig(local_user(), 'vier', 'style', $_POST['vier_style']);
|
2015-10-04 08:40:02 -04:00
|
|
|
set_pconfig(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
|
|
|
|
set_pconfig(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
|
|
|
|
set_pconfig(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
|
|
|
|
set_pconfig(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
|
|
|
|
set_pconfig(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
|
|
|
|
set_pconfig(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
|
2014-02-23 09:57:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-09 07:06:08 -05:00
|
|
|
function theme_admin(App $a) {
|
2015-10-05 11:38:57 -04:00
|
|
|
|
|
|
|
if (!function_exists('get_vier_config'))
|
|
|
|
return;
|
|
|
|
|
2014-02-23 09:57:27 -05:00
|
|
|
$style = get_config('vier', 'style');
|
2015-10-03 06:55:55 -04:00
|
|
|
|
|
|
|
$helperlist = get_config('vier', 'helperlist');
|
|
|
|
|
|
|
|
if ($helperlist == "")
|
|
|
|
$helperlist = "https://helpers.pyxis.uberspace.de/profile/helpers";
|
|
|
|
|
|
|
|
$t = get_markup_template("theme_admin_settings.tpl");
|
|
|
|
$o .= replace_macros($t, array(
|
|
|
|
'$helperlist' => array('vier_helperlist', t('Comma separated list of helper forums'), $helperlist, '', ''),
|
|
|
|
));
|
|
|
|
|
2015-10-04 08:40:02 -04:00
|
|
|
$show_pages = get_vier_config('show_pages', true, true);
|
|
|
|
$show_profiles = get_vier_config('show_profiles', true, true);
|
|
|
|
$show_helpers = get_vier_config('show_helpers', true, true);
|
|
|
|
$show_services = get_vier_config('show_services', true, true);
|
|
|
|
$show_friends = get_vier_config('show_friends', true, true);
|
|
|
|
$show_lastusers = get_vier_config('show_lastusers', true, true);
|
2015-10-03 06:55:55 -04:00
|
|
|
$o .= vier_form($a,$style, $show_pages, $show_profiles, $show_helpers, $show_services,
|
|
|
|
$show_friends, $show_lastusers);
|
|
|
|
|
|
|
|
return $o;
|
2014-02-23 09:57:27 -05:00
|
|
|
}
|
|
|
|
|
2017-01-09 07:06:08 -05:00
|
|
|
function theme_admin_post(App $a) {
|
2014-02-23 09:57:27 -05:00
|
|
|
if (isset($_POST['vier-settings-submit'])){
|
|
|
|
set_config('vier', 'style', $_POST['vier_style']);
|
2015-10-03 06:55:55 -04:00
|
|
|
set_config('vier', 'show_pages', $_POST['vier_show_pages']);
|
2015-10-04 08:40:02 -04:00
|
|
|
set_config('vier', 'show_profiles', $_POST['vier_show_profiles']);
|
|
|
|
set_config('vier', 'show_helpers', $_POST['vier_show_helpers']);
|
|
|
|
set_config('vier', 'show_services', $_POST['vier_show_services']);
|
|
|
|
set_config('vier', 'show_friends', $_POST['vier_show_friends']);
|
|
|
|
set_config('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
|
2015-10-03 06:55:55 -04:00
|
|
|
set_config('vier', 'helperlist', $_POST['vier_helperlist']);
|
2014-02-23 09:57:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-19 08:26:13 -05:00
|
|
|
/// @TODO $a is no longer used
|
2017-01-09 07:06:08 -05:00
|
|
|
function vier_form(App $a, $style, $show_pages, $show_profiles, $show_helpers, $show_services, $show_friends, $show_lastusers) {
|
2014-02-23 09:57:27 -05:00
|
|
|
$styles = array(
|
2015-02-21 03:44:13 -05:00
|
|
|
"plus"=>"Plus",
|
|
|
|
"breathe"=>"Breathe",
|
|
|
|
"dark"=>"Dark",
|
2014-02-23 09:57:27 -05:00
|
|
|
"shadow"=>"Shadow",
|
2014-06-14 18:19:38 -04:00
|
|
|
"netcolour"=>"Coloured Networks",
|
2015-02-21 03:44:13 -05:00
|
|
|
"flat"=>"Flat"
|
2014-02-23 09:57:27 -05:00
|
|
|
);
|
2015-10-03 06:55:55 -04:00
|
|
|
|
2015-10-04 08:40:02 -04:00
|
|
|
$show_or_not = array('0'=>t("don't show"), '1'=>t("show"),);
|
2015-10-03 06:55:55 -04:00
|
|
|
|
|
|
|
$t = get_markup_template("theme_settings.tpl");
|
2014-02-23 09:57:27 -05:00
|
|
|
$o .= replace_macros($t, array(
|
|
|
|
'$submit' => t('Submit'),
|
2017-08-26 03:32:10 -04:00
|
|
|
'$baseurl' => System::baseUrl(),
|
2014-02-23 09:57:27 -05:00
|
|
|
'$title' => t("Theme settings"),
|
|
|
|
'$style' => array('vier_style',t ('Set style'),$style,'',$styles),
|
2015-10-03 06:55:55 -04:00
|
|
|
'$show_pages' => array('vier_show_pages', t('Community Pages'), $show_pages, '', $show_or_not),
|
2015-10-04 08:40:02 -04:00
|
|
|
'$show_profiles' => array('vier_show_profiles', t('Community Profiles'), $show_profiles, '', $show_or_not),
|
|
|
|
'$show_helpers' => array('vier_show_helpers', t('Help or @NewHere ?'), $show_helpers, '', $show_or_not),
|
|
|
|
'$show_services' => array('vier_show_services', t('Connect Services'), $show_services, '', $show_or_not),
|
|
|
|
'$show_friends' => array('vier_show_friends', t('Find Friends'), $show_friends, '', $show_or_not),
|
|
|
|
'$show_lastusers' => array('vier_show_lastusers', t('Last users'), $show_lastusers, '', $show_or_not)
|
2014-02-23 09:57:27 -05:00
|
|
|
));
|
|
|
|
return $o;
|
|
|
|
}
|