faq = $faq; $this->navsection = $navsect; } function Render() { $base = '../../ext/'; $dirs = array('faqs' => 'html', 'faqs_text' => 'text', 'pginstaller' => 'html', 'backend' => 'html'); $imgbase = array('backend' => '/files/developer/backend/'); $href = array('backend' => 'http://developer.postgresql.org/cvsweb.cgi/pgsql/src/tools/backend/'); $hreflocaltranslate = array('backend' => 1); $found = false; foreach ($dirs as $subdir=>$type) { $ext = ($type=='html')?'.html':''; $fn = $base . $subdir . '/' . $this->faq . $ext; $f = @fopen($fn,'r'); if (!$f && $subdir==$this->faq) { // Not found, try subdir match $fn = $base . $subdir . '/index.html'; $f = @fopen($fn,'r'); } if ($f) { $content=fread($f, @filesize($fn)); fclose($f); if ($type=='html') { // Convert character set if (preg_match('!]*>(.*)!is', $content, $matches)) { $content = 'Malformatted FAQ'; } else { $content = $matches[1]; } if ($charset != '') { if ($charset == 'x-euc-jp') { $charset = 'euc-jp'; } $content = iconv($charset,'utf-8',$content); if ($content == '') { $content = 'Character set conversion failed.'; } } // Let's see if we can find a title if (preg_match('!

([^<]+)

!is', $content, $matches)) { $this->title = $matches[1]; } // Lowercase all tags $content = preg_replace("/(<\/?)(\w+)([^>]*>)/e","'\\1'.strtolower('\\2').'\\3'", $content); $content = str_replace('\"','"',$content); // Make some common tags XHTML compatiable $content = str_replace(array('
','
','

','HREF="','NAME="'),array('
','
','

','href="','name="'),$content); $content = preg_replace('/(]+)>/','$1 />', $content); // Possibly change references to images if (!empty($imgbase[$subdir])) { $content = preg_replace('/('; } $this->tpl->setVariable('nav_page_content',$content); $found=true; break; } // if ($f) } //foreach if (!$found) { throw new NotFoundException('FAQ not found'); } } } ?>