function show_dir($path, $dir) { global $newPath, $BASE_DIR, $BASE_URL; $num_files = num_files($BASE_DIR . $path); ?> <td> <table width="102" border="0" cellpadding="0" cellspacing="2"> <tr> <td align="center" class="imgBorder" onMouseOver="pviiClassNew(this,'imgBorderHover')" onMouseOut="pviiClassNew(this,'imgBorder')"> <a href="files.php?dir=<?php echo $path; ?> " onClick="changeLoadingStatus('load')"> <img src="images/folder.gif" width="80" height="80" border=0 alt="<?php echo $dir; ?> "> </a> </td> </tr> <tr> <td><table width="100%" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="1%" class="buttonOut" onMouseOver="pviiClassNew(this,'buttonHover')" onMouseOut="pviiClassNew(this,'buttonOut')"> <a href="files.php?delFolder=<?php echo $BASE_URL . $path; ?> &dir=<?php echo $newPath; ?> " onClick="return deleteFolder('<?php echo $dir; ?> ', <?php echo $num_files; ?> );"><img src="images/edit_trash.gif" width="15" height="15" border="0"></a></td> <td width="99%" class="imgCaption"><?php echo $dir; ?> </td> </tr> </table></td> </tr> </table> </td> <?php }
function outputDirectoryListing($newdir) { $dir = opendir($newdir); $resultList = array(); if ($dir) { while (($file = readdir($dir)) !== false) { if ($file !== "." && $file !== ".." && $file != "migThumbs" && $file != ".DS_Store") { $mtime = filemtime($newdir . $file); if (is_file($newdir . $file)) { $type = "file"; $size = shell_exec("du -k " . $newdir . $file); $chars = preg_split("/[\\s,]*\\\"([^\\\"]+)\\\"[\\s,]*|" . "[\\s,]*'([^']+)'[\\s,]*|" . "[\\s,]+/", $size, -1, PREG_SPLIT_OFFSET_CAPTURE); //print_r($chars); $size = $chars[0][0]; $createthumb = preg_match_all('/^.*\\.(jpg|jpeg|png|gif|tiff|tiff|bmp|mov|m4v|flv|f4v|mp4)$/i', $file, $arr, PREG_PATTERN_ORDER); $childrencount = 0; } else { $type = "folder"; $size = dirsize($newdir . $file); $createthumb = 0; $childrencount = num_files($newdir . $file, 3); } $size *= 1024; //$size = byteSize($size); $arr = array("name" => $file, "createdate" => $mtime, "size" => $size, "type" => $type, "createthumb" => $createthumb, "childrencount" => $childrencount); array_push($resultList, $arr); } } serializeArray($resultList); closedir($dir); } }