Exclude git directories from path traversal

This commit is contained in:
Matthias Gutjahr 2014-04-25 10:39:47 +02:00
parent 041994aa58
commit dfd0261cda

View File

@ -1810,7 +1810,7 @@ function serendipity_traversePath($basedir, $dir='', $onlyDirs = true, $pattern
if ($aExcludeDirs === null) {
// add _vti_cnf to exclude possible added servers frontpage extensions
// add ckeditor/kcfinders .thumb dir to exclude, since no hook
$aExcludeDirs = array("CVS" => true, ".svn" => true, ".thumbs" => true, "_vti_cnf" => true);
$aExcludeDirs = array("CVS" => true, ".svn" => true, ".thumbs" => true, "_vti_cnf" => true, ".git" => true);
}
$odir = serendipity_dirSlash('end', $basedir) . serendipity_dirSlash('end', $dir);
@ -1828,6 +1828,9 @@ function serendipity_traversePath($basedir, $dir='', $onlyDirs = true, $pattern
if ($onlyDirs === false || $bIsDir) {
if ($bPatternMatch &&
(!$bIsDir || $aExcludeDirs == null || !isset($aExcludeDirs[$file]))) {
if ($file == '.git') {
echo $file;
}
$files[] = array(
'name' => $file,
'depth' => $depth,