Merge pull request #395 from DorsetDigital/patch-1

Change source of admin URL in getIsAdmin()
This commit is contained in:
Robbie Averill 2018-10-18 11:02:46 +02:00 committed by GitHub
commit 6a8f15a194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,7 @@ class InitStateMiddleware implements HTTPMiddleware
public function getIsAdmin(HTTPRequest $request) public function getIsAdmin(HTTPRequest $request)
{ {
$adminPaths = static::config()->get('admin_url_paths'); $adminPaths = static::config()->get('admin_url_paths');
$adminPaths[] = AdminRootController::config()->get('url_base') . '/'; $adminPaths[] = AdminRootController::admin_url();
$currentPath = rtrim($request->getURL(), '/') . '/'; $currentPath = rtrim($request->getURL(), '/') . '/';
foreach ($adminPaths as $adminPath) { foreach ($adminPaths as $adminPath) {
if (substr($currentPath, 0, strlen($adminPath)) === $adminPath) { if (substr($currentPath, 0, strlen($adminPath)) === $adminPath) {