Stuff

$d) ? -1 : 1; } function sort_date($a, $b) { $cal = array("Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep"=> 9, "Oct" => 10, "Nov" => 11, "Dec" => 12); list($d1, $m1, $y1) = split(" ", $a); list($d2, $m2, $y2) = split(" ", $b); if ($y1 != $y2) return ($y1 > $y2) ? -1 : 1; if ($m1 != $m2) return ($cal[$m1] > $cal[$m2]) ? -1 : 1; return ($d1 > $d2) ? -1 : 1; } $desc_tab[] = ""; if (file_exists('./stuff/DESC')) { if (($fd = fopen('./stuff/DESC', 'r')) != false) { while ($line = fgets($fd, 300)) { $line = chop($line); if (!ereg("^$", $line)) { if (ereg("\|", $line)) { list($file, $desc) = split("\|", $line); $desc_tab[$file] = $desc; } } } fclose($fd); } } $handle = opendir('./stuff'); while (($file = readdir($handle)) != false) { if ($file != "." && $file != ".." && $file != "DESC") { $lmodif = filemtime("./stuff/$file"); $lmodif = gmdate("d M Y", $lmodif); $size = filesize("./stuff/$file"); if ($size >= 1024) { $size /= 1024; $size = (int) $size; $size = "$size k"; } else { $size = (int) $size; } if (ereg(".png", $file) || ereg(".jpg", $file) || ereg(".gif", $file)) $type = "Image"; elseif (ereg(".sh", $file) || ereg(".pl", $file) || ereg(".pl.gz", $file) || ereg(".phps", $file)) $type = "Script"; elseif (ereg(".gz", $file) || ereg(".tgz", $file) || ereg(".zip", $file)) $type = "Archive"; elseif (ereg(".txt", $file)) $type = "Text"; elseif (ereg(".pdf", $file)) $type = "Doc"; elseif (ereg(".mp3", $file) || ereg(".ogg", $file)) $type = "Music"; else $type = "Unknow"; $desc = ""; while (list($key, $val) = each($desc_tab)) { if ($key == $file) { $desc = $val; } } reset($desc_tab); if ($S == "T") $sort_elt = $type; elseif ($S == "N") $sort_elt = $file; elseif ($S == "L") $sort_elt = $lmodif; elseif ($S == "S") $sort_elt = $size; else $sort_elt = $type; $list["$sort_elt $file"] = ""; $tab[] = "$sort_elt $file"; } } closedir($handle); if (count($tab)) { if ($S == "T") asort($tab); elseif ($S == "N") asort($tab); elseif ($S == "L") usort($tab, "sort_date"); elseif ($S == "S") usort($tab, "sort_size"); else asort($tab); while (list($cle, $val) = each($tab)) { echo "$list[$val]\n"; } } ?>
 
Type Name Description Last modified Size

$type$file$desc$lmodif$size

homejulien@mulot.org