From 6fc52ae10ea0e4c7081833ff220a623f79a3bf78 Mon Sep 17 00:00:00 2001 From: Brandon O'Casey Date: Thu, 11 Dec 2014 11:26:33 -0500 Subject: [PATCH] Fixed a bug where index was always used rather than the actual first_page --- libs/daux.php | 7 +++++-- libs/daux_helper.php | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libs/daux.php b/libs/daux.php index 45d3764..78393eb 100644 --- a/libs/daux.php +++ b/libs/daux.php @@ -46,6 +46,9 @@ $request = DauxHelper::get_request(); $request = urldecode($request); $request_type = isset($query['method']) ? $query['method'] : ''; + if($request == 'first_page') { + $request = $this->tree->first_page->uri; + } switch ($request_type) { case 'DauxEdit': if ($this->options['file_editor']) { @@ -105,7 +108,7 @@ if (!is_dir($this->docs_path) && !is_dir($this->docs_path = $this->local_base . DIRECTORY_SEPARATOR . $this->docs_path)) { $this->generate_error_page('Docs Directory not found', 'The Docs directory does not exist. Check the path again : ' . $this->docs_path, ErrorPage::FATAL_ERROR_TYPE); - return; + return; } if (!isset($global_config['valid_markdown_extensions'])) static::$VALID_MARKDOWN_EXTENSIONS = array('md', 'markdown'); @@ -335,4 +338,4 @@ } - ?> \ No newline at end of file + ?> diff --git a/libs/daux_helper.php b/libs/daux_helper.php index c330832..ece6258 100644 --- a/libs/daux_helper.php +++ b/libs/daux_helper.php @@ -33,7 +33,7 @@ if ($filename[0] == '' || is_numeric($filename[0])) unset($filename[0]); else { $t = $filename[0]; - if ($t[0] == '-') $filename[0] = substr($t, 1); + if ($t[0] == '-') $filename[0] = substr($t, 1); } $filename = implode(' ', $filename); return $filename; @@ -49,7 +49,7 @@ if ($filename[0] == '' || is_numeric($filename[0])) unset($filename[0]); else { $t = $filename[0]; - if ($t[0] == '-') $filename[0] = substr($t, 1); + if ($t[0] == '-') $filename[0] = substr($t, 1); } $filename = implode('_', $filename); return $filename; @@ -97,12 +97,12 @@ } else return false; $uri = str_replace(array('//', '../'), '/', trim($uri, '/')); - if ($uri == "") $uri = "index"; + if ($uri == "") $uri = "first_page"; return $uri; } public static function configure_theme($theme, $base_url, $local_base, $theme_url, $mode = Daux::LIVE_MODE) { - $name = static::pathinfo($theme); + $name = static::pathinfo($theme); if (is_file($theme)) { $theme = file_get_contents($theme); $theme = json_decode($theme, true); @@ -230,7 +230,7 @@ EOT; $entry = new Directory_Entry($path, $new_parents); if ($mode === Daux::STATIC_MODE) $entry->uri .= '.html'; } - if ($entry instanceof Directory_Entry) $node->value[$entry->uri] = $entry; + if ($entry instanceof Directory_Entry) $node->value[$entry->uri] = $entry; } $node->sort(); $node->first_page = $node->get_first_page(); @@ -360,4 +360,4 @@ EOT; } -?> \ No newline at end of file +?>