\r\n"); } $commentParser->open($file); $commentParser->read(); $commentParser->read(); $curPage = $_SERVER['DOCUMENT_ROOT'] . str_replace(" ", "%20", $_SERVER['PHP_SELF']); displayComments($curPage, $commentParser); echo $globalClose; function displayComments($curPage, $parser) { $done = false; do { switch ($parser->getAttribute("path")) { case $curPage: $comments = stripXML($parser, $comments); convertToHTML($comments); $done = true; break; } } while ($parser->next()); if (!$done) { global $commentLayout; global $commentAction; global $commentAttributes; global $commentMessage; global $loc; $comments = "
"; $comments .= ""; $comments .= ""; $comments .= ""; $comments .= ""; $comments .= "
"; $comments = str_replace("#add", $comments, str_replace("#comment", "", str_replace("#delete", "", $commentLayout))); echo $comments; } } function convertToHTML($comments) { global $localOpen; global $localClose; global $commentMessage; global $commentAttributes; global $commentAction; global $deleteAction; global $deleteMessage; global $deleteAttributes; global $enableDelete; global $commentLayout; global $loc; $reg_replace = "
"; $reg_replace .= ""; $reg_replace .= ""; $reg_replace .= ""; $reg_replace .= "
"; $reg_replace .= "
"; $reg_replace .= ""; $reg_replace .= ""; $reg_replace .= ""; $reg_replace .= "
"; $comments = str_replace("", "", str_replace("", "", ereg_replace("[0-9]*", $reg_replace, $comments))); //change the commentData tags into pre tags and kill the escapes so we're all properly formatted and whatnot $comments = str_replace("", "
", str_replace("", "
", str_replace("\\\\", "\\", str_replace("\\\"", "\"", str_replace("\\'", "'", $comments))))); $commentParts = split("", $comments, -1); $splitComments = array(""); do { $subSplit = split("", current($commentParts), -1); while (sizeof($subSplit) > 0) { $curSplit = array_pop($subSplit); if (substr_count($curSplit, "") > 0) { array_push($splitComments, $curSplit); } } } while (next($commentParts)); while ($curString = array_pop($splitComments)) { $curParts = split("", $localOpen, $comments); $comments = str_replace("", $localClose, $comments); echo $comments; } ?>