Example #1
1
 function sDisplay()
 {
     global $goApp;
     $s = "";
     $aEntries =& $this->dContent[WY_DK_GB_ENTRIES];
     $dEntry = array();
     $sName = $sEMail = $sMessage = $sClientIP = "";
     $iTime = $iID = 0;
     if ($goApp->sFormFieldValue(WY_QK_GB_MAGIC, "") == WY_QV_GB_MAGIC && ($sMessage = $goApp->sFormFieldValue(WY_QK_GB_MESSAGE, ""))) {
         // new message arrived
         $sName = $goApp->sFormFieldValue(WY_QK_GB_NAME, "");
         $sEMail = $goApp->sFormFieldValue(WY_QK_GB_EMAIL, "");
         if (!$this->bAddEntry($sName, $sEMail, $sMessage)) {
             $s .= sprintf("<script type=\"text/javascript\"> alert(\"%s\"); </script>", WYTS("IPIsBlocked"));
         }
     }
     if ($goApp->bEditMode) {
         if ($goApp->sCurrentAction() == WY_QV_GB_REMOVE) {
             $iID = $goApp->sFormFieldValue(WY_QK_GB_ID, 0);
             $this->removeEntry($iID);
         }
         if ($goApp->sCurrentAction() == WY_QV_GB_BLOCK) {
             $sIP = $goApp->sFormFieldValue(WY_QK_GB_IP, 0);
             $this->blockIP($sIP);
         }
         if ($goApp->sCurrentAction() == WY_QV_GB_UNBLOCK) {
             $sIP = $goApp->sFormFieldValue(WY_QK_GB_IP, 0);
             $this->unblockIP($sIP);
         }
     }
     foreach ($aEntries as $dEntry) {
         $sName = $dEntry[WY_DK_GB_NAME];
         $sEMail = $dEntry[WY_DK_GB_EMAIL];
         $sMessage = $dEntry[WY_DK_GB_MESSAGE];
         // backward comp.: check isset($dEntry[WY_DK_GB_IP])
         $sClientIP = isset($dEntry[WY_DK_GB_IP]) ? $dEntry[WY_DK_GB_IP] : "";
         $iTime = $dEntry[WY_DK_GB_TIME];
         $iID = $dEntry[WY_DK_GB_ID];
         $s .= "<div class='" . WY_GB_CSS_ALL . "'>";
         if ($goApp->bEditMode) {
             $oURL = od_clone(WYURL::oCurrentURL());
             $oImgURL = od_clone($goApp->oImageURL);
             $dEditorQuery = $this->dEditorQuery;
             $dEditorQuery[WY_QK_GB_ID] = $iID;
             $goApp->setActionInQuery($dEditorQuery, WY_QV_GB_REMOVE);
             $oURL->setQuery(array_merge($oURL->dQuery, $dEditorQuery));
             $oLink = new WYLink($oURL, WYTS("GuestbookRemoveButton"));
             $oImgURL->addComponent("remove-button.gif");
             $oImg = new WYImage($oImgURL);
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GuestbookRemoveConfirm") . "\");");
             $s .= $oLink->sDisplay();
         }
         $s .= "<div>";
         if ($sName) {
             $s .= "<span class='" . WY_GB_CSS_NAME . "'>" . webyep_sHTMLEntities($sName) . "</span>";
         }
         if ($sEMail) {
             $s .= ($sName ? " " : "") . "<span class='" . WY_GB_CSS_EMAIL . "'>(" . $this->_sEMailLink($sEMail) . ")</span>";
         }
         if ($sName || $sEMail) {
             $s .= ", ";
         }
         $s .= "<span class='" . WY_GB_CSS_DATETIME . "'>" . WYTS("AtDate") . " " . sWYTDate($iTime) . " " . WYTS("AtTime") . " " . sWYTTime($iTime) . "</span>:</div>\n";
         if ($goApp->bEditMode) {
             $s .= "<div class='" . WY_GB_CSS_MESSAGE . "'>";
             $s .= WYTS("ClientIP") . ": ";
             $bIsBlocked = in_array($sClientIP, $this->dContent[WY_DK_GB_BLOCKED_IPS]);
             if ($sClientIP) {
                 if (!$bIsBlocked) {
                     $oURL = od_clone(WYURL::oCurrentURL());
                     $oImgURL = od_clone($goApp->oImageURL);
                     $dEditorQuery = $this->dEditorQuery;
                     $dEditorQuery[WY_QK_GB_IP] = $sClientIP;
                     $goApp->setActionInQuery($dEditorQuery, WY_QV_GB_BLOCK);
                     $oURL->setQuery($dEditorQuery);
                     $oLink = new WYLink($oURL, WYTS("GuestbookBlockButton"));
                     $oImgURL->addComponent("block-button.gif");
                     $oImg = new WYImage($oImgURL);
                     $oImg->setAttribute("style", "vertical-align: middle");
                     $oLink->setInnerHTML($oImg->sDisplay());
                     $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GuestbookBlockConfirm") . "\");");
                 }
                 $s .= $sClientIP;
                 if (!$bIsBlocked) {
                     $s .= "&nbsp;" . $oLink->sDisplay();
                 }
             } else {
                 $s .= WYTS("unknown");
             }
             $s .= "</div>\n";
         }
         // make content secure:
         $sMessage = str_replace("<", "", $sMessage);
         $sMessage = str_replace(">", "", $sMessage);
         $s .= "<div class='" . WY_GB_CSS_MESSAGE . "'>" . WYLongTextElement::_sFormatContent($sMessage, $this->bHideEMailAddresses) . "</div>";
         $s .= "</div>\n";
     }
     if ($goApp->bEditMode && count($this->dContent[WY_DK_GB_BLOCKED_IPS])) {
         unset($a);
         $a =& $this->dContent[WY_DK_GB_BLOCKED_IPS];
         $s .= "<div class='" . WY_GB_CSS_ALL . "'>";
         $s .= "<strong>" . WYTS("BlockedIPs") . ":</strong><br />\n";
         $oURL = od_clone(WYURL::oCurrentURL());
         $dEditorQuery = $this->dEditorQuery;
         $goApp->setActionInQuery($dEditorQuery, WY_QV_GB_UNBLOCK);
         $oURL->setQuery($dEditorQuery);
         $oImgURL = od_clone($goApp->oImageURL);
         $oImgURL->addComponent("unblock-button.gif");
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("style", "vertical-align: middle");
         foreach ($a as $sIP) {
             $oURL->dQuery[WY_QK_GB_IP] = $sIP;
             $oLink = new WYLink($oURL, WYTS("GuestbookUnBlockButton"));
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GuestbookUnBlockConfirm") . "\");");
             $s .= $sIP . "&nbsp;" . $oLink->sDisplay() . "<br />\n";
         }
         $s .= "</div>";
     }
     return $s;
 }
