function mkDirs($strPath, $mode = 0700) //creates directory tree recursively
{
if ( is_dir($strPath) ) return true;
if ( mkDirs(dirname($strPath), $mode) ) return mkdir($strPath, $mode);
return false;
}
function mkFile($filename, $string) //dumps file with a directory tree
{
return mkDirs(dirname($filename)) and file_put_contents($filename, $string);
}