summaryrefslogtreecommitdiff
path: root/archives/html
diff options
context:
space:
mode:
authorAlvaro Herrera2010-01-09 03:55:06 +0000
committerAlvaro Herrera2010-01-09 03:55:06 +0000
commit9cf7d420bf830b91bcba95e3d4a0e5a6c1b917ec (patch)
tree72ba16b1a6e95a2ef347135e9ccae21d7b837d5b /archives/html
parent712b634b38f4e8399170e9799e224b3c93169d29 (diff)
Avoid assuming that it's possible to have unbounded numbers of entries in a
directory. git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2616 8f5c7a92-453e-0410-a47f-ad33c8a6b003
Diffstat (limited to 'archives/html')
-rw-r--r--archives/html/msgtxt.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/archives/html/msgtxt.php b/archives/html/msgtxt.php
index ee8b02ee..86f7a9d3 100644
--- a/archives/html/msgtxt.php
+++ b/archives/html/msgtxt.php
@@ -7,7 +7,23 @@ $parts = split("@", $id, 2);
header("Content-type: text/plain");
-$filename= "/home/archives/messages/@" . $parts[1] . "/" . $parts[0];
+$dir = substr($parts[1], 0, 2) .
+ "/" .
+ substr($parts[1], 2, 2) .
+ "/@" .
+ $parts[1] .
+ "/" .
+ substr($parts[0], 0, 2) .
+ "/" .
+ substr($parts[0], 2, 2);
+
+
+$filename= $_SERVER['DOCUMENT_ROOT'] . "/../messages/" . $dir . "/" . $id;
+if (!file_exists($filename)) {
+ print "No message with Message-Id " . $_GET["id"] ." found\n";
+ exit;
+}
+
$file = fopen($filename, "r");
if (!$file) {
print "not found\n";