Example #2
0
 function sDisplay()
 {
     global $goApp;
     $sHTML = "";
     $sFN = $this->sDownloadFileName();
     $oURL = $oLink = od_nil;
     if ($sFN) {
         $oURL = od_clone($goApp->oProgramURL);
         $oURL->addComponent("mp3-player.php");
         $oURL->dQuery[WY_QK_AUDIO_FILENAME] = $sFN;
         $oURL->dQuery[WY_QK_AUDIO_ORG_FILENAME] = $this->sOriginalFilename();
         $oLink = new WYPopupWindowLink($oURL, "WebYepAudioPlayer", 380, 150, WY_POPWIN_TYPE_PLAIN);
         $oLink->setToolTip(WYTS("AudioPlayHint"));
         $oDownloadURL = od_clone($goApp->oProgramURL);
         $oDownloadURL->addComponent("download.php");
         $oDownloadURL->dQuery[WY_QK_DOWNLOAD_FILENAME] = $sFN;
         $oDownloadURL->dQuery[WY_QK_ORIGINAL_FILENAME] = $this->sOriginalFilename();
         $oLink->setAttribute("href", $oDownloadURL->sEURL());
         $sL = $this->sLinkContent;
         if ($sL == "") {
             $sL = webyep_sHTMLEntities($this->sOriginalFilename());
         }
         $oLink->setInnerHTML($sL);
         $sHTML .= $oLink->sDisplay();
     }
     return $sHTML;
 }
Example #3
0
 function sDisplay()
 {
     $s = "";
     if (isset($this->dContent[WY_DK_CONTENT])) {
         $s = webyep_sHTMLEntities($this->dContent[WY_DK_CONTENT]);
     }
     return $s;
 }
Example #4
0
 function WYPopupWindowLink($oURL, $sName, $iW, $iH, $iType)
 {
     global $goApp;
     $sJS = "";
     parent::WYHTMLTag("a");
     $this->bSingular = false;
     $this->dAttributes["href"] = $oURL->sEURL();
     $sJS = WYPopupWindowLink::sOpenWindowCode($oURL, $sName, $iW, $iH, $iType);
     $sJS .= "; return false;";
     $this->dAttributes["onclick"] = webyep_sHTMLEntities($sJS);
 }
