This repository was archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowse.php
executable file
·76 lines (65 loc) · 1.69 KB
/
browse.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
include_once ("./imagedb.inc.php");
include_once ("./components.inc.php");
/* if we don't have a container, we have nothing to browse! */
if (isset($CONTAINER) == false)
{
header("Location: index.php");
exit;
}
/* redirect to the root of the library if none specified */
if (isset($PATH) == false)
{
header("Location: " . buildGetURL("browse.php", $CONTAINER, "/"));
exit;
}
/* generate a listing of the requested path */
$files = array();
$subdirectories = array();
$directoryPath = concatenatePath($CONTAINER->getPath(), $PATH);
$directory = opendir($directoryPath);
while (($file = readdir($directory)) !== false)
{
/* filter out invisible files */
if (!preg_match("|^\..*$|", $file))
{
if (is_dir(concatenatePath($directoryPath, $file)))
{
/* filter out invisible directories */
$subdirectories[$file] = concatenatePath($PATH, $file);
}
else
{
/* TODO filter out non-image files */
$files[$file] = concatenatePath($PATH, $file);
}
}
}
closedir($directory);
?>
<!DOCTYPE html>
<html>
<head>
<title>ImageDB::<?= $CONTAINER->getName() ?><?= $PATH ?></title>
<link rel="stylesheet" media="screen" type="text/css" href="css/screen.css.php" />
</head>
<body>
<p><?= breadcrumbs() ?></p>
<?php
while (list($file, $filePath) = each ($files))
{
echo "<a href=\"" . buildGetURL("detail.php", $CONTAINER, $filePath) .
"\"><img src=\"" . buildGetURL("image.php", $CONTAINER,
array("path" => $filePath, "thumbnail" => NULL)) .
"\" alt=\"{$file}\" /></a>\n";
}
echo "<ul>\n";
while (list($directory, $filePath) = each ($subdirectories))
{
echo "\t<li><a href=\"" . buildGetURL("browse.php", $CONTAINER,
$filePath) . "\">{$directory}</a></li>\n";
}
echo "</ul>\n";
?>
</body>
</html>