protected function getSubpaths($dirpath, $low, $high) { $paths = array(); $depth = $high; $isTop = 1; do { if (!pStudio::isAuthApp($GLOBALS['patchwork_path'][PATCHWORK_PATH_LEVEL - $depth])) { --$depth; continue; } if ('' !== $dirpath) { $path = patchworkPath($dirpath, $depth, $depth, 0); } else { if ($depth < 0) { if (!pStudio::isAuthRead('class')) { break; } if (isset($paths['class'])) { ++$paths['class']['ancestorsNb']; } else { $paths['class'] = array('name' => 'class', 'isTop' => $isTop, 'isDir' => 1, 'ancestorsNb' => 0, 'depth' => $depth); } break; } else { $path = $GLOBALS['patchwork_path'][PATCHWORK_PATH_LEVEL - $depth]; } } if (!$path || $depth < $low) { break; } $h = @opendir($path); if (!$h) { break; } while (false !== ($file = readdir($h))) { if ('.' !== $file && '..' !== $file) { if (isset($paths[$file])) { ++$paths[$file]['ancestorsNb']; } else { $isDir = is_dir($path . $file) - 0; if (!pStudio::isAuthRead($dirpath . $file . ($isDir ? '/' : ''))) { continue; } $paths[$file] = array('name' => $file, 'isTop' => $isTop, 'isDir' => $isDir, 'path' => $path . $file, 'ancestorsNb' => 0, 'depth' => $depth, 'appname' => pStudio::getAppname($depth), 'isApp' => $isDir && file_exists($path . $file . '/config.patchwork.php')); } } } closedir($h); --$depth; $isTop = 0; } while ($depth >= $low); usort($paths, array($this, 'pathCmp')); return $paths; }
function filterApp($o) { $depth = PATCHWORK_PATH_LEVEL - $o->KEY; $o = (object) array('name' => pStudio::getAppname($depth), 'depth' => $depth, 'path' => $o->VALUE); return $o; }