From 61743f2cacbd0b5968e0810d1e53181fc3abe087 Mon Sep 17 00:00:00 2001 From: Gautham Warrier Date: Tue, 4 Mar 2014 17:06:29 +0530 Subject: [PATCH 1/2] Fix incompatibility issue with PHP < 5.4 --- libs/live.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/live.php b/libs/live.php index e5d71d5..474b9c0 100644 --- a/libs/live.php +++ b/libs/live.php @@ -30,7 +30,10 @@ if (is_file($docs_path . "/index.md")) return $docs_path . "/index.md"; else { if (empty($options['languages'])) return $base_doc; - else return $base_doc[array_keys($base_doc)[0]]; + else { + $t = array_keys($base_doc); + return $base_doc[$t[0]]; + } } } else { $url = explode("/", $url); From 49c23d4a6ba8633f6f4361b26196728105e3f69f Mon Sep 17 00:00:00 2001 From: Gautham Warrier Date: Tue, 4 Mar 2014 17:28:20 +0530 Subject: [PATCH 2/2] Add additional checks for invalid request. --- libs/live.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/live.php b/libs/live.php index 474b9c0..b5546f6 100644 --- a/libs/live.php +++ b/libs/live.php @@ -7,7 +7,9 @@ $b = explode('/', clean_url($page, "Live")); $output_language = $b[0]; } - return generate_page(clean_url_to_file($page)); + $file = clean_url_to_file($page); + if (!is_file($file)) $file = FALSE; + return generate_page($file); } // Clean Live Url @@ -39,8 +41,10 @@ $url = explode("/", $url); $file = $docs_path; foreach ($url as $part) { - $dirs = array_keys($tree); - $key = array_search($part, array_map("clean_live", $dirs)); + if (isset($tree)) { + $dirs = array_keys($tree); + $key = array_search($part, array_map("clean_live", $dirs)); + } else $key = FALSE; if ($key === FALSE) { return FALSE; }