Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65026 - in website/public_html/live: . common/code doc
From: dnljms_at_[hidden]
Date: 2010-08-26 16:43:07


Author: danieljames
Date: 2010-08-26 16:43:01 EDT (Thu, 26 Aug 2010)
New Revision: 65026
URL: http://svn.boost.org/trac/boost/changeset/65026

Log:
Merge some mall documentation improvements from beta.

Removed:
   website/public_html/live/common/code/boost_version.php
Properties modified:
   website/public_html/live/ (props changed)
Text files modified:
   website/public_html/live/common/code/boost.php | 1
   website/public_html/live/common/code/boost_archive.php | 68 +++++++++++++++------------------------
   website/public_html/live/doc/display_libs.php | 33 ++++++++++++++++++-
   website/public_html/live/doc/libraries.php | 40 ++++++++++++++++++++++
   4 files changed, 98 insertions(+), 44 deletions(-)

Modified: website/public_html/live/common/code/boost.php
==============================================================================
--- website/public_html/live/common/code/boost.php (original)
+++ website/public_html/live/common/code/boost.php 2010-08-26 16:43:01 EDT (Thu, 26 Aug 2010)
@@ -4,6 +4,7 @@
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
+$boost_current_version = Array(1,44,0);
 require_once(dirname(__FILE__) . '/boost_config.php');
 require_once(dirname(__FILE__) . '/boost_utility.php');
 ?>
\ No newline at end of file

