public static function getDirStructure($bLogical, $site, $path) { global $USER; $arDirContent = array(); if ($USER->CanDoFileOperation('fm_view_listing', array($site, $path))) { \Bitrix\Main\Loader::includeModule('fileman'); $arDirs = array(); $arFiles = array(); \CFileMan::GetDirList(array($site, $path), $arDirs, $arFiles, array(), array("NAME" => "asc"), "DF", $bLogical, true); $arDirContent_t = array_merge($arDirs, $arFiles); for ($i = 0, $l = count($arDirContent_t); $i < $l; $i++) { $file = $arDirContent_t[$i]; $arPath = array($site, $file['ABS_PATH']); if ($file["TYPE"] == "F" && !$USER->CanDoFileOperation('fm_view_file', $arPath) || $file["TYPE"] == "D" && !$USER->CanDoFileOperation('fm_view_listing', $arPath) || $file["TYPE"] == "F" && $file["NAME"] == ".section.php") { continue; } $f = $file['TYPE'] == 'F' ? new \Bitrix\Main\IO\File($file['PATH'], $site) : new \Bitrix\Main\IO\Directory($file['PATH'], $site); $p = $f->getName(); if ($f->isSystem() || $file['TYPE'] == 'F' && in_array($p, array("urlrewrite.php")) || $file['TYPE'] == 'D' && preg_match("/\\/(bitrix|" . \COption::getOptionString("main", "upload_dir", "upload") . ")\\//", "/" . $p . "/")) { continue; } $arFileData = array('NAME' => $bLogical ? $file['LOGIC_NAME'] : $p, 'FILE' => $p, 'TYPE' => $file['TYPE'], 'DATA' => $file); if (strlen($arFileData['NAME']) <= 0) { $arFileData['NAME'] = GetMessage('SEO_DIR_LOGICAL_NO_NAME'); } $arDirContent[] = $arFileData; } unset($arDirContent_t); } return $arDirContent; }
protected function genEditHTML() { if (\CModule::IncludeModule("fileman")) { ob_start(); $codeType = $this->code . '_TEXT_TYPE'; /** @var string $className Имя класса без неймспейса */ $className = $this->getEntityShortName(); $entityClass = $this->entityName; $modelPk = $entityClass::getEntity()->getPrimary(); $id = isset($this->data[$modelPk]) ? $this->data[$modelPk] : false; $bxCode = $this->code . '_' . $className; $bxCodeType = $codeType . '_' . $className; if ($this->forceMultiple) { if ($id) { $bxCode .= '_' . $id; $bxCodeType .= '_' . $id; } else { $bxCode .= '_new_'; $bxCodeType .= '_new_'; } } // TODO Избавиться от данного костыля if ($_REQUEST[$bxCode]) { $this->data[$this->code] = $_REQUEST[$bxCode]; } \CFileMan::AddHTMLEditorFrame($bxCode, $this->data[$this->code], $bxCodeType, $this->data[$codeType], array('width' => $this->getSettings('WIDTH'), 'height' => $this->getSettings('HEIGHT'))); $defaultEditors = array("text" => "text", "html" => "html", "editor" => "editor"); $editors = $this->getSettings('EDITORS'); $defaultEditor = strtolower($this->getSettings('DEFAULT_EDITOR')); $contentType = $this->data[$codeType]; $defaultEditor = isset($contentType) && $contentType == "text" ? "text" : $defaultEditor; $defaultEditor = isset($contentType) && $contentType == "html" ? "editor" : $defaultEditor; if (count($editors) > 1) { foreach ($editors as &$editor) { $editor = strtolower($editor); if (isset($defaultEditors[$editor])) { unset($defaultEditors[$editor]); } } } $script = '<script type="text/javascript">'; $script .= '$(document).ready(function() {'; foreach ($defaultEditors as $editor) { $script .= '$("#bxed_' . $bxCode . '_' . $editor . '").parent().hide();'; } $script .= '$("#bxed_' . $bxCode . '_' . $defaultEditor . '").click();'; $script .= 'setTimeout(function() {$("#bxed_' . $bxCode . '_' . $defaultEditor . '").click(); }, 500);'; $script .= "});"; $script .= '</script>'; echo $script; $html = ob_get_clean(); return $html; } else { return parent::genEditHTML(); } }
function DEMO_Sale_AddMenuItem($menuFile, $menuItem) { if (CModule::IncludeModule('fileman')) { $arResult = CFileMan::GetMenuArray($_SERVER["DOCUMENT_ROOT"] . $menuFile); $arMenuItems = $arResult["aMenuLinks"]; $menuTemplate = $arResult["sMenuTemplate"]; $bFound = false; foreach ($arMenuItems as $item) { if ($item[1] == $menuItem[1]) { $bFound = true; } } if (!$bFound) { $arMenuItems[] = $menuItem; CFileMan::SaveMenu(array($arParams["site_id"], $menuFile), $arMenuItems, $menuTemplate); } } }
<td><?php echo GetMessage("FILEMAN_H_EDIT_TMENU"); ?> </td> <td> <select id="menutype" name="menutype" onChange="chtyp()"> <?php $armt = GetMenuTypes($site); $arAllItems = array(); $strSelected = ""; foreach ($armt as $key => $title) { if (!$USER->CanDoFileOperation('fm_edit_existent_file', array($site, $__fd_path . "/." . $key . ".menu.php"))) { continue; } $arItems = array(); $res = CFileMan::GetMenuArray($DOC_ROOT . $__fd_path . "/." . $key . ".menu.php"); $aMenuLinksTmp = $res["aMenuLinks"]; if (!is_array($aMenuLinksTmp)) { $aMenuLinksTmp = array(); } $itemcnt = 0; $cntMenu = count($aMenuLinksTmp); for ($j = 0; $j < $cntMenu; $j++) { $aMenuLinksItem = $aMenuLinksTmp[$j]; $arItems[] = htmlspecialcharsbx($aMenuLinksItem[0]); } $arAllItems[$key] = $arItems; if ($strSelected == "") { $strSelected = $key; } ?>
echo GetMessage("FLOW_TITLE"); ?> </td> <td><input type="text" name="TITLE" maxlength="255" value="<?php echo $str_TITLE; ?> " style="width:60%"></td> </tr> <?php if (COption::GetOptionString("workflow", "USE_HTML_EDIT", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td colspan="2" align="center"><?php $limit_php_access = $USER->CanDoFileOperation('fm_lpa', array($str_SITE_ID, $str_FILENAME)) && !$USER->CanDoOperation('edit_php'); $bWithoutPHP = !$USER->CanDoOperation('edit_php') && !$limit_php_access; CFileMan::AddHTMLEditorFrame("BODY", $str_BODY, "BODY_TYPE", $str_BODY_TYPE, 400, "Y", $ID, GetDirPath($str_FILENAME), "", false, $bWithoutPHP, false, array('limit_php_access' => $limit_php_access)); ?> </td> </tr> <?php } else { ?> <tr> <td colspan="2" align="center"><?php echo InputType("radio", "BODY_TYPE", "text", $str_BODY_TYPE, false); ?> <?php echo GetMessage("FLOW_TEXT"); ?> / <?php echo InputType("radio", "BODY_TYPE", "html", $str_BODY_TYPE, false);
none<?php } ?> ;"> <td align="center" colspan="2"> <table width="95%" cellspacing="0" border="0" cellpadding="0"> <?php if ($isEditMode) { if (COption::GetOptionString("advertising", "USE_HTML_EDIT", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr valign="top"> <td align="center" colspan="2"><?php if (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) { CFileMan::AddHTMLEditorFrame("CODE", $str_CODE, "CODE_TYPE", $str_CODE_TYPE, array('height' => 450, 'width' => '100%'), "N", 0, "", "onfocus=\"t=this\""); } else { CFileMan::AddHTMLEditorFrame("CODE", $str_CODE, "CODE_TYPE", $str_CODE_TYPE, 300, "N", 0, "", "onfocus=\"t=this\""); } ?> </td> </tr> <?php } else { ?> <tr valign="top"> <td align="center" colspan="2"><?php echo InputType("radio", "CODE_TYPE", "text", $str_CODE_TYPE, false); echo GetMessage("AD_TEXT"); ?> / <?php echo InputType("radio", "CODE_TYPE", "html", $str_CODE_TYPE, false); ?>
<td><?php echo CFile::InputFile("IMAGE_ID", 20, $str_IMAGE_ID); if ($str_IMAGE_ID > 0) { ?> <br /><?php echo CFile::ShowImage($str_IMAGE_ID, 200, 200, "border=0", "", true); } ?> </td> </tr> <?php if (COption::GetOptionString("form", "USE_HTML_EDIT") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td align="center" colspan="2"><?php CFileMan::AddHTMLEditorFrame("TITLE", $str_TITLE, "TITLE_TYPE", $str_TITLE_TYPE, 400); ?> </td> </tr> <?php } else { ?> <tr> <td align="center" colspan="2"><?php echo InputType("radio", "TITLE_TYPE", "text", $str_TITLE_TYPE, false); ?> <?php echo GetMessage("FORM_TEXT"); ?> / <?php echo InputType("radio", "TITLE_TYPE", "html", $str_TITLE_TYPE, false);
</tr> <?php $tabControl->EndCustomField("ANSWERS"); ?> <?php $tabControl->BeginNextFormTab(); $tabControl->BeginCustomField("DESCRIPTION", GetMessage("LEARNING_DESCRIPTION"), false); ?> <?php if (COption::GetOptionString("learning", "use_htmledit", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td colspan="2" align="center"> <?php CFileMan::AddHTMLEditorFrame("DESCRIPTION", $str_DESCRIPTION, "DESCRIPTION_TYPE", $str_DESCRIPTION_TYPE, array('width' => '100%', 'height' => '500'), "N", 0, "", "", false, true, false, array('toolbarConfig' => CFileman::GetEditorToolbarConfig("learning_" . (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? 'public' : 'admin')))); ?> </td> </tr> <?php } else { ?> <tr> <td align="center"><?php echo GetMessage("LEARNING_DESC_TYPE"); ?> :</td> <td> <input type="radio" name="DESCRIPTION_TYPE" value="text"<?php if ($str_DESCRIPTION_TYPE != "html") { echo " checked";
public static function RequestAction($action = '') { global $USER, $APPLICATION; $result = array(); switch($action) { case "load_site_template": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; $siteTemplate = $_REQUEST['site_template']; $siteId = isset($_REQUEST['site_id']) ? $_REQUEST['site_id'] : SITE_ID; $result = self::GetSiteTemplateParams($siteTemplate, $siteId); break; case "load_components_list": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; $siteTemplate = $_REQUEST['site_template']; $result = self::GetComponents($siteTemplate, true); break; case "video_oembed": $result = self::GetVideoOembed($_REQUEST['video_source']); break; // Snippets actions case "load_snippets_list": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; $template = $_REQUEST['site_template']; $result = array( 'result' => true, 'snippets' => array($template => self::GetSnippets($template, $_REQUEST['clear_cache'] == 'Y')) ); break; case "edit_snippet": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; CUtil::JSPostUnEscape(); $template = $_REQUEST['site_template']; // Update if ($_REQUEST['current_path']) { $result = CSnippets::Update(array( 'template' => $template, 'path' => $_REQUEST['path'], 'code' => $_REQUEST['code'], 'title' => $_REQUEST['name'], 'current_path' => $_REQUEST['current_path'], 'description' => $_REQUEST['description'] )); } // Add new else { $result = CSnippets::Add(array( 'template' => $template, 'path' => $_REQUEST['path'], 'code' => $_REQUEST['code'], 'title' => $_REQUEST['name'], 'description' => $_REQUEST['description'] )); } if ($result && $result['result']) { $result['snippets'] = array($template => self::GetSnippets($template)); } break; case "remove_snippet": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; CUtil::JSPostUnEscape(); $template = $_REQUEST['site_template']; $res = CSnippets::Remove(array( 'template' => $template, 'path' => $_REQUEST['path'] )); if ($res) { $result = array( 'result' => true, 'snippets' => array($template => self::GetSnippets($template)) ); } else { $result = array('result' => false); } break; case "snippet_add_category": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; CUtil::JSPostUnEscape(); $template = $_REQUEST['site_template']; $res = CSnippets::CreateCategory(array( 'template' => $template, 'name' => $_REQUEST['category_name'], 'parent' => $_REQUEST['category_parent'] )); if ($res) { $result = array( 'result' => true, 'snippets' => array($template => self::GetSnippets($template)) ); } else { $result = array('result' => false); } break; case "snippet_remove_category": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; CUtil::JSPostUnEscape(); $template = $_REQUEST['site_template']; $res = CSnippets::RemoveCategory(array( 'template' => $template, 'path' => $_REQUEST['category_path'] )); if ($res) { $result = array( 'result' => true, 'snippets' => array($template => self::GetSnippets($template)) ); } else { $result = array('result' => false); } break; case "snippet_rename_category": if (!$USER->CanDoOperation('fileman_view_file_structure')) break; CUtil::JSPostUnEscape(); $template = $_REQUEST['site_template']; $res = CSnippets::RenameCategory(array( 'template' => $template, 'path' => $_REQUEST['category_path'], 'new_name' => $_REQUEST['category_new_name'] )); if ($res) { $result = array( 'result' => true, 'snippets' => array($template => self::GetSnippets($template)) ); } else { $result = array('result' => false); } break; // END *** Snippets actions // spellcheck case "spellcheck_words": case "spellcheck_add_word": CUtil::JSPostUnEscape(); $spellChecker = new CSpellchecker(array( "lang" => $_REQUEST['lang'], "skip_length" => 2, "use_pspell" => $_REQUEST['use_pspell'] !== "N", "use_custom_spell" => $_REQUEST['use_custom_spell'] !== "N", "mode" => PSPELL_FAST )); if ($action == "spellcheck_words") { $words = (isset($_REQUEST['words']) && is_array($_REQUEST['words'])) ? $_REQUEST['words'] : array(); $result = array( 'words' => $spellChecker->checkWords($words) ); } else // Add word { $word = CFileMan::SecurePathVar($_REQUEST['word']); $spellChecker->addWord($word); } break; // END *** spellcheck } self::ShowResponse(intVal($_REQUEST['reqId']), $result); }
echo bitrix_sessid_post(); ?> <?php $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("FILEMAN_TAB1"), "ICON" => "fileman", "TITLE" => GetMessage("FILEMAN_TAB1_ALT"))); $tabControl = new CAdminTabControl("tabControl", $aTabs); $tabControl->Begin(); ?> <?php $tabControl->BeginNextTab(); ?> <?php if ($bEdit && strlen($strWarning) <= 0) { $res = CFileMan::GetMenuArray($abs_path); $aMenuLinksTmp = $res["aMenuLinks"]; $sMenuTemplateTmp = $res["sMenuTemplate"]; } if (!is_array($aMenuLinksTmp)) { $aMenuLinksTmp = array(); } ?> <tr> <td><?php echo GetMessage("FILEMAN_MENU_EDIT_TYPE"); ?> </td> <td> <script>
function BaseConvertToDB($value) { $io = CBXVirtualIo::GetInstance(); $arRes = array("path" => ""); if (!is_array($value)) { $value = array(); } //In case of DB value just serialize it if (implode("|", array_keys($value)) === 'path|width|height|title|duration|author|date|desc') { return serialize($value); } if ($value["B_NEW_FILE"] != "N") { if (strlen($value["CUR_PATH"]) > 0 && $value["DEL_CUR_FILE"] == "Y" && CIBlockPropertyVideo::CheckFileInUploadDir($value["CUR_PATH"])) { // del current file $cur_path_ = $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $value["CUR_PATH"]); $flTmp = $io->GetFile($cur_path_); $flSzTmp = $flTmp->GetFileSize(); if ($io->Delete($cur_path_)) { // Quota if (COption::GetOptionInt("main", "disk_space") > 0) { CDiskQuota::updateDiskQuota("file", $flSzTmp, "delete"); } } } // Get video if (strlen($value["PATH"]) > 0) { $arRes["path"] = $value["PATH"]; } else { if (isset($value["FILE"]) && strlen($value["FILE"]["tmp_name"]) > 0) { $pathToDir = CIBlockPropertyVideo::GetUploadDirPath(); if (!$io->DirectoryExists($_SERVER["DOCUMENT_ROOT"] . $pathToDir)) { CFileMan::CreateDir($pathToDir); } // 1. Convert name $name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "_", $value["FILE"]["name"]); $baseNamePart = substr($name, 0, strpos($name, '.')); $ext = GetFileExtension($name); if (strlen($ext) > 0 && !HasScriptExtension($name) && !substr($name, 0, 1) != ".") { $ind = 0; // 2. Check if file already exists while ($io->FileExists($_SERVER["DOCUMENT_ROOT"] . Rel2Abs($pathToDir, $name))) { $name = $baseNamePart . "_(" . ++$ind . ")." . $ext; } // 3. Rename $pathto = Rel2Abs($pathToDir, $name); if (is_uploaded_file($value["FILE"]["tmp_name"]) && $io->Copy($value["FILE"]["tmp_name"], $_SERVER["DOCUMENT_ROOT"] . $pathto)) { $arRes["path"] = Rel2Abs("/", $pathto); // Quota if (COption::GetOptionInt("main", "disk_space") > 0) { CDiskQuota::updateDiskQuota("file", $value["FILE"]["size"], "add"); } } } } } } elseif (strlen($value["CUR_PATH"]) > 0) { if (preg_match("/^(http|https):\\/\\//", $value["CUR_PATH"])) { $arRes["path"] = $value["CUR_PATH"]; } else { $arRes["path"] = Rel2Abs("/", $value["CUR_PATH"]); } } // Width & height $arRes["width"] = intVal($value["WIDTH"]); $arRes["height"] = intVal($value["HEIGHT"]); if ($arRes["width"] < 0) { $arRes["width"] = 400; } if ($arRes["height"] < 0) { $arRes["height"] = 300; } // Video info $arRes["title"] = $value["TITLE"]; $arRes["duration"] = $value["DURATION"]; $arRes["author"] = $value["AUTHOR"]; $arRes["date"] = $value["DATE"]; $arRes["desc"] = $value["DESC"]; $strRes = serialize($arRes); if ($arRes["path"] == "" && $arRes["title"] == "" && $arRes["author"] == "") { return ""; } return $strRes; }
?> ;"> <?php $site = is_array($arSITE) ? $arSITE[0] : LANG; $arTplList = CSite::GetTemplateList($site); $tpl = ""; while ($ar = $arTplList->Fetch()) { if (strlen($tpl) == 0) { $tpl = $ar["TEMPLATE"]; } if (strlen(trim($ar["CONDITION"])) == 0) { $tpl = $ar["TEMPLATE"]; break; } } CFileMan::ShowHTMLEditControl("FORM_TEMPLATE", htmlspecialcharsback($str_FORM_TEMPLATE), array("site" => $arSITE[0], "templateID" => $tpl, "bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N") != "Y", "bWithoutPHP" => false, "arToolbars" => array("standart", "style", "formating", "source", "template", "table"), "arTaskbars" => array("BXFormElementsTaskbar", "BXPropertiesTaskbar"), "toolbarConfig" => CFileman::GetEditorToolbarConfig("form_edit" . (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? "_public" : "")), "sBackUrl" => "", "fullscreen" => false, 'width' => '100%', 'height' => '500', 'use_editor_3' => 'N')); ?> <script> oBXEditorUtils.addPHPParser(oForm.PHPParser); oBXEditorUtils.addTaskBar('BXFormElementsTaskbar', 2, "<?php echo GetMessageJS('FORM_TASKBARSET_TITLE'); ?> ", []); if (window.arButtons['Optimize']) arButtons['Optimize'][1].hideCondition = function(pMainObj){return pMainObj.name == "FORM_TEMPLATE";} </script> </div></td> </tr> <?php } else { ?>
$arParsedPathTmp = CFileMan::ParsePath(array($site, $pathto), false, false, "", $logical == "Y"); $arFiles[$ind] = $arParsedPathTmp["LAST"]; $pathTmp = $arParsedPathTmp["PREV"]; } } } } } if (strlen($strWarning) <= 0) { $module_id = "fileman"; if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") { $res_log['path'] = substr($pathto, 1); CEventLog::Log("content", "FILE_RENAME", "fileman", "", serialize($res_log)); } $path = $pathTmp; $arParsedPath = CFileMan::ParsePath(array($site, $path), false, false, "", $logical == "Y"); $abs_path = $DOC_ROOT . $path; LocalRedirect("/bitrix/admin/fileman_admin.php?" . $addUrl . "&site=" . $site . "&path=" . UrlEncode($path)); } } } } $APPLICATION->SetTitle(GetMessage("FILEMAN_RENAME_TITLE")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; ShowError($strWarning); if (count($arFiles) > 0) { ?> <form action="fileman_rename.php?lang=<?php echo LANG; ?> &path=<?php
BX.focus(BX('bx-filesrc')); }); return BX.PreventDefault(e || window.event); } BX.ready(function() { BX.bind(document.forms.ffilemanedit.apply, 'click', AjaxApply); }); </script> <?php if (COption::GetOptionString('fileman', "use_code_editor", "Y") == "Y") { $forceSyntax = false; $ext = strtolower(CFileMan::GetFileExtension($path)); if ($ext == 'sql') { $forceSyntax = 'sql'; } elseif ($ext == 'js') { $forceSyntax = 'js'; } CCodeEditor::Show(array('textareaId' => 'bx-filesrc', 'height' => 500, 'forceSyntax' => $forceSyntax)); } // $hkInst = CHotKeys::getInstance(); // $arExecs = $hkInst->GetCodeByClassName("admin_file_edit_apply"); // echo $hkInst->PrintJSExecs($arExecs); ?> <?php } require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
private function AddMenuItem() { //Add menu Item $MenuFolderPath = $this->IO->CombinePath("/", '/services/'); $MenuFilePath = $this->IO->CombinePath($MenuFolderPath, ".left.menu.php"); $AbsMenuFilePath = $this->IO->CombinePath($this->DOCUMENT_ROOT, $MenuFilePath); if ($this->IO->FileExists($AbsMenuFilePath)) { $MenuResource = CFileMan::GetMenuArray($AbsMenuFilePath); $arMenuItems = $MenuResource["aMenuLinks"]; $bAddMenuItem = true; foreach ($arMenuItems as $MenuItem) { if (in_array($MenuItem[1], array($this->PublicDir, $this->PublicDir . "index.php"))) { $bAddMenuItem = false; break; } } if ($bAddMenuItem) { $arMenuItems[] = array(GetMessage("IDEA_PUBLIC_FILE_MENU_TITLE"), $this->PublicDir, array(), array(), "CBXFeatures::IsFeatureEnabled('Idea')"); CFileMan::SaveMenu(array($this->SITE_ID, $MenuFilePath), $arMenuItems, ""); } } }
'absPath' => $abs_path, 'content' => $f->GetContents() ) ); } if(!$APPLICATION->SaveFileContent($abs_path, $filesrc_for_save)) { if($str_err = $APPLICATION->GetException()) { if ($err = $str_err ->GetString()) $strWarning = $err; $bVarsFromForm = true; $path = $io->CombinePath("/", $arParsedPath["PREV"]); $arParsedPath = CFileMan::ParsePath($path, true, false, "", $logical == "Y"); $abs_path = $DOC_ROOT.$path; } if (empty($strWarning)) $strWarning = GetMessage("FILEMAN_FILE_SAVE_ERROR")." "; } else { if(COption::GetOptionString("fileman", "log_page", "Y")=="Y") { $res_log['path'] = substr($path, 1); CEventLog::Log( "content", "PAGE_EDIT", "main",
if ($io->CreateDirectory($absPath)) { $c = str_replace(array_keys($arReplace), array_values($arReplace), file_get_contents(dirname(__FILE__) . "/public/index.php")); if ($f = $io->GetFile($absFile)) { $f->PutContents($c); CUrlRewriter::Add(array('CONDITION' => '#^' . $meeting_folder . '/#', 'RULE' => '', 'ID' => 'bitrix:meetings', 'PATH' => $meeting_folder . '/' . $fileName)); } if (CModule::IncludeModule('fileman')) { $absMenuFile = $absMenuPath . '/.left.menu.php'; $menuFile = $menuFolder . '/.left.menu.php'; $arResult = CFileMan::GetMenuArray($absMenuFile); $arMenuItems = $arResult["aMenuLinks"]; $menuTemplate = $arResult["sMenuTemplate"]; $menuItemPosition = 1; foreach ($arMenuItems as $item) { if ($item[0] == GetMessage('MEETING_MODULE_NAME') || $item[1] == $meeting_folder . '/') { $menuItemPosition = -1; break; } } if ($menuItemPosition > 0) { if ($menuItemPosition > count($arMenuItems)) { $menuItemPosition = 0; } for ($i = count($arMenuItems) - 1; $i >= $menuItemPosition; $i--) { $arMenuItems[$i + 1] = $arMenuItems[$i]; } $arMenuItems[$menuItemPosition] = array(GetMessage('MEETING_MODULE_NAME'), $meeting_folder . '/', array(), array(), "CBXFeatures::IsFeatureEnabled('Meeting')"); CFileMan::SaveMenu(array($site, $menuFile), $arMenuItems, $menuTemplate); } } }
<tr id="tr_SUB_DETAIL_TEXT_DIFF"> <td colspan="2"> <div style="width:95%;background-color:white;border:1px solid black;padding:5px"> <?php echo getDiff($prev_arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT"]); ?> </div> </td> </tr> <?php } elseif (COption::GetOptionString("iblock", "use_htmledit", "Y") == "Y" && $bFileman) { ?> <tr id="tr_SUB_DETAIL_TEXT_EDITOR"> <td colspan="2" align="center"> <?php CFileMan::AddHTMLEditorFrame("SUB_DETAIL_TEXT", $str_DETAIL_TEXT, "SUB_DETAIL_TEXT_TYPE", $str_DETAIL_TEXT_TYPE, array('height' => 450, 'width' => '100%'), "N", 0, "", "", $arIBlock["LID"], true, false, array('toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_" . (defined('BX_SUB_SETTINGS') && BX_SUB_SETTINGS == true ? 'admin' : 'public')), 'saveEditorKey' => $IBLOCK_ID, 'hideTypeSelector' => $arIBlock["FIELDS"]["DETAIL_TEXT_TYPE_ALLOW_CHANGE"]["DEFAULT_VALUE"] === "N")); ?> </td> </tr> <?php } else { ?> <tr id="tr_SUB_DETAIL_TEXT_TYPE"> <td><?php echo GetMessage("IBLOCK_DESC_TYPE"); ?> </td> <td><input type="radio" name="SUB_DETAIL_TEXT_TYPE" id="SUB_DETAIL_TEXT_TYPE_text" value="text"<?php if ($str_DETAIL_TEXT_TYPE != "html") { echo " checked"; }
function replacer($str) { $str = CFileMan::SecurePathVar($str); $str = preg_replace("/[^a-zA-Z0-9_\\.-\\+]/is", "_", $str); return $str; }
<td width="60%"> <input type="text" name="sectionname" value="<?echo htmlspecialcharsbx($f_SECTIONNAME)?>" size="50" maxlength="255"> </td> </tr> <tr class="heading"> <td colspan="2"><?echo GetMessage("FILEMAN_FOLDER_FILEPROPS")?></td> </tr> <tr> <td align="center" colspan="2"> <table border="0" cellspacing="1" cellpadding="3" class="internal"> <tr class="heading"> <td align="center"><?echo GetMessage("FILEMAN_FOLDER_PROPSCODE")?></td> <td align="center"><?echo GetMessage("FILEMAN_FOLDER_PROPSVAL")?></td> </tr> <? $arPropTypes = CFileMan::GetPropstypes($site); if(is_array($arDirProperties)) { foreach ($arDirProperties as $f_CODE => $f_VALUE) { $ind++; $oldind++; if($bInitVars) { $f_CODE = $_POST["CODE_".$oldind]; $f_VALUE = $_POST["VALUE_".$oldind]; } $bPredefinedProperty = False; if(is_set($arPropTypes, $f_CODE))
} if($REQUEST_METHOD=="POST" && strlen($save)>0) { if(!check_freetrix_sessid()) { $strWarning = GetMessage("FILEMAN_SESSION_EXPIRED"); $bVarsFromForm = true; } // lpa was denied earlier, so use file src as is $filesrc_for_save = $_POST['filesrc']; if(strlen($strWarning) <= 0) { if (!CFileMan::CheckOnAllowedComponents($filesrc_for_save)) { $str_err = $APPLICATION->GetException(); if($str_err && ($err = $str_err ->GetString())) $strWarning .= $err; $bVarsFromForm = true; } } if(strlen($strWarning) <= 0) { $f = $io->GetFile($abs_path); $arUndoParams = array( 'module' => 'fileman', 'undoType' => 'edit_file', 'undoHandler' => 'CFileman::UndoEditFile',
$arEdTypes[] = array("code" => "iblock_admin", "editors" => array("PREVIEW_TEXT", "DETAIL_TEXT"), "title" => GetMessage("FILEMAN_EDITOR_TYPE_IBLOCK_ADMIN"), "public" => false); } if (IsModuleInstalled("subscribe")) { $arEdTypes[] = array("code" => "subscribe", "editors" => array(), "title" => GetMessage("FILEMAN_EDITOR_TYPE_SUBSCRIBE"), "public" => false); } if (IsModuleInstalled("learning")) { $arEdTypes[] = array("code" => "learning_public", "editors" => array(), "title" => GetMessage("FILEMAN_EDITOR_TYPE_LEARNING_PUBLIC"), "public" => true); $arEdTypes[] = array("code" => "learning_admin", "editors" => array(), "title" => GetMessage("FILEMAN_EDITOR_TYPE_LEARNING_ADMIN"), "public" => false); } if (IsModuleInstalled("form")) { $arEdTypes[] = array("code" => "form_edit", "editors" => array("FORM_TEMPLATE"), "title" => GetMessage("FILEMAN_EDITOR_TYPE_FORM"), "public" => false); $arEdTypes[] = array("code" => "form_edit_public", "editors" => array("FORM_TEMPLATE"), "title" => GetMessage("FILEMAN_EDITOR_TYPE_FORM_PUBLIC"), "public" => false); } $arCurConfig = array(); for ($i = 0, $l = count($arEdTypes); $i < $l; $i++) { $arCurConfig[$arEdTypes[$i]['code']] = CFileMan::GetEditorToolbarConfig($arEdTypes[$i]['code']); // for ($j = 0, $n = count($arEdTypes[$i]['editors']); $j < $n; $j++) // { // $arJS = Array(); // $arCSS = Array(); // $events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptsGet"); // while($arEvent = $events->Fetch()) // { // $tmp = ExecuteModuleEventEx($arEvent, array($arEdTypes[$i]['editors'][$j], array())); // if (!is_array($tmp)) // continue; // if (is_array($tmp['JS'])) // $arJS = array_merge($arJS, $tmp['JS']); // if (is_array($tmp['CSS'])) // $arCSS = array_merge($arCSS, $tmp['CSS']); // }
echo GetMessage("IB_E_PICTURE"); ?> </td> <td> <?php echo CFileInput::Show('PICTURE', $str_PICTURE, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"))), array('upload' => true, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => true, 'description' => false)); ?> </td> </tr> <?php if (COption::GetOptionString("iblock", "use_htmledit", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td colspan="2" align="center"> <?php CFileMan::AddHTMLEditorFrame("DESCRIPTION", $str_DESCRIPTION, "DESCRIPTION_TYPE", $str_DESCRIPTION_TYPE, array('height' => 450, 'width' => '100%')); ?> </td> </tr> <?php } else { ?> <tr> <td ><?php echo GetMessage("IB_E_DESCRIPTION_TYPE"); ?> </td> <td > <input type="radio" name="DESCRIPTION_TYPE" id="DESCRIPTION_TYPE1" value="text"<?php if ($str_DESCRIPTION_TYPE != "html") { echo " checked";
function SetLastPathes($arPathes = array()) { if (count($arPathes) == 0) { $arPathes = CFileMan::GetLastPathesDefault(); } $arPathes = array_slice($arPathes, 0, 10); CUserOptions::SetOption("fileman", "last_pathes", serialize($arPathes)); }
<? require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_before.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/prolog.php"); if (!$USER->CanDoOperation('fileman_view_file_structure')) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/include.php"); if(CModule::IncludeModule("compression")) CCompress::Disable2048Spaces(); if (isset($_GET['path'])) { $site = CFileMan::__CheckSite($site); if(!$site) $site = CSite::GetSiteByFullPath($_SERVER["DOCUMENT_ROOT"].$path); $io = CBXVirtualIo::GetInstance(); $documentRoot = CSite::GetSiteDocRoot($site); $path = $io->CombinePath("/", $path); $abs_path = $documentRoot.$path; $arPath = Array($site, $path); if ($io->FileExists($abs_path) && $USER->CanDoFileOperation('fm_view_file', $arPath)) { $width = isset($width) ? 'width="'.htmlspecialcharsex($width).'"' : ''; $height = isset($height) ? 'height="'.htmlspecialcharsex($height).'"' : ''; ?> <HTML><HEAD></HEAD><BODY>
public static function Init($Params) { global $USER; $arWarnings = array(); if (!$USER->CanDoOperation('fileman_admin_files') && !$USER->CanDoOperation('fileman_admin_folders')) { $arWarnings[] = GetMessage('FM_UTIL_ACCESS_DENIED'); } $io = CBXVirtualIo::GetInstance(); if (count($arWarnings) == 0) { $pathTo = trim($Params['copyTo'], " /"); $site = CFileMan::__CheckSite($_GET['site']); $siteTo = $Params['siteTo'] ? $Params['siteTo'] : $site; $pathTo = $pathTo == "" ? "/" : "/" . $pathTo . "/"; $absPathTo = CSite::GetSiteDocRoot($siteTo) . $pathTo; $docRootFrom = CSite::GetSiteDocRoot($site); if (!$io->DirectoryExists($absPathTo)) { // Create destination directory $bAccess = $USER->CanDoOperation('fileman_admin_folders') && $USER->CanDoFileOperation('fm_create_new_folder', $pathTo); if ($Params['createCopyTo']) { if ($bAccess) { CFileMan::CreateDir(array($siteTo, $pathTo)); } } else { ?> <script>window.BXFM_NoCopyToDir = "<?php echo $bAccess ? "ask_user" : "access_denied"; ?> ";</script><?php return; } } foreach ($Params['arFiles'] as $file) { $filePath = $file['path']; $caseOption = $Params['caseOption']; if ($Params["userCaseLastPath"]) { if ($Params["userCaseLastPath"] != $filePath) { continue; } $caseOption = $Params['userCaseAnswer']; if ($Params["userCaseToAll"]) { $Params['caseOption'] = $caseOption; } $Params["userCaseLastPath"] = false; } $arPath_i = array($site, $filePath); $absPath_i = $docRootFrom . $filePath; $bDir_i = $io->DirectoryExists($absPath_i); $name_i = CFileman::GetFileName($filePath); $strWarn = ""; // Check if file already exists in destination folder if ($io->FileExists($absPathTo . $name_i) || $bDir_i == $io->DirectoryExists($absPathTo . $name_i) && $bDir_i) { $fTmp = $io->GetFile($absPathTo . $name_i); $fTmp1 = $io->GetFile($absPath_i); $altName = CFilemanCopy::GetAltFileName($absPathTo, $name_i, $bDir_i); if ($caseOption == 'ask') { ?> <script> window.BXFM_fileExist = { fileOld: { name: "<?php echo CUtil::JSEscape($name_i); ?> ", path: "<?php echo CUtil::JSEscape($pathTo . $name_i); ?> ", site: "<?php echo CUtil::JSEscape($siteTo); ?> ", bDir: <?php echo $bDir_i ? "true" : "false"; ?> , size: "<?php echo $bDir_i ? '-' : CFile::FormatSize($fTmp->GetFileSize()); ?> ", date: "<?php echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPathTo . $name_i) + CTimeZone::GetOffset()); ?> " }, fileNew: { alt_name: "<?php echo CUtil::JSEscape($altName); ?> ", name: "<?php echo CUtil::JSEscape($name_i); ?> ", path: "<?php echo CUtil::JSEscape($filePath); ?> ", site: "<?php echo CUtil::JSEscape($site); ?> ", bDir: <?php echo $bDir_i ? "true" : "false"; ?> , size: "<?php echo $bDir_i ? '-' : CFile::FormatSize($fTmp1->GetFileSize()); ?> ", date: "<?php echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPath_i) + CTimeZone::GetOffset()); ?> " } }; </script><?php return; } elseif ($caseOption == 'replace') { // We don't need to replace, couse it's one file if (CFileMan::NormalizePath($pathTo . "/" . $name_i) == $filePath) { continue; } $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy'], true); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } elseif ($caseOption == 'auto_rename') { $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $altName)), !$Params['bCopy']); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } elseif ($caseOption == 'skip') { continue; } } else { $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy']); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } $module_id = "fileman"; if (COption::GetOptionString($module_id, "log_page", "Y") == "Y" && $log) { $res_log['copy_to'] = substr($pathTo, 1); $res_log['path'] = substr($filePath, 1); if ($Params['bCopy'] == "copy") { if (!$bDir_i) { CEventLog::Log("content", "FILE_COPY", "fileman", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_COPY", "fileman", "", serialize($res_log)); } } else { if (!$bDir_i) { CEventLog::Log("content", "FILE_MOVE", "fileman", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_MOVE", "fileman", "", serialize($res_log)); } } } } } $arWarnings; ?> <script> window.BXFM_result = { status: "<?php echo count($arWarnings) > 0 ? 'errors' : 'ok'; ?> ", errors: <?php echo count($arWarnings) > 0 ? CUtil::PhpToJSObject($arWarnings) : '{}'; ?> }; </script><?php }
$BUCKET_ID = intval($f_BUCKET_ID); $row =& $lAdmin->AddRow($BUCKET_ID.'_'.$f_NAME, $Elem); $c = $arParts[$BUCKET_ID.$f_NAME]; if ($c > 1) { $parts = ' ('.GetMessage("MAIN_DUMP_PARTS").$c.')'; $size = $arSize[$f_NAME]; } else { $parts = ''; $size = $f_SIZE; } $row->AddField("NAME", '<img src="/bitrix/images/fileman/types/'.CFileMan::GetFileTypeEx($f_NAME).'.gif" width="16" height="16" border=0 alt=""> '.$f_NAME.$parts); $row->AddField("SIZE", HumanSize($size)); $row->AddField("PLACE", $f_PLACE ? $f_PLACE : GetMessage("MAIN_DUMP_LOCAL")); $row->AddField("DATE", $f_DATE); $arActions = Array(); if ($f_PERMISSION >= "R") { $arActions[] = array( "ICON" => "download", "DEFAULT" => true, "TEXT" => GetMessage("MAIN_DUMP_ACTION_DOWNLOAD"), "ACTION" => "AjaxSend('?action=download&f_id=".$f_NAME."&BUCKET_ID=".$BUCKET_ID."&".bitrix_sessid_get()."')" ); $arActions[] = array(
<?echo getDiff($prev_arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT"])?> </div> </td> </tr> <?elseif(COption::GetOptionString("iblock", "use_htmledit", "Y")=="Y" && $bFileman):?> <tr id="tr_DETAIL_TEXT_EDITOR"> <td colspan="2" align="center"> <?CFileMan::AddHTMLEditorFrame( "DETAIL_TEXT", $str_DETAIL_TEXT, "DETAIL_TEXT_TYPE", $str_DETAIL_TEXT_TYPE, array( 'height' => 450, 'width' => '100%' ), "N", 0, "", "", $arIBlock["LID"], true, false, array('toolbarConfig' => CFileman::GetEditorToolbarConfig("iblock_".(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? 'public' : 'admin')), 'saveEditorKey' => $IBLOCK_ID) ); ?></td> </tr> <?else:?> <tr id="tr_DETAIL_TEXT_TYPE"> <td><?echo GetMessage("IBLOCK_DESC_TYPE")?></td> <td><input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_text" value="text"<?if($str_DETAIL_TEXT_TYPE!="html")echo " checked"?>> <label for="DETAIL_TEXT_TYPE_text"><?echo GetMessage("IBLOCK_DESC_TYPE_TEXT")?></label> / <input type="radio" name="DETAIL_TEXT_TYPE" id="DETAIL_TEXT_TYPE_html" value="html"<?if($str_DETAIL_TEXT_TYPE=="html")echo " checked"?>> <label for="DETAIL_TEXT_TYPE_html"><?echo GetMessage("IBLOCK_DESC_TYPE_HTML")?></label></td> </tr>
<?php } else { if ($_GET['subdialog'] == 'Y') { echo "<script>structReload('" . urlencode($pathToEdit) . "');</script>"; $popupWindow->Close(false); } else { $popupWindow->Close(true, $relativePath); } } die; } } //Properties from fileman settings $arFilemanProperties = array(); if (CModule::IncludeModule("fileman") && is_callable(array("CFileMan", "GetPropstypes"))) { $arFilemanProperties = CFileMan::GetPropstypes($site); } //Properties from page $arDirProperties = array(); if ($strWarning != "" && isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"])) { //Restore post values if error occured foreach ($_POST["PROPERTY"] as $arProperty) { if (isset($arProperty["VALUE"]) && strlen($arProperty["VALUE"]) > 0) { $arDirProperties[$arProperty["CODE"]] = $arProperty["VALUE"]; } } } else { $arPageSlice = ParseFileContent($fileContent); $arDirProperties = $arPageSlice["PROPERTIES"]; } //All file properties. Includes properties from root folders
function PreviewFlash($Params) { if (CModule::IncludeModule("fileman")) { global $APPLICATION, $USER; if (CModule::IncludeModule("compression")) { CCompress::Disable2048Spaces(); } $path = $Params['path']; $path = CFileMan::SecurePathVar($path); $path = Rel2Abs("/", $path); $arPath = array($Params['site'], $path); if (!$USER->CanDoFileOperation('fm_view_file', $arPath)) { $path = ''; } if ($path == "") { return; } $APPLICATION->RestartBuffer(); ?> <HTML> <HEAD></HEAD> <BODY id="__flash" style="margin:0px; border-width: 0px;"> <embed id="__flash_preview" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="__flash_preview" quality="high" width="<?php echo $Params['width']; ?> " height="<?php echo $Params['height']; ?> " src="<?php echo htmlspecialcharsex($path); ?> " /> </BODY> </HTML> <?php die; } }