aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-07-06 08:04:35 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit1a8ac737e52cb25a5c346232ee398f5908cee7d7 (patch)
tree31954c4e106b5743e2005d72c2d548a0be8d6dce /application/front/controller/admin
parent6132d64748dfc6806ed25f71d2e078a5ed29d071 (diff)
downloadShaarli-1a8ac737e52cb25a5c346232ee398f5908cee7d7.tar.gz
Shaarli-1a8ac737e52cb25a5c346232ee398f5908cee7d7.tar.zst
Shaarli-1a8ac737e52cb25a5c346232ee398f5908cee7d7.zip
Process main page (linklist) through Slim controller
Including a bunch of improvements on the container, and helper used across new controllers.
Diffstat (limited to 'application/front/controller/admin')
-rw-r--r--application/front/controller/admin/ConfigureController.php3
-rw-r--r--application/front/controller/admin/ExportController.php5
-rw-r--r--application/front/controller/admin/ImportController.php3
-rw-r--r--application/front/controller/admin/ManageShaareController.php5
-rw-r--r--application/front/controller/admin/ManageTagController.php3
-rw-r--r--application/front/controller/admin/PasswordController.php9
-rw-r--r--application/front/controller/admin/PluginsController.php3
-rw-r--r--application/front/controller/admin/ThumbnailsController.php18
-rw-r--r--application/front/controller/admin/ToolsController.php3
9 files changed, 23 insertions, 29 deletions
diff --git a/application/front/controller/admin/ConfigureController.php b/application/front/controller/admin/ConfigureController.php
index 201a859b..865fc2b0 100644
--- a/application/front/controller/admin/ConfigureController.php
+++ b/application/front/controller/admin/ConfigureController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use Shaarli\Languages; 7use Shaarli\Languages;
8use Shaarli\Render\TemplatePage;
8use Shaarli\Render\ThemeUtils; 9use Shaarli\Render\ThemeUtils;
9use Shaarli\Thumbnailer; 10use Shaarli\Thumbnailer;
10use Slim\Http\Request; 11use Slim\Http\Request;
@@ -52,7 +53,7 @@ class ConfigureController extends ShaarliAdminController
52 $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE)); 53 $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE));
53 $this->assignView('pagetitle', t('Configure') .' - '. $this->container->conf->get('general.title', 'Shaarli')); 54 $this->assignView('pagetitle', t('Configure') .' - '. $this->container->conf->get('general.title', 'Shaarli'));
54 55
55 return $response->write($this->render('configure')); 56 return $response->write($this->render(TemplatePage::CONFIGURE));
56 } 57 }
57 58
58 /** 59 /**
diff --git a/application/front/controller/admin/ExportController.php b/application/front/controller/admin/ExportController.php
index 7afbfc23..2be957fa 100644
--- a/application/front/controller/admin/ExportController.php
+++ b/application/front/controller/admin/ExportController.php
@@ -6,6 +6,7 @@ namespace Shaarli\Front\Controller\Admin;
6 6
7use DateTime; 7use DateTime;
8use Shaarli\Bookmark\Bookmark; 8use Shaarli\Bookmark\Bookmark;
9use Shaarli\Render\TemplatePage;
9use Slim\Http\Request; 10use Slim\Http\Request;
10use Slim\Http\Response; 11use Slim\Http\Response;
11 12
@@ -24,7 +25,7 @@ class ExportController extends ShaarliAdminController
24 { 25 {
25 $this->assignView('pagetitle', t('Export') .' - '. $this->container->conf->get('general.title', 'Shaarli')); 26 $this->assignView('pagetitle', t('Export') .' - '. $this->container->conf->get('general.title', 'Shaarli'));
26 27
27 return $response->write($this->render('export')); 28 return $response->write($this->render(TemplatePage::EXPORT));
28 } 29 }
29 30
30 /** 31 /**
@@ -74,6 +75,6 @@ class ExportController extends ShaarliAdminController
74 $this->assignView('eol', PHP_EOL); 75 $this->assignView('eol', PHP_EOL);
75 $this->assignView('selection', $selection); 76 $this->assignView('selection', $selection);
76 77
77 return $response->write($this->render('export.bookmarks')); 78 return $response->write($this->render(TemplatePage::NETSCAPE_EXPORT_BOOKMARKS));
78 } 79 }
79} 80}
diff --git a/application/front/controller/admin/ImportController.php b/application/front/controller/admin/ImportController.php
index 8c5305b9..758d5ef9 100644
--- a/application/front/controller/admin/ImportController.php
+++ b/application/front/controller/admin/ImportController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use Psr\Http\Message\UploadedFileInterface; 7use Psr\Http\Message\UploadedFileInterface;
8use Shaarli\Render\TemplatePage;
8use Slim\Http\Request; 9use Slim\Http\Request;
9use Slim\Http\Response; 10use Slim\Http\Response;
10 11
@@ -39,7 +40,7 @@ class ImportController extends ShaarliAdminController
39 ); 40 );
40 $this->assignView('pagetitle', t('Import') .' - '. $this->container->conf->get('general.title', 'Shaarli')); 41 $this->assignView('pagetitle', t('Import') .' - '. $this->container->conf->get('general.title', 'Shaarli'));
41 42
42 return $response->write($this->render('import')); 43 return $response->write($this->render(TemplatePage::IMPORT));
43 } 44 }
44 45
45 /** 46 /**
diff --git a/application/front/controller/admin/ManageShaareController.php b/application/front/controller/admin/ManageShaareController.php
index bdfc5ca7..3aa48423 100644
--- a/application/front/controller/admin/ManageShaareController.php
+++ b/application/front/controller/admin/ManageShaareController.php
@@ -7,6 +7,7 @@ namespace Shaarli\Front\Controller\Admin;
7use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
8use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
9use Shaarli\Formatter\BookmarkMarkdownFormatter; 9use Shaarli\Formatter\BookmarkMarkdownFormatter;
10use Shaarli\Render\TemplatePage;
10use Shaarli\Thumbnailer; 11use Shaarli\Thumbnailer;
11use Slim\Http\Request; 12use Slim\Http\Request;
12use Slim\Http\Response; 13use Slim\Http\Response;
@@ -28,7 +29,7 @@ class ManageShaareController extends ShaarliAdminController
28 t('Shaare a new link') .' - '. $this->container->conf->get('general.title', 'Shaarli') 29 t('Shaare a new link') .' - '. $this->container->conf->get('general.title', 'Shaarli')
29 ); 30 );
30 31
31 return $response->write($this->render('addlink')); 32 return $response->write($this->render(TemplatePage::ADDLINK));
32 } 33 }
33 34
34 /** 35 /**
@@ -365,7 +366,7 @@ class ManageShaareController extends ShaarliAdminController
365 $editLabel . t('Shaare') .' - '. $this->container->conf->get('general.title', 'Shaarli') 366 $editLabel . t('Shaare') .' - '. $this->container->conf->get('general.title', 'Shaarli')
366 ); 367 );
367 368
368 return $response->write($this->render('editlink')); 369 return $response->write($this->render(TemplatePage::EDIT_LINK));
369 } 370 }
370 371
371 /** 372 /**
diff --git a/application/front/controller/admin/ManageTagController.php b/application/front/controller/admin/ManageTagController.php
index 7dab288a..0380ef1f 100644
--- a/application/front/controller/admin/ManageTagController.php
+++ b/application/front/controller/admin/ManageTagController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use Shaarli\Bookmark\BookmarkFilter; 7use Shaarli\Bookmark\BookmarkFilter;
8use Shaarli\Render\TemplatePage;
8use Slim\Http\Request; 9use Slim\Http\Request;
9use Slim\Http\Response; 10use Slim\Http\Response;
10 11
@@ -28,7 +29,7 @@ class ManageTagController extends ShaarliAdminController
28 t('Manage tags') .' - '. $this->container->conf->get('general.title', 'Shaarli') 29 t('Manage tags') .' - '. $this->container->conf->get('general.title', 'Shaarli')
29 ); 30 );
30 31
31 return $response->write($this->render('changetag')); 32 return $response->write($this->render(TemplatePage::CHANGE_TAG));
32 } 33 }
33 34
34 /** 35 /**
diff --git a/application/front/controller/admin/PasswordController.php b/application/front/controller/admin/PasswordController.php
index bcce01a6..5ec0d24b 100644
--- a/application/front/controller/admin/PasswordController.php
+++ b/application/front/controller/admin/PasswordController.php
@@ -7,6 +7,7 @@ namespace Shaarli\Front\Controller\Admin;
7use Shaarli\Container\ShaarliContainer; 7use Shaarli\Container\ShaarliContainer;
8use Shaarli\Front\Exception\OpenShaarliPasswordException; 8use Shaarli\Front\Exception\OpenShaarliPasswordException;
9use Shaarli\Front\Exception\ShaarliFrontException; 9use Shaarli\Front\Exception\ShaarliFrontException;
10use Shaarli\Render\TemplatePage;
10use Slim\Http\Request; 11use Slim\Http\Request;
11use Slim\Http\Response; 12use Slim\Http\Response;
12use Throwable; 13use Throwable;
@@ -33,7 +34,7 @@ class PasswordController extends ShaarliAdminController
33 */ 34 */
34 public function index(Request $request, Response $response): Response 35 public function index(Request $request, Response $response): Response
35 { 36 {
36 return $response->write($this->render('changepassword')); 37 return $response->write($this->render(TemplatePage::CHANGE_PASSWORD));
37 } 38 }
38 39
39 /** 40 /**
@@ -55,7 +56,7 @@ class PasswordController extends ShaarliAdminController
55 56
56 return $response 57 return $response
57 ->withStatus(400) 58 ->withStatus(400)
58 ->write($this->render('changepassword')) 59 ->write($this->render(TemplatePage::CHANGE_PASSWORD))
59 ; 60 ;
60 } 61 }
61 62
@@ -71,7 +72,7 @@ class PasswordController extends ShaarliAdminController
71 72
72 return $response 73 return $response
73 ->withStatus(400) 74 ->withStatus(400)
74 ->write($this->render('changepassword')) 75 ->write($this->render(TemplatePage::CHANGE_PASSWORD))
75 ; 76 ;
76 } 77 }
77 78
@@ -95,6 +96,6 @@ class PasswordController extends ShaarliAdminController
95 96
96 $this->saveSuccessMessage(t('Your password has been changed')); 97 $this->saveSuccessMessage(t('Your password has been changed'));
97 98
98 return $response->write($this->render('changepassword')); 99 return $response->write($this->render(TemplatePage::CHANGE_PASSWORD));
99 } 100 }
100} 101}
diff --git a/application/front/controller/admin/PluginsController.php b/application/front/controller/admin/PluginsController.php
index d5ec91f0..44025395 100644
--- a/application/front/controller/admin/PluginsController.php
+++ b/application/front/controller/admin/PluginsController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use Exception; 7use Exception;
8use Shaarli\Render\TemplatePage;
8use Slim\Http\Request; 9use Slim\Http\Request;
9use Slim\Http\Response; 10use Slim\Http\Response;
10 11
@@ -44,7 +45,7 @@ class PluginsController extends ShaarliAdminController
44 t('Plugin Administration') .' - '. $this->container->conf->get('general.title', 'Shaarli') 45 t('Plugin Administration') .' - '. $this->container->conf->get('general.title', 'Shaarli')
45 ); 46 );
46 47
47 return $response->write($this->render('pluginsadmin')); 48 return $response->write($this->render(TemplatePage::PLUGINS_ADMIN));
48 } 49 }
49 50
50 /** 51 /**
diff --git a/application/front/controller/admin/ThumbnailsController.php b/application/front/controller/admin/ThumbnailsController.php
index e5308510..81c87ed0 100644
--- a/application/front/controller/admin/ThumbnailsController.php
+++ b/application/front/controller/admin/ThumbnailsController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 7use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
8use Shaarli\Render\TemplatePage;
8use Slim\Http\Request; 9use Slim\Http\Request;
9use Slim\Http\Response; 10use Slim\Http\Response;
10 11
@@ -36,7 +37,7 @@ class ThumbnailsController extends ShaarliAdminController
36 t('Thumbnails update') .' - '. $this->container->conf->get('general.title', 'Shaarli') 37 t('Thumbnails update') .' - '. $this->container->conf->get('general.title', 'Shaarli')
37 ); 38 );
38 39
39 return $response->write($this->render('thumbnails')); 40 return $response->write($this->render(TemplatePage::THUMBNAILS));
40 } 41 }
41 42
42 /** 43 /**
@@ -61,19 +62,4 @@ class ThumbnailsController extends ShaarliAdminController
61 62
62 return $response->withJson($this->container->formatterFactory->getFormatter('raw')->format($bookmark)); 63 return $response->withJson($this->container->formatterFactory->getFormatter('raw')->format($bookmark));
63 } 64 }
64
65 /**
66 * @param mixed[] $data Variables passed to the template engine
67 *
68 * @return mixed[] Template data after active plugins render_picwall hook execution.
69 */
70 protected function executeHooks(array $data): array
71 {
72 $this->container->pluginManager->executeHooks(
73 'render_tools',
74 $data
75 );
76
77 return $data;
78 }
79} 65}
diff --git a/application/front/controller/admin/ToolsController.php b/application/front/controller/admin/ToolsController.php
index d087f2cd..a476e898 100644
--- a/application/front/controller/admin/ToolsController.php
+++ b/application/front/controller/admin/ToolsController.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use Shaarli\Render\TemplatePage;
7use Slim\Http\Request; 8use Slim\Http\Request;
8use Slim\Http\Response; 9use Slim\Http\Response;
9 10
@@ -29,7 +30,7 @@ class ToolsController extends ShaarliAdminController
29 30
30 $this->assignView('pagetitle', t('Tools') .' - '. $this->container->conf->get('general.title', 'Shaarli')); 31 $this->assignView('pagetitle', t('Tools') .' - '. $this->container->conf->get('general.title', 'Shaarli'));
31 32
32 return $response->write($this->render('tools')); 33 return $response->write($this->render(TemplatePage::TOOLS));
33 } 34 }
34 35
35 /** 36 /**