diff --git a/filesystem/File.php b/filesystem/File.php index c46693c2e..242c85b6b 100755 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -310,6 +310,10 @@ class File extends DataObject { $name = ereg_replace(' +','-',trim($name)); $name = ereg_replace('[^A-Za-z0-9.+_\-]','',$name); + while($name[0] == '_' || $name[0] == '.') { + $name = substr($name, 1); + } + // We might have just turned it blank, so check again. if(!$name) $name = 'new-folder'; diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 8a5c469f6..71f9408c4 100755 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -83,12 +83,10 @@ class Folder extends File { if(file_exists($baseDir)) { $actualChildren = scandir($baseDir); foreach($actualChildren as $actualChild) { - if($actualChild[0] == '.') continue; // ignore hidden files - if(substr($actualChild,0,6) == 'Thumbs') continue; // ignore windows cache stuff - if($actualChild == '_resampled') continue; // ignore the resampled copies of images - if($actualChild == '_tmp') continue; // ignore tmp folder for PhotoEditor. - - + if($actualChild[0] == '.' || $actualChild[0] == '_' || substr($actualChild,0,6) == 'Thumbs') { + continue; + } + // A record with a bad class type doesn't deserve to exist. It must be purged! if(isset($hasDbChild[$actualChild])) { $child = $hasDbChild[$actualChild]; @@ -186,6 +184,10 @@ class Folder extends File { $file = ereg_replace('[^A-Za-z0-9+.-]+','',$file); $file = ereg_replace('-+', '-',$file); + while($file[0] == '_' || $file[0] == '.') { + $file = substr($file, 1); + } + $file = $this->RelativePath . $file; Filesystem::makeFolder(dirname("$base/$file"));