commit 8cc74c0d1903b00af705556450cf79a53b8ad1fb
parent bf63e9cd2a38f95265e72973a4eb57ec6f9cb694
Author: markseu <mark2011@mayberg.se>
Date: Tue, 29 Jul 2014 16:21:48 +0200
Better location handling (bugfix for junibreh)
Diffstat:
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
@@ -1,4 +1,4 @@
-Yellow 0.3.8
+Yellow 0.3.9
============
Yellow is for people who make websites. [Visit website](http://datenstrom.se/yellow).
diff --git a/system/core/core.php b/system/core/core.php
@@ -5,7 +5,7 @@
// Yellow main class
class Yellow
{
- const Version = "0.3.8";
+ const Version = "0.3.9";
var $page; //current page
var $pages; //pages from file system
var $config; //configuration
@@ -1510,31 +1510,34 @@ class YellowToolbox
function findChildrenFromLocation($location, $pathBase, $pathHome, $fileDefault, $fileExtension)
{
$fileNames = array();
- $path = empty($location) ? $pathBase : $this->findFileFromLocation($location, $pathBase, $pathHome, "", "");
- foreach($this->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
+ if(empty($location) || !$this->isFileLocation($location))
{
- $token = $fileDefault;
- if(!is_file($path.$entry."/".$fileDefault))
+ $path = empty($location) ? $pathBase : $this->findFileFromLocation($location, $pathBase, $pathHome, "", "");
+ foreach($this->getDirectoryEntries($path, "/.*/", true, true, false) as $entry)
{
- $fileFolder = $this->normaliseName($entry).$fileExtension;
- $regex = "/^[\d\-\_\.]*($fileDefault|$fileFolder)$/";
- foreach($this->getDirectoryEntries($path.$entry, $regex, true, false, false) as $entry2)
+ $token = $fileDefault;
+ if(!is_file($path.$entry."/".$fileDefault))
{
- if($this->normaliseName($entry2) == $fileDefault) { $token = $entry2; break; }
- if($this->normaliseName($entry2) == $fileFolder) { $token = $entry2; break; }
+ $fileFolder = $this->normaliseName($entry).$fileExtension;
+ $regex = "/^[\d\-\_\.]*($fileDefault|$fileFolder)$/";
+ foreach($this->getDirectoryEntries($path.$entry, $regex, true, false, false) as $entry2)
+ {
+ if($this->normaliseName($entry2) == $fileDefault) { $token = $entry2; break; }
+ if($this->normaliseName($entry2) == $fileFolder) { $token = $entry2; break; }
+ }
}
+ array_push($fileNames, $path.$entry."/".$token);
}
- array_push($fileNames, $path.$entry."/".$token);
- }
- if(!empty($location))
- {
- $fileFolder = $this->normaliseName(basename($path)).$fileExtension;
- $regex = "/^.*\\".$fileExtension."$/";
- foreach($this->getDirectoryEntries($path, $regex, true, false, false) as $entry)
+ if(!empty($location))
{
- if($this->normaliseName($entry) == $fileDefault) continue;
- if($this->normaliseName($entry) == $fileFolder) continue;
- array_push($fileNames, $path.$entry);
+ $fileFolder = $this->normaliseName(basename($path)).$fileExtension;
+ $regex = "/^.*\\".$fileExtension."$/";
+ foreach($this->getDirectoryEntries($path, $regex, true, false, false) as $entry)
+ {
+ if($this->normaliseName($entry) == $fileDefault) continue;
+ if($this->normaliseName($entry) == $fileFolder) continue;
+ array_push($fileNames, $path.$entry);
+ }
}
}
return $fileNames;