function showFilesPath($filesArr, $pathArr, $level = 0) { ?> <ul> <?php if ($level >= sizeof($pathArr)) { ?> </ul> <?php return; } $link = getPartPath($pathArr, $level); foreach ($filesArr[$level] as $key => $file) { if (is_dir(CONTAINER . $link . $file)) { ?> <li class="folder"><a href="?filename=<?php echo $link . $file; ?> "><?php echo $file; ?> </a></li> <?php } else { ?> <li class="file"><a href="?filename=<?php echo $link . $file; ?> "><?php echo $file; ?> </a></li> <?php } if (isset($pathArr[$level + 1]) && $file == $pathArr[$level + 1]) { ?> <li><?php showFilesPath($filesArr, $pathArr, ++$level); ?> </li> <?php } } ?> </ul> <?php }
<div class="container"> <form action="<?php echo $_SERVER['PHP_SELF'] . '?filename=' . $path; ?> " method="POST"> <table> <tr id="note-head"> <td><input type="submit" name="edit" value="Save"></td> <td class="logo">Notepad+-</td> </tr> <tr> <td id="folders"> <?php $pathArr = getPathArr($path); $filesArr = getFilesArr($pathArr); showFilesPath($filesArr, $pathArr); ?> </td> <td id="textfield"> <?php if (isset($_GET['filename'])) { ?> <div class="textwrapper"> <textarea name="content" id="text"><?php if (is_file(CONTAINER . $path)) { $file = file_get_contents(CONTAINER . $path); echo $file; } elseif (is_dir(CONTAINER . $path)) { echo end($pathArr); } ?>