diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -79,6 +79,7 @@ require_once 'application/Utils.php'; | |||
79 | require_once 'application/PluginManager.php'; | 79 | require_once 'application/PluginManager.php'; |
80 | require_once 'application/Router.php'; | 80 | require_once 'application/Router.php'; |
81 | require_once 'application/Updater.php'; | 81 | require_once 'application/Updater.php'; |
82 | use \Shaarli\ThemeUtils; | ||
82 | 83 | ||
83 | // Ensure the PHP version is supported | 84 | // Ensure the PHP version is supported |
84 | try { | 85 | try { |
@@ -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))); |
125 | RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory | 126 | RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory |
126 | RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory | 127 | RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory |
127 | 128 | ||
128 | $pluginManager = new PluginManager($conf); | 129 | $pluginManager = new PluginManager($conf); |
@@ -203,7 +204,7 @@ function setup_login_state($conf) | |||
203 | } | 204 | } |
204 | // If session does not exist on server side, or IP address has changed, or session has expired, logout. | 205 | // If session does not exist on server side, or IP address has changed, or session has expired, logout. |
205 | if (empty($_SESSION['uid']) | 206 | if (empty($_SESSION['uid']) |
206 | || ($conf->get('security.session_protection_disabled') == false && $_SESSION['ip'] != allIPs()) | 207 | || ($conf->get('security.session_protection_disabled') === false && $_SESSION['ip'] != allIPs()) |
207 | || time() >= $_SESSION['expires_on']) | 208 | || time() >= $_SESSION['expires_on']) |
208 | { | 209 | { |
209 | logout(); | 210 | logout(); |
@@ -617,7 +618,7 @@ function showDailyRSS($conf) { | |||
617 | $tpl->assign('links', $links); | 618 | $tpl->assign('links', $links); |
618 | $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS))); | 619 | $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS))); |
619 | $tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false)); | 620 | $tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false)); |
620 | $html = $tpl->draw('dailyrss', $return_string=true); | 621 | $html = $tpl->draw('dailyrss', true); |
621 | 622 | ||
622 | echo $html . PHP_EOL; | 623 | echo $html . PHP_EOL; |
623 | } | 624 | } |
@@ -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); |