key_ = $path_parts[2]; if ($archive_subdir) { $this->file_ = $archive_file_prefix . $path_parts[1] . '/' . $path_parts[2]; } else { $this->file_ = $archive_file_prefix . $path_parts[2]; } $this->archive_ = str_replace('\\','/', $archive_prefix . $path_parts[1] . '.zip'); foreach ($info_map as $i) { if (preg_match($i[0],$this->key_)) { $this->extractor_ = $i[1]; $this->type_ = $i[2]; 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. header("HTTP/1.0 404 Not Found"); $this->extractor_ = 'raw'; } 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(); } } function content_head() { if ($this->head_content_) { print $this->head_content_; } else { print <<Boost C++ Libraries HTML ; } } function is_raw() { return $this->extractor_ == 'raw'; } function _extract_string($unzip) { $file_handle = popen($unzip,'r'); $text = ''; while ($file_handle && !feof($file_handle)) { $text .= fread($file_handle,8*1024); } pclose($file_handle); return $text; } function _extract_raw($unzip) { header('Content-type: '.$this->type_); ## header('Content-Disposition: attachment; filename="downloaded.pdf"'); $file_handle = popen($unzip,'r'); fpassthru($file_handle); pclose($file_handle); } function content() { if ($this->extractor_) { $f = '_content_'.$this->extractor_; $this->$f(); } } function _init_text() { } function _content_text() { print "

".$this->key_."

\n"; print "
\n";
        print htmlentities($this->content_);
        print "
\n"; } function _init_cpp() { } function _content_cpp() { $text = htmlentities($this->content_); print "

".$this->key_."

\n"; print "
\n";
        $root = dirname(preg_replace('@([^/]+/)@','../',$this->key_));
        $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 .= << HTML ; } preg_match('@([^<]+)@i',$this->content_,$title); if (isset($title[1])) { $h .= <<Boost C++ Libraries - ${title[1]} HTML ; } else if ($h !== '') { $h .= <<Boost C++ Libraries HTML ; } if ($h !== '') { $this->head_content_ = $h; } } function _content_html_pre() { $text = $this->content_; $text = preg_replace( '@href="?http://www.boost.org/?([^"\s]*)"?@i', 'href="/${1}"', $text ); $text = preg_replace( '@href="?(?:\.\./)+people/(.*\.htm)"?@i', 'href="/users/people/${1}l"', $text ); $text = preg_replace( '@href="?(?:\.\./)+(LICENSE_.*\.txt)"?@i', 'href="/${1}"', $text ); $text = preg_replace( '@_init_html_pre(); } function _content_boost_book_html() { $text = $this->_content_html_pre(); $text = substr($text,strpos($text,'
')); $text = substr($text,0,strpos($text,'')); for ($i = 0; $i < 8; $i++) { $text = preg_replace( '@(.*)@Ssm', '${2}', $text ); } $text = str_replace('
','',$text); $text = str_replace('','
',$text); $text = preg_replace( '@[\s]+(border|cellpadding|cellspacing|width|height|valign|frame|rules|naturalsizeflag|background)=[^\s>]+@i', '', $text ); print $text; } function _init_boost_libs_html() { $this->_init_html_pre(); } function _content_boost_libs_html() { $text = $this->_content_html_pre(); preg_match('@]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE); preg_match('@@i',$text,$body_end,PREG_OFFSET_CAPTURE); if (!isset($body_begin[0])) { return; } else if (!isset($body_end[0])) { $text = substr($text, $body_begin[0][1]+strlen($body_begin[0][0])); } else { $text = substr($text, $body_begin[0][1]+strlen($body_begin[0][0]), $body_end[0][1]-($body_begin[0][1]+strlen($body_begin[0][0])) ); } # nasty code, because (?!fubar) causes an ICE... preg_match('@@i',$text,$table_end,PREG_OFFSET_CAPTURE); if (isset($table_begin[0]) && isset($table_end[0]) && strpos(substr($text,0,$table_end[0][1]),'boost.png',$table_begin[0][1]) !== FALSE) { $text = substr($text,$table_end[0][1]+strlen($table_end[0][0])); } preg_match('@@i',$text,$h1_end,PREG_OFFSET_CAPTURE); preg_match('@@i',$text,$table_end,PREG_OFFSET_CAPTURE); if (isset($h1_begin[0]) && isset($table_end[0]) && $table_begin[0][1] < $h1_begin[0][1] && $h1_begin[0][1] < $table_end[0][1]+8) { $text = substr($text,$h1_begin[0][1], $h1_begin[0][1]-$h1_end[0][1]+5) . substr($text,$table_end[0][1]+8); } #else #{ # $text = substr($text,$h1_begin[0][1]); #} #if (isset($title[1])) #{ # $text = "

