aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2017-01-06 11:40:54 +0100
committerGitHub <noreply@github.com>2017-01-06 11:40:54 +0100
commit7418f7cb60524c3bfc2f240386b5e3e7eb9b3257 (patch)
tree4b0c89c133ad1679c5db3a4f0f6b94079f776395 /index.php
parent93b1fe54fb99efff30eec0d405cc7319fbbc1f95 (diff)
parent01c6e32a02034ab119d83364c4648ce55d75543b (diff)
downloadShaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.tar.gz
Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.tar.zst
Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.zip
Merge pull request #732 from ArthurHoaro/feature/theme-manager
Theme manager: improvements
Diffstat (limited to 'index.php')
-rw-r--r--index.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/index.php b/index.php
index 0639e85f..e553d1dd 100644
--- a/index.php
+++ b/index.php
@@ -79,6 +79,7 @@ require_once 'application/Utils.php';
79require_once 'application/PluginManager.php'; 79require_once 'application/PluginManager.php';
80require_once 'application/Router.php'; 80require_once 'application/Router.php';
81require_once 'application/Updater.php'; 81require_once 'application/Updater.php';
82use \Shaarli\ThemeUtils;
82 83
83// Ensure the PHP version is supported 84// Ensure the PHP version is supported
84try { 85try {
@@ -122,7 +123,7 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) {
122$conf = new ConfigManager(); 123$conf = new ConfigManager();
123$conf->setEmpty('general.timezone', date_default_timezone_get()); 124$conf->setEmpty('general.timezone', date_default_timezone_get());
124$conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER))); 125$conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER)));
125RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory 126RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory
126RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory 127RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory
127 128
128$pluginManager = new PluginManager($conf); 129$pluginManager = new PluginManager($conf);
@@ -1124,6 +1125,7 @@ function renderPage($conf, $pluginManager, $LINKSDB)
1124 $conf->set('general.timezone', $tz); 1125 $conf->set('general.timezone', $tz);
1125 $conf->set('general.title', escape($_POST['title'])); 1126 $conf->set('general.title', escape($_POST['title']));
1126 $conf->set('general.header_link', escape($_POST['titleLink'])); 1127 $conf->set('general.header_link', escape($_POST['titleLink']));
1128 $conf->set('resource.theme', escape($_POST['theme']));
1127 $conf->set('redirector.url', escape($_POST['redirector'])); 1129 $conf->set('redirector.url', escape($_POST['redirector']));
1128 $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); 1130 $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection']));
1129 $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault'])); 1131 $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault']));
@@ -1134,6 +1136,7 @@ function renderPage($conf, $pluginManager, $LINKSDB)
1134 $conf->set('api.secret', escape($_POST['apiSecret'])); 1136 $conf->set('api.secret', escape($_POST['apiSecret']));
1135 try { 1137 try {
1136 $conf->write(isLoggedIn()); 1138 $conf->write(isLoggedIn());
1139 invalidateCaches($conf->get('resource.page_cache'));
1137 } 1140 }
1138 catch(Exception $e) { 1141 catch(Exception $e) {
1139 error_log( 1142 error_log(
@@ -1151,6 +1154,8 @@ function renderPage($conf, $pluginManager, $LINKSDB)
1151 else // Show the configuration form. 1154 else // Show the configuration form.
1152 { 1155 {
1153 $PAGE->assign('title', $conf->get('general.title')); 1156 $PAGE->assign('title', $conf->get('general.title'));
1157 $PAGE->assign('theme', $conf->get('resource.theme'));
1158 $PAGE->assign('theme_available', ThemeUtils::getThemes($conf->get('resource.raintpl_tpl')));
1154 $PAGE->assign('redirector', $conf->get('redirector.url')); 1159 $PAGE->assign('redirector', $conf->get('redirector.url'));
1155 list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); 1160 list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone'));
1156 $PAGE->assign('timezone_form', $timezone_form); 1161 $PAGE->assign('timezone_form', $timezone_form);