function renderFolder($folder) { echo "<li><span class='selectable' id='" . $folder['folder']->id . "'>" . $folder['folder']->title . "</span>"; if (!empty($folder['subfolders'])) { echo "<ul>"; foreach ($folder['subfolders'] as $subfolder) { renderFolder($subfolder); } echo "</ul>"; } echo "</li>"; }
unset($_SESSION['access-token']); echo renderHtmlPage("Unlinked.", "Go back <a href='" . htmlspecialchars(getPath("")) . "'>home</a>."); } else { if ($requestPath === "/") { $dbxClient = getClient(); if ($dbxClient === false) { header("Location: " . getPath("dropbox-auth-start")); exit; } $path = "/"; if (isset($_GET['path'])) { $path = $_GET['path']; } $entry = $dbxClient->getMetadataWithChildren($path); if ($entry['is_dir']) { echo renderFolder($entry); } else { echo renderFile($entry); } } else { if ($requestPath == "/download") { $dbxClient = getClient(); if ($dbxClient === false) { header("Location: " . getPath("dropbox-auth-start")); exit; } if (!isset($_GET['path'])) { header("Location: " . getPath("")); exit; } $path = $_GET['path'];