${title[1]}

\n" . $text; #} $text = preg_replace( '@(]+>[\s]*)?]*>([\s]*)?@i', '', $text ); $text = preg_replace( '@]*>@i', '', $text ); $text = preg_replace( '@]*>@i', '', $text ); $text = preg_replace( '@[\s]+(border|cellpadding|cellspacing|width|height|valign|align|frame|rules|naturalsizeflag|background)=[^\s>]+@i', '', $text ); $text = preg_replace( '@]*@i', ']*>@i', '', $text ); $text = preg_replace( '@<([^\s]+)[\s]+>@i', '<${1}>', $text ); $text = _preg_replace_bounds( '@
[\s]*(
)@i','@(
)[\s]*
@i', '${1}','${1}', $text ); $text = _preg_replace_bounds( '@
[\s]*(

)@i','@(

)[\s]*
@i', '${1}','${1}', $text ); $text = _preg_replace_bounds( '@
[\s]*(
)@i','@(
)[\s]*@i', '${1}','${1}', $text ); $text = _preg_replace_bounds( '@
[\s]*
  • @i','@
  • [\s]*
    @i', '', $text ); $text = _preg_replace_bounds( '@(?:
    [\s]*)+

    @i','@

    (?:[\s]*
    )+@i', '

    ','

    ', $text ); $text = preg_replace( '@(]+[\s]*>)[\s]*(${2}', $text ); $text = preg_replace( '@([\s]+[\s]+[\s]+[\s]+[\s]+[\s]+)
    .*_arr.*.*.*
    @i', '${1}
    ', $text ); $text = preg_replace( '@([\s]+[\s]+@i', '
    ${1}>', $text ); $text = preg_replace( '@
    ([\s]+[\s]+)@i', '
    ${1}', $text ); $text = preg_replace( '@src=".*theme/u_arr\.gif"@i', 'src="/style/css_0/up.png"', $text ); $text = preg_replace( '@src=".*theme/l_arr\.gif"@i', 'src="/style/css_0/prev.png"', $text ); $text = preg_replace( '@src=".*theme/r_arr\.gif"@i', 'src="/style/css_0/next.png"', $text ); $text = preg_replace( '@src=".*theme/u_arr_disabled\.gif"@i', 'src="/style/css_0/up_disabled.png"', $text ); $text = preg_replace( '@src=".*theme/l_arr_disabled\.gif"@i', 'src="/style/css_0/prev_disabled.png"', $text ); $text = preg_replace( '@src=".*theme/r_arr_disabled\.gif"@i', 'src="/style/css_0/next_disabled.png"', $text ); $text = preg_replace( '@src=".*theme/note\.gif"@i', 'src="/style/css_0/note.png"', $text ); $text = preg_replace( '@src=".*theme/alert\.gif"@i', 'src="/style/css_0/caution.png"', $text ); $text = preg_replace( '@src=".*theme/bulb\.gif"@i', 'src="/style/css_0/tip.png"', $text ); $text = preg_replace( '@@i', '', $text ); $text = preg_replace( '@(@i', '${1} class="inline">', $text ); print $text; } function _init_boost_frame1_html() { $this->_init_html_pre(); } function _content_boost_frame1_html() { $text = $this->_content_html_pre(); $text = substr($text,strpos($text,'
    ')); $text = substr($text,0,strpos($text,'')); for ($i = 0; $i < 8; $i++) { $text = preg_replace( '@(.*)@Ssm', '${2}', $text ); } $text = str_replace('
    ','',$text); $text = str_replace('
    ','
    ',$text); $text = preg_replace( '@[\s]+(border|cellpadding|cellspacing|width|height|valign|frame|rules|naturalsizeflag|background)=[^\s>]+@i', '', $text ); print $text; } } ?>