|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69140 - in website/public_html/beta: common/code doc
From: dnljms_at_[hidden]
Date: 2011-02-22 04:17:15
Author: danieljames
Date: 2011-02-22 04:17:12 EST (Tue, 22 Feb 2011)
New Revision: 69140
URL: http://svn.boost.org/trac/boost/changeset/69140
Log:
Directory listings in documentation.
Text files modified:
website/public_html/beta/common/code/boost_archive.php | 71 ++++++++++++++++++++++++++++++++++++---
website/public_html/beta/doc/.htaccess | 5 --
2 files changed, 64 insertions(+), 12 deletions(-)
Modified: website/public_html/beta/common/code/boost_archive.php
==============================================================================
--- website/public_html/beta/common/code/boost_archive.php (original)
+++ website/public_html/beta/common/code/boost_archive.php 2011-02-22 04:17:12 EST (Tue, 22 Feb 2011)
@@ -57,14 +57,46 @@
// Check file exists.
- $check_file = $params['zipfile'] ? $params['archive'] : $params['file'];
+ if ($params['zipfile'])
+ {
+ $check_file = $params['archive'];
+
+ if (!is_file($check_file)) {
+ file_not_found($params, 'Unable to find zipfile.');
+ return;
+ }
+ }
+ else
+ {
+ $check_file = $params['file'];
+
+ if (is_dir($check_file))
+ {
+ if(substr($check_file, -1) != '/') {
+ $redirect = resolve_url(basename($check_file).'/');
+ header("Location: $redirect", TRUE, 301);
+ return;
+ }
- if (!is_file($check_file)) {
- file_not_found($params,
- $params['zipfile'] ?
- 'Unable to find zipfile.' :
- 'Unable to find file.');
- return;
+ $found_file = NULL;
+ if (is_file("$check_file/index.html")) $found_file = 'index.html';
+ else if (is_file("$check_file/index.htm")) $found_file = 'index.htm';
+
+ if ($found_file) {
+ $params['file'] = $check_file = $check_file.$found_file;
+ $params['key'] = $params['key'].$found_file;
+ }
+ else {
+ if (!http_headers('text/html', filemtime($check_file), $expires))
+ return;
+
+ return display_dir($params, $check_file);
+ }
+ }
+ else if (!is_file($check_file)) {
+ file_not_found($params, 'Unable to find file.');
+ return;
+ }
}
// Choose filter to use
@@ -226,6 +258,31 @@
);
}
+function display_dir($params, $dir)
+{
+ $handle = opendir($dir);
+
+ $title = htmlentities("Index listing for $params[key]");
+
+ $params['title'] = $title;
+
+ $content = "<h3>$title</h3>\n<ul>\n";
+
+ while (($file = readdir($handle)) !== false)
+ {
+ if (substr($file, 0, 1) != '.') {
+ $file_html = htmlentities($file);
+ $content .= "<li><a href='$file'>$file</a></li>\n";
+ }
+ }
+
+ $content .= "</ul>\n";
+
+ $params['content'] = $content;
+
+ display_template($params['template'], boost_archive_render_callbacks($content, $params));
+}
+
function display_raw_file($params, $type)
{
## header('Content-Disposition: attachment; filename="downloaded.pdf"');
Modified: website/public_html/beta/doc/.htaccess
==============================================================================
--- website/public_html/beta/doc/.htaccess (original)
+++ website/public_html/beta/doc/.htaccess 2011-02-22 04:17:12 EST (Tue, 22 Feb 2011)
@@ -26,11 +26,6 @@
RewriteRule ^libs/release(/.*)?$ libs/1_46_0$1 [R]
RewriteRule ^libs/development(/.*)?$ libs/1_46_0$1 [R]
-#~ # In case we don't get a file looking URI we send it to the index.html file.
-#~ # - With some exceptions.
-RewriteCond %{REQUEST_URI} !/(Jamroot|Jamfile|ChangeLog)$
-RewriteRule ^libs/([0-9_]+(?:beta[0-9]*)?)/([^.]*[^./])/?$ libs/$1/$2/index.html [R]
-
# Rewrite specific versions to the dynamic handlers.
RewriteRule ^libs/([0-9_]+(?:beta[0-9]*)?)/?$ libraries.php/$1 [L]
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk