From 6e9d542022d612e5352e4ad4c8bf25bbea530c4a Mon Sep 17 00:00:00 2001 From: "mckenzierobotics.org" Date: Mon, 5 Sep 2011 14:41:25 -0700 Subject: Fix a nasty bug in View.class.php when the installation path contains a dot --- src/lib/View.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/View.class.php b/src/lib/View.class.php index ea5ad60..f0afa39 100644 --- a/src/lib/View.class.php +++ b/src/lib/View.class.php @@ -40,8 +40,9 @@ class View { // Make a list of candidate extensions for this view. $files = glob(self::filename($view, '*')); $this->extensions = array(); + $regex = '@'.preg_quote(VIEWPATH,'@').'[^.]*\.(.*)\.php$@'; foreach ($files as $file) { - $ext = preg_replace('@[^.]*\.(.*)\.php$@','$1', $file); + $ext = preg_replace($regex, '$1', $file); $this->extensions[] = $ext; } if (count($this->extensions)<1) return false; @@ -77,9 +78,9 @@ class View { // extension, and the value is how much we like that extension. // Higher numbers are better. $prefs = array(); - + $accept = new HTTP_Accept($accept_str); - + // Loop through the candidate views, and record how much we // like each. foreach ($this->extensions as $ext) { @@ -92,7 +93,7 @@ class View { $prefs[$ext] = $quality; } } - + // Create an array of all extensions tied for the top quality. $ret = array(); $top_quality = 0.001;// minimum acceptable according to RFC 2616 -- cgit v1.2.3-2-g168b