2define(
'BX_PUBLIC_MODE', 0);
3require(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include/prolog_admin_before.php");
4require(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include/prolog_admin_js.php");
6$addUrl =
'lang='.LANGUAGE_ID.(isset($logical) && $logical ==
"Y"?
'&logical=Y':
'');
7$useEditor3 = COption::GetOptionString(
'fileman',
"use_editor_3",
"N") ==
"Y";
13 ||
$_REQUEST[
'from'] ==
'includecomponent'
18if (!(
$USER->CanDoOperation(
'fileman_admin_files') ||
$USER->CanDoOperation(
'fileman_edit_existent_files')))
23require_once(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/fileman/include.php");
28$obJSPopup =
new CJSPopup(
"lang=".urlencode($_GET[
"lang"] ??
'').
"&site=".urlencode($_GET[
"site"] ??
'').
"&back_url=".urlencode($_GET[
"back_url"] ??
'').
"&path=".urlencode($_GET[
"path"] ??
'').
"&name=".urlencode($_GET[
"name"] ??
''),
array(
"SUFFIX"=>(isset(
$_REQUEST[
'subdialog']) &&
$_REQUEST[
'subdialog'] ==
'Y'?
'editor':
'')));
35 if($arSiteTemplate[
"CONDITION"] ==
'')
106 $USER->CanDoOperation(
'fileman_admin_files') &&
107 $USER->CanDoFileOperation(
'fm_create_new_file',
$arPath)
114 $USER->CanDoOperation(
'fileman_edit_existent_files') &&
115 $USER->CanDoFileOperation(
'fm_edit_existent_file',
$arPath)
124 if(!
$USER->IsAdmin() && str_starts_with(CFileman::GetFileName(
$abs_path),
"."))
145 $limit_php_access = (
$USER->CanDoFileOperation(
'fm_lpa',
$arPath) && !
$USER->CanDoOperation(
'edit_php'));
146 if ($limit_php_access)
149 if (!isset(\
Bitrix\Main\Application::getInstance()->getSession()[
'arOFP']))
152 if(isset($_POST[
'ofp_id']))
154 $ofp_id = $_POST[
'ofp_id'];
158 $ofp_id = mb_substr(md5(
$site.
'|'.
$path), 0, 8);
159 if(!isset(\
Bitrix\Main\Application::getInstance()->getSession()[
'arOFP'][$ofp_id]))
170 $filesrc_tmp = $oFile->GetContents();
188 $filesrc_tmp = CFileman::GetTemplateContent($arTemplates[0][
"file"], LANGUAGE_ID,
array(
$site_template));
208 if($limit_php_access)
212 $ofp =
$io->CombinePath(
"/", $ofp);
215 $f =
$io->GetFile($abs_ofp);
216 $old_filesrc_tmp =
$f->GetContents();
217 $old_res = CFileman::ParseFileContent($old_filesrc_tmp,
true);
218 $old_filesrc = $old_res[
"CONTENT"];
222 $res = CFileman::ParseFileContent($filesrc_tmp,
true);
223 $prolog = CFileman::SetTitle(
$res[
"PROLOG"],
$title);
224 for (
$i = 0;
$i<=$maxind;
$i++)
226 if(trim($_POST[
"CODE_".
$i]) <>
'')
228 if($_POST[
"CODE_".
$i] != $_POST[
"H_CODE_".
$i])
230 $prolog = CFileman::SetProperty($prolog, trim($_POST[
"H_CODE_".
$i]),
"");
231 $prolog = CFileman::SetProperty($prolog, trim($_POST[
"CODE_".
$i]), trim($_POST[
"VALUE_".
$i]));
234 $prolog = CFileman::SetProperty($prolog, trim($_POST[
"CODE_".
$i]), trim($_POST[
"VALUE_".
$i]));
237 $prolog = CFileman::SetProperty($prolog, trim($_POST[
"H_CODE_".
$i]),
"");
239 $epilog =
$res[
"EPILOG"];
240 $filesrc_for_save = $prolog.$filesrc.$epilog;
248 if($str_err && ($err = $str_err ->GetString()))
264 $arUndoParams =
array(
265 'module' =>
'fileman',
266 'undoType' =>
'edit_file',
267 'undoHandler' =>
'CFileman::UndoEditFile',
268 'arContent' =>
array(
270 'content' =>
$f->GetContents()
279 if ($err = $str_err ->GetString())
293 if(COption::GetOptionString(
"fileman",
"log_page",
"Y")==
"Y")
313 if(!str_starts_with(
$url,
"/") || mb_substr(
$url, 1, 1) ==
"/")
319 top.BX.reload(
'<?=CUtil::JSEscape($url)?>',
true);
321 if (
null !=
top.structReload)
322 top.structReload(
'<?=urlencode($_REQUEST["path"] ?? '')?>');
332top.CloseWaitWindow();
333top.<?=
$obJSPopup->jsPopup?>.ShowError(
'<?=CUtil::JSEscape($strWarning)?>');
334var pMainObj =
top.GLOBAL_pMainObj[
'<?=CUtil::JSEscape($editor_name)?>'];
337top.BXSetSessionID(
'<?=CUtil::JSEscape(bitrix_sessid())?>');
349top.CloseWaitWindow();
350top.<?=
$obJSPopup->jsPopup?>.ShowError(
'<?=CUtil::JSEscape($strWarning)?>');
351var pMainObj =
top.GLOBAL_pMainObj[
'<?=CUtil::JSEscape($editor_name)?>'];
360 $res = CFileman::ParseFileContent($filesrc_tmp,
true);
364 if ($limit_php_access)
377 $end = $arPHP[
$n][1];
380 $src = $arPHP[
$n][2];
381 if (str_starts_with($src,
"<?php"))
382 $src = substr($src, 5);
384 $src = substr($src, 2);
385 $src = substr($src, 0, -2);
388 $comp2_begin =
'$APPLICATION->INCLUDECOMPONENT(';
389 if (mb_strtoupper(mb_substr($src, 0, mb_strlen($comp2_begin))) == $comp2_begin)
390 $new_filesrc .= $arPHP[
$n][2];
392 $new_filesrc .=
'#PHP'.str_pad(++$php_count, 4,
"0", STR_PAD_LEFT).
'#';
394 $new_filesrc .= mb_substr(
$filesrc, $end);
399 $bEditProps = (mb_strpos(
$res[
"PROLOG"],
"prolog_before") > 0 || mb_strpos(
$res[
"PROLOG"],
"header.php") > 0);
411 'style' =>
"0px; height: 500px; overflow: hidden;",
412 'class' =>
"bx-content-editor"
417<iframe src=
"javascript:void(0)" name=
"file_edit_form_target" height=
"0" width=
"0" style=
"display: none;"></iframe>
418<form action=
"/bitrix/admin/public_file_edit.php" name=
"editor_form" method=
"post" enctype=
"multipart/form-data" target=
"file_edit_form_target" style=
"margin: 0px; padding: 0px; ">
424?><script>BX.WindowManager.Get().setAutosave();</script><?
428<input type=
"submit" name=
"submitbtn" style=
"display: none;" />
429<input type=
"hidden" name=
"mode" id=
"mode" value=
"public" />
430<input type=
"hidden" name=
"save" id=
"save" value=
"Y" />
431<input type=
"hidden" name=
"site" id=
"site" value=
"<?=htmlspecialcharsbx($site)?>" />
432<input type=
"hidden" name=
"template" id=
"template" value=
"<?echo htmlspecialcharsbx($template)?>" />
433<input type=
"hidden" name=
"templateID" id=
"templateID" value=
"<?echo htmlspecialcharsbx($_REQUEST['templateID'] ?? '')?>" />
434<input type=
"hidden" name=
"subdialog" value=
"<?echo htmlspecialcharsbx($_REQUEST['subdialog'] ?? '')?>" />
436 <input type=
"hidden" name=
"back_url" value=
"<?=htmlspecialcharsbx($_REQUEST['back_url'] ?? '')?>" />
439 <input type=
"hidden" name=
"edit_new_file_undo" value=
"<?=htmlspecialcharsbx($_REQUEST['edit_new_file_undo'] ?? '')?>" />
442 <input type=
"hidden" name=
"new" id=
"new" value=
"Y" />
443 <input type=
"hidden" name=
"filename" id=
"filename" value=
"<?echo htmlspecialcharsbx($filename)?>" />
444 <input type=
"hidden" name=
"path" id=
"path" value=
"<?=htmlspecialcharsbx($path.'/'.$filename)?>" />
446 <input type=
"hidden" name=
"title" value=
"<?=htmlspecialcharsbx($title)?>" />
447 <input type=
"hidden" name=
"path" id=
"path" value=
"<?=htmlspecialcharsbx($path)?>" />
451<?=
$obJSPopup->jsPopup?>.PARTS.CONTENT.getElementsByTagName(
'FORM')[0].style.display =
'none';
453function BXFormSubmit()
456 var obForm = document.forms.editor_form;
457 obForm.elements.submitbtn.click();
460function BXSetSessionID(new_sessid)
462 document.forms.editor_form.sessid.value = new_sessid;
479 'bAllowPhp' =>
$USER->CanDoOperation(
'edit_php'),
480 "limitPhpAccess" => $limit_php_access,
483 "templateId" =>
$_REQUEST[
'templateID'] ??
'',
490 editorDialog = BX.WindowManager.Get(),
491 editor =
top.BXHtmlEditor.Get(
'<?=CUtil::JSEscape($editor_name)?>');
493 if (editor.IsInited())
499 BX.addCustomEvent(editor,
"OnEditorInitedAfter", onEditorInited);
502 BX.addCustomEvent(editorDialog,
'onWindowResizeExt', onEditorDialogResize);
503 BX.addCustomEvent(editorDialog,
'onBeforeWindowClose', onBeforeDialogClose);
504 BX.addCustomEvent(editorDialog,
'onWindowUnRegister', onEditorUnregister);
506 function onEditorDialogResize(params)
508 if (this.offsetTop === undefined)
509 this.offsetTop = editor.CheckBrowserCompatibility() ? 0 : 40;
512 width = params.width,
513 height = params.height - this.offsetTop;
515 editor.SetConfigHeight(
height);
519 function onEditorInited()
521 onEditorDialogResize(editorDialog.GetInnerPos());
522 function ConfirmExitDialog(editor)
525 id:
'bx_confirm_exit',
528 className:
'bxhtmled-confirm-exit-dialog'
532 this.
id =
'confirm_exit';
534 ConfirmExitDialog.superclass.constructor.apply(
this, [editor, params]);
536 this.oDialog.ClearButtons();
537 this.oDialog.SetButtons([
538 new BX.CWindowButton(
540 title:
'<?= GetMessageJS('PUBLIC_EDIT_SAVE_BUT
')?>',
541 className:
'adm-btn-save',
544 if (typeof window.BXFormSubmit ==
'function')
548 _this.oDialog.Close(true);
551 new BX.CWindowButton(
553 title:
'<?= GetMessageJS('PUBLIC_EDIT_EXIT_BUT
')?>',
556 editorDialog.Close(true);
557 _this.oDialog.Close(true);
560 this.oDialog.btnCancel
562 this.SetContent(
"<?= GetMessageJS('PUBLIC_EDIT_DIALOG_EXIT_ACHTUNG')?>");
563 this.SetTitle(
"<?= GetMessageJS('PUBLIC_EDIT_EDITOR')?>");
565 BX.extend(ConfirmExitDialog, window.BXHtmlEditor.Dialog);
566 editor.RegisterDialog(
'ConfirmExit', ConfirmExitDialog);
568 BX.addCustomEvent(editor,
'OnIframeKeyDown',
function(e, keyCode, target)
570 if (keyCode == 27 && !editor.IsExpanded() && !editor.IsPopupsOpened())
572 editorDialog.Close();
576 BX.addCustomEvent(editor,
'OnGetDefaultUploadImageName',
function(nameObj)
578 nameObj.value =
'<?=CUtil::JSEscape($imgName)?>';
582 function onBeforeDialogClose()
584 if (editor.IsExpanded() || editor.IsPopupsOpened())
586 editorDialog.DenyClose();
588 else if (editor.IsContentChanged() && !editor.IsSubmited())
590 editorDialog.DenyClose();
591 editor.GetDialog(
'ConfirmExit').Show();
595 function onEditorUnregister()
609 "templateID" =>
$_REQUEST[
'templateID'] ??
'',
610 "bUseOnlyDefinedStyles" => COption::GetOptionString(
"fileman",
"show_untitled_styles",
"N")!=
"Y",
611 "bWithoutPHP" => (!
$USER->CanDoOperation(
'edit_php')),
612 "toolbarConfig" => CFileman::GetEditorToolbarConfig(
$editor_name),
613 "arTaskbars" => Array(
"BXComponentsTaskbar",
"BXComponents2Taskbar",
"BXPropertiesTaskbar",
"BXSnippetsTaskbar"),
616 "limit_php_access" => $limit_php_access,
619 'light_mode' =>
true,
625 arEditorFastDialogs[
'asksave'] =
function(pObj)
628 title: BX_MESS.EDITOR,
629 innerHTML :
"<div style='margin-bottom: 20px; padding: 5px;'>" + BX_MESS.DIALOG_EXIT_ACHTUNG +
"</div>",
634 window.oBXEditorDialog.SetButtons([
635 new BX.CWindowButton(
637 title: BX_MESS.DIALOG_SAVE_BUT,
640 pObj.pMainObj.isSubmited = true;
641 if(pObj.params.savetype ==
'save')
643 window.oBXEditorDialog.Close(true);
645 className:
'adm-btn-save'
647 new BX.CWindowButton(
649 title: BX_MESS.DIALOG_EXIT_BUT,
652 pObj.pMainObj.isSubmited = true;
653 <?=$obJSPopup->jsPopup?>.CloseDialog();
654 pObj.pMainObj.oPublicDialog.Close(true);
657 window.oBXEditorDialog.btnCancel
660 BX.addClass(window.oBXEditorDialog.PARTS.CONTENT_DATA,
"bxed-dialog");
665 function _BXOnBeforeCloseDialog()
667 var pMainObj = GLOBAL_pMainObj[
'<?=CUtil::JSEscape($editor_name)?>'];
670 if (pMainObj.IsChanged() && !pMainObj.isSubmited)
672 pMainObj.oPublicDialog.DenyClose();
673 pMainObj.OpenEditorDialog(
"asksave",
false, 600, {window: window, savetype: _bEdit ?
'save' :
'saveas', popupMode:
true},
true);
677 function CheckEditorFinish()
679 var pMainObj = GLOBAL_pMainObj[
'<?=CUtil::JSEscape($editor_name)?>'];
680 if (!pMainObj.bLoadFinish)
681 return setTimeout(
'CheckEditorFinish()', 100);
685 pMainObj.oPublicDialog = BX.WindowManager.Get();
686 BX.addClass(pMainObj.oPublicDialog.PARTS.CONTENT,
"bx-editor-dialog-cont");
687 pMainObj.oPublicDialog.AllowClose();
690 BX.removeClass(BX.findParent(pMainObj.pWnd, {tagName:
"DIV", className:
"bx-core-dialog-content"}),
"bx-core-dialog-content");
692 if (BX.browser.IsIE())
694 pMainObj.pWnd.firstChild.rows[0].style.height =
'1px';
696 if (sftbl = BX.findChild(pMainObj.oPublicDialog.PARTS.CONTENT, {tagName:
"TABLE"}))
698 sftbl.cellSpacing = 0;
699 sftbl.cellPadding = 0;
703 var onWinResizeExt =
function(Params)
706 topTlbrH = BX(
'filesrc_pub_toolBarSet0').offsetHeight || 51,
707 h = parseInt(Params.height) - 2,
708 w = parseInt(Params.width) - 3;
710 pMainObj.pWnd.style.height = h +
"px";
711 pMainObj.pWnd.style.width = w +
"px";
712 BX.findParent(pMainObj.cEditor, {tagName:
"TABLE"}).style.height = (h - (topTlbrH + 35)) +
"px";
713 pMainObj.arTaskbarSet[2]._SetTmpClass(
true);
714 pMainObj.arTaskbarSet[2].Resize(
false,
false,
false);
715 pMainObj.arTaskbarSet[3].Resize(
false,
false,
false);
717 if (window._SetTmpClassInterval)
718 clearInterval(window._SetTmpClassInterval);
719 window._SetTmpClassInterval = setTimeout(
function()
721 pMainObj.arTaskbarSet[2]._SetTmpClass(
false);
722 pMainObj.SetCursorFF();
725 onWinResizeExt(pMainObj.oPublicDialog.GetInnerPos());
726 BX.addCustomEvent(pMainObj.oPublicDialog,
'onWindowResizeExt', onWinResizeExt);
727 BX.addCustomEvent(pMainObj.oPublicDialog,
'onBeforeWindowClose', _BXOnBeforeCloseDialog);
732 <?
if (COption::GetOptionString(
"fileman",
"htmleditor_fullscreen",
"N") ==
"Y"):?>
733 BX.WindowManager.Get().__expand();
747<textarea name=
"<?=htmlspecialcharsbx($editor_name)?>" id=
"<?=htmlspecialcharsbx($editor_name)?>" style=
"height: 99%; width: 100%;"><?=htmlspecialcharsex(
$filesrc)?></textarea>
751 wnd = BX.WindowManager.Get();
753function TAResize(data)
755 var ta = BX(
'<?=CUtil::JSEscape($editor_name)?>');
757 border = parseInt(BX.style(ta,
'border-left-width')) + parseInt(BX.style(ta,
'border-right-width'));
763 ta.style.height = (data.height - border - 10) +
'px';
765 ta.style.width = (data.width - border - 10) +
'px';
768BX.addCustomEvent(wnd,
'onWindowResizeExt', TAResize);
769TAResize(wnd.GetInnerPos());
775 <input type=
"button" class=
"adm-btn-save" id=
"btn_popup_save" name=
"btn_popup_save" value=
"<?=GetMessage("JSPOPUP_SAVE_CAPTION
")?>" onclick=
"BXFormSubmit();" title=
"<?=GetMessage("JSPOPUP_SAVE_CAPTION
")?>" />
785require(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/include/epilog_admin_js.php");
if($canUseYandexMarket) $strWarning
static Log($SEVERITY, $AUDIT_TYPE_ID, $MODULE_ID, $ITEM_ID, $DESCRIPTION=false, $SITE_ID=false)
static GetScriptFileExt()
static CheckOnAllowedComponents($str)
static __CheckSite($site)
static ParsePath($path, $bLast=false, $url=false, $param="", $bLogical=false)
static CheckFileName($str)
static Init($arExt=array(), $bReturn=false)
static ShowUndoMessage($ID)
static Add($params=array())
static ParseFile($filesrc, $limit=false)
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
$_SERVER["DOCUMENT_ROOT"]
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
check_bitrix_sessid($varname='sessid')
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
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."%"