mirror of
https://github.com/sigmasternchen/Wish
synced 2025-03-15 15:38:54 +00:00
how did that happend?
This commit is contained in:
parent
10c608e039
commit
5f5dcdea47
1 changed files with 27 additions and 0 deletions
27
wish-sys/sys-part/lib/kernel/files.php
Normal file → Executable file
27
wish-sys/sys-part/lib/kernel/files.php
Normal file → Executable file
|
@ -10,4 +10,31 @@
|
||||||
}
|
}
|
||||||
echo json_encode($files);
|
echo json_encode($files);
|
||||||
}
|
}
|
||||||
|
if (isset($_GET['getStructure'])) {
|
||||||
|
if (strpos($_GET['dir'], "../") !== false)
|
||||||
|
die("illegal file path");
|
||||||
|
$dir = $_GET['dir'];
|
||||||
|
|
||||||
|
while (substr($dir, 0, 1) == "/")
|
||||||
|
$dir = substr($dir, 1);
|
||||||
|
|
||||||
|
$base = "../../../../" . $dir;
|
||||||
|
|
||||||
|
$structure = getStructure($base);
|
||||||
|
echo json_encode($structure);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStructure($base) {
|
||||||
|
$result = array();
|
||||||
|
$handle = opendir($base);
|
||||||
|
while ($file = readdir($handle)) {
|
||||||
|
if ($file == "." || $file == "..")
|
||||||
|
continue;
|
||||||
|
if (!is_dir($base . "/" . $file))
|
||||||
|
$result[$file] = file_get_contents($base . "/" . $file);
|
||||||
|
else
|
||||||
|
$result[$file] = getStructure($base . "/" . $file);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue