diff options
author | redmatrix <mike@macgirvin.com> | 2016-09-01 13:19:08 -0700 |
---|---|---|
committer | redmatrix <mike@macgirvin.com> | 2016-09-01 13:19:08 -0700 |
commit | 549943fb1082bac14096d97ee2124052a8f6f364 (patch) | |
tree | 99019d9c03af2c1f4666046115c82415020d597e /Zotlabs | |
parent | 2940f9591b201e5014f3967a90a402c96ae08ac4 (diff) | |
download | volse-hubzilla-549943fb1082bac14096d97ee2124052a8f6f364.tar.gz volse-hubzilla-549943fb1082bac14096d97ee2124052a8f6f364.tar.bz2 volse-hubzilla-549943fb1082bac14096d97ee2124052a8f6f364.zip |
provide json module to load theme specific settings so we can auto-fill the display settings page with schemas and theme settings whenever somebody makes a different theme selection
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Settings.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Theme.php | 44 |
2 files changed, 44 insertions, 1 deletions
diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index dedfdda86..cf6f96e87 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -649,7 +649,6 @@ class Settings extends \Zotlabs\Web\Controller { build_sync_packet(); - //$_SESSION['theme'] = $theme; if($email_changed && \App::$config['system']['register_policy'] == REGISTER_VERIFY) { // FIXME - set to un-verified, blocked and redirect to logout diff --git a/Zotlabs/Module/Theme.php b/Zotlabs/Module/Theme.php new file mode 100644 index 000000000..da23d9c15 --- /dev/null +++ b/Zotlabs/Module/Theme.php @@ -0,0 +1,44 @@ +<?php + +namespace Zotlabs\Module; + + +class Theme extends \Zotlabs\Web\Controller { + + function get() { + $theme = argv(1); + if(! $theme) + killme(); + + $theme_config = ""; + if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){ + require_once($themeconfigfile); + if(class_exists(ucfirst($theme) . 'Config')) { + $clsname = ucfirst($theme) . 'Config'; + $th_config = new $clsname(); + $schemas = $th_config->get_schemas(); + } + $theme_config = theme_content($a); + } + + $ret = array('theme' => $theme, 'schemas' => $schemas,'config' => $theme_config); + json_return_and_die($ret); + + } + + + function get_theme_config_file($theme){ + + $base_theme = \App::$theme_info['extends']; + + if (file_exists("view/theme/$theme/php/config.php")){ + return "view/theme/$theme/php/config.php"; + } + if (file_exists("view/theme/$base_theme/php/config.php")){ + return "view/theme/$base_theme/php/config.php"; + } + return null; + } + + +}
\ No newline at end of file |