prevents debug users from exploring system's directory structure * ex: $root = $_SERVER['DOCUMENT_ROOT']; */ function path($dir) { return mb_substr($dir,-1)=='/' ? $dir : $dir.'/'; } function is_top($dir) { global $root; return strlen($dir)>strlen($root); } function is_low($dir) { global $root; return substr($dir,0,strlen($root))==$root; } $root = path(realpath($_POST['root'])); if (!$root) exit("ERROR: Root filesystem directory not set in jqueryFileTree.php"); $docroot = '/usr/local/emhttp'; require_once "$docroot/webGui/include/Secure.php"; $rootdir = path(realpath($_POST['dir'])); $filters = (array)($_POST['filter']); $match = unbundle($_POST['match']); $checkbox = $_POST['multiSelect']=='true' ? "" : ""; echo "