12define(
"DEBUG_FILE_MAN",
false);
13if(!defined(
"CACHED_stickers_count")) define(
"CACHED_stickers_count", 36000000);
18 "exts" =>
array(
"css"),
23 "exts" =>
array(
"htaccess"),
28 "exts" =>
array(
"html",
"htm",
"shtml",
"shtm"),
33 "exts" =>
array(
"png"),
38 "exts" =>
array(
"gif"),
43 "exts" =>
array(
"jpeg",
"jpg",
"jpe"),
48 "exts" =>
array(
"js"),
50 "name" =>
"JavaScript"
53 "exts" =>
array(
"php",
"php3",
"php4",
"php5",
"php6",
"phtml"),
58 "exts" =>
array(
"txt",
"sql"),
63 "exts" =>
array(
"xml",
"xsl"),
68 "exts" =>
array(
"csv"),
73 "exts" =>
array(
"fla",
"swf"),
107 $page_permission =
$APPLICATION->GetFileAccessPermission($cur_page);
110 $sect_permission =
$APPLICATION->GetFileAccessPermission($cur_dir);
115 $default_edit = COption::GetOptionString(
"fileman",
"default_edit");
116 if($default_edit ==
"php")
118 $editor_type =
"file";
119 $full_src =
"&full_src=Y";
121 elseif($default_edit ==
"text")
122 $editor_type =
"file";
124 $editor_type =
"html";
129 'create_section' =>
array(),
131 'edit_section' =>
array()
134 if ($sect_permission>=
"W")
137 $href =
"/bitrix/admin/fileman_".$editor_type.
"_edit.php?lang=".LANGUAGE_ID.
"&site=".
SITE_ID.
"&path=".UrlEncode(
$APPLICATION->GetCurDir()).
"&new=Y&templateID=".urlencode(SITE_TEMPLATE_ID).
"&back_url=".UrlEncode(
$requestUri);
138 $APPLICATION->AddPanelButtonMenu(
'create',
array(
"SEPARATOR"=>
true,
"SORT"=>99));
141 "TITLE"=>
GetMessage(
"fileman_panel_new_page_title"),
142 "ACTION" =>
"jsUtils.Redirect([], '".CUtil::JSEscape($href).
"')",
147 $href =
"/bitrix/admin/fileman_newfolder.php?lang=".LANGUAGE_ID.
"&site=".
SITE_ID.
"&path=". UrlEncode(
$APPLICATION->GetCurDir()).
"&back_url=".UrlEncode(
$requestUri);
148 $APPLICATION->AddPanelButtonMenu(
'create_section',
array(
"SEPARATOR"=>
true,
"SORT"=>99));
151 "TITLE"=>
GetMessage(
"fileman_panel_new_folder_title"),
152 "ACTION" =>
"jsUtils.Redirect([], '".CUtil::JSEscape($href).
"')",
157 if ($page_permission>=
"W")
159 $href =
"/bitrix/admin/fileman_".$editor_type.
"_edit.php?lang=".LANGUAGE_ID.
"&site=".
SITE_ID.
"&templateID=".urlencode(SITE_TEMPLATE_ID).$full_src.
"&path=".UrlEncode(isset(
$_SERVER[
"REAL_FILE_PATH"]) &&
$_SERVER[
"REAL_FILE_PATH"]<>
""?
$_SERVER[
"REAL_FILE_PATH"] : $cur_page).
"&back_url=".UrlEncode(
$requestUri);
163 "TITLE"=>
GetMessage(
"fileman_panel_edit_title"),
164 "ACTION" =>
"jsUtils.Redirect([], '".CUtil::JSEscape($href).
"')",
171 if ($sect_permission>=
"W")
173 $href =
"/bitrix/admin/fileman_folder.php?lang=".LANGUAGE_ID.
"&site=".
SITE_ID.
"&path=".UrlEncode(
$APPLICATION->GetCurDir()).
"&back_url=".UrlEncode(
$requestUri);
174 $APPLICATION->AddPanelButtonMenu(
'edit_section',
array(
"SEPARATOR"=>
true,
"SORT"=>99));
177 "TITLE"=>
GetMessage(
"fileman_panel_folder_prop_title"),
178 "ACTION" =>
"jsUtils.Redirect([], '".CUtil::JSEscape($href).
"')",
184 require_once(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/fileman/classes/general/sticker.php");
187 $useHotKeys = COption::GetOptionString(
'fileman',
"stickers_use_hotkeys",
"Y") ==
"Y";
193 "TEXT" =>
GetMessage(
"FMST_PANEL_STICKER_ADD").($useHotKeys ?
' (Ctrl+Shift+S)' :
''),
194 "TITLE" =>
GetMessage(
"FMST_PANEL_STICKER_ADD_TITLE"),
198 "HK_ID" =>
"FMST_PANEL_STICKER_ADD",
200 $arMenu[] = [
"SEPARATOR" =>
true];
205 "ID" =>
"bxst-show-sticker-icon",
206 "TEXT" =>
GetMessage(
"FMST_PANEL_STICKERS_SHOW",
array(
"#COUNT#" => $curPageCount)).($useHotKeys ?
' (Ctrl+Shift+X)' :
''),
207 "TITLE" =>
GetMessage(
"FMST_PANEL_STICKERS_SHOW_TITLE"),
210 "HK_ID"=>
"FMST_PANEL_STICKERS_SHOW",
213 "TEXT" =>
GetMessage(
"FMST_PANEL_CUR_STICKER_LIST").($useHotKeys ?
' (Ctrl+Shift+L)' :
''),
214 "TITLE" =>
GetMessage(
"FMST_PANEL_CUR_STICKER_LIST_TITLE"),
217 "HK_ID"=>
"FMST_PANEL_CUR_STICKER_LIST",
220 "TEXT" =>
GetMessage(
"FMST_PANEL_ALL_STICKER_LIST"),
221 "TITLE" =>
GetMessage(
"FMST_PANEL_ALL_STICKER_LIST_TITLE"),
224 "HK_ID"=>
"FMST_PANEL_ALL_STICKER_LIST",
230 "ICON" =>
"bx-panel-small-stickers-icon",
231 "TEXT" =>
GetMessage(
"FMST_PANEL_STICKERS_TOOLTIP_TITLE"),
232 "MAIN_SORT" =>
"1000",
235 "HK_ID"=>
"FMST_PANEL_STICKERS",
252 @include(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/fileman/install/version.php");
253 if (!isset($arModuleVersion[
'VERSION']))
255 return $arModuleVersion[
'VERSION'];
265 if($sMenuTemplateTmp <>
'')
266 $strMenuLinks .=
"\$sMenuTemplate = \"".CFileMan::EscapePHPString($sMenuTemplateTmp).
"\";\n";
268 $strMenuLinks .=
"\$aMenuLinks = Array(";
273 $strMenuLinksTmp =
"";
276 $strMenuLinksTmp .=
",";
278 $strMenuLinkHref = $arMenuItem[1] ??
'';
280 $strMenuLinksTmp .=
"\n".
282 " \"".CFileMan::EscapePHPString(($arMenuItem[0] ??
null)).
"\", \n".
283 " \"".CFileMan::EscapePHPString($strMenuLinkHref).
"\", \n".
286 if(is_array(($arMenuItem[2] ??
null)))
288 for($j = 0,
$l =
count(($arMenuItem[2] ?? [])); $j <
$l; $j++)
291 $strMenuLinksTmp .=
", ";
292 $strMenuLinksTmp .=
"\"".CFileMan::EscapePHPString($arMenuItem[2][$j] ??
null).
"\"";
295 $strMenuLinksTmp .=
"), \n";
297 $strMenuLinksTmp .=
" Array(";
298 if(is_array($arMenuItem[3] ??
null))
304 $strMenuLinksTmp .=
", ";
305 $strMenuLinksTmp .=
"\"".CFileMan::EscapePHPString(
$arParams[$j]).
"\"=>".
"\"".CFileMan::EscapePHPString($arMenuItem[3][
$arParams[$j]]).
"\"";
309 $strMenuLinksTmp .=
"), \n".
310 " \"".CFileMan::EscapePHPString($arMenuItem[4] ??
null).
"\" \n".
313 $strMenuLinks .= $strMenuLinksTmp;
315 $strMenuLinks .=
"\n);";
317 $GLOBALS[
"CACHE_MANAGER"]->CleanDir(
"menu");
318 CBitrixComponent::clearComponentCache(
"bitrix:menu");
323 $aMenuLinks = Array();
331 $arrMenuContent = str_replace([
'<?php',
'<?',
'?>'],
'', $arrMenuContent);
334 $arrMenuContent = str_replace(
'SITE_DIR."',
'"/', $arrMenuContent);
337 eval($arrMenuContent);
340 return Array(
"aMenuLinks"=>$aMenuLinks,
"sMenuTemplate" => $sMenuTemplate);
362 $p = mb_strrpos(
$path ??
'',
"/");
369 $dir->MarkWritable();
372 $badDirs[] = mb_substr(
$path,
$p + 1);
380 if(!
$USER->CanDoFileOperation(
'fm_create_new_folder', Array(
$site,
$path)))
381 return GetMessage(
"FILEMAN_FILEMAN_CREATE_FOLDER_DENY").
" \"".
$path.
"\".\n";
402 if(trim(
$path) ==
'')
403 return GetMessage(
"FILEMAN_FILEMAN_TRYING_ROOT_DELETE").
"\n";
405 return GetMessage(
"FILEMAN_FILEMAN_FOLDER").
" \"$path\" ".
GetMessage(
"FILEMAN_FILEMAN_NOT_EXISTS").
"\n";
409 return GetMessage(
"FILEMAN_FILEMAN_FOLDER_DEL_DENY").
"\" ".
$path.
"\".\n";
412 $arChildren = $d->GetChildren();
413 foreach ($arChildren as $child)
415 if (!$child->IsDirectory() && $child->GetName() !=
".access.php")
416 return GetMessage(
"FILEMAN_FILEMAN_FOLDER_DEL_ERROR").
" \"".
$path.
"\" ".
GetMessage(
"FILEMAN_FILEMAN_FOLDER_NOT_EMPTY").
".\n";
430 return GetMessage(
"FILEMAN_FILEMAN_FOLDER_DEL_ERROR").
" \"".
$path.
"\".\n";
444 return GetMessage(
"FILEMAN_FILEMAN_FILE").
" \"$path\" ".
GetMessage(
"FILEMAN_FILEMAN_NOT_EXISTS").
"\n";
446 if(mb_strlen(
$path) >= 12 && mb_substr(
$path, mb_strlen(
$path) - 12) ==
"/.access.php")
451 return GetMessage(
"FILEMAN_FILEMAN_FILE_DEL_DENY").
" \"".
$path.
"\".\n";
458 $file_size =
$f->GetFileSize();
462 if(CModule::IncludeModule(
"search"))
466 if(COption::GetOptionInt(
"main",
"disk_space") > 0)
469 $quota->updateDiskQuota(
"file", $file_size,
"delete");
484 $src =
$_SERVER[
"DOCUMENT_ROOT"].$path;
485 $src = str_replace(
"//",
"/",$src);
486 if($src ==
$_SERVER[
"DOCUMENT_ROOT"])
491 @set_time_limit(600);
497 if(@unlink($linkPath))
500 return GetMessage(
"FILEMAN_FILEMAN_SYMLINK_DEL_ERROR").
" \"".
$path.
"\".\n";
506 return GetMessage(
"FILEMAN_FILEMAN_FOLDER_DEL_DENY").
" \"".
$path.
"\".\n";
510 return CFileman::DeleteFile(Array(
$site,
$path));
516 $arChildren = $d->GetChildren();
517 foreach ($arChildren as $child)
519 $fn = $child->GetName();
520 if ($child->IsDirectory())
526 if($fn ==
".access.php")
continue;
541 return $io->CombinePath(
"/",
$path);
544 public static function CopyEx($path_from, $path_to, $bDeleteAfterCopy =
false, $bOverride =
false)
547 CMain::InitPathVars($site_from, $path_from);
548 $DOC_ROOT_FROM = CSite::GetSiteDocRoot($site_from);
550 CMain::InitPathVars($site_to, $path_to);
551 $DOC_ROOT_TO = CSite::GetSiteDocRoot($site_to);
554 $path_from =
Rel2Abs(
'/', $path_from);
555 $path_to =
Rel2Abs(
'/', $path_to);
558 if(mb_strpos($DOC_ROOT_TO.$path_to.
"/", $DOC_ROOT_FROM.$path_from.
"/") === 0)
559 return GetMessage(
"FILEMAN_LIB_BAD_FOLDER").
": \"".$path_from.
"\".\n";
563 if(
$io->DirectoryExists($DOC_ROOT_FROM.$path_from))
566 if(!
$USER->CanDoFileOperation(
'fm_view_listing', Array($site_from, $path_from)))
567 return GetMessage(
"FILEMAN_FILEMAN_FOLDER_READ_DENY").
" \"".$path_from.
"\".\n";
569 if ($bDeleteAfterCopy && !
$USER->CanDoFileOperation(
'fm_delete_folder', Array($site_from, $path_from)))
570 return GetMessage(
"FILEMAN_FILEMAN_FOLDER_DEL_DENY").
" \"".$path_from.
"\".\n";
578 $APPLICATION->CopyFileAccessPermission(Array($site_from, $path_from), Array($site_to, $path_to));
583 if (!
$USER->CanDoFileOperation(
'fm_create_new_file', Array($site_to, $path_to)))
584 return GetMessage(
"FILEMAN_FILEMAN_FILE_WRITE_DENY").
" \"".$path_to.
"\".\n";
587 if(!
$USER->CanDoFileOperation(
'fm_view_file', Array($site_from, $path_from)))
588 return GetMessage(
"FILEMAN_FILEMAN_FILE_READ_DENY").
" \"".$path_from.
"\".\n";
591 if (!(
$USER->CanDoOperation(
'edit_php') ||
$USER->CanDoFileOperation(
'fm_lpa', [$site_from, $path_from]) || !(
HasScriptExtension($path_from) || mb_substr($path_from, 0, 1) ==
".")))
593 return GetMessage(
"FILEMAN_FILEMAN_FILE_READ_DENY").
" \"".$path_from.
"\".\n";
597 if($bDeleteAfterCopy && !
$USER->CanDoFileOperation(
'fm_delete_file', Array($site_from, $path_from)))
598 return GetMessage(
"FILEMAN_FILEMAN_FILE_DEL_DENY").
" \"".$path_from.
"\".\n";
601 $p = mb_strrpos($path_to,
"/");
602 $path_to_dir = mb_substr($path_to, 0,
$p);
607 if(
$io->FileExists($DOC_ROOT_TO.$path_to) ||
$io->DirectoryExists($DOC_ROOT_TO.$path_to))
617 return GetMessage(
"FILEMAN_FILEMAN_FILE_WITH_NAME").
" \"".$path_to.
"\" ".
GetMessage(
"FILEMAN_FILEMAN_ALREADY_EXISTS").
"!\n";
621 $APPLICATION->CopyFileAccessPermission(Array($site_from, $path_from), Array($site_to, $path_to));
624 if(COption::GetOptionInt(
"main",
"disk_space") > 0)
626 $f =
$io->GetFile($DOC_ROOT_FROM.$path_from);
627 $size =
$f->GetFileSize();
629 if (!$quota->checkDiskQuota(
array(
"FILE_SIZE"=>$size)))
630 return $quota->LAST_ERROR;
636 echo
"copy(".$DOC_ROOT_FROM.$path_from.
",".$DOC_ROOT_TO.$path_to.
");<br>";
638 if (!
$io->Copy($DOC_ROOT_FROM.$path_from, $DOC_ROOT_TO.$path_to))
639 $strWarning .=
GetMessage(
'FILEMAN_COPY_ERROR',
array(
'#PATH_FROM#' => htmlspecialcharsex($path_from),
'#PATH_TO#' => htmlspecialcharsex($path_to)));
642 if(COption::GetOptionInt(
"main",
"disk_space") > 0)
643 $quota->updateDiskQuota(
"file", $size,
"copy");
646 if(CModule::IncludeModule(
"search"))
648 $site = CSite::GetSiteByFullPath($DOC_ROOT_TO.$path_to);
649 CSearch::ReIndexFile(Array($site_to, $path_to),
$site);
659 $d =
$io->GetDirectory($DOC_ROOT_FROM.$path_from);
660 $arChildren = $d->GetChildren();
661 foreach ($arChildren as $child)
663 $fn = $child->GetName();
665 if($child->IsDirectory())
668 $strWarning .=
CFileMan::CopyEx(Array($site_from, $path_from.
"/".$fn), Array($site_to, $path_to.
"/".$fn), $bDeleteAfterCopy, $bOverride);
675 if($fn ==
".access.php")
678 if(!
$USER->CanDoFileOperation(
'fm_create_new_file', Array($site_to, $path_to.
"/".$fn)))
681 elseif(!
$USER->CanDoFileOperation(
'fm_view_file', Array($site_from, $path_from.
"/".$fn)))
683 elseif (!(
$USER->CanDoOperation(
'edit_php') ||
$USER->CanDoFileOperation(
'fm_lpa', Array($site_from, $path_from.
"/".$fn)) || !(
HasScriptExtension($fn) || mb_substr($fn, 0, 1) ==
".")))
687 if(
$io->FileExists($DOC_ROOT_TO.$path_to.
"/".$fn))
704 $APPLICATION->CopyFileAccessPermission(Array($site_from, $path_from.
"/".$fn), Array($site_to, $path_to.
"/".$fn));
707 echo
"copy(".$DOC_ROOT_FROM.$path_from.
"/".$fn.
",".$DOC_ROOT_TO.$path_to.
"/".$fn.
");<br>";
709 if (!
$io->Copy($DOC_ROOT_FROM.$path_from.
"/".$fn, $DOC_ROOT_TO.$path_to.
"/".$fn))
710 $strWarning .=
GetMessage(
'FILEMAN_COPY_ERROR',
array(
'#PATH_FROM#' => htmlspecialcharsex($path_from.
"/".$fn),
'#PATH_TO#' => htmlspecialcharsex($path_to.
"/".$fn)));
713 if(COption::GetOptionInt(
"main",
"disk_space") > 0)
715 $f =
$io->GetFile($DOC_ROOT_TO.$path_to.
"/".$fn);
717 $quota->updateDiskQuota(
"file",
$f->GetFileSize(),
"copy");
721 if(CModule::IncludeModule(
"search"))
723 $site = CSite::GetSiteByFullPath($DOC_ROOT_TO, $path_to.
"/".$fn);
737 if($bDeleteAfterCopy)
755 $arDir = $arDirsTmp[
$i];
756 $arDir[
"DEPTH_LEVEL"] = $depth;
779 if($arSite =
$res->Fetch())
780 $site = $arSite[
'ID'];
807 return CFile::FormatSize($size);
812 global $arFilemanPredifinedFileTypesR;
814 if (
count($arFilemanPredifinedFileTypesR) <= 0)
816 foreach (
$GLOBALS[
'arFilemanPredifinedFileTypes'] as
$key => $value)
817 foreach ($value[
"exts"] as $ext)
818 $arFilemanPredifinedFileTypesR[$ext] =
$key;
820 if (isset($arFilemanPredifinedFileTypesR[$fileExt]))
821 return $arFilemanPredifinedFileTypesR[$fileExt];
842 if ($Params[
'path'] <>
'')
846 if (COption::GetOptionInt(
"main",
"disk_space") > 0)
850 $file_size =
$f->GetFileSize();
852 $quota->UpdateDiskQuota(
"file", $file_size,
"delete");
856 if (is_array($Params[
'perm']) &&
count($Params[
'perm']) > 0)
860 $permFile = $Params[
'perm'][
$i][
'permFile'];
863 $permContent = mb_substr($permContent, 0, mb_strpos($permContent,
"?".
">"));
864 $permContent .=
"\$PERM[\"".EscapePHPString($Params[
'perm'][
$i][
'file']).
"\"][\"".
EscapePHPString($Params[
'perm'][
$i][
'group']).
"\"]=\"".
EscapePHPString($Params[
'perm'][
$i][
'perm']).
"\";\n";
865 $permContent .=
"?".
">\n";
872 if (is_array($Params[
'menu']) &&
count($Params[
'menu']) > 0)
876 $menuFile = $Params[
'menu'][
$i][
'menuFile'];
877 $menuIndex = $Params[
'menu'][
$i][
'menuIndex'];
878 $menuItem = $Params[
'menu'][
$i][
'menuItem'];
884 $arMenu[
"aMenuLinks"][] = $menuItem;
886 $arMenu[
"aMenuLinks"] = array_merge(array_slice(
$arMenu[
"aMenuLinks"], 0, $menuIndex),
array($menuItem), array_slice(
$arMenu[
"aMenuLinks"], $menuIndex));
893 if (is_array($Params[
'SEF']) &&
count($Params[
'SEF']) > 0)
898 "SITE_ID" => $Params[
'site'],
899 "CONDITION" => $Params[
'SEF'][
$i][
"CONDITION"],
900 "ID" => $Params[
'SEF'][
$i][
"ID"],
901 "PATH" => $Params[
'SEF'][
$i][
"PATH"],
902 "RULE" => $Params[
'SEF'][
$i][
"RULE"]
907 $GLOBALS[
"CACHE_MANAGER"]->CleanDir(
"menu");
919 $f =
$io->GetFile($Params[
'absPath']);
922 if (COption::GetOptionInt(
"main",
"disk_space") > 0)
924 $file_size =
$f->GetFileSize();
926 $quota->UpdateDiskQuota(
"file", $file_size,
"delete");
929 $sucess =
$io->Delete($Params[
'absPath']);
934 $APPLICATION->RemoveFileAccessPermission(Array($Params[
'site'], $Params[
'path']));
936 if (CModule::IncludeModule(
"search"))
943 if (!empty(
$arMenu[
"aMenuLinks"]))
946 foreach (
$arMenu[
"aMenuLinks"] as $menuIndex => $arItem)
948 if ($arItem[1] == $Params[
'menu'][
'menuPath'] && $arItem[0] == $Params[
'menu'][
'menuName'])
950 unset(
$arMenu[
"aMenuLinks"][$menuIndex]);
961 if (isset($Params[
'public']) && $Params[
'public'] ==
'Y')
965 window.location =
'<?= CUtil::JSEscape(CHTTP::URN2URI(GetDirPath($Params['path'])))?>';
970 $GLOBALS[
"CACHE_MANAGER"]->CleanDir(
"menu");
978 if ($Params[
'absPath'] <>
'')
979 $APPLICATION->SaveFileContent($Params[
'absPath'], $Params[
'content']);
981 $GLOBALS[
"CACHE_MANAGER"]->CleanDir(
"menu");
988 if ($Params[
'path'] <>
'' && $Params[
'path'] !=
"/" &&
$io->DirectoryExists($Params[
'absPath']))
989 CFileman::DeleteEx(Array($Params[
'site'], $Params[
'path']));
996 if (!empty(
$arMenu[
"aMenuLinks"]))
999 foreach (
$arMenu[
"aMenuLinks"] as $menuIndex => $arItem)
1001 if ($arItem[1] == $Params[
'menu'][
'menuPath'] && $arItem[0] == $Params[
'menu'][
'menuName'])
1003 unset(
$arMenu[
"aMenuLinks"][$menuIndex]);
1024 $path_file = mb_substr(
$path,
$p + 1);
1025 $path_dir = mb_substr(
$path, 0,
$p);
1028 if (!
$io->FileExists(
$DOC_ROOT.$path_dir.
"/.access.php"))
1031 include(
$io->GetPhysicalName(
$DOC_ROOT.$path_dir.
"/.access.php"));
1034 foreach($PERM as $file=>$arPerm)
1036 if($file == $path_file)
1038 foreach($arPerm as $group=>
$perm)
1040 'permFile' =>
$DOC_ROOT.$path_dir.
"/.access.php",
1054 $useEditor3 = COption::GetOptionString(
'fileman',
"use_editor_3",
"Y") ==
"Y";
1057 $showTextType = isset(
$params[
'strTextTypeFieldName']) &&
$params[
'strTextTypeFieldName'];
1058 $strTextTypeFieldName =
$params[
'strTextTypeFieldName'];
1059 $textType =
$params[
'strTextTypeValue'] ==
'html' ?
'html' :
'text';
1060 $bxid =
'bxed_'.$name;
1062 $replaceNewLines = COption::GetOptionString(
'fileman',
"replace_new_lines",
"Y") ==
"Y";
1064 if ($textType ==
'html')
1066 $curType = CUserOptions::GetOption(
'html_editor',
"type_selector_".
$name.$key,
false,
$USER->GetId());
1067 $curType = $curType[
'type'] ??
null;
1068 if ($curType && in_array($curType,
array(
'html',
'editor')))
1070 $textType = $curType;
1073 $ch =
"checked=\"checked\"";
1075 <div
class=
"bx-ed-type-selector">
1076 <?
if ($showTextType):?>
1077 <span
class=
"bx-ed-type-selector-item"><input <?
if ($textType ==
'text') {echo
$ch;}?> type=
"radio" name=
"<?= $strTextTypeFieldName?>" id=
"<?= $bxid?>_text" value=
"text" /><label
for=
"<?= $bxid?>_text"><?=
GetMessage(
'FILEMAN_FILEMAN_TYPE_TEXT')?></label></span>
1079 <span
class=
"bx-ed-type-selector-item"><input <?
if ($textType ==
'html') {echo
$ch;}?> type=
"radio" name=
"<?= $strTextTypeFieldName?>" id=
"<?= $bxid?>_html" value=
"html" /><label
for=
"<?= $bxid?>_html">HTML</label></span>
1081 <span
class=
"bx-ed-type-selector-item"><input <?
if ($textType ==
'editor') {echo
$ch;}?> type=
"radio" name=
"<?= $strTextTypeFieldName?>" id=
"<?= $bxid?>_editor" value=
"html" /><label
for=
"<?= $bxid?>_editor"><?=
GetMessage(
'FILEMAN_FILEMAN_TYPE_HTML_EDITOR')?></label></span>
1083 <span
class=
"bx-ed-type-selector-item"><input type=
"checkbox" id=
"<?= $bxid?>_editor" name=
"<?= $strTextTypeFieldName?>" value=
"Y" <?
if ($textType ==
'editor') {echo
$ch;}?> /><label
for=
"<?= $bxid?>_editor"><?=
GetMessage(
"FILEMAN_FILEMAN_USE_HTML_EDITOR");?></span>
1087 function onChangeInputType(editorName)
1089 if (window[
'changeType_' + editorName] && typeof window[
'changeType_' + editorName] ==
'function')
1091 window[
'changeType_' + editorName]();
1095 return setTimeout(
function(){onChangeInputType(editorName);}, 100);
1102 pOptText = BX(
"<?= $bxid?>_text"),
1103 pOptHtml = BX(
"<?= $bxid?>_html"),
1104 pOptEditor = BX(
"<?= $bxid?>_editor");
1108 BX.bind(pOptText,
'click',
function(){onChangeInputType(
'<?= $name?>');});
1112 BX.bind(BX(
"<?= $bxid?>_html"),
'click',
function(){onChangeInputType(
'<?= $name?>');});
1116 BX.bind(BX(
"<?= $bxid?>_editor"),
'click',
function(){onChangeInputType(
'<?= $name?>');});
1125 top.changeType_<?=
$name?> = window.changeType_<?=
$name?> =
function(bSave)
1128 replaceNewLines = <?= $replaceNewLines ?
'true' :
'false'?>,
1129 pOptHtml = BX(
"<?= $bxid?>_html"),
1130 pOptEditor = BX(
"<?= $bxid?>_editor");
1132 var curType = pOptEditor.checked ?
'editor' :
'text';
1133 if (pOptHtml && pOptHtml.checked)
1140 if (bSave !==
false)
1142 BX.userOptions.save(
'html_editor',
'type_selector_<?= $name.$key?>',
'type', curType);
1146 <?
if (isset(
$params[
'externalFuncName']) &&
$params[
'externalFuncName']):?>
1147 var func = window[
'<?= $params['externalFuncName
']?>'];
1148 if (func && typeof func ==
'function')
1155 editorName =
'<?= $name?>',
1156 textarea = BX(
"bxed_<?= $name?>"),
1157 show = pOptEditor.checked,
1158 editor = window.BXHtmlEditor.Get(editorName),
1159 textareaValue = textarea.value ||
'';
1161 replaceNewLines = replaceNewLines && window.BXHtmlEditor.ReplaceNewLines;
1163 if (replaceNewLines)
1165 if (curType ==
'html')
1167 textareaValue = window.BXHtmlEditor.ReplaceNewLines(textareaValue);
1168 textarea.value = textareaValue;
1170 else if (curType ==
'editor')
1172 textareaValue = window.BXHtmlEditor.ReplaceNewLines(textareaValue);
1176 textareaValue = window.BXHtmlEditor.ReplaceNewLinesBack(textareaValue);
1177 textarea.value = textareaValue;
1181 function runEditor(editor, textareaValue)
1183 textarea.style.display =
"none";
1186 if (editor.sandbox.inited)
1188 editor.SetContent(textareaValue,
true);
1192 BX.addCustomEvent(editor,
"OnCreateIframeAfter",
function()
1194 editor.SetContent(textareaValue,
true);
1199 if (editor && editor.Check())
1203 runEditor(editor, textareaValue);
1207 if (editor.IsShown())
1208 editor.SaveContent();
1210 textarea.style.display =
"";
1211 if (replaceNewLines && curType ==
'text')
1213 textareaValue = textarea.value = window.BXHtmlEditor.ReplaceNewLinesBack(textarea.value);
1219 BX.addCustomEvent(window.BXHtmlEditor,
"OnEditorCreated",
function(editor)
1221 if (editor.id == editorName)
1223 runEditor(editor, textareaValue);
1226 window.BXHtmlEditor.Show(
false, editorName);
1227 textarea.style.display =
"none";
1238 window.changeType_<?=
$name?> =
function(bSave)
1241 pOptHtml = BX(
"<?= $bxid?>_html"),
1242 pOptEditor = BX(
"<?= $bxid?>_editor");
1244 var curType = pOptEditor.checked ?
'editor' :
'text';
1245 if (pOptHtml && pOptHtml.checked)
1250 <?
if (isset(
$params[
'externalFuncName']) &&
$params[
'externalFuncName']):?>
1251 var func = window[
'<?= $params['externalFuncName
']?>'];
1252 if (func && typeof func ==
'function')
1259 var el = BX(
"bxed_<?= $name?>");
1260 if(pOptEditor.checked && el.style.display !=
"none")
1262 var onEditorInit =
function(pMainObj)
1264 pMainObj.SetContent(pMainObj.PreparseHeaders(el.value));
1265 pMainObj.Show(
true);
1266 pMainObj.LoadContent();
1269 el.style.display =
"none";
1271 el.pMainObj =
new BXHTMLEditor(
"<?= $name?>", onEditorInit);
1273 onEditorInit(el.pMainObj);
1275 else if(!pOptEditor.checked && el.style.display ==
"none")
1277 el.pMainObj.Show(
false);
1278 el.pMainObj.SaveContent(
true);
1279 el.style.display =
"";
1285 if (bSave !==
false)
1287 BX.ajax.get(
'/bitrix/admin/fileman_manage_settings.php?<?= bitrix_sessid_get()?>&target=text_type&edname=<?= $name?>&key=<?= $key?>&type=' + curType);
1293 var pOptEditor = BX(
"<?= $bxid?>_editor");
1296 BX.addCustomEvent(pOptEditor.form,
'onAutoSaveRestore', function (ob, data)
1298 var pOptEditor = BX(
"<?= $bxid?>_editor");
1300 setTimeout(
function()
1302 if (pOptEditor.checked)
1304 var pMainObj = GLOBAL_pMainObj[
'<?= $name?>'];
1305 if (pMainObj && pMainObj.bShowed)
1307 pMainObj.SetContent(data[pMainObj.name]);
1308 pMainObj.LoadContent();
1324 $strTextTypeFieldName,
1326 $arSize = Array(
"height"=>350),
1327 $CONVERT_FOR_WORKFLOW=
"N",
1328 $WORKFLOW_DOCUMENT_ID=0,
1329 $NEW_DOCUMENT_PATH=
"",
1332 $bWithoutPHP =
true,
1333 $arTaskbars =
false,
1334 $arAdditionalParams = Array()
1341 global $htmled, $usehtmled;
1342 $strTextFieldName = preg_replace(
"/[^a-zA-Z0-9_:\.]/is",
"", $strTextFieldName);
1344 if(is_array($arSize))
1345 $iHeight = $arSize[
"height"];
1350 $dontShowTA = isset($arAdditionalParams[
'dontshowta']) ? $arAdditionalParams[
'dontshowta'] :
false;
1352 if ($arAdditionalParams[
'hideTypeSelector'] ??
null)
1354 $textType = $strTextTypeValue ==
'html' ?
'editor' :
'text';
1355 ?><input type=
"hidden" name=
"<?= $strTextTypeFieldName?>" value=
"<?= $strTextTypeValue?>"/><?
1360 'name' => $strTextFieldName,
1361 'key' => ($arAdditionalParams[
'saveEditorKey'] ??
null),
1362 'strTextTypeFieldName' => $strTextTypeFieldName,
1363 'strTextTypeValue' => $strTextTypeValue,
1364 'bSave' => ($arAdditionalParams[
'saveEditorState'] ??
null) !==
false
1368 $curHTMLEd = $textType ==
'editor';
1371 <textarea
class=
"typearea" style=
"<? echo(($curHTMLEd || $dontShowTA) ? 'display:none;' : '');?>width:100%;height:<?=$iHeight?>px;" name=
"<?=$strTextFieldName?>" id=
"bxed_<?=$strTextFieldName?>" wrap=
"virtual" <?=$textarea_field?>><?=
htmlspecialcharsbx($strTextValue)?></textarea>
1375 $arTaskbars = Array(
"BXPropertiesTaskbar",
"BXSnippetsTaskbar");
1376 else if (!$arTaskbars)
1377 $arTaskbars = Array(
"BXPropertiesTaskbar",
"BXSnippetsTaskbar",
"BXComponents2Taskbar");
1379 $minHeight = ($arAdditionalParams[
'minHeight'] ??
null) ? intval($arAdditionalParams[
'minHeight']) : 450;
1381 "bUseOnlyDefinedStyles"=>COption::GetOptionString(
"fileman",
"show_untitled_styles",
"N")!=
"Y",
1382 "bFromTextarea" =>
true,
1383 "bDisplay" => $curHTMLEd,
1384 "bWithoutPHP" => $bWithoutPHP,
1385 "arTaskbars" => $arTaskbars,
1386 "height" => max($iHeight, $minHeight)
1389 if (isset($arAdditionalParams[
'use_editor_3']))
1390 $arParams[
'use_editor_3'] = $arAdditionalParams[
'use_editor_3'];
1393 if(isset($arSize[
"width"]))
1396 if (isset($arAdditionalParams))
1397 $arParams[
"arAdditionalParams"] = $arAdditionalParams;
1399 if (isset($arAdditionalParams[
'limit_php_access']))
1400 $arParams[
'limit_php_access'] = $arAdditionalParams[
'limit_php_access'];
1402 if (isset($arAdditionalParams[
'toolbarConfig']))
1403 $arParams[
'toolbarConfig'] = $arAdditionalParams[
'toolbarConfig'];
1405 if (isset($arAdditionalParams[
'componentFilter']))
1406 $arParams[
'componentFilter'] = $arAdditionalParams[
'componentFilter'];
1410 CFileman::ShowHTMLEditControl($strTextFieldName, $strTextValue,
$arParams);
1422 CUtil::InitJSCore(
array(
'window',
'ajax'));
1427 $name = preg_replace(
"/[^a-zA-Z0-9_:\.]/is",
"",
$name);
1429 if (!isset(
$arParams[
"limit_php_access"]))
1435 $direction_rtl =
false;
1451 if (!isset(
$template) && defined(
'SITE_TEMPLATE_ID'))
1456 if (!isset(
$template) && isset($_GET[
'siteTemplateId']))
1463 $dbSiteRes = CSite::GetTemplateList(
$site);
1464 $SITE_TEMPLATE = Array();
1465 while($arSiteRes = $dbSiteRes->Fetch())
1467 if ($arSiteRes[
'CONDITION'] ==
"" || !isset(
$template))
1478 $useEditor3 = COption::GetOptionString(
'fileman',
"use_editor_3",
"Y") ==
"Y";
1488 'width' => (
$arParams[
"width"] ??
null),
1491 'bAllowPhp' => !
$arParams[
"bWithoutPHP"] &&
$USER->CanDoOperation(
'edit_php'),
1492 "limitPhpAccess" =>
$arParams[
"limit_php_access"],
1494 "componentFilter" => (isset(
$arParams[
'componentFilter']) ?
$arParams[
'componentFilter'] :
false),
1495 "setFocusAfterShow" => isset(
$arParams[
'setFocusAfterShow']) ?
$arParams[
'setFocusAfterShow'] :
true,
1508 is_array(
$arParams[
"toolbarConfig"] ??
null)
1513 $arParams[
"use_advanced_php_parser"] = COption::GetOptionString(
"fileman",
"use_advanced_php_parser",
"Y");
1514 $arParams[
"ar_entities"] = COption::GetOptionString(
"fileman",
"ar_entities",
'umlya,greek,other');
1519 $arParams[
"usePspell"] = COption::GetOptionString(
"fileman",
"use_pspell",
"N");
1522 $arParams[
"useCustomSpell"] = COption::GetOptionString(
"fileman",
"use_custom_spell",
"Y");
1524 $arParams[
'allowRenderComp2'] = COption::GetOptionString(
'fileman',
"allow_render_components",
"N") ==
'Y';
1525 $arParams[
'renderComponents'] =
$arParams[
'allowRenderComp2'] && CUserOptions::GetOption(
'fileman',
"render_components",
"Y") ==
'Y';
1527 $lca = COption::GetOptionString(
"fileman",
"use_lca",
"N");
1528 $styleList_render_style = (COption::GetOptionString(
"fileman",
"render_styles_in_classlist",
"Y") ==
'Y') ?
'true' :
'false';
1529 $arAdditionalParams = (isset(
$arParams[
"arAdditionalParams"])) ?
$arParams[
"arAdditionalParams"] : Array();
1533 if(($bUseOnlyDefinedStyles ??
null) && !
is_set(
$arResult,
"STYLES_TITLE"))
1535 $bUseOnlyDefinedStyles =
false;
1538 $arParams[
"body_class"] = COption::GetOptionString(
"fileman",
"editor_body_class",
"");
1539 $arParams[
"body_id"] = COption::GetOptionString(
"fileman",
"editor_body_id",
"");
1542 <script bxrunfirst=
"true">
1543 var relPath =
"<?= CUtil::JSEscape($relPath);?>";
1544 var <? echo
'ar_'.$name.
'_taskbars';?> = {};
1547 echo
'ar_'.
$name.
'_taskbars["'.$arTaskbars[
$k].
'"] = true;';
1548 if ($arToolbars !==
false)
1550 echo
'var ar_'.$name.
'_toolbars = {};';
1552 echo
'ar_'.
$name.
'_toolbars["'.$arToolbars[
$k].
'"] = true;';
1555 echo
'var ar_'.$name.
'_toolbars = false;';
1558 window.ar_<?=
$name?>_config = <?= CUtil::PhpToJSObject(
$arParams)?>;
1562 CFileman::GetHTMLEditorSettings(
$name,
$arParams[
"light_mode"], $arTaskbars, $str_taskbars);
1563 $str_taskbars .=
'_'.CFileman::GetVersion();
1567 $arTemplates = Array(Array(
'value' =>
'.default',
'name' =>
GetMessage(
"FILEMAN_DEFTEMPL")));
1570 $arTemplates[] = Array(
'value'=>$ar_site_templates[
'ID'],
'name'=>$ar_site_templates[
'NAME']);
1573 <script bxrunfirst=
"true">
1575 arBXTemplates = <?= CUtil::PhpToJSObject($arTemplates)?>,
1576 BXSite =
"<?= CUtil::JSEscape($site)?>",
1577 BXLang =
"<?= CUtil::JSEscape(LANGUAGE_ID)?>",
1578 styleList_render_style = <?=$styleList_render_style?>,
1579 limit_php_access = <?=
$arParams[
"limit_php_access"] ?
'true' :
'false'?>,
1580 lca = <?= $lca ==
'Y' ?
'true' :
'false'?>,
1581 lightMode = <?=
$arParams[
"light_mode"] ?
'true' :
'false'?>,
1582 BX_PERSONAL_ROOT =
"<?=BX_PERSONAL_ROOT?>";
1584 window.limit_php_access =
top.limit_php_access = limit_php_access;
1585 window.lightMode =
top.lightMode = lightMode;
1586 window.lca =
top.lca = lca;
1587 window.BXLang =
top.BXLang = BXLang;
1588 window.BXSite =
top.BXSite = BXSite;
1589 window.BX_PERSONAL_ROOT =
top.BX_PERSONAL_ROOT = BX_PERSONAL_ROOT;
1596 while($arEvent = $events->Fetch())
1599 if (!is_array(
$tmp))
1602 if (is_array(
$tmp[
'JS']))
1603 $arJS = array_merge($arJS,
$tmp[
'JS']);
1604 if (is_array(
$tmp[
'CSS']))
1605 $arCSS = array_merge($arCSS,
$tmp[
'CSS']);
1611 $arJS[
$i] = preg_replace(
"/[^a-zA-Z0-9_:\.]/is",
"", $arJS[
$i]);
1612 if(file_exists(
$_SERVER[
'DOCUMENT_ROOT'].
'/bitrix/admin/htmleditor2/'.$arJS[
$i]))
1616 <script src=
"/bitrix/admin/fileman_js.php?lang=<?=LANGUAGE_ID?>&v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/'.LANGUAGE_ID.'/admin/fileman_js.php')?>"></script>
1617 <script src=
"/bitrix/admin/fileman_common_js.php?s=<?=$str_taskbars?>"></script>
1621 $script_filename =
$arr[
$i];
1622 ?><script src=
"/bitrix/admin/htmleditor2/<?=$script_filename?>?v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/htmleditor2/'.$script_filename)?>"></script><?
1625 <script src=
"/bitrix/js/main/popup_menu.js?v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/js/main/popup_menu.js')?>"></script>
1629 $arCSS[
$i] = preg_replace(
"/[^a-zA-Z0-9_:\.]/is",
"", $arCSS[
$i]);
1630 if(!file_exists(
$_SERVER[
'DOCUMENT_ROOT'].
'/bitrix/admin/htmleditor2/'.$arCSS[
$i]))
1632 ?><link rel=
"stylesheet" type=
"text/css" href=
"/bitrix/admin/htmleditor2/<?=$arCSS[$i]?>?v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/htmleditor2/'.$arCSS[$i])?>"/><?
1636 while($arEvent = $db_events->Fetch())
1643 <div
class=
"bxedmain-cont" id=
"<?= $name.'_object';?>"><table
id=
"<?= $name?>_pFrame" class=
"bxedmainframe dim100x100" style=
"display:none;">
1644 <tr
style=
"height: 1%;"><td
id=
"<?= $name?>_toolBarSet0" colspan=
"2" style=
"width: 100%; display: none; border-bottom: 1px solid #808080 !important;"></td></tr>
1646 <td
id=
"<?= $name?>_toolBarSet1" style=
"width:0%; display: none; border-right: 1px solid #808080 !important;"></td>
1647 <td vAlign=
"top" style=
"width: 4000px; padding: 0!important;">
1648 <table
class=
"dim100x100">
1650 <td
class=
"bx-ceditor" id=
"<?= $name?>_cEditor"></td>
1651 <td
id=
"<?= $name?>_taskBarSet2" class=
"bxedtaskbarset" style=
"width:0%; display: none;">
1653 <tr><td
class=
"bx-move-col-v" rowSpan=
"3"><img src=
"/bitrix/images/1.gif" /></td><td
style=
"height:26px;"></td></tr>
1654 <tr><td
style=
"vertical-align: top;"></td></tr>
1655 <tr><td
class=
"bx-taskbar-tabs"></td></tr>
1659 <tr
style=
"height:0%; display: none;">
1660 <td
id=
"<?= $name?>_taskBarSet3" colspan=
"2">
1662 <tr><td
class=
"bx-move-col-h"><img src=
"/bitrix/images/1.gif" /></td></tr>
1663 <tr><td
style=
"height:26px;"></td></tr>
1664 <tr><td
style=
"vertical-align: top; background: #F4F4F4 none !important;"></td></tr>
1665 <tr><td
class=
"bx-taskbar-tabs"></td></tr>
1672 <tr
id=
"bx-css-tt"><td
id=
"<?= $name?>_taskBarTabs" colspan=
"2" class=
"tasktabcell"></td></tr>
1676 BX.loadCSS(
'/bitrix/admin/htmleditor2/editor.css');
1677 var bEd = BX(
"bxed_<?= $name?>_editor");
1678 if (bEd && !bEd.checked)
1679 BX(
"<?= $name?>_object").style.display =
"none";
1682 if(!(
$arParams[
"bFromTextarea"] ??
null))
1687 if((
$arParams[
"bDisplay"] ??
null) !==
false)
1692 BX.ready(
function(){
1694 BX(
"bxed_<?= $name;?>").pMainObj =
new BXHTMLEditor(
"<?= $name;?>");
1721 $prolog = trim(mb_strtolower(
$res[
'PROLOG']));
1722 if ($prolog <>
'' &&
1723 mb_strpos($prolog,
"prolog_before") ===
false &&
1724 mb_strpos($prolog,
'bitrix/header.php') ===
false &&
1725 mb_strpos($prolog,
'$application->settitle') ===
false &&
1726 mb_strpos($prolog,
'$application->setpageproperty') ===
false)
1729 $res[
'PROLOG'] =
'';
1732 $epilog = trim(mb_strtolower(
$res[
'EPILOG']));
1733 if ($epilog <>
'' &&
1734 mb_strpos($epilog,
'bitrix/footer.php') ===
false &&
1735 mb_strpos($epilog,
'epilog.php') ===
false)
1738 $res[
'EPILOG'] =
'';
1749 public static function SetProperty($prolog, $property_key, $property_val)
1764 if(!($ar_templ = $db_templ->Fetch()))
1767 $db_site_templ = CSite::GetTemplateList(
$site);
1768 while($ar_site_templ = $db_site_templ->Fetch())
1770 if($ar_site_templ[
"CONDITION"] ==
'')
1780 $ar_templ = $db_templ->Fetch();
1787 "ID" => $ar_templ[
"ID"],
1788 "NAME" => $ar_templ[
"NAME"]
1791 if(
is_set($ar_templ,
"STYLES"))
1803 if (mb_substr(
$url, -5) !=
'print')
1806 if (mb_substr(
$url, 0, 4) ==
'url(' && mb_substr(
$url, -1) ==
')')
1807 $url = trim(mb_substr(
$url, 4, -1),
' "\'');
1809 if (mb_substr($url, 0, 1) != '/' && file_exists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/
".$ar_templ["ID
"]."/
".$url))
1810 $css = "\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/
".$ar_templ["ID
"]."/
".$url)."\n
";
1811 else if(file_exists($_SERVER["DOCUMENT_ROOT
"].$url))
1812 $css = "\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].$url)."\n
";
1814 $ar_templ["STYLES
"] = str_replace($matches[0][$j], $css, $ar_templ["STYLES
"]);
1818 $arResult["STYLES
"] = $ar_templ["STYLES
"] ?? '';
1819 $arResult["STYLES_TITLE
"] = $ar_templ["STYLES_TITLE
"] ?? '';
1820 $arResult["EDITOR_STYLES
"] = $ar_templ["EDITOR_STYLES
"] ?? '';
1825 $arResult = Array("ID
" => ".
default", "NAME
" => GetMessage("FILEMAN_DDEF_TEMPLATE
"));
1829 $io = CBXVirtualIo::GetInstance();
1831 if(!is_set($arResult, "STYLES
") || $arResult["STYLES
"] == false)
1833 if($io->FileExists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/
".($site == ''?LANGUAGE_ID:$site)."/styles.css
"))
1835 $arResult["STYLES
"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/
".($site == ''?LANGUAGE_ID : $site)."/styles.css
");
1836 $arResult["STYLES_TITLE
"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/
".($site == ''?LANGUAGE_ID : $site)."/.styles.php
");
1838 elseif($io->FileExists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/styles.css
"))
1840 $arResult["STYLES
"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/styles.css
");
1841 $arResult["STYLES_TITLE
"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/.styles.php
");
1843 elseif($io->FileExists($_SERVER["DOCUMENT_ROOT
"]."local/templates/.default/styles.css
"))
1845 $arResult["STYLES
"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"]."local/templates/.default/styles.css
");
1846 $arResult["STYLES_TITLE
"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT
"]."local/templates/.default/.styles.php
");
1850 $arResult["STYLES
"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/.default/styles.css
");
1851 $arResult["STYLES_TITLE
"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/.default/.styles.php
");
1855 if (isset($arAdditionalParams['additionalCSS']))
1857 $additionalCSS = $arAdditionalParams['additionalCSS'];
1858 for ($i = 0, $l = count($additionalCSS); $i < $l; $i++)
1860 $css_file_path = $additionalCSS[$i];
1861 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($css_file_path);
1865 if($templateID <> '' && $io->FileExists($_SERVER["DOCUMENT_ROOT
"]."local/templates/
".$templateID."/editor.css
"))
1867 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"]."local/templates/
".$templateID."/editor.css
");
1869 elseif($templateID <> '' && $io->FileExists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/
".$templateID."/editor.css
"))
1871 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/
".$templateID."/editor.css
");
1873 elseif($io->FileExists($_SERVER["DOCUMENT_ROOT
"]."local/templates/.default/editor.css
"))
1875 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"]."local/templates/.default/editor.css
");
1877 elseif($io->FileExists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/.default/editor.css
"))
1879 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/templates/.default/editor.css
");
1881 elseif($io->FileExists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/
".$site."/editor.css
"))
1883 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/
".($site == '' ? LANGUAGE_ID : $site)."/editor.css
");
1885 elseif($io->FileExists($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/editor.css
"))
1887 $arResult["STYLES
"] .= "\r\n
".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT
"].BX_PERSONAL_ROOT."/php_interface/editor.css
");
1890 $arResult["STYLES
"] = preg_replace("/\r\n/
", " ", $arResult["STYLES
"]);
1891 $arResult["STYLES
"] = preg_replace("/\n/
", " ", $arResult["STYLES
"]);
1892 $arResult["SITE_TEMPLATE_PATH
"] = getLocalPath('templates/'.$templateID, BX_PERSONAL_ROOT);
1897 public static function __CheckOnAllowedComponents($str)
1899 $allowed_components = trim(COption::GetOptionString('fileman', "~allowed_components
", ''));
1900 if ($allowed_components == '')
1903 $arAC = explode("\n
",$allowed_components);
1904 $arAC = array_unique($arAC);
1905 $arAllowedComponents = Array();
1906 foreach ($arAC as $f)
1911 $f = preg_replace("/\s/is
", "", $f);
1912 $f = preg_replace("/\./is
", "\\.
", $f);
1913 $f = preg_replace("/\*/is
", ".*
", $f);
1914 $arAllowedComponents[] = '/^'.$f.'$/';
1916 if (count($arAllowedComponents) == 0)
1918 $comp_RE = '/\$application->includecomponent\(\s*?(.*?),/i';
1919 preg_match_all($comp_RE, $str, $matches);
1921 for ($i = 0, $l = count($matches[1]); $i < $l; $i++)
1923 $name = trim($matches[1][$i]);
1925 $name = mb_substr($name, 1, -1);
1927 $bxlen = mb_strlen($bx);
1928 if (mb_substr($name, 0, $bxlen) != $bx)
1930 $name = mb_substr($name, $bxlen);
1931 for ($j = 0, $c = count($arAllowedComponents); $j < $c; $j++)
1932 if (preg_match($arAllowedComponents[$j], $name))
1940 public static function CheckOnAllowedComponents($str)
1942 if (($r = CFileMan::__CheckOnAllowedComponents($str)) !== true)
1944 $GLOBALS['APPLICATION']->ThrowException(GetMessage("FILEMAN_UNALLOWED_COMPONENTS
", Array("#BAD_COMPONENT#
" => $r)), "UNALLOWED_COMPONENTS
");
1950 public static function GetHTMLEditorSettings($edname, $lightMode, $arTaskbars, &$loadParams)
1955 if (!window.SETTINGS)
1958 SETTINGS['<?= $edname?>'] = {};
1963 //Get toolbar settings
1964 $toolbar_settings = stripslashes(CUserOptions::GetOption("fileman
", "toolbar_settings_
".$edname));
1965 $rs_tlbrs = stripslashes(CUserOptions::GetOption("fileman
", "rs_toolbar_
".$edname, 'Y'));
1967 if ($toolbar_settings)
1969 ?>SETTINGS['<?= $edname?>'].arToolbarSettings = [];<?
1970 $res = explode("||
", $toolbar_settings);
1971 for ($i = 0, $len = count($res); $i < $len; $i++)
1973 $tmp = explode(":
", $res[$i]);
1974 $tlbrname = $tmp[0];
1975 $tmp2 = explode(",
", $tmp[1]);
1978 $arPos = explode(";
", mb_substr($tmp2[2], 1, -1));
1981 _ar.show = <?echo($show == 'true' ? 'true' : 'false');?>;
1982 _ar.docked = <?echo($docked=='true' ? 'true' : 'false');?>;
1983 <?if ($docked=='true'):?>
1984 _ar.position = [<?echo$arPos[0];?>,<?echo$arPos[1];?>,<?echo$arPos[2];?>];
1987 x : '<?echo(mb_substr($arPos[0], -2) == "px
"? mb_substr($arPos[0], 0, -2) : $arPos[0]);?>',
1988 y : '<?echo(mb_substr($arPos[1], -2) == "px
"? mb_substr($arPos[1], 0, -2) : $arPos[1]);?>'
1992 SETTINGS['<?= $edname?>'].arToolbarSettings["<?=$tlbrname?>
"] = _ar;
1996 $loadParams = 'em'; // extended mode
1999 //Get taskbar settings
2000 $taskbars = CUserOptions::GetOption("fileman
", "taskbar_settings_
".$edname, false);
2001 if ($taskbars !== false && CheckSerializedData($taskbars, 10))
2002 $taskbars = unserialize($taskbars, ['allowed_classes' => false]);
2006 if (is_array($taskbars))
2008 ?>SETTINGS['<?= $edname?>'].arTaskbarSettings = {};<?
2009 foreach($taskbars as $tname => $tskbr)
2012 ?>SETTINGS['<?= $edname?>'].arTaskbarSettings["<?=$tname;?>
"] = {show: <?= $tskbr['show'] ? 'true' : 'false'?>, set: <?= $tskbr['set'] == 2 ? 2 : 3?>, active: <?= $tskbr['active'] ? 'true' : 'false'?>};<?
2013 if ($tskbr['show'] && in_array($tname, $arTaskbars))
2017 case 'BXSnippetsTaskbar':
2020 case 'BXComponents2Taskbar':
2021 $loadParams .= 'c2';
2029 if (in_array('BXSnippetsTaskbar', $arTaskbars))
2031 if (in_array('BXComponents2Taskbar', $arTaskbars))
2032 $loadParams .= 'c2';
2035 //Get taskbarset settings
2036 $taskbarset = CUserOptions::GetOption("fileman
", "taskbarset_settings_
".$edname, false);
2038 if ($taskbarset !== false && CheckSerializedData($taskbarset, 10))
2039 $taskbarset = unserialize($taskbarset, ['allowed_classes' => false]);
2041 $taskbarset = false;
2043 if (is_array($taskbarset))
2045 ?>SETTINGS['<?= $edname?>'].arTBSetsSettings = [];<?
2046 foreach($taskbarset as $iNum => $tskbrset)
2050 ?>SETTINGS['<?= $edname?>'].arTBSetsSettings["<?= intval($iNum)?>
"] = {show: <?= $tskbrset['show'] ? 'true' : 'false'?>, size: <?= intval($tskbrset['size'])?>};
2055 $show_tooltips = CUserOptions::GetOption("fileman
", "show_tooltips
".$edname, "Y
");
2056 $visualEffects = CUserOptions::GetOption("fileman
", "visual_effects
".$edname, "Y
");
2057 $arC2DS = CUtil::GetPopupSize("bx_edc2_
".$edname, array("width" => 650, "height" => 450));
2060 SETTINGS['<?= $edname?>'].showTooltips4Components = <?echo $show_tooltips == "N
" ? "false" : "true";?>;
2061 SETTINGS['<?= $edname?>'].visualEffects = <?echo $visualEffects == "N
" ? "false" : "true";?>;
2063 window.comp2_dialog_size = {width: '<?= $arC2DS['width']?>', height: '<?= $arC2DS['height']?>'};
2069 public static function CheckFileName($str)
2071 $io = CBXVirtualIo::GetInstance();
2072 if (!$io->ValidateFilenameString($str))
2073 return GetMessage("FILEMAN_NAME_ERR
");
2077 public static function GetPropstypes($site="")
2080 'description' => GetMessage("FILEMAN_OPTION_PROPS_DESCR
"),
2081 'keywords' => GetMessage("FILEMAN_OPTION_PROPS_KEYW
")
2083 $res = COption::GetOptionString('fileman', "propstypes
", addslashes(serialize($defRes)), $site);
2084 if (CheckSerializedData($res))
2085 $res = unserialize(stripslashes($res), ['allowed_classes' => false]);
2091 public static function SetPropstypes($arPT = Array(), $desc = false, $site = "")
2093 $str = addslashes(serialize($arPT));
2094 if (mb_strlen($str) > 2000)
2096 return COption::SetOptionString('fileman', "propstypes
", $str, $desc, $site);
2100 public static function OnModuleUpdate($arParams)
2102 if (isset($arParams['successModules']) && count($arParams['successModules']) > 0)
2103 CFileMan::ClearComponentsListCache();
2106 public static function ClearComponentsListCache($id = '')
2108 $GLOBALS["CACHE_MANAGER
"]->CleanDir("fileman_component_tree_array
");
2111 public static function SecurePathVar($str)
2113 $str = preg_replace("/\.\.+[\/\\\]+/i
", "", $str);
2117 public static function GetUnixFilePermissions($file)
2119 $io = CBXVirtualIo::GetInstance();
2120 $f = $io->GetFile($file);
2121 $perms = $f->GetPermissions();
2123 if (($perms & 0xC000) == 0xC000)
2124 $info = 's'; // Socket
2125 elseif (($perms & 0xA000) == 0xA000)
2126 $info = 'l'; // Symbolic Link
2127 elseif (($perms & 0x8000) == 0x8000)
2128 $info = '-'; // Regular
2129 elseif (($perms & 0x6000) == 0x6000)
2130 $info = 'b'; // Block special
2131 elseif (($perms & 0x4000) == 0x4000)
2132 $info = 'd'; // Directory
2133 elseif (($perms & 0x2000) == 0x2000)
2134 $info = 'c'; // Character special
2135 elseif (($perms & 0x1000) == 0x1000)
2136 $info = 'p'; // FIFO pipe
2138 $info = 'u'; // Unknown
2141 $info .= (($perms & 0x0100) ? 'r' : '-');
2142 $info .= (($perms & 0x0080) ? 'w' : '-');
2143 $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
2146 $info .= (($perms & 0x0020) ? 'r' : '-');
2147 $info .= (($perms & 0x0010) ? 'w' : '-');
2148 $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
2151 $info .= (($perms & 0x0004) ? 'r' : '-');
2152 $info .= (($perms & 0x0002) ? 'w' : '-');
2153 $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
2155 return array(sprintf("%o
", $perms & 0xfff), $info);
2158 public static function IsWindows()
2160 return PATH_SEPARATOR === ';';
2163 public static function SaveLastPath($path)
2165 $path = CFileMan::NormalizePath($path);
2166 if ($path == "" || $path == "/
")
2169 $arPathes = CFileMan::GetLastPathes();
2170 $key = array_search($path, $arPathes);
2173 unset($arPathes[$key]);
2175 $arPathes = array_merge(array($path), $arPathes);
2177 CFileMan::SetLastPathes($arPathes);
2180 public static function GetLastPathes()
2182 $arPathes = CUserOptions::GetOption("fileman
", "last_pathes
", false);
2183 $arPathes = ($arPathes === false || !CheckSerializedData($arPathes))
2184 ? CFileMan::GetLastPathesDefault()
2185 : unserialize($arPathes, ['allowed_classes' => false]);
2186 $arPathes = array_slice($arPathes, 0, 10);
2191 public static function SetLastPathes($arPathes = array())
2193 if (count($arPathes) == 0)
2194 $arPathes = CFileMan::GetLastPathesDefault();
2195 $arPathes = array_slice($arPathes, 0, 10);
2196 CUserOptions::SetOption("fileman
", "last_pathes
", serialize($arPathes));
2199 public static function GetLastPathesDefault()
2201 return array("/bitrix
");
2204 public static function GetEditorToolbarConfig($editorType)
2206 $res = COption::GetOptionString('fileman', "toolbar_config_
".$editorType, false);
2207 if ($res && CheckSerializedData($res))
2209 $arConfig = unserialize($res, ['allowed_classes' => false]);
2210 if (is_array($arConfig))
2216 public static function decodePdfViewerLangFiles()
2218 $localePath = \Bitrix\Main\Application::getDocumentRoot().'/bitrix/components/bitrix/pdf.viewer/pdfjs/locale/';
2219 if(!\Bitrix\Main\IO\Directory::isDirectoryExists($localePath))
2224 $localePath.'de/viewer.properties' => 'iso-8859-1',
2225 $localePath.'ru/viewer.properties' => 'windows-1251',
2226 $localePath.'ua/viewer.properties' => 'windows-1251',
2228 foreach($filesToDecode as $path => $charset)
2230 static::decodeLangFile($path, $charset);
2239 protected static function decodeLangFile($path, $charsetFrom)
2241 $file = new \Bitrix\Main\IO\File($path);
2242 if($file->isExists())
2244 $content = $file->getContents();
2245 if(\Bitrix\Main\Text\Encoding::detectUtf8($content))
2249 $content = \Bitrix\Main\Text\Encoding::convertEncoding($content, $charsetFrom, 'UTF-8');
2250 $file->putContents($content);
2255function is_array_assoc($arr)
2258 foreach($arr as $k=>$val)
2267function setEditorEventHandlers($name)
2271 function onContextMenu_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnContextMenu(e);}
2272 function onClick_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnClick(e);}
2273 function onDblClick_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnDblClick(e);}
2274 function onMouseUp_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnMouseUp(e);}
2275 function onDragDrop_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnDragDrop(e);}
2276 function onKeyPress_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnKeyPress(e);}
2277 function onKeyDown_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnKeyDown(e);}
2278 function onPaste_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnPaste(e);}
2280 function OnSubmit_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].onSubmit(e);}
2282 function OnDispatcherEvent_pDocument_<?= $name;?>(e){pBXEventDispatcher.OnEvent(GLOBAL_pMainObj['<?= $name;?>'].pDocument, e);}
2283 function OnDispatcherEvent_pEditorDocument_<?= $name;?>(e){pBXEventDispatcher.OnEvent(GLOBAL_pMainObj['<?= $name;?>'].pEditorDocument, e);}
2288function _replace_br_($str)
2291 $pos2 = mb_strpos(mb_strtolower($str), "\n
");
2294 $str = str_replace("\r
"," ",$str);
2295 $str = str_replace("\n
"," ",$str);
2296 $str = str_replace("\\r
"," ",$str);
2297 $str = str_replace("\\n
"," ",$str);
if($canUseYandexMarket) $strWarning
static DeleteIndex($MODULE_ID, $ITEM_ID=false, $PARAM1=false, $PARAM2=false, $SITE_ID=false)
static ReindexFile($path, $SEARCH_SESS_ID='')
static GetArchiveExtensions()
static ConvertCharset($string, $direction=1, $skipEvents=false)
static ParseFileContent($filesrc, $bCheckProlog=false)
static CompareFiles($f1, $f2, $sort=Array())
static 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())
static UndoNewFile($Params, $type)
static UndoEditFile($Params, $type)
static DirsRecursive($path, &$arDirs, $arFilter=Array(), $depth=0)
static GetFileType($path)
static GetScriptFileExt()
static SetProperty($prolog, $property_key, $property_val)
static FetchFileAccessPerm($path)
static CopyEx($path_from, $path_to, $bDeleteAfterCopy=false, $bOverride=false)
static NormalizePath($path)
static __CheckSite($site)
static GetFileExtension($path)
static ShowTypeSelector($params)
static GetFileTypeEx($fileName)
static SaveMenu($path, $aMenuLinksTmp, $sMenuTemplateTmp="")
static GetAllDirList(&$arDirs, $arFilter=Array(), $site=false)
static GetFileName($path)
static GetDirList($path, &$arDirs, &$arFiles, $arFilter=Array(), $sort=Array(), $type="DF", $bLogical=false, $task_mode=false)
static UndoNewSection($Params, $type)
static ParsePath($path, $bLast=false, $url=false, $param="", $bLogical=false)
static CheckFileName($str)
static UnEscapePHPString($str)
static UndoFileDelete($Params, $type)
static ShowHTMLEditControl($name, $content, $arParams=Array())
static OnGroupDelete($group_id)
static GetAllTemplateParams($templateID, $site, $findcomponent=true, $arAdditionalParams=Array())
static GetFileTemplates($lang=LANG, $arTemplates=Array())
static GetStrFileSize($size)
static GetMenuArray($abs_path)
static GetTemplateContent($filename, $lang=LANG, $arTemplates=Array())
static SetTitle($prolog, $title)
static EscapePHPString($str)
static GetList($arOrder=array(), $arFilter=array(), $arSelect=false)
static GetScriptStr($mode)
static Init($Params=array())
static CanDoOperation($operation)
static GetBShowStickers()
if(!is_array($prop["VALUES"])) $tmp
hidden PROPERTY[<?=$propertyIndex?>][CODE]<?=htmlspecialcharsEx( $propertyCode)?> height
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
</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
$GLOBALS['arFilemanPredifinedFileTypesR']
setEditorEventHandlers($name)
$_SERVER["DOCUMENT_ROOT"]
SetPrologProperty($prolog, $property_key, $property_val)
SetPrologTitle($prolog, $title)
GetTemplateContent($filename, $lang=LANG, $arTemplates=array())
GetFileTemplates($lang=LANG, $arTemplates=array())
foreach(['Bitrix\\Main'=> '/lib', 'Psr\\Container'=> '/vendor/psr/container/src', 'Psr\\Log'=> '/vendor/psr/log/src', 'Psr\\Http\\Message'=> '/vendor/psr/http-message/src', 'Psr\\Http\\Client'=> '/vendor/psr/http-client/src', 'Http\\Promise'=> '/vendor/php-http/promise/src', 'PHPMailer\\PHPMailer'=> '/vendor/phpmailer/phpmailer/src', 'GeoIp2'=> '/vendor/geoip2/geoip2/src', 'MaxMind\\Db'=> '/vendor/maxmind-db/reader/src/MaxMind/Db', 'PhpParser'=> '/vendor/nikic/php-parser/lib/PhpParser', 'Recurr'=> '/vendor/simshaun/recurr/src/Recurr',] as $namespace=> $namespacePath) $documentRoot
const SITE_DIR(!defined('LANG'))
if(!defined('SITE_ID')) $lang
check_bitrix_sessid($varname='sessid')
ExecuteModuleEventEx($arEvent, $arParams=[])
ParseFileContent($filesrc, $params=[])
bxstrrpos($haystack, $needle)
htmlspecialcharsback($str)
HasScriptExtension($check_name)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Rel2Abs($curdir, $relpath)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</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']
if(!Loader::includeModule('sale')) $pattern
$GLOBALS['_____370096793']