aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/config/ConfigManager.php4
-rw-r--r--application/container/ContainerBuilder.php1
-rw-r--r--application/front/ShaarliMiddleware.php2
-rw-r--r--application/front/controller/admin/ConfigureController.php17
-rw-r--r--application/front/controller/visitor/InstallController.php13
-rw-r--r--application/front/controller/visitor/TagController.php2
-rw-r--r--application/legacy/LegacyUpdater.php3
7 files changed, 22 insertions, 20 deletions
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php
index e45bb4c3..4c98be30 100644
--- a/application/config/ConfigManager.php
+++ b/application/config/ConfigManager.php
@@ -3,6 +3,7 @@ namespace Shaarli\Config;
3 3
4use Shaarli\Config\Exception\MissingFieldConfigException; 4use Shaarli\Config\Exception\MissingFieldConfigException;
5use Shaarli\Config\Exception\UnauthorizedConfigException; 5use Shaarli\Config\Exception\UnauthorizedConfigException;
6use Shaarli\Thumbnailer;
6 7
7/** 8/**
8 * Class ConfigManager 9 * Class ConfigManager
@@ -361,7 +362,7 @@ class ConfigManager
361 $this->setEmpty('security.open_shaarli', false); 362 $this->setEmpty('security.open_shaarli', false);
362 $this->setEmpty('security.allowed_protocols', ['ftp', 'ftps', 'magnet']); 363 $this->setEmpty('security.allowed_protocols', ['ftp', 'ftps', 'magnet']);
363 364
364 $this->setEmpty('general.header_link', '?'); 365 $this->setEmpty('general.header_link', '/');
365 $this->setEmpty('general.links_per_page', 20); 366 $this->setEmpty('general.links_per_page', 20);
366 $this->setEmpty('general.enabled_plugins', self::$DEFAULT_PLUGINS); 367 $this->setEmpty('general.enabled_plugins', self::$DEFAULT_PLUGINS);
367 $this->setEmpty('general.default_note_title', 'Note: '); 368 $this->setEmpty('general.default_note_title', 'Note: ');
@@ -381,6 +382,7 @@ class ConfigManager
381 // default state of the 'remember me' checkbox of the login form 382 // default state of the 'remember me' checkbox of the login form
382 $this->setEmpty('privacy.remember_user_default', true); 383 $this->setEmpty('privacy.remember_user_default', true);
383 384
385 $this->setEmpty('thumbnails.mode', Thumbnailer::MODE_ALL);
384 $this->setEmpty('thumbnails.width', '125'); 386 $this->setEmpty('thumbnails.width', '125');
385 $this->setEmpty('thumbnails.height', '90'); 387 $this->setEmpty('thumbnails.height', '90');
386 388
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php
index 593aafb7..bfe93501 100644
--- a/application/container/ContainerBuilder.php
+++ b/application/container/ContainerBuilder.php
@@ -99,7 +99,6 @@ class ContainerBuilder
99 $container['pluginManager'] = function (ShaarliContainer $container): PluginManager { 99 $container['pluginManager'] = function (ShaarliContainer $container): PluginManager {
100 $pluginManager = new PluginManager($container->conf); 100 $pluginManager = new PluginManager($container->conf);
101 101
102 // FIXME! Configuration is already injected
103 $pluginManager->load($container->conf->get('general.enabled_plugins')); 102 $pluginManager->load($container->conf->get('general.enabled_plugins'));
104 103
105 return $pluginManager; 104 return $pluginManager;
diff --git a/application/front/ShaarliMiddleware.php b/application/front/ShaarliMiddleware.php
index e9f5552d..fd978e99 100644
--- a/application/front/ShaarliMiddleware.php
+++ b/application/front/ShaarliMiddleware.php
@@ -56,7 +56,7 @@ class ShaarliMiddleware
56 } catch (ShaarliFrontException $e) { 56 } catch (ShaarliFrontException $e) {
57 // Possible functional error 57 // Possible functional error
58 $this->container->pageBuilder->reset(); 58 $this->container->pageBuilder->reset();
59 $this->container->pageBuilder->assign('message', $e->getMessage()); 59 $this->container->pageBuilder->assign('message', nl2br($e->getMessage()));
60 60
61 $response = $response->withStatus($e->getCode()); 61 $response = $response->withStatus($e->getCode());
62 62
diff --git a/application/front/controller/admin/ConfigureController.php b/application/front/controller/admin/ConfigureController.php
index 865fc2b0..e675fcca 100644
--- a/application/front/controller/admin/ConfigureController.php
+++ b/application/front/controller/admin/ConfigureController.php
@@ -98,10 +98,10 @@ class ConfigureController extends ShaarliAdminController
98 if ($thumbnailsMode !== Thumbnailer::MODE_NONE 98 if ($thumbnailsMode !== Thumbnailer::MODE_NONE
99 && $thumbnailsMode !== $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) 99 && $thumbnailsMode !== $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE)
100 ) { 100 ) {
101 $this->saveWarningMessage(t( 101 $this->saveWarningMessage(
102 'You have enabled or changed thumbnails mode. ' 102 t('You have enabled or changed thumbnails mode.') .
103 .'<a href="'. $this->container->basePath .'/admin/thumbnails">Please synchronize them</a>.' 103 '<a href="'. $this->container->basePath .'/admin/thumbnails">' . t('Please synchronize them.') .'</a>'
104 )); 104 );
105 } 105 }
106 $this->container->conf->set('thumbnails.mode', $thumbnailsMode); 106 $this->container->conf->set('thumbnails.mode', $thumbnailsMode);
107 107
@@ -110,8 +110,13 @@ class ConfigureController extends ShaarliAdminController
110 $this->container->history->updateSettings(); 110 $this->container->history->updateSettings();
111 $this->container->pageCacheManager->invalidateCaches(); 111 $this->container->pageCacheManager->invalidateCaches();
112 } catch (Throwable $e) { 112 } catch (Throwable $e) {
113 // TODO: translation + stacktrace 113 $this->assignView('message', t('Error while writing config file after configuration update.'));
114 $this->saveErrorMessage('ERROR while writing config file after configuration update.'); 114
115 if ($this->container->conf->get('dev.debug', false)) {
116 $this->assignView('stacktrace', $e->getMessage() . PHP_EOL . $e->getTraceAsString());
117 }
118
119 return $response->write($this->render('error'));
115 } 120 }
116 121
117 $this->saveSuccessMessage(t('Configuration was saved.')); 122 $this->saveSuccessMessage(t('Configuration was saved.'));
diff --git a/application/front/controller/visitor/InstallController.php b/application/front/controller/visitor/InstallController.php
index aa032860..94ebb4ae 100644
--- a/application/front/controller/visitor/InstallController.php
+++ b/application/front/controller/visitor/InstallController.php
@@ -128,13 +128,14 @@ class InstallController extends ShaarliVisitorController
128 $this->container->conf->get('credentials.salt') 128 $this->container->conf->get('credentials.salt')
129 ) 129 )
130 ); 130 );
131 $this->container->conf->set('general.header_link', $this->container->basePath);
131 132
132 try { 133 try {
133 // Everything is ok, let's create config file. 134 // Everything is ok, let's create config file.
134 $this->container->conf->write($this->container->loginManager->isLoggedIn()); 135 $this->container->conf->write($this->container->loginManager->isLoggedIn());
135 } catch (\Exception $e) { 136 } catch (\Exception $e) {
136 $this->assignView('message', $e->getMessage()); 137 $this->assignView('message', t('Error while writing config file after configuration update.'));
137 $this->assignView('stacktrace', $e->getTraceAsString()); 138 $this->assignView('stacktrace', $e->getMessage() . PHP_EOL . $e->getTraceAsString());
138 139
139 return $response->write($this->render('error')); 140 return $response->write($this->render('error'));
140 } 141 }
@@ -155,18 +156,14 @@ class InstallController extends ShaarliVisitorController
155 { 156 {
156 // Ensure Shaarli has proper access to its resources 157 // Ensure Shaarli has proper access to its resources
157 $errors = ApplicationUtils::checkResourcePermissions($this->container->conf); 158 $errors = ApplicationUtils::checkResourcePermissions($this->container->conf);
158
159 if (empty($errors)) { 159 if (empty($errors)) {
160 return true; 160 return true;
161 } 161 }
162 162
163 // FIXME! Do not insert HTML here. 163 $message = t('Insufficient permissions:') . PHP_EOL;
164 $message = '<p>'. t('Insufficient permissions:') .'</p><ul>';
165
166 foreach ($errors as $error) { 164 foreach ($errors as $error) {
167 $message .= '<li>'.$error.'</li>'; 165 $message .= PHP_EOL . $error;
168 } 166 }
169 $message .= '</ul>';
170 167
171 throw new ResourcePermissionException($message); 168 throw new ResourcePermissionException($message);
172 } 169 }
diff --git a/application/front/controller/visitor/TagController.php b/application/front/controller/visitor/TagController.php
index c176f43f..de4e7ea2 100644
--- a/application/front/controller/visitor/TagController.php
+++ b/application/front/controller/visitor/TagController.php
@@ -11,8 +11,6 @@ use Slim\Http\Response;
11 * Class TagController 11 * Class TagController
12 * 12 *
13 * Slim controller handle tags. 13 * Slim controller handle tags.
14 *
15 * TODO: check redirections with new helper
16 */ 14 */
17class TagController extends ShaarliVisitorController 15class TagController extends ShaarliVisitorController
18{ 16{
diff --git a/application/legacy/LegacyUpdater.php b/application/legacy/LegacyUpdater.php
index cbf6890f..0ab3a55b 100644
--- a/application/legacy/LegacyUpdater.php
+++ b/application/legacy/LegacyUpdater.php
@@ -534,7 +534,8 @@ class LegacyUpdater
534 534
535 if ($thumbnailsEnabled) { 535 if ($thumbnailsEnabled) {
536 $this->session['warnings'][] = t( 536 $this->session['warnings'][] = t(
537 'You have enabled or changed thumbnails mode. <a href="./admin/thumbnails">Please synchronize them</a>.' 537 t('You have enabled or changed thumbnails mode.') .
538 '<a href="./admin/thumbnails">' . t('Please synchronize them.') . '</a>'
538 ); 539 );
539 } 540 }
540 541