Subversion Repositories SvarDOS

Rev

Rev 832 | Rev 847 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
835 mateusz.vi 1
<h1>SvarDOS files</h1>
832 mateusz.vi 2
<p class="copyr">latest build, archival versions, staging releases... it's all here!</p>
3
 
4
<?php
5
 
6
function nice_filesize($f) {
7
  $res = filesize($f);
8
  if ($res > 1024 * 1024) {
9
    $res = round($res / (1024 * 1024), 2) . ' MiB';
10
  } else {
11
    $res = round($res / 1024, 2) . ' KiB';
12
  }
13
  return($res);
14
}
15
 
16
 
17
chdir('download');
18
$dir = '.';
19
 
20
if (!empty($_GET['dir'])) {
21
  $dir = $_GET['dir'];
22
  if (!preg_match('/^[0-9]{8}(\.staging){0,1}$/', $dir)) {
23
    echo '<p style="font-size: 2em; text-align: center; font-weight: bold;">I AM WATCHING YOU</p>';
24
    exit(0);
25
  }
26
}
27
 
28
if ($dir == '.') {
29
  $flist = scandir($dir, SCANDIR_SORT_DESCENDING);
30
} else {
31
  $flist = scandir($dir);
32
}
33
 
34
echo "<div style=\"margin: 0 auto; width: -moz-fit-content; width: fit-content;\">\n";
35
 
36
if (strlen($dir) > 1) {
37
  echo "<h2>BUILD: {$dir}</h2>\n";
38
  echo '<a href="?p=files">[back to root]</a><br>' . "\n";
39
} else {
40
  echo "<h2>AVAILABLE BUILDS:</h2>\n";
41
}
42
 
43
echo "<br>\n";
44
 
45
echo "<table style=\"border: 1px #888 solid; min-width: 10em;\">\n";
46
 
47
foreach ($flist as $f) {
48
  if ($f[0] == '.') continue;
49
  if (preg_match('/\.php$/', $f)) continue;
50
 
51
  echo '<tr><td style="padding: 0 1em;">';
52
 
53
  if (is_dir($dir . '/' . $f)) {
54
    echo "<a href=\"?p=files&amp;dir={$f}\">{$f}</a>";
55
  } else {
56
    echo "<a href=\"download/{$dir}/{$f}\">{$f}</a>";
57
    echo "</td><td style=\"padding: 0 1em 0 2em; color: #222;\">" . nice_filesize($dir . '/' . $f);
58
  }
59
 
60
  echo "</td></tr>\n";
61
 
62
}
63
 
64
echo "</table>\n";
65
 
66
echo "</div>\n";
67
 
68
?>