diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/PageBuilder.php | 3 | ||||
-rw-r--r-- | application/Updater.php | 16 | ||||
-rw-r--r-- | application/config/ConfigJson.php | 10 | ||||
-rw-r--r-- | application/config/ConfigManager.php | 8 |
4 files changed, 32 insertions, 5 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 544aba7c..b133dee8 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -75,7 +75,8 @@ class PageBuilder | |||
75 | } | 75 | } |
76 | $this->tpl->assign('shaarlititle', $this->conf->get('general.title', 'Shaarli')); | 76 | $this->tpl->assign('shaarlititle', $this->conf->get('general.title', 'Shaarli')); |
77 | $this->tpl->assign('openshaarli', $this->conf->get('security.open_shaarli', false)); | 77 | $this->tpl->assign('openshaarli', $this->conf->get('security.open_shaarli', false)); |
78 | $this->tpl->assign('showatom', $this->conf->get('feed.show_atom', false)); | 78 | $this->tpl->assign('showatom', $this->conf->get('feed.show_atom', true)); |
79 | $this->tpl->assign('feed_type', $this->conf->get('feed.show_atom', true) !== false ? 'atom' : 'rss'); | ||
79 | $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); | 80 | $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); |
80 | $this->tpl->assign('token', getToken($this->conf)); | 81 | $this->tpl->assign('token', getToken($this->conf)); |
81 | // To be removed with a proper theme configuration. | 82 | // To be removed with a proper theme configuration. |
diff --git a/application/Updater.php b/application/Updater.php index 1bc5be0c..0fb68c5a 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -378,6 +378,22 @@ class Updater | |||
378 | 378 | ||
379 | $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL')); | 379 | $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL')); |
380 | $this->conf->write($this->isLoggedIn); | 380 | $this->conf->write($this->isLoggedIn); |
381 | |||
382 | return true; | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * Use ATOM feed as default. | ||
387 | */ | ||
388 | public function updateMethodAtomDefault() | ||
389 | { | ||
390 | if (!$this->conf->exists('feed.show_atom') || $this->conf->get('feed.show_atom') === true) { | ||
391 | return true; | ||
392 | } | ||
393 | |||
394 | $this->conf->set('feed.show_atom', true); | ||
395 | $this->conf->write($this->isLoggedIn); | ||
396 | |||
381 | return true; | 397 | return true; |
382 | } | 398 | } |
383 | 399 | ||
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php index 30908d90..9ef2ef56 100644 --- a/application/config/ConfigJson.php +++ b/application/config/ConfigJson.php | |||
@@ -21,8 +21,14 @@ class ConfigJson implements ConfigIO | |||
21 | $data = str_replace(self::getPhpSuffix(), '', $data); | 21 | $data = str_replace(self::getPhpSuffix(), '', $data); |
22 | $data = json_decode($data, true); | 22 | $data = json_decode($data, true); |
23 | if ($data === null) { | 23 | if ($data === null) { |
24 | $error = json_last_error(); | 24 | $errorCode = json_last_error(); |
25 | throw new \Exception('An error occurred while parsing JSON file: error code #'. $error); | 25 | $error = 'An error occurred while parsing JSON configuration file ('. $filepath .'): error code #'; |
26 | $error .= $errorCode. '<br>➜ <code>' . json_last_error_msg() .'</code>'; | ||
27 | if ($errorCode === JSON_ERROR_SYNTAX) { | ||
28 | $error .= '<br>Please check your JSON syntax (without PHP comment tags) using a JSON lint tool such as '; | ||
29 | $error .= '<a href="http://jsonlint.com/">jsonlint.com</a>.'; | ||
30 | } | ||
31 | throw new \Exception($error); | ||
26 | } | 32 | } |
27 | return $data; | 33 | return $data; |
28 | } | 34 | } |
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index f2097410..7bfbfc72 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php | |||
@@ -81,7 +81,11 @@ class ConfigManager | |||
81 | */ | 81 | */ |
82 | protected function load() | 82 | protected function load() |
83 | { | 83 | { |
84 | $this->loadedConfig = $this->configIO->read($this->getConfigFileExt()); | 84 | try { |
85 | $this->loadedConfig = $this->configIO->read($this->getConfigFileExt()); | ||
86 | } catch (\Exception $e) { | ||
87 | die($e->getMessage()); | ||
88 | } | ||
85 | $this->setDefaultValues(); | 89 | $this->setDefaultValues(); |
86 | } | 90 | } |
87 | 91 | ||
@@ -317,7 +321,7 @@ class ConfigManager | |||
317 | $this->setEmpty('updates.check_updates_interval', 86400); | 321 | $this->setEmpty('updates.check_updates_interval', 86400); |
318 | 322 | ||
319 | $this->setEmpty('feed.rss_permalinks', true); | 323 | $this->setEmpty('feed.rss_permalinks', true); |
320 | $this->setEmpty('feed.show_atom', false); | 324 | $this->setEmpty('feed.show_atom', true); |
321 | 325 | ||
322 | $this->setEmpty('privacy.default_private_links', false); | 326 | $this->setEmpty('privacy.default_private_links', false); |
323 | $this->setEmpty('privacy.hide_public_links', false); | 327 | $this->setEmpty('privacy.hide_public_links', false); |