source: trunk/www/downloads/index.php @ 19376

Last change on this file since 19376 was 19376, checked in by yeled@…, 14 years ago

add svn:keywords Id

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 944 bytes
RevLine 
[14587]1  <?php
2    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
3    include_once("$DOCUMENT_ROOT/includes/common.inc");
4    include_once("$DOCUMENT_ROOT/includes/functions.inc");
5    print_header('DarwinPorts Downloads', 'iso-8859-1');
6  ?>
7
8    <div id="content">
9       
10                <h2 class="hdr">Available Downloads</h2>
[17280]11                <table>
[14587]12<?php
[17223]13$dir=".";
14
15// Read files from the dirctory
16$files = array();
17$rep=opendir($dir);
18while ($file = readdir($rep)) {
19        if (   preg_match('/^(\..*)|(.*\.php)$/', $file)
20                || is_dir($file)
[17280]21           ) {
[17223]22                continue;
[17280]23        }
24       
25        // Add file to array, as key, with modtime as value
26        $files[$file] = filemtime($file);
[14587]27}
[15226]28closedir($rep);
[17223]29
[17280]30// Sort the array in reverse order by value (modtime)
31arsort($files);
[17223]32
33// Emit the files, with dates
[17280]34foreach ($files as $f => $t) {
35        echo "<tr>";
36        echo "<td>".date("d-M-Y G:i", $t)."</td><td><a href=\"/downloads/$f\">$f</a></td>\n";
37        echo "</tr>";
[17223]38}
[14587]39?>
[17280]40                </table>
[14587]41    </div>
42  </div>
43
44<?php
45  print_footer();
46?>
Note: See TracBrowser for help on using the repository browser.