<?php
function setDirTree($_dirTree) {
if(!empty($_dirTree) && is_string($_dirTree)) {
if(preg_match('`^\.\/[^\.\.\/]`si', $_dirTree)) {
chdir('.');
$_dirTree = str_replace('./','',$_dirTree);
}
if(preg_match('`^(\.\/)?[\.\.\/]{1,}`si', $_dirTree, $matches)) {
chdir($matches[0]);
$_dirTree = str_replace($matches[0],'',$_dirTree);
}
$path = explode('/', $_dirTree);
if(!is_dir($path[0])) {
mkdir($path[0]);
}
chdir($path[0]);
array_shift($path);
$path = implode('/', $path);
setDirTree($path);
}
}
?>