forked from CYGNUS-RD/reconstruction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
131 lines (129 loc) · 4.22 KB
/
index.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<html>
<head>
<title><?php echo getcwd(); ?></title>
<style type='text/css'>
body {
font-family: "Candara", sans-serif;
font-size: 9pt;
line-height: 10.5pt;
}
div.pic h3 {
font-size: 11pt;
margin: 0.5em 1em 0.2em 1em;
}
div.pic p {
font-size: 11pt;
margin: 0.2em 1em 0.1em 1em;
}
div.pic {
display: block;
float: left;
background-color: white;
border: 1px solid #ccc;
padding: 2px;
text-align: center;
margin: 2px 10px 10px 2px;
-moz-box-shadow: 7px 5px 5px rgb(80,80,80); /* Firefox 3.5 */
-webkit-box-shadow: 7px 5px 5px rgb(80,80,80); /* Chrome, Safari */
box-shadow: 7px 5px 5px rgb(80,80,80); /* New browsers */
width: 320px;
}
a { text-decoration: none; color: rgb(80,0,0); }
a:hover { text-decoration: underline; color: rgb(255,80,80); }
div.dirlinks h2 { margin-bottom: 4pt; margin-left: -24pt; color: rgb(80,0,0); }
div.dirlinks { margin: 0 24pt; }
div.dirlinks a {
font-size: 11pt; font-weight: bold;
padding: 0 0.5em;
}
</style>
</head>
<body>
<h1><?php echo getcwd(); ?></h1>
<?php
$has_subs = false;
foreach (glob("*") as $filename) {
if (is_dir($filename) && !preg_match("/^\..*|.*private.*/", $filename)) {
$has_subs = true;
break;
}
}
if ($has_subs) {
print "<div class=\"dirlinks\">\n";
print "<h2>Directories</h2>\n";
print "<a href=\"../\">[parent]</a> ";
foreach (glob("*") as $filename) {
if (is_dir($filename) && ($_SERVER['PHP_AUTH_USER'] == 'gpetrucc' || !preg_match("/^\..*|.*private.*/", $filename))) {
print " <a href=\"$filename\">[$filename]</a>";
}
}
print "</div>";
}
foreach (array("00_README.txt", "README.txt", "readme.txt") as $readme) {
if (file_exists($readme)) {
print "<pre class='readme'>\n"; readfile($readme); print "</pre>";
}
}
?>
<h2><a name="plots">Plots</a></h2>
<p><form>Filter: <input type="text" name="match" size="30" value="<?php if (isset($_GET['match'])) print htmlspecialchars($_GET['match']); ?>" /><input type="Submit" value="Go" /><input type="checkbox" name="regexp" <?php if ($_GET['regexp']) print "checked=\"checked\""?> >RegExp</input></form></p>
<div>
<?php
$displayed = array();
if ($_GET['noplots']) {
print "Plots will not be displayed.\n";
} else {
$other_exts = array('.pdf', '.cxx', '.eps', '.root', '.txt', '.dir', '.info');
$filenames = glob("*.png"); sort($filenames);
foreach ($filenames as $filename) {
if (isset($_GET['match'])) {
if (isset($_GET['regexp']) && $_GET['regexp']) {
if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue;
} else {
if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue;
}
}
array_push($displayed, $filename);
$brfname = str_replace("_","_­",$filename);
print "<div class='pic'>\n";
print "<h3><a href=\"$filename\">$brfname</a></h3>";
print "<a href=\"$filename\"><img src=\"$filename\" style=\"border: none; width: 300px; \"></a>";
$others = array();
foreach ($other_exts as $ex) {
$other_filename = str_replace('.png', $ex, $filename);
if (file_exists($other_filename)) {
array_push($others, "<a class=\"file\" href=\"$other_filename\">[" . $ex . "]</a>");
if ($ex != '.txt') array_push($displayed, $other_filename);
}
}
if ($others) print "<p>Also as ".implode(', ',$others)."</p>";
print "</div>";
}
}
?>
</div>
<div style="display: block; clear:both;">
<h2><a name="files">Other files</a></h2>
<ul>
<?
foreach (glob("*") as $filename) {
if ($_GET['noplots'] || !in_array($filename, $displayed)) {
if (isset($_GET['match'])) {
if (isset($_GET['regexp']) && $_GET['regexp']) {
if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue;
} else {
if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue;
}
}
if (is_dir($filename)) {
print "<li>[DIR] <a href=\"$filename\">$filename</a></li>";
} else {
print "<li><a href=\"$filename\">$filename</a></li>";
}
}
}
?>
</ul>
</div>
</body>
</html>