function AddHTMLEditorFrame($strTextFieldName, $strTextValue, $strTextTypeFieldName, $strTextTypeValue, $arSize = array("height" => 350), $CONVERT_FOR_WORKFLOW = "N", $WORKFLOW_DOCUMENT_ID = 0, $NEW_DOCUMENT_PATH = "", $textarea_field = "", $site = false, $bWithoutPHP = true, $arTaskbars = false, $arAdditionalParams = array()) { // We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986] if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid()) { return; } global $htmled, $usehtmled; $strTextFieldName = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $strTextFieldName); if (is_array($arSize)) { $iHeight = $arSize["height"]; } else { $iHeight = $arSize; } $strTextValue = htmlspecialcharsback($strTextValue); $dontShowTA = isset($arAdditionalParams['dontshowta']) ? $arAdditionalParams['dontshowta'] : false; if ($arAdditionalParams['hideTypeSelector']) { $textType = $strTextTypeValue == 'html' ? 'editor' : 'text'; ?> <input type="hidden" name="<?php echo $strTextTypeFieldName; ?> " value="<?php echo $strTextTypeValue; ?> "/><?php } else { $textType = CFileMan::ShowTypeSelector(array('name' => $strTextFieldName, 'key' => $arAdditionalParams['saveEditorKey'], 'strTextTypeFieldName' => $strTextTypeFieldName, 'strTextTypeValue' => $strTextTypeValue, 'bSave' => $arAdditionalParams['saveEditorState'] !== false)); } $curHTMLEd = $textType == 'editor'; setEditorEventHandlers($strTextFieldName); ?> <textarea class="typearea" style="<?php echo $curHTMLEd || $dontShowTA ? 'display:none;' : ''; ?> width:100%;height:<?php echo $iHeight; ?> px;" name="<?php echo $strTextFieldName; ?> " id="bxed_<?php echo $strTextFieldName; ?> " wrap="virtual" <?php echo $textarea_field; ?> ><?php echo htmlspecialcharsbx($strTextValue); ?> </textarea> <?php if ($bWithoutPHP) { $arTaskbars = array("BXPropertiesTaskbar", "BXSnippetsTaskbar"); } else { if (!$arTaskbars) { $arTaskbars = array("BXPropertiesTaskbar", "BXSnippetsTaskbar", "BXComponents2Taskbar"); } } $minHeight = $arAdditionalParams['minHeight'] ? intval($arAdditionalParams['minHeight']) : 450; $arParams = array("bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N") != "Y", "bFromTextarea" => true, "bDisplay" => $curHTMLEd, "bWithoutPHP" => $bWithoutPHP, "arTaskbars" => $arTaskbars, "height" => max($iHeight, $minHeight)); if (isset($arAdditionalParams['use_editor_3'])) { $arParams['use_editor_3'] = $arAdditionalParams['use_editor_3']; } $arParams['site'] = strlen($site) <= 0 ? LANG : $site; if (isset($arSize["width"])) { $arParams["width"] = $arSize["width"]; } if (isset($arAdditionalParams)) { $arParams["arAdditionalParams"] = $arAdditionalParams; } if (isset($arAdditionalParams['limit_php_access'])) { $arParams['limit_php_access'] = $arAdditionalParams['limit_php_access']; } if (isset($arAdditionalParams['toolbarConfig'])) { $arParams['toolbarConfig'] = $arAdditionalParams['toolbarConfig']; } if (isset($arAdditionalParams['componentFilter'])) { $arParams['componentFilter'] = $arAdditionalParams['componentFilter']; } $arParams['setFocusAfterShow'] = isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : false; CFileman::ShowHTMLEditControl($strTextFieldName, $strTextValue, $arParams); }