aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorKnah Tsaeb <Knah-Tsaeb@knah-tsaeb.org>2016-12-07 11:58:25 +0100
committerArthurHoaro <arthur@hoa.ro>2017-01-05 12:04:02 +0100
commitadc4aee80f7cd3242f65f0b316af2b560a64712c (patch)
treeaf62f8bfb21232bc36dd6d12eb5bc2fc35c21146 /application
parentfc11ab2f290a3712b766d78fdbcd354625a35d0a (diff)
downloadShaarli-adc4aee80f7cd3242f65f0b316af2b560a64712c.tar.gz
Shaarli-adc4aee80f7cd3242f65f0b316af2b560a64712c.tar.zst
Shaarli-adc4aee80f7cd3242f65f0b316af2b560a64712c.zip
Change templates set through administration UI
Diffstat (limited to 'application')
-rw-r--r--application/ApplicationUtils.php1
-rw-r--r--application/PageBuilder.php2
-rw-r--r--application/Utils.php10
-rw-r--r--application/config/ConfigManager.php1
-rw-r--r--application/config/ConfigPhp.php3
5 files changed, 15 insertions, 2 deletions
diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php
index 7f963e97..a0f482b0 100644
--- a/application/ApplicationUtils.php
+++ b/application/ApplicationUtils.php
@@ -150,6 +150,7 @@ class ApplicationUtils
150 'inc', 150 'inc',
151 'plugins', 151 'plugins',
152 $conf->get('resource.raintpl_tpl'), 152 $conf->get('resource.raintpl_tpl'),
153 $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme'),
153 ) as $path) { 154 ) as $path) {
154 if (! is_readable(realpath($path))) { 155 if (! is_readable(realpath($path))) {
155 $errors[] = '"'.$path.'" directory is not readable'; 156 $errors[] = '"'.$path.'" directory is not readable';
diff --git a/application/PageBuilder.php b/application/PageBuilder.php
index 32c7f9f1..e226a77d 100644
--- a/application/PageBuilder.php
+++ b/application/PageBuilder.php
@@ -79,7 +79,7 @@ class PageBuilder
79 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); 79 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
80 $this->tpl->assign('token', getToken($this->conf)); 80 $this->tpl->assign('token', getToken($this->conf));
81 // To be removed with a proper theme configuration. 81 // To be removed with a proper theme configuration.
82 $this->tpl->assign('conf', $this->conf); 82 $this->tpl->assign('theme', $this->conf->get('resource.theme', 'default'));
83 } 83 }
84 84
85 /** 85 /**
diff --git a/application/Utils.php b/application/Utils.php
index 35d65224..7556d3c9 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -270,3 +270,13 @@ function normalize_spaces($string)
270{ 270{
271 return preg_replace('/\s{2,}/', ' ', trim($string)); 271 return preg_replace('/\s{2,}/', ' ', trim($string));
272} 272}
273
274function getAllTheme($raintpl_tpl)
275{
276 $allTheme = glob($raintpl_tpl.'/*', GLOB_ONLYDIR);
277 foreach ($allTheme as $value) {
278 $themes[] = str_replace($raintpl_tpl.'/', '', $value);
279 }
280
281 return $themes;
282}
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php
index ca8918b5..a401887c 100644
--- a/application/config/ConfigManager.php
+++ b/application/config/ConfigManager.php
@@ -299,6 +299,7 @@ class ConfigManager
299 $this->setEmpty('resource.log', 'data/log.txt'); 299 $this->setEmpty('resource.log', 'data/log.txt');
300 $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt'); 300 $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt');
301 $this->setEmpty('resource.raintpl_tpl', 'tpl/'); 301 $this->setEmpty('resource.raintpl_tpl', 'tpl/');
302 $this->setEmpty('resource.theme', 'default');
302 $this->setEmpty('resource.raintpl_tmp', 'tmp/'); 303 $this->setEmpty('resource.raintpl_tmp', 'tmp/');
303 $this->setEmpty('resource.thumbnails_cache', 'cache'); 304 $this->setEmpty('resource.thumbnails_cache', 'cache');
304 $this->setEmpty('resource.page_cache', 'pagecache'); 305 $this->setEmpty('resource.page_cache', 'pagecache');
diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php
index 27187b66..2eb68d80 100644
--- a/application/config/ConfigPhp.php
+++ b/application/config/ConfigPhp.php
@@ -41,6 +41,7 @@ class ConfigPhp implements ConfigIO
41 'resource.log' => 'config.LOG_FILE', 41 'resource.log' => 'config.LOG_FILE',
42 'resource.update_check' => 'config.UPDATECHECK_FILENAME', 42 'resource.update_check' => 'config.UPDATECHECK_FILENAME',
43 'resource.raintpl_tpl' => 'config.RAINTPL_TPL', 43 'resource.raintpl_tpl' => 'config.RAINTPL_TPL',
44 'resource.theme' => 'config.theme',
44 'resource.raintpl_tmp' => 'config.RAINTPL_TMP', 45 'resource.raintpl_tmp' => 'config.RAINTPL_TMP',
45 'resource.thumbnails_cache' => 'config.CACHEDIR', 46 'resource.thumbnails_cache' => 'config.CACHEDIR',
46 'resource.page_cache' => 'config.PAGECACHE', 47 'resource.page_cache' => 'config.PAGECACHE',
@@ -99,7 +100,7 @@ class ConfigPhp implements ConfigIO
99 $configStr .= '$GLOBALS[\'' . $key . '\'] = ' . var_export($conf[$key], true) . ';' . PHP_EOL; 100 $configStr .= '$GLOBALS[\'' . $key . '\'] = ' . var_export($conf[$key], true) . ';' . PHP_EOL;
100 } 101 }
101 } 102 }
102 103
103 // Store all $conf['config'] 104 // Store all $conf['config']
104 foreach ($conf['config'] as $key => $value) { 105 foreach ($conf['config'] as $key => $value) {
105 $configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL; 106 $configStr .= '$GLOBALS[\'config\'][\''. $key .'\'] = '.var_export($conf['config'][$key], true).';'. PHP_EOL;