protected function render(string $template): string
{
+ // Legacy key that used to be injected by PluginManager
+ $this->assignView('_PAGE_', $template);
+ $this->assignView('template', $template);
+
$this->assignView('linkcount', $this->container->bookmarkService->count(BookmarkFilter::$ALL));
$this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE));
'target' => $template,
'loggedin' => $this->container->loginManager->isLoggedIn(),
'basePath' => $this->container->basePath,
+ 'rootPath' => preg_replace('#/index\.php$#', '', $this->container->basePath),
'bookmarkService' => $this->container->bookmarkService
];
}
if (null !== $referer) {
$currentUrl = parse_url($referer);
+ // If the referer is not related to Shaarli instance, redirect to default
+ if (
+ isset($currentUrl['host'])
+ && strpos(index_url($this->container->environment), $currentUrl['host']) === false
+ ) {
+ return $response->withRedirect($defaultPath);
+ }
+
parse_str($currentUrl['query'] ?? '', $params);
$path = $currentUrl['path'] ?? $defaultPath;
} else {
}
}
- $queryString = count($params) > 0 ? '?'. http_build_query($params) : '';
+ $queryString = count($params) > 0 ? '?' . http_build_query($params) : '';
$anchor = $anchor ? '#' . $anchor : '';
return $response->withRedirect($path . $queryString . $anchor);