aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/visitor/ShaarliVisitorController.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-06-06 14:01:03 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commitc22fa57a5505fe95fd01860e3d3dfbb089f869cd (patch)
treea72b57e49b7b2b995ace278bad00fc47d5b6d61d /application/front/controller/visitor/ShaarliVisitorController.php
parent8eac2e54882d8adae8cbb45386dca1b465242632 (diff)
downloadShaarli-c22fa57a5505fe95fd01860e3d3dfbb089f869cd.tar.gz
Shaarli-c22fa57a5505fe95fd01860e3d3dfbb089f869cd.tar.zst
Shaarli-c22fa57a5505fe95fd01860e3d3dfbb089f869cd.zip
Handle shaare creation/edition/deletion through Slim controllers
Diffstat (limited to 'application/front/controller/visitor/ShaarliVisitorController.php')
-rw-r--r--application/front/controller/visitor/ShaarliVisitorController.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php
index f12915c1..98423d90 100644
--- a/application/front/controller/visitor/ShaarliVisitorController.php
+++ b/application/front/controller/visitor/ShaarliVisitorController.php
@@ -78,16 +78,16 @@ abstract class ShaarliVisitorController
78 ]; 78 ];
79 79
80 foreach ($common_hooks as $name) { 80 foreach ($common_hooks as $name) {
81 $plugin_data = []; 81 $pluginData = [];
82 $this->container->pluginManager->executeHooks( 82 $this->container->pluginManager->executeHooks(
83 'render_' . $name, 83 'render_' . $name,
84 $plugin_data, 84 $pluginData,
85 [ 85 [
86 'target' => $template, 86 'target' => $template,
87 'loggedin' => $this->container->loginManager->isLoggedIn() 87 'loggedin' => $this->container->loginManager->isLoggedIn()
88 ] 88 ]
89 ); 89 );
90 $this->assignView('plugins_' . $name, $plugin_data); 90 $this->assignView('plugins_' . $name, $pluginData);
91 } 91 }
92 } 92 }
93 93
@@ -102,9 +102,10 @@ abstract class ShaarliVisitorController
102 Request $request, 102 Request $request,
103 Response $response, 103 Response $response,
104 array $loopTerms = [], 104 array $loopTerms = [],
105 array $clearParams = [] 105 array $clearParams = [],
106 string $anchor = null
106 ): Response { 107 ): Response {
107 $defaultPath = $request->getUri()->getBasePath(); 108 $defaultPath = rtrim($request->getUri()->getBasePath(), '/') . '/';
108 $referer = $this->container->environment['HTTP_REFERER'] ?? null; 109 $referer = $this->container->environment['HTTP_REFERER'] ?? null;
109 110
110 if (null !== $referer) { 111 if (null !== $referer) {
@@ -133,7 +134,8 @@ abstract class ShaarliVisitorController
133 } 134 }
134 135
135 $queryString = count($params) > 0 ? '?'. http_build_query($params) : ''; 136 $queryString = count($params) > 0 ? '?'. http_build_query($params) : '';
137 $anchor = $anchor ? '#' . $anchor : '';
136 138
137 return $response->withRedirect($path . $queryString); 139 return $response->withRedirect($path . $queryString . $anchor);
138 } 140 }
139} 141}