function list_files($user, $err_msg) { $dir = sandbox_dir($user); $d = opendir($dir); if (!$d) { error_page("Can't open sandbox directory"); } page_head("file sandbox for {$user->name}"); echo "\n <form action=sandbox.php method=post ENCTYPE=\"multipart/form-data\">\n <input type=hidden name=action value=upload_file>\n Upload a file to your sandbox:\n <p><input size=80 type=file name=new_file>\n <p> <input type=submit value=Upload>\n </form>\n <hr>\n "; if (strcmp($err_msg, "") != 0) { echo "<p>{$err_msg}<hr>"; } $files = array(); while (($f = readdir($d)) !== false) { if ($f == '.') { continue; } if ($f == '..') { continue; } $files[] = $f; } if (count($files) == 0) { echo "Your sandbox is currently empty."; } else { sort($files); start_table(); table_header("Name<br><span class=note>(click to view)</span>", "Modified", "Size (bytes)", "MD5", "Delete", "Download"); foreach ($files as $f) { $path = "{$dir}/{$f}"; list($error, $size, $md5) = sandbox_parse_link_file($path); if ($error) { table_row($f, "Can't parse link file", "", "<a href=sandbox.php?action=delete_files&name={$f}>delete</a>"); continue; } $p = sandbox_physical_path($user, $md5); if (!is_file($p)) { table_row($f, "Physical file not found", "", ""); continue; } $ct = time_str(filemtime($path)); table_row("<a href=sandbox.php?action=view_file&name={$f}>{$f}</a>", $ct, $size, $md5, button_text("sandbox.php?action=delete_file&name={$f}", "Delete"), button_text("sandbox.php?action=download_file&name={$f}", "Download")); } end_table(); } page_tail(); }
<?php button_text('After this window closes you must click either "Save" or "Cancel" in the editing window. If you click "Preview" your changes will be lost.', "warn"); ?> </p> <form name="vki_getnames"> <table cellspacing='4'> <tr><td> <select id = "vki_names"></select><br /> <tr><td> <input type='submit'class='nine_pt' value = "<?php button_text('Initialize Keyboad', 'button_ini'); ?> " onclick="setKeyboard(true)"> <input type='button' class='nine_pt' value="<?php button_text('Unload Keyboard', 'button_unload'); ?> " onclick="setKeyboard(false)"> <input type='button' class='nine_pt' value="<?php button_text('Exit', 'button_exit'); ?> " onclick="window.close()"> </table> </form> </BODY> </HTML>