X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=62d719e1141cd757d18242b93da8c305cec371ef;hb=adc4aee80f7cd3242f65f0b316af2b560a64712c;hp=2ed14d4f2f3ac67ed6bd5e041fc434b27a7aa050;hpb=fc11ab2f290a3712b766d78fdbcd354625a35d0a;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 2ed14d4f..62d719e1 100644 --- a/index.php +++ b/index.php @@ -122,7 +122,8 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) { $conf = new ConfigManager(); $conf->setEmpty('general.timezone', date_default_timezone_get()); $conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER))); -RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory +$conf->setEmpty('resource.theme', 'default'); +RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory $pluginManager = new PluginManager($conf); @@ -1124,6 +1125,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) $conf->set('general.timezone', $tz); $conf->set('general.title', escape($_POST['title'])); $conf->set('general.header_link', escape($_POST['titleLink'])); + $conf->set('resource.theme', escape($_POST['theme'])); $conf->set('redirector.url', escape($_POST['redirector'])); $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault'])); @@ -1134,6 +1136,7 @@ function renderPage($conf, $pluginManager, $LINKSDB) $conf->set('api.secret', escape($_POST['apiSecret'])); try { $conf->write(isLoggedIn()); + invalidateCaches($conf->get('resource.page_cache')); } catch(Exception $e) { error_log( @@ -1151,6 +1154,8 @@ function renderPage($conf, $pluginManager, $LINKSDB) else // Show the configuration form. { $PAGE->assign('title', $conf->get('general.title')); + $PAGE->assign('theme', $conf->get('resource.theme')); + $PAGE->assign('theme_available', getAllTheme($conf->get('resource.raintpl_tpl'))); $PAGE->assign('redirector', $conf->get('redirector.url')); list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); $PAGE->assign('timezone_form', $timezone_form);