Example #5
0
 function sDisplay()
 {
     global $goApp, $webyep_sProductName;
     $s = "";
     $oImg = od_nil;
     $oLink = od_nil;
     $oImgURL = od_clone($goApp->oImageURL);
     $oPageURL = od_clone(WYURL::oCurrentURL());
     $oNoticeURL = od_clone($goApp->oProgramURL);
     unset($oPageURL->dQuery[WY_QK_LOGOUT]);
     $oNoticeURL->addComponent(WYTS("LogonURL"));
     if (!$goApp->bEditMode) {
         if ($this->bVisible) {
             $oImgURL->addComponent("logon-button.gif");
             $oImg = new WYImage($oImgURL);
         } else {
             $oImgURL->addComponent("nix.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("width", 16);
             $oImg->setAttribute("height", 16);
         }
         $oImg->setAttribute("style", "border: none");
         $oImg->setAttribute("alt", WYTS("WebYepLogon"));
         $oLink = new WYLink($oNoticeURL);
         if ($goApp->bValidUser()) {
             $oPageURL->dQuery[WY_QK_EDITMODE] = "yes" . mt_rand(1000, 9999);
             $oLink->setAttribute("onclick", "document.location=\"" . $oPageURL->sEURL() . "\"; return false;");
         } else {
             $oLink->setAttribute("onclick", webyep_sHTMLEntities($goApp->sAuthWindowJS()) . "; return false;");
         }
         $oLink->setInnerHTML($oImg->sDisplay());
         $sToolTip = WYTS("LogonButton");
         $sToolTip = str_replace("WebYep", $webyep_sProductName, $sToolTip);
         $oLink->setToolTip($sToolTip);
         $s = $oLink->sDisplay();
     } else {
         $oImgURL->addComponent("logoff-button.gif");
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("style", "border: none");
         $oImg->setAttribute("alt", WYTS("LogoffButton"));
         $oPageURL->dQuery[WY_QK_EDITMODE] = "no" . mt_rand(1000, 9999);
         $oLink = new WYLink($oPageURL);
         $oLink->setInnerHTML($oImg->sDisplay());
         $oLink->setToolTip(WYTS("LogoffButton"));
         $oLink->setAttribute("onclick", "if (event.shiftKey || event.altKey) this.href += \"&" . WY_QK_LOGOUT . "=1\"; return true;");
         $s = $oLink->sDisplay();
     }
     return $s;
 }
Example #6
0
 function sDisplay()
 {
     global $goApp;
     $s = "<!-- BEGINN WebYepReadMore -->";
     $DI = $goApp->oDocument->iDocumentInstanceForLoopID($goApp->oDocument->iLoopID());
     $DOC_INST = $DI ? '?DOC_INST=' . $DI : '';
     $TARGET = $this->sTargetFrame ? ' target="' . $this->sTargetFrame . '"' : '';
     if ($goApp->bEditMode) {
         $s .= $this->sEditButtonHTML("edit-button-read-more.gif");
     }
     $s .= '<a href="' . $this->sTargetPage . $DOC_INST . '" class="WebYepReadMoreLink"' . $TARGET . '>';
     if (isset($this->dContent[WY_DK_CONTENT]) && $this->dContent[WY_DK_CONTENT]) {
         $s .= webyep_sHTMLEntities($this->dContent[WY_DK_CONTENT]);
     } else {
         $s .= $this->sLinkText;
     }
     $s .= '</a>';
     $s .= "<!-- END WebYepReadMore -->\n";
     return $s;
 }
Example #7
0
 function WYSelectMenu($sN, $dItems, $sSelKeyApp = "", $bUseEntities = true)
 {
     global $goApp;
     $sSelKeyForm = $goApp->sFormFieldValue($sN);
     $sKey = "";
     $sValue = "";
     parent::WYHTMLTag("select");
     $this->bSingular = false;
     $this->dAttributes["name"] = $sN;
     $this->sSelectedKey = $sSelKeyForm ? $sSelKeyForm : $sSelKeyApp;
     $this->aItems = array();
     $o = new WYHTMLTag("option");
     $o->setSingular(false);
     foreach ($dItems as $sKey => $sValue) {
         $o->setAttribute("value", $sKey);
         if ($sKey == $this->sSelectedKey) {
             $o->setAttribute("selected", "");
         } else {
             $o->removeAttribute("selected");
         }
         $o->setInnerHTML($bUseEntities ? webyep_sHTMLEntities($sValue) : $sValue);
         $this->sInnerHTML .= $o->sDisplay();
     }
 }
Example #8
0
 /**
  * Recursive function to build an HTML tree from a nested dictionary (v2)
  *
  * @param  mixed  $subtree The (nested) dictionary, containing the menu data
  * @return string          Nested list (HTML)
  */
 function buildHtmlTree($subtree)
 {
     global $goApp, $webyep_iMenuID, $webyep_bUseJavaScriptMenus, $webyep_bMenuJSInserted, $webyep_bAutoCloseMenus, $webyep_bOpenFullURLsInNewWindow, $webyep_bTitleAlwaysOpensPage;
     $sElementID = "WYMUTREE_{$webyep_iMenuID}_" . $this->iLastTitleID;
     if ($this->iLastTitleID != 0 && !in_array($this->iLastTitleID, $this->aCurrentPath) && !in_array($sElementID, $this->aOpenTrees)) {
         $this->aCloseTrees[] = $this->iLastTitleID;
     }
     if ($this->iLastTitleID == 0) {
         // first ul doesn't get an ID
         $sHTML = "\n<" . $this->sListType . ' class="' . WEBYEP_MENU_CSS . "\">\n";
     } else {
         $sHTML = "\n<" . $this->sListType . ' class="' . WEBYEP_MENU_CSS . " WYMUTREE_{$webyep_iMenuID}\" id=\"{$sElementID}\">\n";
     }
     $iEntryNr = 0;
     foreach ($subtree as $dEntry) {
         $iEntryNr++;
         $aClass = array(WEBYEP_MENU_CSS_ITEM);
         $bIsTitle = count($dEntry['SUBITEMS']) ? true : false;
         $bUseTitleAsItem = false;
         $bIsCurrentEntry = false;
         if ($dEntry['VISIBLE']) {
             if ($dEntry['URL']) {
                 $oURL = new WYURL($dEntry['URL']);
                 $bOpenInNewWindow = $webyep_bOpenFullURLsInNewWindow && WYURL::bIsAbsolute($dEntry['URL']);
                 $bUseTitleAsItem = true;
             } else {
                 $oURL = od_clone($this->oURL);
             }
             // new feature: suppress DI, if user specifies somepage.php?DOC_INST=0 in URL field
             if (!isset($oURL->dQuery[WY_QK_DI]) || $oURL->dQuery[WY_QK_DI] > 0) {
                 $oURL->dQuery[WY_QK_DI] = $dEntry[WY_DK_ITEMID];
                 // overwrite existing DI, otherwise we could not delete those contents!
                 if ($webyep_bTitleAlwaysOpensPage) {
                     $bUseTitleAsItem = true;
                 }
             } else {
                 unset($oURL->dQuery[WY_QK_DI]);
                 // really dispose
             }
             $sURL = $oURL->sEURL(true, true, $dEntry['URL'] != "");
             // is this entry expanded?
             if (!$webyep_bUseJavaScriptMenus || in_array($dEntry[WY_DK_ITEMID], $this->aCurrentPath) || in_array($sElementID, $this->aOpenTrees)) {
                 $bIsExpanded = true;
             }
             // CSS
             $bIsCurrentEntry = $this->_bIsCurrentEntry($dEntry[WY_DK_ITEMID], $dEntry['URL']);
             if (!$bIsCurrentEntry && in_array($dEntry[WY_DK_ITEMID], $this->aCurrentPath)) {
                 $aClass[] = WEBYEP_MENU_CSS_CURRENT_PATH;
             }
             if ($bIsCurrentEntry) {
                 $aClass[] = WEBYEP_MENU_CSS_CURRENT_ITEM;
             }
             if ($iEntryNr == 1) {
                 $aClass[] = WEBYEP_MENU_CSS_FIRST_ITEM;
             }
             if ($bIsTitle) {
                 unset($aClass[0]);
                 // no WEBYEP_MENU_CSS_ITEM for titles
                 $aClass[] = WEBYEP_MENU_CSS_TITLE;
                 $aClass[] = WEBYEP_MENU_CSS_EXPANDED;
             }
             $sClass = implode(' ', $aClass);
             // assemble HTML
             $sText = str_replace("\\", "<br />", webyep_sHTMLEntities($dEntry['TITLE']));
             $sID = $bIsTitle ? ' id="WYMUTITLE' . $webyep_iMenuID . $dEntry[WY_DK_ITEMID] . '"' : '';
             $sHTML .= '<li class="' . $sClass . '"' . $sID . '>';
             $sHTML .= $this->buildLink($bIsTitle, $bUseTitleAsItem, $bIsExpanded, $sClass, $dEntry[WY_DK_ITEMID], $sText, $sURL);
             if ($bIsTitle) {
                 $this->iLastTitleID = $dEntry[WY_DK_ITEMID];
                 $sHTML .= $this->buildHtmlTree($dEntry['SUBITEMS']);
             }
             $sHTML .= "</li>\n";
         }
     }
     $sHTML .= '</' . $this->sListType . ">\n";
     return $sHTML;
 }
Example #9
0
 function _sFormatContent($sContent, $bHideEMailAddress)
 {
     // also used by guestbook as class method - do not use $this->!
     global $goApp, $webyep_sCharset, $webyep_bOpenFullURLsInNewWindow;
     $sHTMLStandard = $goApp->sHTMLStandard();
     $sBR = $sHTMLStandard == "HTML" ? "<br>" : "<br />";
     $aOutLines = array();
     $sASCIIBullets = chr(149) . chr(183) . "+";
     if ($sContent) {
         $sContent = str_replace("\r\n", "\n", $sContent);
         $sContent = str_replace("\r", "\n", $sContent);
         $aInLines = explode("\n", $sContent);
     } else {
         $aInLines = array();
     }
     $sOutLine = "";
     $bInLI = false;
     $bInTable = false;
     $bNL = true;
     $sListType = "";
     $iListLevel = 0;
     $iNumLines = count($aInLines);
     $iLine = 0;
     $sTarget = "";
     foreach ($aInLines as $sLine) {
         $bNL = true;
         $sOutLine = "";
         if (preg_match("/^([*{$sASCIIBullets}]+)[ \t]+/", $sLine, $aReg) && strpos($sLine, "|") == false) {
             // bullet list item
             if (substr($aReg[1], 0, 1) == "+") {
                 $sListType = "ol";
             } else {
                 $sListType = "ul";
             }
             $iNewListLevel = strlen($aReg[1]);
             $sLine = preg_replace("/^[*{$sASCIIBullets}]+[ \t]+/", "", $sLine);
             if ($iNewListLevel > $iListLevel) {
                 $sOutLine .= "\n" . "<{$sListType}>\n";
             } else {
                 if ($iNewListLevel < $iListLevel) {
                     $sOutLine .= "</li>\n";
                     while ($iNewListLevel != $iListLevel) {
                         $sOutLine .= "</{$sListType}>\n";
                         $sOutLine .= "</li>\n";
                         $iListLevel--;
                     }
                 } else {
                     $sOutLine .= "</li>\n";
                 }
             }
             $iListLevel = $iNewListLevel;
             $sOutLine .= "<li>";
             $bInLI = true;
             $bNL = false;
         } else {
             if (trim($sLine) != "" && $iListLevel > 0) {
                 // continued bullet list item
                 $sLine = ltrim($sLine);
                 // strip indention
                 $sOutLine .= "\n{$sBR}    ";
                 $bNL = false;
             }
         }
         $sLine = webyep_sHTMLEntities($sLine, false);
         $sLine = preg_replace("/<FETT ([^>]*)>/", "<strong>\\1</strong>", $sLine);
         $sLine = preg_replace("/<BOLD ([^>]*)>/", "<strong>\\1</strong>", $sLine);
         $sLine = preg_replace("/<([^>a-z:# ]*) ([^>]*)>/", "<span class='\\1'>\\2</span>", $sLine);
         if ($webyep_bOpenFullURLsInNewWindow) {
             $sTarget = " target='_blank'";
         } else {
             $sTarget = "";
         }
         $sLine = preg_replace("|<LINK: *http(s?)://([^ ]*) ([^>]*)>|", "<a href='HtTp\\1://\\2'{$sTarget}>\\3</a>", $sLine);
         $sLine = preg_replace("|<LINK: *HTTP(S?)://([^ ]*) ([^>]*)>|", "<a href='HtTp\\1://\\2'{$sTarget}>\\3</a>", $sLine);
         $sLine = preg_replace("|<LINK: *([^ ]*) ([^>]*)>|", "<a href='\\1'>\\2</a>", $sLine);
         $sLine = preg_replace("{((HTTP)|(http))://([-a-zA-Z0-9_/.~%#?=&;]+[-a-zA-Z0-9_/~%#?=&;])}", "<a href='HtTp://\\4'{$sTarget}>http://@@\\4</a>", $sLine);
         while (preg_match("|(.*)http://@@([-a-zA-Z0-9_/.~%]+)(.*)|", $sLine, $aReg)) {
             $sLine = $aReg[1] . "http://" . str_replace("/", "/&shy;", $aReg[2]) . $aReg[3];
         }
         $sLine = preg_replace("{((HTTPS)|(https))://([-a-zA-Z0-9_/.~%#?=&;]+[-a-zA-Z0-9_/~%#?=&;])}", "<a href='HtTpS://\\4'{$sTarget}>https://@@\\4</a>", $sLine);
         while (preg_match("|(.*)https://@@([-a-zA-Z0-9_/.~%]+)(.*)|", $sLine, $aReg)) {
             $sLine = $aReg[1] . "https://" . str_replace("/", "/&shy;", $aReg[2]) . $aReg[3];
         }
         if ($bHideEMailAddress) {
             if (preg_match("|[-a-zA-Z0-9_.]+@[-a-zA-Z0-9_.]+|", $sLine)) {
                 $sLine = WYLongTextElement::_sFormatEMailLinks($sLine);
             }
         } else {
             $sLine = preg_replace('|([-a-zA-Z0-9_.]+@[-a-zA-Z0-9_.]+[-a-zA-Z0-9_])|', "<a href='mailto:\\1'>\\1</a>", $sLine);
         }
         if (preg_match('|^-+$|', $sLine)) {
             $sLine = "<hr style='height:1px; border-right-style:none; border-left-style:none; border-bottom-style:none;'" . ($sHTMLStandard != "HTML" ? " /" : "") . ">\n";
             $bNL = false;
         }
         $sOutLine .= $sLine;
         if ($iListLevel > 0 && (trim($sLine) == "" || !preg_match("|[^ \t*{$sASCIIBullets}]+|", $sLine))) {
             // end of bullet list
             while ($iListLevel > 0) {
                 $sOutLine .= "</li>\n";
                 $sOutLine .= "</{$sListType}>\n";
                 $iListLevel--;
                 $bInLI = false;
             }
             $bNL = false;
             $bInLI = false;
         }
         if ($iListLevel == 0 && preg_match('/([^\\\\]\\|)|(^\\|)/', $sOutLine)) {
             $aCells = WYLongTextElement::_aSplitTableCells($sOutLine);
             $sOutLine = "<tr>\n";
             foreach ($aCells as $sCell) {
                 $sCell = trim($sCell);
                 if ($sCell == "") {
                     $sCell = "&nbsp;";
                 }
                 $sOutLine .= "   <td>{$sCell}</td>\n";
             }
             $sOutLine .= "</tr>\n";
             if (!$bInTable) {
                 $sOutLine = "<table border='0' cellpadding='0' cellspacing='0'>\n" . $sOutLine;
                 $bInTable = true;
             }
             $bNL = false;
         } else {
             if ($bInTable && !preg_match('/([^\\\\]\\|)|(^\\|)/', $sOutLine)) {
                 $sOutLine = "</table>{$sOutLine}\n";
                 $bInTable = false;
                 $bNL = false;
             }
         }
         $sOutLine = preg_replace('/\\\\\\|/', '|', $sOutLine);
         $iLine++;
         if ($iLine >= $iNumLines) {
             $bNL = false;
         }
         $aOutLines[] = $sOutLine . ($bNL ? "{$sBR}\n" : "");
     }
     // close everything left open:
     //if ($bInLI) $aOutLines[] = "</li>\n";
     if ($bInLI) {
         $aOutLines[] = "\n";
     }
     while ($iListLevel) {
         $aOutLines[] .= "</{$sListType}>\n";
         $iListLevel--;
     }
     if ($bInTable) {
         $aOutLines[] = "</table>\n";
     }
     $sContent = join("", $aOutLines);
     $sContent = str_replace("{$sBR}\n.{$sBR}", $sHTMLStandard == "HTML" ? "<br clear='all'>" : "<br clear='all' />", $sContent);
     $sContent = str_replace("{$sBR}\n<table>", "\n<table>", $sContent);
     $sContent = str_replace("HtTpS", "https", $sContent);
     $sContent = str_replace("HtTp", "http", $sContent);
     return $sContent;
 }