cvs: pearweb /public_html faq.php

From: Date: Mon, 03 Sep 2001 23:12:58 +0000
Subject: cvs: pearweb /public_html faq.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-777@lists.php.net to get a copy of this message
mj Mon Sep 3 19:12:58 2001 EDT Modified files: /pearweb/public_html faq.php Log: * indenting looked somehow crapy * improved error handling Index: pearweb/public_html/faq.php diff -u pearweb/public_html/faq.php:1.8 pearweb/public_html/faq.php:1.9 --- pearweb/public_html/faq.php:1.8 Mon Sep 3 07:58:24 2001 +++ pearweb/public_html/faq.php Mon Sep 3 19:12:58 2001 @@ -1,6 +1,6 @@ <?php -// $Id: faq.php,v 1.8 2001/09/03 11:58:24 ssb Exp $ +// $Id: faq.php,v 1.9 2001/09/03 23:12:58 mj Exp $ response_header("Frequently Asked Questions"); @@ -57,42 +57,47 @@ */ case "qandaset" : { $content .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">"; - return; - } + return; + } + case "question" : { $content .= "<tr><td bgcolor=\"#cccccc\"><a name=\"faq-{$ID}\" /><font size=\"+1\">"; $content .= $attribs['TITLE']; - $TOC[$ID++] = $attribs['TITLE']; - return; - } + $TOC[$ID++] = $attribs['TITLE']; + return; + } + case "answer" : { $content .= "<tr><td bgcolor=\"#eeeeee\">"; - return; - } + return; + } + case "ulink" : { $content .= "<a href=\"".$attribs['URL']."\">"; if (!empty($attribs['NAME'])) { $content .= $attribs['NAME']; } - return; - } + return; + } + case "faqlink" : { $content .= "<a href=\"faq.php#faq-".$attribs['FAQ']."\">"; return; - } + } + case "author" : { - $content .= "<{$tagmap[$key1]}>"; + $content .= "<{$tagmap[$key1]}>"; if (!empty($attribs['NAME'])) { - $content .= "Answer written by $attribs[NAME]"; + $content .= "Answer written by". $attribs['NAME']; } - return; - } + return; + } } if (isset($tagmap[$key2])) { - $content .= "<{$tagmap[$key2]}>"; + $content .= "<{$tagmap[$key2]}>"; } elseif (isset($tagmap[$key1])) { - $content .= "<{$tagmap[$key1]}>"; + $content .= "<{$tagmap[$key1]}>"; } } @@ -112,22 +117,24 @@ */ case "qandaset" : { $content .= "</table>"; - return; - } + return; + } + case "question" : { $content .= "</font></td></tr>\n"; return; - } + } + case "answer" : { $content .= "<br /></td></tr>\n"; return; - } + } } if (isset($tagmap[$key2])) { - $content .= "</{$tagmap[$key2]}>"; + $content .= "</{$tagmap[$key2]}>"; } elseif (isset($tagmap[$key1])) { - $content .= "</{$tagmap[$key1]}>"; + $content .= "</{$tagmap[$key1]}>"; } } @@ -138,7 +145,11 @@ $filename = "../doc/pearfaq.xml"; -$fp = fopen($filename, "r") or die("error opening pearfaq.xml"); +$fp = @fopen($filename, "r"); + +if (!$fp) { + PEAR::raiseError("error opening pearfaq.xml"); +} $parser = xml_parser_create(); @@ -147,11 +158,11 @@ while ($data = fread($fp, 4096)) { if (!xml_parse($parser, $data, feof($fp))) { - $code = xml_get_error_code($parser); - $msg = "While parsing pearfaq.xml on line " . - xml_get_current_line_number($parser) . ": " . - xml_error_string($code); - PEAR::raiseError($msg, $code); + $code = xml_get_error_code($parser); + $msg = "While parsing pearfaq.xml on line " . + xml_get_current_line_number($parser) . ": " . + xml_error_string($code); + PEAR::raiseError($msg, $code); } }

« previous php.pear.cvs (#777) next »