function GetSafeFieldValue($s_fld, $b_text_subs = false, $s_array_sep = ";")
 {
     //
     // for array values, insert the array separator after making
     // the individual values HTML-safe
     // The equivalent logic up to and including version 8.24 used
     // htmlspecialchars not htmlentities.
     // The use of htmlentities broke UTF-8 template processing,
     // and this was reported in version 8.28.
     // By specifying the character set, we trigger the use of htmlspecialchars
     // so the logic is equivalent to the old logic.
     //
     if (isset($this->_aFields[$s_fld]) && is_array($this->_aFields[$s_fld])) {
         $s_value = implode($this->_GetArraySep($s_array_sep), HTMLEntitiesArray($this->_aFields[$s_fld], false, GetMailOption("CharSet")));
     } else {
         if (!isset($this->_aFields[$s_fld])) {
             if (($s_name = GetFileName($s_fld)) === false) {
                 $s_name = "";
             }
             $s_value = $s_name;
         } else {
             $s_value = (string) $this->_aFields[$s_fld];
         }
         if ($b_text_subs) {
             list($s_value, $a_subs_data) = $this->_PrepareTextSubstitute($s_value);
         }
         $s_value = FixedHTMLEntities($s_value, GetMailOption("CharSet"));
         if ($b_text_subs) {
             $s_value = $this->_CompleteTextSubstitute($s_value, $a_subs_data);
         }
     }
     return $s_value;
 }
 function ShowMessages()
 {
     global $aMessages, $sLangID, $bShowMesgNumbers, $aGetVars, $sHTMLCharSet;
     //
     // force message numbers on unless "mnums=no"
     //
     if (isset($aGetVars["mnums"]) && $aGetVars["mnums"] == "no") {
         $bShowMesgNumbers = false;
     } else {
         $bShowMesgNumbers = true;
     }
     LoadBuiltinLanguage();
     $s_def_lang = $sLangID;
     $a_def_mesgs = $aMessages;
     LoadLanguageFile();
     $s_active_lang = $sLangID;
     $a_active_mesgs = $aMessages;
     $a_list = get_defined_constants();
     echo "<html>\n";
     echo "<head>\n";
     if (isset($sHTMLCharSet) && $sHTMLCharSet !== "") {
         echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset={$sHTMLCharSet}\">\n";
     }
     echo "</head>\n";
     echo "<body>\n";
     echo "<table border=\"1\" cellpadding=\"10\" width=\"95%\">\n";
     echo "<tr>\n";
     echo "<th>\n";
     echo "Message Number";
     echo "</th>\n";
     echo "<th>\n";
     echo "{$s_def_lang}";
     echo "</th>\n";
     echo "<th>\n";
     echo "{$s_active_lang}";
     echo "</th>\n";
     echo "</tr>\n";
     foreach ($a_list as $s_name => $i_value) {
         if (substr($s_name, 0, 4) == "MSG_") {
             //
             // some PHP constants begin with MSG_, so we try to skip them too
             //
             switch ($s_name) {
                 case "MSG_IPC_NOWAIT":
                 case "MSG_EAGAIN":
                 case "MSG_ENOMSG":
                 case "MSG_NOERROR":
                 case "MSG_EXCEPT":
                 case "MSG_OOB":
                 case "MSG_PEEK":
                 case "MSG_DONTROUTE":
                 case "MSG_EOR":
                     continue 2;
             }
             if ($i_value >= 256) {
                 continue;
             }
             echo "<tr>\n";
             echo "<td valign=\"top\">\n";
             echo "{$s_name} ({$i_value})";
             echo "</td>\n";
             echo "<td valign=\"top\">\n";
             $aMessages = $a_def_mesgs;
             $s_def_msg = GetMessage((int) $i_value, array(), true, true);
             echo nl2br(htmlentities($s_def_msg));
             // English - don't need FixedHTMLEntities
             echo "</td>\n";
             echo "<td valign=\"top\">\n";
             $aMessages = $a_active_mesgs;
             $s_act_msg = GetMessage((int) $i_value, array(), true, true);
             if ($s_def_msg == $s_act_msg) {
                 echo "<i>identical</i>\n";
             } else {
                 echo nl2br(FixedHTMLEntities($s_act_msg));
             }
             echo "</td>\n";
             echo "</tr>\n";
         }
     }
     echo "</table>\n";
     echo "</body>\n";
     echo "</html>\n";
 }