15 private const TASKS_CATEGORY =
'tasks';
41 if (!window.BXHtmlEditor)
48 SaveConfig:
function(config)
52 if (config && config.id)
54 BXHtmlEditor.configs[config.id] = config;
59 Show:
function(config, id)
63 if ((!config || typeof config !=
'object') &&
id && BXHtmlEditor.configs[
id])
65 config = BXHtmlEditor.configs[id];
68 if (config && typeof config ==
'object')
70 if (!BXHtmlEditor.editors[config.id] || !BXHtmlEditor.editors[config.id].Check())
72 BXHtmlEditor.editors[config.id] =
new window.BXEditor(config);
76 BXHtmlEditor.editors[config.id].CheckAndReInit();
84 if (BXHtmlEditor.editors[
id])
86 BXHtmlEditor.editors[config.id].Hide();
91 return BXHtmlEditor.editors[id] ||
false;
93 OnBeforeUnload:
function()
95 for (var
id in BXHtmlEditor.editors)
97 if (BXHtmlEditor.editors.hasOwnProperty(
id) &&
98 BXHtmlEditor.editors[
id].config.askBeforeUnloadPage ===
true &&
99 BXHtmlEditor.editors[
id].IsShown() &&
100 BXHtmlEditor.editors[
id].IsContentChanged() &&
101 !BXHtmlEditor.editors[
id].IsSubmited() &&
102 BXHtmlEditor.editors[
id].beforeUnloadHandlerAllowed !==
false)
104 if(typeof(BX.desktopUtils) !=
'undefined' && typeof(BX.desktopUtils.isChangedLocationToBx) ==
'function' && BX.desktopUtils.isChangedLocationToBx())
108 return BXHtmlEditor.editors[id].config.beforeUnloadMessage || BX.message(
'BXEdExitConfirm');
113 ReplaceNewLines :
function(content)
115 content = content.replace(/<[^<>]*br>\n/ig,
'#BX_BR#');
119 contentTmp = content.replace(/([\s|\S]+)\n([\s|\S]+)/gi,
function (s, s1, s2)
121 if (s1.match(/>\s*$/) || s2.match(/^\s*</))
123 return s1 +
'#BX_BR#' + s2;
126 if (contentTmp == content)
132 content = contentTmp;
136 content = content.replace(/#BX_BR#/ig,
"<br>\n");
141 ReplaceNewLinesBack:
function(content)
143 content = content.replace(/<[^<>]*br>\n/ig,
'#BX_BR#');
147 contentTmp = content.replace(/([\s|\S]+)#BX_BR#([\s|\S]+)/gi,
function (s, s1, s2)
149 if (s1.match(/>\s*$/) || s2.match(/^\s*</))
151 return s1 +
'\n' + s2;
154 if (contentTmp == content)
160 content = contentTmp;
164 content = content.replace(/#BX_BR#/ig,
"<br>\n");
170 window.BXHtmlEditor = BXHtmlEditor;
171 window.onbeforeunload = BXHtmlEditor.OnBeforeUnload;
174 BX.onCustomEvent(window,
"OnBXHtmlEditorInit");
175 top.BXHtmlEditorAjaxResponse = {};
179 $basePath =
'/bitrix/js/fileman/html_editor/';
180 $this->
id = (isset(
$arParams[
'id']) &&
$arParams[
'id'] <>
'') ?
$arParams[
'id'] :
'bxeditor'.mb_substr(uniqid(mt_rand(),
true), 0, 4);
181 $this->
id = preg_replace(
"/[^a-zA-Z0-9_:\.]/is",
"", $this->
id);
184 $this->name = preg_replace(
"/[^a-zA-Z0-9_:\.]/is",
"",
$arParams[
'name']);
188 $this->name = $this->id;
191 $this->cssIframePath = $this->
GetActualPath($basePath.
'iframe-style.css');
204 '/bitrix/js/main/dd.js'
207 'rel' =>
array(
'ui.design-tokens',
'date',
'timer')
209 CUtil::InitJSCore(
array(
'html_editor'));
213 foreach(
GetModuleEvents(
"fileman",
"OnBeforeHTMLEditorScriptRuns",
true) as $arEvent)
216 $this->bAutorized = is_object(
$USER) &&
$USER->IsAuthorized();
222 $this->bAllowPhp =
$arParams[
'bAllowPhp'] !==
false;
227 $arParams[
"bodyClass"] = COption::GetOptionString(
"fileman",
"editor_body_class",
"");
228 $arParams[
"bodyId"] = COption::GetOptionString(
"fileman",
"editor_body_id",
"");
230 $this->content = (
$arParams[
'content'] ??
'');
231 $this->content = preg_replace(
"/\r\n/is",
"\n", $this->content);
234 $this->inputId = isset(
$arParams[
'inputId']) ?
$arParams[
'inputId'] :
'html_editor_content_id';
253 if (!isset(
$siteId) && defined(
'SITE_ID'))
268 elseif (defined(
'SITE_TEMPLATE_ID'))
273 if (!isset(
$templateId) && isset($_GET[
'siteTemplateId']))
280 $arTemplates =
array();
281 $arSnippets =
array();
282 $templateParams =
array();
297 $dbSiteRes = CSite::GetTemplateList(
$siteId);
299 while($arSiteRes = $dbSiteRes->Fetch())
303 $first = $arSiteRes[
'TEMPLATE'];
305 if ($arSiteRes[
'CONDITION'] ==
"")
322 $userSettings =
array(
324 'split_vertical' => 0,
326 'taskbar_shown' => 0,
327 'taskbar_width' => 250,
328 'specialchars' =>
false,
329 'clean_empty_spans' =>
'Y',
330 'paste_clear_colors' =>
'Y',
331 'paste_clear_borders' =>
'Y',
332 'paste_clear_decor' =>
'Y',
333 'paste_clear_table_dimen' =>
'Y',
334 'show_snippets' =>
'Y',
335 'link_dialog_type' =>
'internal'
338 $settingsKey = self::GetSettingKey(
$arParams);
339 $curSettings = CUserOptions::GetOption(
"html_editor", $settingsKey,
false,
$USER->GetId());
340 if (is_array($curSettings))
342 foreach ($userSettings as
$k =>
$val)
344 if (isset($curSettings[
$k]))
346 $userSettings[
$k] = $curSettings[
$k];
353 $arParams[
"uploadImagesFromClipboard"] =
false;
358 $arParams[
"usePspell"] = COption::GetOptionString(
"fileman",
"use_pspell",
"N");
363 $arParams[
"useCustomSpell"] = COption::GetOptionString(
"fileman",
"use_custom_spell",
"Y");
368 $arParams[
"showSnippets"] =
$arParams[
"showSnippets"] && $userSettings[
'show_snippets'] !=
'N';
371 if(!isset(
$arParams[
"initConponentParams"]))
375 $arParams[
"actionUrl"] =
$arParams[
"bbCode"] ?
'/bitrix/tools/html_editor_action.php' :
'/bitrix/admin/fileman_html_editor_action.php';
384 $arParams[
'copilotParams'][
'contextId'] ??=
'bxhtmled_copilot';
385 $arParams[
'copilotParams'][
'moduleId'] ??=
'main';
388 if (!empty(
$arParams[
'copilotParams'][
'category']))
390 $arParams[
'copilotParams'][
'invitationLineMode'] ??=
'lastLine';
394 $isCopilotEnabled = (
$arParams[
'isCopilotEnabled'] !==
false)
395 && !empty(
$arParams[
'copilotParams'][
'category'])
396 && (
$arParams[
'isCopilotTextEnabledBySettings'] ??
true)
401 if ($isCopilotEnabled)
408 'isCopilotEnabled' => $isCopilotEnabled,
409 'isCopilotImageEnabledBySettings' =>
$arParams[
'isCopilotImageEnabledBySettings'] ??
true,
410 'isCopilotTextEnabledBySettings' =>
$arParams[
'isCopilotTextEnabledBySettings'] ??
true,
411 'copilotParams' =>
$arParams[
"copilotParams"],
412 'isMentionUnavailable' =>
$arParams[
'isMentionUnavailable'] ??
false,
417 'allowPhp' => $this->bAllowPhp,
418 'limitPhpAccess' =>
$arParams[
'limitPhpAccess'],
419 'templates' => $arTemplates,
421 'templateParams' => $templateParams,
422 'componentFilter' =>
$arParams[
'componentFilter'] ??
null,
423 'snippets' => $arSnippets,
424 'placeholder' => isset(
$arParams[
'placeholder']) ?
$arParams[
'placeholder'] :
'Text here...',
426 'cssIframePath' => $this->cssIframePath,
433 'useCustomSpell' =>
$arParams[
"useCustomSpell"],
435 'askBeforeUnloadPage' => (
$arParams[
"askBeforeUnloadPage"] ??
null) !==
false,
436 'settingsKey' => $settingsKey,
437 'showComponents' =>
$arParams[
"showComponents"],
438 'showSnippets' =>
$arParams[
"showSnippets"],
440 'view' => $userSettings[
'view'],
441 'splitVertical' => $userSettings[
'split_vertical'] ?
true :
false,
442 'splitRatio' => $userSettings[
'split_ratio'],
443 'taskbarShown' => $userSettings[
'taskbar_shown'] ? true :
false,
444 'taskbarWidth' => $userSettings[
'taskbar_width'],
445 'lastSpecialchars' => $userSettings[
'specialchars'] ? explode(
'|', $userSettings[
'specialchars']) :
false,
446 'cleanEmptySpans' => $userSettings[
'clean_empty_spans'] !=
'N',
447 'pasteSetColors' => $userSettings[
'paste_clear_colors'] !=
'N',
448 'pasteSetBorders' => $userSettings[
'paste_clear_borders'] !=
'N',
449 'pasteSetDecor' => $userSettings[
'paste_clear_decor'] !=
'N',
450 'pasteClearTableDimen' => $userSettings[
'paste_clear_table_dimen'] !=
'N',
451 'linkDialogType' => $userSettings[
'link_dialog_type'],
456 if (($this->bAllowPhp ||
$arParams[
'limitPhpAccess']) &&
$arParams[
"showTaskbars"] !==
false)
463 $this->jsConfig[
"initAutosave"] =
$arParams[
"initAutosave"];
466 if (isset(
$arParams[
"uploadImagesFromClipboard"]))
468 $this->jsConfig[
"uploadImagesFromClipboard"] =
$arParams[
"uploadImagesFromClipboard"];
473 $this->jsConfig[
"useFileDialogs"] =
$arParams[
"useFileDialogs"];
475 elseif (\
Bitrix\Main\ModuleManager::isModuleInstalled(
'bitrix24'))
477 $this->jsConfig[
"useFileDialogs"] =
false;
482 $this->jsConfig[
"showTaskbars"] =
$arParams[
"showTaskbars"];
487 $this->jsConfig[
"showNodeNavi"] =
$arParams[
"showNodeNavi"];
492 $this->jsConfig[
"controlsMap"] =
$arParams[
"controlsMap"];
497 $this->jsConfig[
"smiles"] =
$arParams[
"arSmiles"];
502 $this->jsConfig[
"smileSets"] =
$arParams[
"arSmilesSet"];
507 $this->jsConfig[
"iframeCss"] =
$arParams[
"iframeCss"];
510 if (isset(
$arParams[
"beforeUnloadMessage"]))
512 $this->jsConfig[
"beforeUnloadMessage"] =
$arParams[
"beforeUnloadMessage"];
515 if (isset(
$arParams[
"setFocusAfterShow"]))
517 $this->jsConfig[
"setFocusAfterShow"] =
$arParams[
"setFocusAfterShow"];
522 $this->jsConfig[
"relPath"] =
$arParams[
"relPath"];
528 $this->jsConfig[
"autoResize"] =
$arParams[
"autoResize"];
529 if (isset(
$arParams[
'autoResizeOffset']))
531 $this->jsConfig[
'autoResizeOffset'] =
$arParams[
'autoResizeOffset'];
533 if (isset(
$arParams[
'autoResizeMaxHeight']))
535 $this->jsConfig[
'autoResizeMaxHeight'] =
$arParams[
'autoResizeMaxHeight'];
537 if (isset(
$arParams[
'autoResizeSaveSize']))
539 $this->jsConfig[
'autoResizeSaveSize'] =
$arParams[
'autoResizeSaveSize'] !==
false;
545 $this->jsConfig[
"minBodyWidth"] =
$arParams[
"minBodyWidth"];
549 $this->jsConfig[
"minBodyHeight"] =
$arParams[
"minBodyHeight"];
553 $this->jsConfig[
"normalBodyWidth"] =
$arParams[
"normalBodyWidth"];
558 $this->jsConfig[
'autoLink'] =
$arParams[
'autoLink'];
566 if (!Loader::includeModule(
'ai'))
571 $engine = AI\Engine::getByCategory(AI\Engine::CATEGORIES[
'text'], AI\Context::getFake());
578 $isTasks = str_contains($id,
'tasks');
582 return self::TASKS_CATEGORY;
600 if ((
$arParams[
"uploadImagesFromClipboard"] ??
null) !==
false)
605 'HtmlEditor:onBeforeBuild',
609 EventManager::getInstance()->send(
$event);
618 'requestUrl' =>
'/bitrix/admin/fileman_component_params.php'
625 $width = isset($this->jsConfig[
'width']) && intval($this->jsConfig[
'width']) > 0 ? $this->jsConfig[
'width'] :
"100%";
626 $height = isset($this->jsConfig[
'height']) && intval($this->jsConfig[
'height']) > 0 ? $this->jsConfig[
'height'] :
"100%";
628 $widthUnit = mb_strpos(
$width,
"%") ===
false ?
"px" :
"%";
629 $heightUnit = mb_strpos($height,
"%") ===
false ?
"px" :
"%";
631 $height = intval($height);
634 <div
class=
"bx-html-editor" id=
"bx-html-editor-<?=$this->id?>" style=
"width:<?= $width.$widthUnit?>; height:<?= $height.$heightUnit?>; <?= $display ? '' : 'display: none;'?>">
635 <div
class=
"bxhtmled-toolbar-cnt" id=
"bx-html-editor-tlbr-cnt-<?=$this->id?>">
636 <div
class=
"bxhtmled-toolbar" id=
"bx-html-editor-tlbr-<?=$this->id?>"></div>
638 <div
class=
"bxhtmled-search-cnt" id=
"bx-html-editor-search-cnt-<?=$this->id?>" style=
"display: none;"></div>
639 <div
class=
"bxhtmled-area-cnt" id=
"bx-html-editor-area-cnt-<?=$this->id?>">
640 <div
class=
"bxhtmled-iframe-cnt" id=
"bx-html-editor-iframe-cnt-<?=$this->id?>"></div>
641 <div
class=
"bxhtmled-textarea-cnt" id=
"bx-html-editor-ta-cnt-<?=$this->id?>"></div>
642 <div
class=
"bxhtmled-resizer-overlay" id=
"bx-html-editor-res-over-<?=$this->id?>"></div>
643 <div
id=
"bx-html-editor-split-resizer-<?=$this->id?>"></div>
645 <div
class=
"bxhtmled-nav-cnt" id=
"bx-html-editor-nav-cnt-<?=$this->id?>" style=
"display: none;"></div>
646 <div
class=
"bxhtmled-taskbar-cnt bxhtmled-taskbar-hidden" id=
"bx-html-editor-tskbr-cnt-<?=$this->id?>">
647 <div
class=
"bxhtmled-taskbar-top-cnt" id=
"bx-html-editor-tskbr-top-<?=$this->id?>"></div>
648 <div
class=
"bxhtmled-taskbar-resizer" id=
"bx-html-editor-tskbr-res-<?=$this->id?>">
649 <div
class=
"bxhtmled-right-side-split-border">
650 <div data-bx-tsk-split-but=
"Y" class=
"bxhtmled-right-side-split-btn"></div>
653 <div
class=
"bxhtmled-taskbar-search-nothing" id=
"bxhed-tskbr-search-nothing-<?=$this->id?>"><?=
GetMessage(
'HTMLED_SEARCH_NOTHING')?></div>
654 <div
class=
"bxhtmled-taskbar-search-cont" id=
"bxhed-tskbr-search-cnt-<?=$this->id?>" data-bx-type=
"taskbar_search">
655 <div
class=
"bxhtmled-search-alignment" id=
"bxhed-tskbr-search-ali-<?=$this->id?>">
656 <input type=
"text" class=
"bxhtmled-search-inp" id=
"bxhed-tskbr-search-inp-<?=$this->id?>" placeholder=
"<?= GetMessage('HTMLED_SEARCH_PLACEHOLDER')?>"/>
658 <div
class=
"bxhtmled-search-cancel" data-bx-type=
"taskbar_search_cancel" title=
"<?= GetMessage('HTMLED_SEARCH_CANCEL')?>"></div>
661 <div
id=
"bx-html-editor-file-dialogs-<?=$this->id?>" style=
"display: none;"></div>
666 function Run($display =
true)
668 $content = $this->jsConfig[
'content'];
669 $templates = $this->jsConfig[
'templates'];
670 $templateParams = $this->jsConfig[
'templateParams'];
671 $snippets = $this->jsConfig[
'snippets'];
672 $components = $this->jsConfig[
'components'] ??
null;
674 unset($this->jsConfig[
'content'], $this->jsConfig[
'templates'], $this->jsConfig[
'templateParams'], $this->jsConfig[
'snippets'], $this->jsConfig[
'components']);
679 config.content =
'<?= CUtil::JSEscape($content)?>';
681 config.templateParams = <?= $this->
SafeJsonEncode($templateParams)?>;
685 window.BXHtmlEditor.Show(config);
687 window.BXHtmlEditor.SaveConfig(config);
708 ?><script>BX.message(<?=CUtil::PhpToJSObject($mess_lang,
false);?>);</script><?
718 $this->jsConfig[
$option] = $value;
727 'bClearCache' => $bClearCache,
728 'returnArray' =>
true
734 'bClearCache' => $bClearCache
745 $allowed = trim(COption::GetOptionString(
'fileman',
"~allowed_components",
''));
746 $mask = $allowed ===
''? 0 : mb_substr(md5($allowed), 0, 10);
748 $lang = isset($Params[
'lang']) ? $Params[
'lang'] : LANGUAGE_ID;
749 $component_type =
'';
751 $component_type =
'_'.$arFilter[
'TYPE'];
753 $cache_name =
'component_tree_array_'.$lang.
'_'.$mask.$component_type;
754 $table_id =
"fileman_component_tree";
761 if(
$CACHE_MANAGER->Read(self::CACHE_TIME, $cache_name, $table_id))
766 if (empty(self::$arComponents))
771 $arAC = explode(
"\n", $allowed);
772 $arAC = array_unique($arAC);
773 $arAllowed = Array();
774 foreach ($arAC as
$f)
776 $f = preg_replace(
"/\s/is",
"",
$f);
777 $f = preg_replace(
"/\./is",
"\\.",
$f);
778 $f = preg_replace(
"/\*/is",
".*",
$f);
779 $arAllowed[] =
'/^'.$f.
'$/';
781 $namespace =
'bitrix';
790 self::$arComponents =
array(
794 self::$thirdLevelId = 0;
796 if (isset($arTree[
'#']))
804 return self::$arComponents;
809 foreach ($arEls as $elName => $arEl)
811 $arEl[
'*'] = $arEl[
'*'] ??
null;
812 if (mb_strpos(
$path,
",") !==
false)
814 if (isset($arEl[
'*']))
816 $thirdLevelName =
'__bx_thirdLevel_'.self::$thirdLevelId;
817 self::$thirdLevelId++;
818 foreach ($arEl[
'*'] as $name => $comp)
820 self::$arComponents[
'items'][] =
array(
823 "type" => $comp[
'TYPE'],
824 "title" => $comp[
'TITLE'],
825 "complex" => $comp[
'COMPLEX'],
826 "params" =>
array(
"DESCRIPTION" => $comp[
'DESCRIPTION']),
827 "thirdlevel" => $thirdLevelName
834 $realPath = ((
$path ==
'') ? $elName :
$path.
','.$elName);
836 self::$arComponents[
'groups'][] =
array(
839 "title" => (isset($arEl[
'@'][
'NAME']) && $arEl[
'@'][
'NAME'] !==
'') ? $arEl[
'@'][
'NAME'] : $elName
842 if (isset($arEl[
'#']))
847 if (is_array($arEl[
'*']) && !empty($arEl[
'*']))
849 foreach ($arEl[
'*'] as $name => $comp)
851 self::$arComponents[
'items'][] =
array(
854 "type" => $comp[
'TYPE'],
855 "title" => $comp[
'TITLE'],
856 "complex" => $comp[
'COMPLEX'],
857 "params" =>
array(
"DESCRIPTION" => $comp[
'DESCRIPTION']),
858 "thirdlevel" =>
false
867 $arTemplates = Array(Array(
'value' =>
'.default',
'name' =>
GetMessage(
"FILEMAN_DEFTEMPL")));
871 $arTemplates[] = Array(
'value'=>
$ar[
'ID'],
'name'=>
$ar[
'NAME']);
884 case "load_site_template":
885 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
887 $siteTemplate =
$_REQUEST[
'site_template'];
891 case "load_components_list":
892 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
894 $siteTemplate =
$_REQUEST[
'site_template'];
895 $componentFilter = isset(
$_REQUEST[
'componentFilter']) ?
$_REQUEST[
'componentFilter'] :
false;
902 case "load_snippets_list":
903 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
912 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
924 'current_path' =>
$_REQUEST[
'current_path'],
925 'description' =>
$_REQUEST[
'description']
936 'description' =>
$_REQUEST[
'description']
946 case "remove_snippet":
947 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
969 case "snippet_add_category":
970 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
991 case "snippet_remove_category":
992 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
1012 case "snippet_rename_category":
1013 if (!
$USER->CanDoOperation(
'fileman_view_file_structure'))
1019 'new_name' =>
$_REQUEST[
'category_new_name']
1037 case "spellcheck_words":
1038 case "spellcheck_add_word":
1042 "use_pspell" =>
$_REQUEST[
'use_pspell'] !==
"N",
1043 "use_custom_spell" =>
$_REQUEST[
'use_custom_spell'] !==
"N",
1044 "mode" => PSPELL_FAST
1047 if (
$action ==
"spellcheck_words")
1051 'words' => $spellChecker->checkWords($words)
1057 $spellChecker->addWord($word);
1061 case "load_file_dialogs":
1063 $editorId = preg_replace(
"/[^a-zA-Z0-9_-]/is",
"_", $editorId);
1067 "event" =>
"BxOpenFileBrowserWindFile".$editorId,
1068 "arResultDest" => Array(
"FUNCTION_NAME" =>
"OnFileDialogSelect".$editorId),
1069 "arPath" => Array(
"SITE" =>
SITE_ID),
1072 "showUploadTab" =>
true,
1073 "showAddToMenuTab" =>
false,
1074 "fileFilter" =>
'image',
1075 "allowAllFiles" =>
true,
1076 "saveConfig" =>
true
1079 CMedialib::ShowBrowseButton(
1082 'event' =>
"BxOpenFileBrowserWindFile".$editorId,
1083 'button_id' =>
"bx-open-file-link-medialib-but-".$editorId,
1084 'id' =>
"bx_open_file_link_medialib_button_".$editorId,
1085 'MedialibConfig' =>
array(
1086 "event" =>
"BxOpenFileBrowserFileMl".$editorId,
1087 "arResultDest" => Array(
"FUNCTION_NAME" =>
"OnFileDialogSelect".$editorId)
1089 'useMLDefault' =>
false
1093 CMedialib::ShowBrowseButton(
1096 'event' =>
"BxOpenFileBrowserWindFile".$editorId,
1097 'button_id' =>
"bx-open-file-medialib-but-".$editorId,
1098 'id' =>
"bx_open_file_medialib_button_".$editorId,
1099 'MedialibConfig' =>
array(
1100 "event" =>
"BxOpenFileBrowserImgFileMl".$editorId,
1101 "arResultDest" => Array(
"FUNCTION_NAME" =>
"OnFileDialogImgSelect".$editorId),
1102 "types" =>
array(
'image')
1112 $uploader = new \CFileUploader(
1114 "onFileIsUploaded" =>
function (
$hash, &$file, &$package, &$upload, &
$error)
1116 $error = \CFile::CheckFile($file[
"files"][
"default"], 0,
"image/", \CFile::GetImageExtensions());
1120 if(empty(
$error) &&
$io->ValidateFilenameString(
$fileName) &&
$io->ValidatePathString(self::GetUploadPath().$fileName))
1122 if (COption::GetOptionString(
'fileman',
"use_medialib",
"Y") !=
"N" &&
1123 CMedialib::CanDoOperation(
'medialib_view_collection', 0,
false,
true))
1125 $image = CMedialib::AutosaveImage($file[
"files"][
"default"]);
1126 if ($image && $image[
'PATH'])
1128 $file[
"uploadedPath"] = $image[
'PATH'];
1139 if(
$io->FileExists(
$_SERVER[
"DOCUMENT_ROOT"].$newPath))
1144 while(
true && $iter < 1000)
1147 if(!
$io->FileExists(
$_SERVER[
"DOCUMENT_ROOT"].$newPath))
1155 $file[
"uploadedPath"] = $newPath;
1163 $uploader->checkPost();
1175 if ($reqId ===
false)
1195 'groups' =>
array(),
1196 'templates' =>
array(),
1198 'template_props' =>
array()
1203 if (is_array($arTemplates))
1219 if (is_array($arTemplateProps))
1221 foreach ($arTemplateProps as
$k => $arTemplateProp)
1223 $result[
'templ_props'][] = self::_HandleComponentParam(
$k, $arTemplateProp, $arProps[
'GROUPS']);
1233 if (is_array($arProps[
'GROUPS']))
1235 foreach ($arProps[
'GROUPS'] as
$k => $arGroup)
1239 'title' => $arGroup[
'NAME']
1244 if (is_array($arProps[
'PARAMETERS']))
1246 foreach ($arProps[
'PARAMETERS'] as
$k => $arParam)
1248 $result[
'properties'][] = self::_HandleComponentParam(
$k, $arParam, $arProps[
'GROUPS']);
1255 private static function _HandleComponentParam(
$name =
'', $arParam =
array(), $arGroup =
array())
1257 $name = preg_replace(
"/[^a-zA-Z0-9_-]/is",
"_",
$name);
1261 'parent' => (isset($arParam[
'PARENT']) && isset($arGroup[$arParam[
'PARENT']])) ? $arParam[
'PARENT'] :
false
1264 if (!empty($arParam))
1266 foreach ($arParam as
$k => $prop)
1268 if (
$k ==
'TYPE' && $prop ==
'FILE')
1271 'NAME' => CUtil::JSEscape(
$name),
1272 'TARGET' => isset($arParam[
'FD_TARGET']) ? $arParam[
'FD_TARGET'] :
'F',
1273 'EXT' => isset($arParam[
'FD_EXT']) ? $arParam[
'FD_EXT'] :
'',
1274 'UPLOAD' => isset($arParam[
'FD_UPLOAD']) && $arParam[
'FD_UPLOAD'] && $arParam[
'FD_TARGET'] ==
'F',
1275 'USE_ML' => isset($arParam[
'FD_USE_MEDIALIB']) && $arParam[
'FD_USE_MEDIALIB'],
1276 'ONLY_ML' => isset($arParam[
'FD_USE_ONLY_MEDIALIB']) && $arParam[
'FD_USE_ONLY_MEDIALIB'],
1277 'ML_TYPES' => isset($arParam[
'FD_MEDIALIB_TYPES']) ? $arParam[
'FD_MEDIALIB_TYPES'] :
false
1280 elseif (in_array(
$k, Array(
'FD_TARGET',
'FD_EXT',
'FD_UPLOAD',
'FD_MEDIALIB_TYPES',
'FD_USE_ONLY_MEDIALIB')))
1296 $params[
"STYLES"] = preg_replace(
"/(url\(\"?)images\//is",
"\\1".
$params[
'SITE_TEMPLATE_PATH'].
'/images/',
$params[
"STYLES"]);
1299 if (is_array(
$params[
'EDITOR_STYLES']))
1319 if($metaData && isset($metaData[
'EMBED']))
1323 'html' => $metaData[
'EMBED'],
1324 'title' => $metaData[
'TITLE'],
1325 'provider' => $metaData[
'EXTRA'][
'PROVIDER_NAME'] ??
null,
1326 'width' => intval($metaData[
'EXTRA'][
'VIDEO_WIDTH'] ??
null),
1327 'height' => intval($metaData[
'EXTRA'][
'VIDEO_HEIGHT'] ??
null),
1333 isset($metaData[
'EXTRA'][
'VIDEO']) &&
1334 !empty($metaData[
'EXTRA'][
'VIDEO']) &&
1335 $metaData[
'EXTRA'][
'VIDEO_TYPE'] !=
'application/x-shockwave-flash'
1341 unset(
$output[
'data'][
'local']);
1342 $output[
'data'][
'remote'] =
true;
1343 $output[
'data'][
'title'] = $metaData[
'TITLE'];
1344 if(isset($metaData[
'EXTRA'][
'VIDEO_WIDTH']))
1346 $output[
'data'][
'width'] = $metaData[
'EXTRA'][
'VIDEO_WIDTH'];
1348 if(isset($metaData[
'EXTRA'][
'VIDEO_HEIGHT']))
1350 $output[
'data'][
'height'] = $metaData[
'EXTRA'][
'VIDEO_HEIGHT'];
1352 if(isset($metaData[
'EXTRA'][
'VIDEO_TYPE']))
1354 $output[
'data'][
'mimeType'] = $metaData[
'EXTRA'][
'VIDEO_TYPE'];
1363 if (mb_strpos(
$path, $serverPath) !==
false)
1368 if (
$io->FileExists(
$io->RelativeToAbsolutePath(
$path)))
1387 $http = new \Bitrix\Main\Web\HttpClient();
1389 $http->setPrivateIp(
false);
1390 $http->setTimeout(5);
1391 $http->setStreamTimeout(5);
1392 $resp1 = $http->head(
$path);
1393 if ($resp1 !==
false)
1395 if($resp1 ==
'403 Forbidden' || $http->getStatus() ==
'403')
1397 $output[
'error'] .=
'[FVID403] '.GetMessage(
'HTMLED_VIDEO_FORBIDDEN').
";\n";
1399 elseif($resp1 ==
'Not Found' || $http->getStatus() ==
'404' || $http->getContentType() ==
'text/html')
1401 $output[
'error'] .=
'[FVID404] '.GetMessage(
'HTMLED_VIDEO_NOT_FOUND').
";\n";
1414 $error = $http->getError();
1426 if (defined(
"SITE_SERVER_NAME") && SITE_SERVER_NAME <>
'')
1427 $server_name = SITE_SERVER_NAME;
1428 $server_name = $server_name ??
null;
1430 $server_name = COption::GetOptionString(
"main",
"server_name",
"");
1432 $server_name =
$_SERVER[
'HTTP_HOST'];
1433 $server_name = rtrim($server_name,
'/');
1434 if (!preg_match(
'/^[a-z0-9\.\-]+$/i', $server_name))
1437 $host = $converter->Encode($server_name);
1438 $server_name =
$host;
1441 $serverPath = (CMain::IsHTTPS() ?
"https://" :
"http://").$server_name;
1446 private static function GetSettingKey(
$params =
array())
1448 $settingsKey =
"user_settings_".$params[
"bbCode"];
1451 $settingsKey .=
'_'.$params[
"view"];
1453 if (isset(
$params[
"controlsMap"]) && is_array(
$params[
"controlsMap"]))
1459 $controlId = strtolower(
$control[
'id']);
1460 if ($controlId ==
'bbcode' || $controlId ==
'changeview')
1462 $settingsKey .=
'_'.$control[
'id'];
1467 return $settingsKey;
1472 return '/upload/images/';
if(isset( $_REQUEST["mode"]) &&$_REQUEST["mode"]=="ajax") if(isset($_REQUEST["mode"]) && $_REQUEST["mode"]=="save_lru" &&check_bitrix_sessid()) $first
static loadLanguageFile($file, $language=null, $normalize=true)
static fetchVideoMetaData($url)
static encode($data, $options=null)
static ShowScript($arConfig)
static Init($config=array())
static GetTemplateProps($componentName, $templateName, $siteTemplate="", $arCurrentValues=array())
static GetTemplatesList($componentName, $currentTemplate=false)
static GetComponentsTree($filterNamespace=false, $arNameFilter=false, $arFilter=false)
static GetComponentProps($componentName, $arCurrentValues=array(), $templateProperties=array())
static SecurePathVar($str)
static GetSiteTemplates()
BuildSceleton($display=true)
static ShowResponse($reqId=false, $Res=false)
SafeJsonEncode($data=array())
static RequestAction($action='')
GetAiCategory(string $id, string $name)
static getRemoteVideoUrlInfo($path)
static GetSnippets($templateId, $bClearCache=false)
static GetComponents($Params, $bClearCache=false, $arFilter=array())
static GetSiteTemplateParams($templateId, $siteId)
static GetComponentParams($name, $siteTemplate='', $template='', $curValues=array(), $loadHelp=true)
static _HandleComponentElement($arEls, $path)
static GetVideoOembed($url='')
setOption(string $option, $value)
static Init($arExt=array(), $bReturn=false)
static RegisterExt($name, $arPaths)
static GetList($arOrder=array(), $arFilter=array(), $arSelect=false)
static Remove($params=array())
static GetGroupList($Params)
static Add($params=array())
static GetDefaultFileName($path)
static Update($params=array())
static RemoveCategory($params)
static RenameCategory($params)
static CreateCategory($params=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
bx_acc_lim_group_list limitGroupList[] multiple<?=$group[ 'ID']?> ID selected margin top
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
$_SERVER["DOCUMENT_ROOT"]
if(!defined('SITE_ID')) $lang
ExecuteModuleEventEx($arEvent, $arParams=[])
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
CopyDirFiles($path_from, $path_to, $ReWrite=true, $Recursive=false, $bDeleteAfterCopy=false, $strExclude="")
GetMessage($name, $aReplace=null)
GetFileNameWithoutExtension($path)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
<? endif;?> window document title
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
$GLOBALS['_____370096793']
adm detail iblock types adm detail iblock list tr_SITE_ID display