version_ = $path_parts[1]; $this->key_ = $path_parts[2]; if ($archive_subdir) { $this->file_ = $archive_file_prefix . $this->version_ . '/' . $this->key_; } else { $this->file_ = $archive_file_prefix . $this->key_; } $this->archive_ = str_replace('\\','/', $archive_dir . '/' . $this->version_ . '.zip'); foreach ($info_map as $i) { if (preg_match($i[1],$this->key_)) { $this->extractor_ = $i[2]; $this->type_ = $i[3]; break; } } $unzip = UNZIP .' -p '.escapeshellarg($this->archive_) .' '.escapeshellarg($this->file_); if (! $this->extractor_) { # File doesn't exist, or we don't know how to handle it. $this->extractor_ = '404'; $this->_init_404(); } else if ($get_as_raw || $this->extractor_ == 'raw') { $this->_extract_raw($unzip); //~ print "--- $unzip"; } else { /* We pre-extract so we can get this like meta tag information before we have to print it out. */ $this->content_ = $this->_extract_string($unzip); $f = '_init_'.$this->extractor_; $this->$f(); if ($this->extractor_ == 'simple') { $f = '_content_'.$this->extractor_; $this->$f(); } } } function content_head() { if ($this->head_content_) { print $this->head_content_; } else { print <<Boost C++ Libraries HTML ; } } function is_raw() { return $this->extractor_ == 'raw' || $this->extractor_ == 'simple'; } function _extract_string($unzip) { $file_handle = popen($unzip,'r'); $text = ''; while ($file_handle && !feof($file_handle)) { $text .= fread($file_handle,8*1024); } if(pclose($file_handle) == 0) { return $text; } else { $this->extractor_ = '404'; return ''; } } function _extract_raw($unzip) { header('Content-type: '.$this->type_); ## header('Content-Disposition: attachment; filename="downloaded.pdf"'); $file_handle = popen($unzip,'rb'); fpassthru($file_handle); if(pclose($file_handle) != 0) { // TODO: Maybe I should buffer the file so that I can return a // proper 404 error. echo "File not found."; } } function content() { if ($this->extractor_) { $f = '_content_'.$this->extractor_; $this->$f(); } } function _init_text() { } function _content_text() { print "
\n";
print htmlentities($this->content_);
print "\n";
}
function _init_cpp()
{
}
function _content_cpp()
{
$text = htmlentities($this->content_);
print "\n";
$root = dirname(preg_replace('@([^/]+/)@','../',$this->key_));
$text = preg_replace(
'@(#[ ]*include[ ]+<)(boost[^&]+)@Ssm',
'${1}${2}',
$text );
$text = preg_replace(
'@(#[ ]*include[ ]+")(boost[^&]+)@Ssm',
'${1}${2}',
$text );
print $text;
print "\n";
}
function _init_html_pre()
{
$h = '';
preg_match('@text/html; charset=([^\s"]+)@i',$this->content_,$charset);
if (isset($charset[1]))
{
$h .= <<