diff --git a/admin.php b/admin.php index e3ad7f56..21185760 100644 --- a/admin.php +++ b/admin.php @@ -129,7 +129,7 @@ class AdminPlugin extends Plugin $home = '/' . trim($this->config->get('system.home.alias'), '/'); // set the default if not set before - $this->session->expert = $this->session->expert ?: true; + $this->session->expert = $this->session->expert ?: false; // set session variable if it's passed via the url if ($this->uri->param('mode') == 'expert') { @@ -143,12 +143,16 @@ class AdminPlugin extends Plugin $this->grav['admin']->routes = $pages->routes(); + // Remove default route from routes. + if (isset($this->grav['admin']->routes['/'])) { + unset($this->grav['admin']->routes['/']); + } + $pages->dispatch('/', true)->route($home); // Make local copy of POST. $post = !empty($_POST) ? $_POST : array(); - // Handle tasks. $this->admin->task = $task = !empty($post['task']) ? $post['task'] : $this->uri->param('task'); if ($task) { diff --git a/classes/admin.php b/classes/admin.php index 4626c673..6209ae42 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -136,7 +136,7 @@ class Admin public function authenticate($form) { if (!$this->user->authenticated && isset($form['username']) && isset($form['password'])) { - $file = CompiledYamlFile::instance(ACCOUNTS_DIR . $form['username'] . YAML_EXT); + $file = CompiledYamlFile::instance($this->grav['locator']->findResource('account://' . $form['username'] . YAML_EXT)); if ($file->exists()) { $user = new User($file->content()); $user->authenticated = true; @@ -198,7 +198,7 @@ class Admin public function blueprints($type) { if ($this->blueprints === null) { - $this->blueprints = new Data\Blueprints(SYSTEM_DIR . '/blueprints/'); + $this->blueprints = new Data\Blueprints($this->grav['locator']->findResource('blueprints://')); } return $this->blueprints->get($type); } @@ -231,7 +231,7 @@ class Admin $config = $this->grav['config']; $obj = new Data\Data($config->get('system'), $blueprints); $obj->merge($post); - $file = CompiledYamlFile::instance(USER_DIR . "config/{$type}.yaml"); + $file = CompiledYamlFile::instance($this->grav['locator']->findResource("user://config/{$type}.yaml")); $obj->file($file); $data[$type] = $obj; break; @@ -243,7 +243,7 @@ class Admin $config = $this->grav['config']; $obj = new Data\Data($config->get('site'), $blueprints); $obj->merge($post); - $file = CompiledYamlFile::instance(USER_DIR . "config/{$type}.yaml"); + $file = CompiledYamlFile::instance($this->grav['locator']->findResource("user://config/{$type}.yaml")); $obj->file($file); $data[$type] = $obj; break; @@ -350,7 +350,7 @@ class Admin public function logs() { if (!isset($this->logs)) { - $file = LogFile::instance(LOG_DIR . 'exception.log'); + $file = LogFile::instance($this->grav['locator']->findResource('log://exception.log')); $content = $file->content(); @@ -405,7 +405,7 @@ class Admin */ public function logEntry() { - $file = File::instance(LOG_DIR . $this->route . '.html'); + $file = File::instance($this->grav['locator']->findResource("log://{$this->route}.html")); $content = $file->content(); return $content; diff --git a/classes/popularity.php b/classes/popularity.php index cdfc8920..ab840317 100644 --- a/classes/popularity.php +++ b/classes/popularity.php @@ -38,7 +38,7 @@ class Popularity { $this->config = self::$grav['config']; - $this->data_path = LOG_DIR . 'popularity'; + $this->data_path = self::$grav['locator']->findResource('log://') . 'popularity'; $this->daily_file = $this->data_path.'/'.self::DAILY_FILE; $this->monthly_file = $this->data_path.'/'.self::MONTHLY_FILE; $this->totals_file = $this->data_path.'/'.self::TOTALS_FILE; diff --git a/themes/grav/templates/pages.html.twig b/themes/grav/templates/pages.html.twig index 85a7a04c..8a64ca6d 100644 --- a/themes/grav/templates/pages.html.twig +++ b/themes/grav/templates/pages.html.twig @@ -122,7 +122,7 @@ {% endif %} - {% if admin.session.expert == '1' %} + {% if admin.session.expert == '0' %} {% include 'partials/blueprints-raw.html.twig' with { blueprints: admin.blueprints('pages/'~modular~'raw'), data: context } %} {% else %}