Modified: website/public_html/live/common/code/boost_archive.php
==============================================================================
--- website/public_html/live/common/code/boost_archive.php (original)
+++ website/public_html/live/common/code/boost_archive.php 2010-08-26 16:43:01 EDT (Thu, 26 Aug 2010)
@@ -45,7 +45,8 @@
 function display_from_archive(
     $params,
     $content_map = array(),
- $override_extractor = null)
+ $override_extractor = null,
+ $expires = null)
 {
     $params['template'] = dirname(__FILE__)."/template.php";
     $params['title'] = NULL;
@@ -117,10 +118,15 @@
           .' '.escapeshellarg($params['file']);
 
         if($extractor == 'raw') {
- display_raw_file($unzip, $type);
+ display_raw_file($unzip, $type, $expires);
             return;
         }
 
+ if ($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: max-age='.strtotime($expires, 0)); // 30 days
+ }
+
         // Note: this sets $params['content'] with either the content or an error
         // message:
         if(!extract_file($unzip, $params['content'])) {
@@ -131,16 +137,16 @@
     else
     {
         if($extractor == 'raw') {
- display_unzipped_file($params['file'], $type);
+ display_unzipped_file($params['file'], $type, $expires);
             return;
         }
 
- // Note: this sets $params['content'] with either the content or an error
- // message:
- if(!extract_unzipped_file($params['file'], $params['content'])) {
- file_not_found($params, $params['content']);
- return;
+ if ($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: max-age='.strtotime($expires, 0)); // 30 days
         }
+
+ $params['content'] = file_get_contents($params['file']);
     }
     
     if($type == 'text/html') {
@@ -217,7 +223,8 @@
     }
 }
 
-function display_raw_file($unzip, $type) {
+function display_raw_file($unzip, $type, $expires = null)
+ {
     header('Content-type: '.$type);
     switch($type) {
         case 'image/png':
@@ -230,8 +237,10 @@
             header('Expires: '.date(DATE_RFC2822, strtotime("+1 year")));
             header('Cache-Control: max-age=31556926'); // A year, give or take a day.
         default:
- header('Expires: '.date(DATE_RFC2822, strtotime("+1 month")));
- header('Cache-Control: max-age=2592000'); // 30 days
+ if($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: max-age='.strtotime($expires, 0));
+ }
     }
 
     // Since we're not returning a HTTP error for non-existant files,
@@ -250,7 +259,7 @@
         echo 'Error extracting file: '.unzip_error($exit_status);
 };
 
-function display_unzipped_file($file, $type) {
+function display_unzipped_file($file, $type, $expires = null) {
     header('Content-type: '.$type);
     switch($type) {
         case 'image/png':
@@ -262,6 +271,11 @@
         case 'application/xml-dtd':
             header('Expires: '.date(DATE_RFC2822, strtotime("+1 year")));
             header('Cache-Control: max-age=31556926'); // A year, give or take a day.
+ default:
+ if($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: max-age='.strtotime($expires, 0));
+ }
     }
 
     // Since we're not returning a HTTP error for non-existant files,
@@ -299,34 +313,6 @@
     }
 }
 
-function extract_unzipped_file($file, &$content) {
- header('Expires: '.date(DATE_RFC2822, strtotime("+1 month")));
- header('Cache-Control: max-age=2592000'); // 30 days
-
- $file_handle = fopen($file,'r');
-
- if($file_handle === FALSE) {
- $content = null;
- return false;
- }
-
- $text = '';
- while ($file_handle && !feof($file_handle)) {
- $text .= fread($file_handle,8*1024);
- }
- $exit_status = fclose($file_handle);
-
- if($exit_status) {
- $content = $text;
- return true;
- }
- else {
- $content = null;
- return false;
- }
-}
-
-
 //
 // Filters
 //
@@ -561,7 +547,7 @@
     $url['scheme'] = 'http'; # Detect other schemes?
 
     if(!isset($url['host'])) {
- $url['host'] = $_SERVER['SERVER_NAME'];
+ $url['host'] = $_SERVER['HTTP_HOST'];
         
         if($url['path'][0] != '/') {
             $path = explode('/', $_SERVER['REQUEST_URI']);

Deleted: website/public_html/live/common/code/boost_version.php
==============================================================================
--- website/public_html/live/common/code/boost_version.php 2010-08-26 16:43:01 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,76 +0,0 @@
-<?php
-/*
- Copyright 2005-2006 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-require_once(dirname(__FILE__) . '/boost.php');
-
-$boost_current_version = Array(1,44,0);
-
-function boost_title()
-{
- $vinfo = array();
- if (isset($_SERVER["PATH_INFO"])) {
- preg_match('@([0-9]+)_([0-9]+)_([0-9]+)@',$_SERVER["PATH_INFO"],$vinfo);
- }
- if (isset($vinfo[0])) {
- array_shift($vinfo);
- return 'Boost '.implode('.', $vinfo);
- }
- else {
- return 'Boost';
- }
-}
-
-function boost_version($v,$r,$p)
-{
- if (isset($_SERVER["PATH_INFO"]))
- {
- $vinfo = array();
- preg_match('@([0-9]+)_([0-9]+)_([0-9]+)@',$_SERVER["PATH_INFO"],$vinfo);
- if (isset($vinfo[0]))
- {
- return
- ($v < $vinfo[1]) ||
- ($v == $vinfo[1] && $r < $vinfo[2]) ||
- ($v == $vinfo[1] && $r == $vinfo[2] && $p <= $vinfo[3]);
- }
- else
- {
- return FALSE;
- }
- }
- else
- {
- return TRUE;
- }
-}
-
-function boost_future_version($version)
-{
- if ($version)
- {
- $vinfo = array();
- preg_match('@([0-9]+)_([0-9]+)_([0-9]+)@',$version,$vinfo);
- if (isset($vinfo[0]))
- {
- global $boost_current_version;
- $v = $boost_current_version[0];
- $r = $boost_current_version[1];
- $p = $boost_current_version[2];
- return
- ($v < $vinfo[1]) ||
- ($v == $vinfo[1] && $r < $vinfo[2]) ||
- ($v == $vinfo[1] && $r == $vinfo[2] && $p < $vinfo[3]);
- }
- else
- {
- return FALSE;
- }
- }
- else
- {
- return FALSE;
- }
-}

Modified: website/public_html/live/doc/display_libs.php
==============================================================================
--- website/public_html/live/doc/display_libs.php (original)
+++ website/public_html/live/doc/display_libs.php 2010-08-26 16:43:01 EDT (Thu, 26 Aug 2010)
@@ -1,6 +1,33 @@
 <?php
 require_once(dirname(__FILE__) . '/../common/code/boost_archive.php');
-require_once(dirname(__FILE__) . '/../common/code/boost_version.php');
+
+function boost_future_version($version)
+{
+ if ($version)
+ {
+ $vinfo = array();
+ preg_match('@([0-9]+)_([0-9]+)_([0-9]+)@',$version,$vinfo);
+ if (isset($vinfo[0]))
+ {
+ global $boost_current_version;
+ $v = $boost_current_version[0];
+ $r = $boost_current_version[1];
+ $p = $boost_current_version[2];
+ return
+ ($v < $vinfo[1]) ||
+ ($v == $vinfo[1] && $r < $vinfo[2]) ||
+ ($v == $vinfo[1] && $r == $vinfo[2] && $p < $vinfo[3]);
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+}
 
 function add_spirit_analytics($content) {
     if(stripos($content, '_uacct = "UA-11715441-2"') !== FALSE)
@@ -72,4 +99,6 @@
   array('@.*@','@^more/.*html$@i','basic','text/html'),
   //~ the headers are text files displayed in an embeded page
   array('@.*@','@^boost/.*$@i','cpp','text/plain')
-));
+ ),
+ null, "+1 year"
+);

Modified: website/public_html/live/doc/libraries.php
==============================================================================
--- website/public_html/live/doc/libraries.php (original)
+++ website/public_html/live/doc/libraries.php 2010-08-26 16:43:01 EDT (Thu, 26 Aug 2010)
@@ -1,8 +1,46 @@
 <?php
 
-require_once(dirname(__FILE__) . '/../common/code/boost_version.php');
 require_once(dirname(__FILE__) . '/../common/code/boost_libraries.php');
 
+function boost_title()
+{
+ $vinfo = array();
+ if (isset($_SERVER["PATH_INFO"])) {
+ preg_match('@([0-9]+)_([0-9]+)_([0-9]+)@',$_SERVER["PATH_INFO"],$vinfo);
+ }
+ if (isset($vinfo[0])) {
+ array_shift($vinfo);
+ return 'Boost '.implode('.', $vinfo);
+ }
+ else {
+ return 'Boost';
+ }
+}
+
+function boost_version($v,$r,$p)
+{
+ if (isset($_SERVER["PATH_INFO"]))
+ {
+ $vinfo = array();
+ preg_match('@([0-9]+)_([0-9]+)_([0-9]+)@',$_SERVER["PATH_INFO"],$vinfo);
+ if (isset($vinfo[0]))
+ {
+ return
+ ($v < $vinfo[1]) ||
+ ($v == $vinfo[1] && $r < $vinfo[2]) ||
+ ($v == $vinfo[1] && $r == $vinfo[2] && $p <= $vinfo[3]);
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ return TRUE;
+ }
+}
+
 //$libs = new boost_libraries(dirname(__FILE__) . '/libraries.xml');
 $libs = unserialize(file_get_contents(dirname(__FILE__) . '/libraries.txt'));
 


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