Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. function iterateDirectory($i) {
  2. $dnumber = 0;
  3. $fnumber = 0;
  4. echo "<ul>";
  5. foreach ($i as $path) {
  6. if ($path->isDir()) {
  7. if (!preg_match('/\.\.$/', $path, $matches)) {
  8. $newpath = replacepath($path);
  9. echo "<li class='directory sortit' id='directory$dnumber'>";
  10. echo "<span class='caret'>";
  11. echo "<a href='delete.php?path=" . $path . "'><button class='btn btn-secondary'>Delete directory</button></a>";
  12. echo $newpath;
  13. iterateDirectory($path);
  14. echo "</span>";
  15. echo '</li>';
  16. $dnumber++;
  17. }
  18. } else {
  19. echo "<li class='file sortit' id='file$fnumber'>";
  20. echo "<a href='delete.php?path=" . $path . "'><button class='btn btn-secondary'>Delete image</button></a>";
  21. echo $path;
  22. echo "</li>";
  23. $fnumber++;
  24. }
  25. }
  26. echo '</ul>';
  27. }
  28.  
  29. function replacepath($oldpath) {
  30. $newpath = "<button class='collapsible'>" . "folder:" . $oldpath . "</button>";
  31. return $newpath;
  32. }
  33.  
  34. $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($curuser));
  35.  
  36. iterateDirectory($iterator);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement