Prevent admin plugin to activate when the URL of a page contains its route. Fixes #45

This commit is contained in:
Flavio Copes
2015-08-11 11:07:24 +02:00
parent fe1105c746
commit 4de32052c2

View File

@@ -91,9 +91,9 @@ class AdminPlugin extends Plugin
$this->base = '/' . trim($route, '/');
$this->uri = $this->grav['uri'];
// Only activate admin if we're inside the admin path.
if (substr($this->uri->route(), 0, strlen($this->base)) == $this->base) {
if ($this->uri->route() == $this->base ||
substr($this->uri->route(), 0, strlen($this->base) + 1) == $this->base . '/') {
$this->active = true;
}
}