if ($default_outfile_action == "F") { echo "selected"; } ?> ><?php echo Loc::getMessage("CAT_DEF_OUTFILE_F"); ?> </option> </select> </td> </tr> <tr> <td width="40%"> <?php $yandex_agent_file = Option::get('catalog', 'yandex_agent_file'); CAdminFileDialog::ShowScript(array("event" => "BtnClick", "arResultDest" => array("FORM_NAME" => "ara", "FORM_ELEMENT_NAME" => "yandex_agent_file"), "arPath" => array("PATH" => GetDirPath($yandex_agent_file)), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'php', "allowAllFiles" => true, "SaveConfig" => true)); ?> <?php echo Loc::getMessage("CAT_AGENT_FILE"); ?> </td> <td width="60%"><input type="text" name="yandex_agent_file" size="50" maxlength="255" value="<?php echo $yandex_agent_file; ?> "> <input type="button" name="browse" value="..." onClick="BtnClick()"></td> </tr> <tr class="heading"> <td colspan="2"><?php echo Loc::getMessage("CO_PAR_IE_CSV"); ?> </td>
$arRunErrors[] = GetMessage("CES_ERROR_BAD_EXPORT_FILENAME"); } else { $SETUP_FILE_NAME = Rel2Abs("/", $SETUP_FILE_NAME); if (strtolower(substr($SETUP_FILE_NAME, strlen($SETUP_FILE_NAME) - 4)) != ".csv") { $SETUP_FILE_NAME .= ".csv"; } if (0 !== strpos($SETUP_FILE_NAME, $strCatalogDefaultFolder)) { $arRunErrors[] = GetMessage('CES_ERROR_PATH_WITHOUT_DEFAUT'); } else { CheckDirPath($_SERVER["DOCUMENT_ROOT"] . $SETUP_FILE_NAME); if (!($fp = fopen($_SERVER["DOCUMENT_ROOT"] . $SETUP_FILE_NAME, "wb"))) { $arRunErrors[] = GetMessage("CATI_CANNOT_CREATE_FILE"); } @fclose($fp); if ('Y' == $export_files) { $strExportPath = GetDirPath($SETUP_FILE_NAME); $strFilePath = str_replace($strExportPath, '', substr($SETUP_FILE_NAME, 0, -4)) . '_files/'; if (!CheckDirPath($_SERVER['DOCUMENT_ROOT'] . $strExportPath . $strFilePath)) { $arRunErrors[] = str_replace('#PATH#', $strExportPath . $strFilePath, GetMessage('CATI_NO_RIGHTS_EXPORT_FILES_PATH')); $export_files = 'N'; } } } } $bFieldsPres = !empty($field_needed) && is_array($field_needed) && in_array('Y', $field_needed); if ($bFieldsPres && (empty($field_code) || !is_array($field_code))) { $bFieldsPres = false; } if (!$bFieldsPres) { $arRunErrors[] = GetMessage("CATI_NO_FIELDS"); }
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);
public static function GetFileContent($did, $fname, $wf_path = "", $site = false) { $err_mess = CAllWorkflow::err_mess() . "<br>Function: GetFileContent<br>Line: "; global $DB, $APPLICATION, $USER; $did = intval($did); // check if executable if ($USER->IsAdmin() || CBXVirtualIoFileSystem::ValidatePathString($fname) && !HasScriptExtension($fname)) { if ($did > 0) { // check if it is associated wtih document $z = CWorkflow::GetFileByID($did, $fname); // found one if ($zr = $z->Fetch()) { // get it's contents $path = CWorkflow::GetTempDir() . $zr["TEMP_FILENAME"]; if (file_exists($path)) { return $APPLICATION->GetFileContent($path); } } else { // lookup in database $strSql = "SELECT FILENAME, SITE_ID FROM b_workflow_document WHERE ID='{$did}'"; $y = $DB->Query($strSql, false, $err_mess . __LINE__); // found if ($yr = $y->Fetch()) { // get it's directory $path = GetDirPath($yr["FILENAME"]); // absolute path $pathto = Rel2Abs($path, $fname); $DOC_ROOT = CSite::GetSiteDocRoot($yr["SITE_ID"]); $path = $DOC_ROOT . $pathto; // give it another try $u = CWorkflow::GetFileByID($did, $pathto); // found if ($ur = $u->Fetch()) { // get it's contents $path = CWorkflow::GetTempDir() . $ur["TEMP_FILENAME"]; if (file_exists($path)) { return $APPLICATION->GetFileContent($path); } } elseif (file_exists($path)) { // get it's contents if ($USER->CanDoFileOperation('fm_view_file', array($yr["SITE_ID"], $pathto))) { return $APPLICATION->GetFileContent($path); } } } } } $DOC_ROOT = CSite::GetSiteDocRoot($site); // new one if (strlen($wf_path) > 0) { $pathto = Rel2Abs($wf_path, $fname); $path = $DOC_ROOT . $pathto; if (file_exists($path)) { // get it's contents if ($USER->CanDoFileOperation('fm_view_file', array($site, $pathto))) { $src = $APPLICATION->GetFileContent($path); return $src; } } } // still failed to find // get path $path = $DOC_ROOT . $fname; if (file_exists($path)) { // get it's contents if ($USER->CanDoFileOperation('fm_view_file', array($site, $fname))) { return $APPLICATION->GetFileContent($path); } } } else { return GetMessage("FLOW_ACCESS_DENIED_PHP_VIEW"); } }
function UndoNewFile($Params, $type) { global $APPLICATION; $documentRoot = CSite::GetSiteDocRoot($Params['site']); $io = CBXVirtualIo::GetInstance(); // Delete file $f = $io->GetFile($Params['absPath']); $f->MarkWritable(); if (COption::GetOptionInt("main", "disk_space") > 0) { $file_size = $f->GetFileSize(); $quota = new CDiskQuota(); $quota->UpdateDiskQuota("file", $file_size, "delete"); } $sucess = $io->Delete($Params['absPath']); if (!$sucess) { return; } $APPLICATION->RemoveFileAccessPermission(array($Params['site'], $Params['path'])); if (CModule::IncludeModule("search")) { CSearch::DeleteIndex("main", $Params['site'] . "|" . $Params['path']); } // Find and clean file from menu if ($Params['menu']) { $arMenu = CFileman::GetMenuArray($documentRoot . $Params['menu']['menuFile']); if (!empty($arMenu["aMenuLinks"])) { $found = false; foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem) { if ($arItem[1] == $Params['menu']['menuPath'] && $arItem[0] == $Params['menu']['menuName']) { unset($arMenu["aMenuLinks"][$menuIndex]); $found = true; break; } } if ($found) { CFileMan::SaveMenu(array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]); } } } if (isset($Params['public']) && $Params['public'] == 'Y') { ?> <script type="text/javascript"> window.location = '<?php echo CUtil::JSEscape(CHTTP::URN2URI(GetDirPath($Params['path']))); ?> '; </script> <?php } $GLOBALS["CACHE_MANAGER"]->CleanDir("menu"); }
</td> <td> <?php } if (!array_key_exists($ID, $arValues)) { if (SubStr($ID, 0, StrLen("SEF_URL_TEMPLATES_")) == "SEF_URL_TEMPLATES_" && is_array($arValues["SEF_URL_TEMPLATES"]) && array_key_exists(SubStr($ID, StrLen("SEF_URL_TEMPLATES_")), $arValues["SEF_URL_TEMPLATES"])) { $arValues[$ID] = $arValues["SEF_URL_TEMPLATES"][SubStr($ID, StrLen("SEF_URL_TEMPLATES_"))]; } elseif (SubStr($ID, 0, StrLen("VARIABLE_ALIASES_")) == "VARIABLE_ALIASES_" && is_array($arValues["VARIABLE_ALIASES"]) && array_key_exists(SubStr($ID, StrLen("VARIABLE_ALIASES_")), $arValues["VARIABLE_ALIASES"])) { $arValues[$ID] = $arValues["VARIABLE_ALIASES"][SubStr($ID, StrLen("VARIABLE_ALIASES_"))]; } } if (!array_key_exists($ID, $arValues) && isset($prop["DEFAULT"])) { $arValues[$ID] = $prop["DEFAULT"]; } if ($arValues["SEF_FOLDER"] == "") { $arValues["SEF_FOLDER"] = GetDirPath($_GET["src_page"]); } if ($prop["MULTIPLE"] == 'Y' && !is_array($arValues[$ID])) { if (isset($arValues[$ID])) { $val = array($arValues[$ID]); } else { $val = array(); } } elseif ($prop["TYPE"] == "LIST" && !is_array($arValues[$ID])) { $val = array($arValues[$ID]); } else { $val = $arValues[$ID]; } $res = ""; if ($prop["COLS"] < 1) { $prop["COLS"] = '30';
echo Loc::getMessage("CAT_DEF_OUTFILE_F"); ?> </option> </select> </td> </tr> <tr> <td width="40%"> <? $yandex_agent_file = Option::get('catalog', 'yandex_agent_file'); CAdminFileDialog::ShowScript ( Array( "event" => "BtnClick", "arResultDest" => array("FORM_NAME" => "ara", "FORM_ELEMENT_NAME" => "yandex_agent_file"), "arPath" => array("PATH" => GetDirPath($yandex_agent_file)), "select" => 'F',// F - file only, D - folder only "operation" => 'O',// O - open, S - save "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'php', "allowAllFiles" => true, "SaveConfig" => true, ) ); ?> <?echo Loc::getMessage("CAT_AGENT_FILE")?></td> <td width="60%"><input type="text" name="yandex_agent_file" size="50" maxlength="255" value="<?echo $yandex_agent_file?>"> <input type="button" name="browse" value="..." onClick="BtnClick()"></td> </tr> <tr class="heading"> <td colspan="2"><?echo Loc::getMessage("CO_PAR_IE_CSV") ?></td>
<div class="adm-list-item" id="SETTINGS[<?echo $FIELD_ID?>][DEFAULT_VALUE][USE_WATERMARK_TEXT]" style="padding-left:16px;display:<? if($arFields[$FIELD_ID]["DEFAULT_VALUE"]["USE_WATERMARK_TEXT"]==="Y") echo 'block'; else echo 'none'; ?>" > <?echo GetMessage("IB_E_FIELD_PICTURE_WATERMARK_TEXT")?>: <input name="FIELDS[<?echo $FIELD_ID?>][DEFAULT_VALUE][WATERMARK_TEXT]" type="text" value="<?echo htmlspecialcharsbx($arFields[$FIELD_ID]["DEFAULT_VALUE"]["WATERMARK_TEXT"])?>" size="35" > <?CAdminFileDialog::ShowScript(array( "event" => "BtnClickFont".$FIELD_ID, "arResultDest" => array("ELEMENT_ID" => "FIELDS_".$FIELD_ID."__DEFAULT_VALUE__WATERMARK_TEXT_FONT_"), "arPath" => array("PATH" => GetDirPath(($arFields[$FIELD_ID]["DEFAULT_VALUE"]["WATERMARK_TEXT_FONT"]))), "select" => 'F',// F - file only, D - folder only "operation" => 'O',// O - open, S - save "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'ttf', "allowAllFiles" => false, "SaveConfig" => true, ));?> </div> <div class="adm-list-item" id="SETTINGS[<?echo $FIELD_ID?>][DEFAULT_VALUE][WATERMARK_TEXT_FONT]" style="padding-left:16px;display:<? if($arFields[$FIELD_ID]["DEFAULT_VALUE"]["USE_WATERMARK_TEXT"]==="Y") echo 'block'; else echo 'none'; ?>" >
<?php CAdminFileDialog::ShowScript(array("event" => "BtnClick", "arResultDest" => array("FORM_NAME" => "form", "FORM_ELEMENT_NAME" => "EDIT_FILE_BEFORE"), "arPath" => array("SITE" => SITE_ID, "PATH" => GetDirPath($str_EDIT_FILE_BEFORE)), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'php', "allowAllFiles" => true, "SaveConfig" => true)); ?> <?php echo GetMessage("IBTYPE_E_FILE_BEFORE"); ?> </td> <td><input type="text" name="EDIT_FILE_BEFORE" size="50" maxlength="255" value="<?php echo $str_EDIT_FILE_BEFORE; ?> "> <input type="button" name="browse" value="..." onClick="BtnClick()"></td> </tr> <tr> <td> <?php CAdminFileDialog::ShowScript(array("event" => "BtnClick2", "arResultDest" => array("FORM_NAME" => "form", "FORM_ELEMENT_NAME" => "EDIT_FILE_AFTER"), "arPath" => array("SITE" => SITE_ID, "PATH" => GetDirPath($str_EDIT_FILE_AFTER)), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'php', "allowAllFiles" => true, "SaveConfig" => true)); ?> <?php echo GetMessage("IBTYPE_E_FILE_AFTER"); ?> </td> <td><input type="text" name="EDIT_FILE_AFTER" size="50" maxlength="255" value="<?php echo $str_EDIT_FILE_AFTER; ?> "> <input type="button" name="browse" value="..." onClick="BtnClick2()"></td> </tr> <?php $tabControl->Buttons(array("disabled" => false, "back_url" => $back_url)); $tabControl->End();
public static function drawSelectPath($name, $value, $form_name) { $event_name = 'btnClick_' . uniqid(); \CAdminFileDialog::ShowScript(array('event' => $event_name, 'arResultDest' => array('FORM_NAME' => $form_name, 'FORM_ELEMENT_NAME' => $name), 'arPath' => array('PATH' => GetDirPath($value)), 'select' => 'F', 'operation' => 'O', 'showUploadTab' => false, 'showAddToMenuTab' => false, 'fileFilter' => 'php', 'allowAllFiles' => true, 'SaveConfig' => true)); return '<input type="text" name="' . $name . '" size="50" maxlength="255" value="' . htmlspecialchars($value) . '"> <input type="button"' . ' name="browse" value="..." onClick="' . $event_name . '()">'; }
function COPY($options, $drop = false) { $statusSymlinkDelete = false; $arCacheCleanID = array(); if (!$this->CheckWebRights("", array("action" => "create"), true)) { return $this->ThrowAccessDenied(__LINE__); } elseif ($_SERVER['REQUEST_METHOD'] == "MOVE" && !empty($_SERVER["CONTENT_LENGTH"])) { return "415 Unsupported media type"; } elseif ($options["path"] == $options["dest_url"]) { return "204 No Content"; } elseif (empty($options["dest_url"])) { return $this->ThrowError("502 bad gateway", "EMPTY_DESTINATION_URL", GetMessage("WD_FILE_ERROR2"), __LINE__); } $destUrl = $options["dest_url"]; if (substr($destUrl, -1) === "/") { $destUrl = substr($destUrl, 0, -1); } $destName = GetFileName($destUrl); if ($destUrl !== "" && $destName !== "") { $destParentDir = GetDirPath($destUrl); $destParentDir = count($destParentDir) > 0 ? $destParentDir : "/"; $o = array("path" => $destParentDir, "depth" => 1); $result = $this->PROPFIND($o, $files, array("COLUMNS" => array("ID", "NAME"), "return" => "array")); if (!empty($result["RESULT"])) { foreach ($result["RESULT"] as $key => $res) { if ($res["NAME"] === $destName) { if (strlen(GetFileExtension($destName)) > 0) { return $this->ThrowError("400 Bad Request", "FOLDER_IS_EXISTS", str_replace("#FILE#", '"' . $res["NAME"] . '"', GetMessage("WD_FILE_ERROR8")), __LINE__); } elseif (isset($options['section_id']) && $res['ID'] == $options['section_id']) { return $this->ThrowError("400 Bad Request", "SAME_FOLDER_IS_EXISTS", str_replace("#FOLDER#", '"' . $res["NAME"] . '"', GetMessage("WD_FILE_ERROR5")), __LINE__); } else { return $this->ThrowError("400 Bad Request", "FOLDER_IS_EXISTS", str_replace("#FOLDER#", '"' . $res["NAME"] . '"', GetMessage("WD_FILE_ERROR5")), __LINE__); } } } } } //$this->CheckUniqueName($basename, $section_id, &$res) //GetFileName() $arFrom = array(); $arTo = array(); $is_dir = false; ////////////// CHECK FROM $this->IsDir($options); $arFrom = $this->arParams; if ($this->arParams["not_found"]) { return $this->ThrowError("404 Not Found", "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND", GetMessage("WD_FILE_ERROR3"), __LINE__); } elseif ($this->arParams["is_dir"] === true) { $is_dir = true; if ($_SERVER['REQUEST_METHOD'] == "MOVE" && $options["depth"] != "infinity") { return "400 Bad request"; } elseif ($this->check_creator) { return $this->ThrowAccessDenied("USER_IS_NOT_CREATOR", __LINE__); } elseif (empty($options["path"])) { $options["path"] = $this->_get_path($arFrom["item_id"], false); } $res = $this->_udecode($options["dest_url"]); $res2 = str_replace("//", "/", $res . "/"); $res1 = str_replace("//", "/", $options["path"] . "/"); if ($res1 === $res2) { return "204 No Content"; } elseif (strtolower(substr($res2, 0, strlen($res1))) == strtolower($res1) && strlen($res1) != strlen($res2)) { return $this->ThrowError("400 Bad Request", "SECTION_IS_NOT_UPDATED", GetMessage("WD_FILE_ERROR100"), __LINE__); } } else { // found and is_file } if (!empty($arFrom['parent_id'])) { list($contextType, $contextEntityId) = $this->getContextData(); $sectionData = $this->getSectionDataForLinkAnalyze($arFrom['parent_id']); if (CWebDavSymlinkHelper::isLink($contextType, $contextEntityId, $sectionData)) { $arFrom['is_symlink'] = true; $arFrom['symlink_section_data'] = $sectionData; $arFrom['symlink_section_data_link'] = CWebDavSymlinkHelper::getLinkData($contextType, $contextEntityId, $sectionData); } } ////////////// CHECK TO $arToParams = array("path" => $options['dest_url']); if (strpos($options['dest_url'], '.Trash') !== false) { $arToParams['check_permissions'] = false; } $this->IsDir($arToParams); $arTo = $this->arParams; if (!empty($arTo['parent_id'])) { list($contextType, $contextEntityId) = $this->getContextData(); $sectionData = $this->getSectionDataForLinkAnalyze($arTo['parent_id']); if (CWebDavSymlinkHelper::isLink($contextType, $contextEntityId, $sectionData)) { $arTo['is_symlink'] = true; $arTo['symlink_section_data'] = $sectionData; $arTo['symlink_section_data_link'] = CWebDavSymlinkHelper::getLinkData($contextType, $contextEntityId, $sectionData); } } if ($this->arParams["not_found"] == true) { if ($this->e_rights && strpos($options['dest_url'], '.Trash') === false && !$this->CheckWebRights("COPY", array('action' => $drop ? 'move' : 'copy', 'from' => array($arFrom), 'to' => array($arTo)), false)) { return $this->ThrowAccessDenied(__LINE__); } //$arTo = false; } elseif ($arFrom["is_dir"] === true && $arTo["is_file"] === true || $arFrom["is_file"] === true && $arTo["is_dir"] === true) { return $this->ThrowError("400 Bad Request", "FOLDER_IS_EXISTS", str_replace("#FOLDER#", $this->arParams["item_id"], GetMessage("WD_FILE_ERROR5")), __LINE__); } elseif (!$this->CheckWebRights("COPY", array('action' => $drop ? 'move' : 'copy', 'from' => array($arFrom), 'to' => array($arTo)), false)) { return $this->ThrowAccessDenied(__LINE__); } elseif ($arFrom["item_id"] == $arTo["item_id"] && $arFrom['basename'] == $arTo['basename']) { // else - trying to change case in name return "204 No Content"; } elseif ($arFrom["element_array"]["WF_PARENT_ELEMENT_ID"] > 0) { unset($arTo["item_id"]); } elseif (isset($options['rename']) && $options['rename'] === true) { // fix fast delete to trash from different folders with the same file name $nameSuffix = 1; do { $tmpName = $options["dest_url"] . " (" . $nameSuffix++ . ")"; $this->IsDir(array("path" => $tmpName)); $arTo = $this->arParams; } while ($arTo["not_found"] !== true); $options['dest_url'] = $tmpName; } elseif (!$options["overwrite"]) { return $this->ThrowError('412 Precondition failed', "FILE_OR_FOLDER_ALREADY_EXISTS", GetMessage("WD_FILE_ERROR4"), __LINE__); } elseif (!$this->CheckName($arTo["basename"])) { return $this->ThrowError("400 bad request", "BAD_NAME", GetMessage("WD_FILE_ERROR101"), __LINE__); } elseif ($arTo["is_file"] && $this->check_creator && $arTo["element_array"]["CREATED_BY"] != $GLOBALS["USER"]->GetID()) { return $this->ThrowAccessDenied("USER_IS_NOT_CREATOR", __LINE__); } if ($this->workflow == 'workflow' && $arFrom["is_file"] && !CWorkflow::IsAdmin() && !$GLOBALS['USER']->CanDoOperation('webdav_change_settings')) { $bNeedCheckWfRights = false; if ($this->e_rights) { $arToParent = $this->GetObject(array('section_id' => $arTo['parent_id'])); if ($arToParent['is_dir']) { $bNeedCheckWfRights = !$this->GetPermission('SECTION', $arToParent['item_id'], 'element_edit_any_wf_status'); } } else { $bNeedCheckWfRights = $this->permission < 'W'; } if ($bNeedCheckWfRights && CIBlockElement::WF_GetStatusPermission($arFrom["element_array"]["WF_STATUS_ID"]) != 2) { return $this->ThrowError("400 bad request", "BAD_WF_RIGHTS", GetMessage("WD_FILE_ERROR110"), __LINE__); } } if ($arTo['parent_id'] == $this->GetMetaID('TRASH')) { $arCheckTrashElement = $arFrom[$arFrom['is_dir'] ? 'dir_array' : 'element_array']; if ($this->_parse_webdav_info($arCheckTrashElement) && !isset($arCheckTrashElement['PROPS']['BX:']['UNDELETE'])) { return $this->ThrowAccessDenied("BAD_NAME", __LINE__); } } if ($arFrom["is_file"]) { $el = new CIBlockElement(); if ($arTo["item_id"] && $arTo['item_id'] !== $arFrom['item_id']) { $this->_ib_elm_delete($arTo['item_id']); // TODO: need to check permissions ? } //drop == true if this action is @move@ //is file if ($drop) { $actionRename = $arFrom['parent_id'] == $arTo['parent_id']; $arFields = array("NAME" => $arTo["basename"], "MODIFIED_BY" => $GLOBALS['USER']->GetID(), "IBLOCK_SECTION_ID" => $arTo["parent_id"]); $this->_onEvent($arFrom['parent_id'] != $arTo['parent_id'] ? 'Move' : 'Rename', $arFrom['element_id'], 'FILE', array('TO' => $arFrom['parent_id'] != $arTo['parent_id'] ? $arTo["parent_id"] : $arTo["basename"])); //from symlink move. Not rename!!!! if (!$actionRename && (!empty($arFrom['is_symlink']) || !empty($arTo['is_symlink']))) { $targetIblockId = $this->IBLOCK_ID; if (!empty($arTo['is_symlink'])) { $targetIblockId = $arTo['symlink_section_data']['IBLOCK_ID']; } //move and don't delete item if (self::_move_from_iblock_to_iblock($arFrom['item_id'], $targetIblockId, $arTo['parent_id'], false, true)) { $statusSymlinkDelete = $this->DELETE(array("element_id" => $arFrom['item_id'])); } } else { if ($this->workflow == 'workflow') { if ($arTo["parent_id"] != $arFrom["parent_id"]) { $arFields["WF_COMMENTS"] = GetMessage("WD_FILE_IS_MOVED"); $el->SetElementSection($arFrom["item_id"], $arTo["parent_id"]); // TODO: need to check permissions ??? } else { $arFields["WF_COMMENTS"] = GetMessage("WD_FILE_IS_RENAMED"); } if ($arTo["parent_id"] != $arFrom["parent_id"] && $arTo["basename"] != $arFrom["element_name"]) { $arFields["WF_COMMENTS"] = GetMessage("WD_FILE_IS_MOVED_AND_RENAMED"); } } if ($this->workflow == 'bizproc' || $this->workflow == 'bizproc_limited') { $this->AddDocumentToHistory($arFrom['item_id'], $arFrom['element_name']); } $el->Update($arFrom["item_id"], $arFields, $this->workflow == 'workflow', true, false, false); // TODO: need to check permissions ??? $arCacheCleanID[] = 'element' . $arFrom["item_id"]; if ($this->workflow == 'bizproc' || $this->workflow == 'bizproc_limited') { $db_res2 = CIBlockElement::GetList(array(), array("WF_PARENT_ELEMENT_ID" => $arFrom["item_id"], "SHOW_HISTORY" => "Y"), false, false, array("ID")); if ($db_res2 && ($res2 = $db_res2->Fetch())) { do { $res = $el->Update($res2["ID"], array("IBLOCK_SECTION_ID" => $arFields["IBLOCK_SECTION_ID"]), false, true, false, false); $arCacheCleanID[] = 'element' . $res2["ID"]; } while ($res2 = $db_res2->Fetch()); } } } } else { //from symlink copy if (!empty($arFrom['is_symlink']) || !empty($arTo['is_symlink'])) { $targetIblockId = $this->IBLOCK_ID; if (!empty($arTo['is_symlink'])) { $targetIblockId = $arTo['symlink_section_data']['IBLOCK_ID']; } //move and don't delete item if (!self::_move_from_iblock_to_iblock($arFrom['item_id'], $targetIblockId, $arTo['parent_id'], false, true)) { return '403 Forbidden'; } } else { $options = array('path' => $options["dest_url"], 'content_length' => $arFrom["file_array"]['FILE_SIZE'], 'content_type' => $arFrom["file_array"]['CONTENT_TYPE']); $stat = $this->PUT($options); if ($stat === false) { return '403 Forbidden'; } elseif (is_resource($stat) && get_resource_type($stat) == 'stream') { fclose($stat); $arTmpFile = CFile::MakeFileArray($arFrom['element_array']['PROPERTY_FILE_VALUE']); // since CopyDirFiles doesn't support clouds if (!(is_array($arTmpFile) && is_set($arTmpFile, 'tmp_name'))) { return false; } CopyDirFiles($arTmpFile['tmp_name'], $options["TMP_FILE"]); clearstatcache(); $options['USER_FIELDS'] = $this->GetUfFieldsSimpleArray($arFrom['item_id']); if (!$this->put_commit($options)) { return $this->ThrowError('409 Conflict', "BAD_BP_PERMISSIONS", GetMessage("WD_FILE_ERROR110"), __LINE__); } } } } $this->_onEvent(($arFrom['parent_id'] != $arTo['parent_id'] ? 'Move' : 'Rename') . 'Finished', $arFrom['element_id'], 'FILE'); } else { $se = new CIBlockSection(); $actionRename = $arFrom['parent_id'] == $arTo['parent_id']; $actionWithSymlink = !empty($arFrom['is_symlink']) || !empty($arTo['is_symlink']); $actionMoveInSymlink = false; if ($actionWithSymlink) { $actionMoveInSymlink = $arFrom['symlink_section_data_link'] == $arTo['symlink_section_data_link']; } //drop == true if this action is @move@ //not symlink and move! but if action rename in symlink - run this code block if (!$actionWithSymlink && $drop || $actionWithSymlink && $actionRename || $actionMoveInSymlink) { $this->_onEvent($arFrom['parent_id'] != $arTo['parent_id'] ? 'Move' : 'Rename', $arFrom['item_id'], 'FOLDER', array('TO' => $arFrom['parent_id'] != $arTo['parent_id'] ? $arTo["parent_id"] : $arTo["basename"])); $GLOBALS['DB']->StartTransaction(); if (isset($options['overwrite']) && $arTo['is_dir'] === true && $arTo['item_id'] !== $arFrom['item_id']) { $se->Delete($arTo['item_id']); } $result = $se->Update($arFrom["item_id"], array("NAME" => $arTo["basename"], "IBLOCK_SECTION_ID" => $arTo["parent_id"])); // TODO: need to check permissions ??? if ($result == false) { $GLOBALS['DB']->Rollback(); return $this->ThrowError("409 Conflict", "SECTION_IS_NOT_UPDATED", $se->LAST_ERROR ? $se->LAST_ERROR : GetMessage("WD_FILE_ERROR102"), __LINE__); } else { $arCacheCleanID[] = 'section' . $arFrom["item_id"]; $this->ClearCache("section"); $GLOBALS['DB']->Commit(); } } else { if (isset($options['overwrite']) && $arTo['is_dir'] === true) { $se->Delete($arTo['item_id']); } if ($arTo["item_id"] === false) { $arPath = explode("/", $options["dest_url"]); $this->IsDir(array('path' => "/" . implode("/", array_slice($arPath, 0, -1)))); if ($this->arParams["not_found"] === false) { if ($this->arParams["item_id"] == 0) { // root $arTo["dir_array"] = array("LEFT_MARGIN" => 0, "RIGHT_MARGIN" => $this->INT_MAX); } if ($arTo["dir_array"]["LEFT_MARGIN"] - 1 < $arFrom["dir_array"]["LEFT_MARGIN"] && $arFrom["dir_array"]["RIGHT_MARGIN"] < $arTo["dir_array"]["RIGHT_MARGIN"] + 1) { // If folder moved to upper folder } elseif ($arTo["dir_array"]["RIGHT_MARGIN"] < $arFrom["dir_array"]["LEFT_MARGIN"] || $arFrom["dir_array"]["RIGHT_MARGIN"] < $arTo["dir_array"]["LEFT_MARGIN"]) { // if folder moved to neighbourhood folder } elseif ($arFrom["dir_array"]["LEFT_MARGIN"] - 1 <= $arTo["dir_array"]["LEFT_MARGIN"] && $arTo["dir_array"]["RIGHT_MARGIN"] <= $arFrom["dir_array"]["RIGHT_MARGIN"] + 1 || $arTo["dir_array"]["ID"] == $arFrom["dir_array"]["ID"]) { return $this->ThrowError("400 Bad Request", "SECTION_IS_NOT_UPDATED", GetMessage("WD_FILE_ERROR100"), __LINE__); } if (!empty($arTo['is_symlink'])) { $parentSectionId = $this->arParams["item_id"]; if ($this->arParams["item_id"] == $arTo['symlink_section_data_link']['ID']) { $parentSectionId = $arTo['symlink_section_data_link'][self::UF_LINK_SECTION_ID]; } $arTo["dir_array"]["ID"] = $se->Add(array("IBLOCK_ID" => $arTo['symlink_section_data']['IBLOCK_ID'], "IBLOCK_SECTION_ID" => $parentSectionId, "NAME" => end(array_slice($arPath, -1, 1)))); $arTo["dir_array"]['IBLOCK_ID'] = $arTo['symlink_section_data']['IBLOCK_ID']; } else { $arTo["dir_array"]["ID"] = $se->Add(array("IBLOCK_ID" => $this->IBLOCK_ID, "IBLOCK_SECTION_ID" => $this->arParams["item_id"], "NAME" => end(array_slice($arPath, -1, 1)))); } if ($arTo["dir_array"]["ID"] === false) { return $this->ThrowError("409 Conflict", "FOLDER_IS_NOT_MOVED", str_replace(array("#FOLDER#", "#TEXT_ERROR#"), array("/" . implode("/", $arPath), $se->LAST_ERROR), GetMessage("WD_FILE_ERROR103")), __LINE__); } else { $returnSection = $arTo["dir_array"]["ID"]; $this->_onEvent('Add', $returnSection, 'FOLDER'); } } } else { return $this->ThrowError("409 Conflict", "FOLDER_IS_NOT_MOVED", str_replace(array("#FOLDER#", "#TEXT_ERROR#"), array($options["dest_url"], $se->LAST_ERROR), GetMessage("WD_FILE_ERROR103")), __LINE__); } $arFrom["dir_array"]['is_symlink'] = !empty($arFrom['is_symlink']); $arFrom["dir_array"]['symlink_section_data'] = empty($arFrom['symlink_section_data']) ? array() : $arFrom['symlink_section_data']; $arTo["dir_array"]['is_symlink'] = !empty($arTo['is_symlink']); $arTo["dir_array"]['symlink_section_data'] = empty($arTo['symlink_section_data']) ? array() : $arTo['symlink_section_data']; $result = $this->copy_commit($arFrom["dir_array"], $arTo["dir_array"], $options, $drop); if ($result === true && $drop === true) { if ($actionWithSymlink) { $this::$lastActionMoveWithSymlink = true; $this->DELETE(array("section_id" => $arFrom["item_id"])); } else { CIBlockSection::Delete($arFrom["item_id"]); } $this->ClearCache("section"); } elseif (is_string($result) && strpos($result, "403") !== false) { return $this->ThrowAccessDenied(__LINE__); } } if ($result !== true) { return $result; } } if ($arFrom['element_id']) { CWebDavDiskDispatcher::sendEventToOwners($arFrom['element_array'], null, 'copy'); } elseif ($arFrom['is_dir']) { CWebDavDiskDispatcher::sendEventToOwners(null, $arFrom['dir_array'], 'copy'); } $this->ClearCache($arCacheCleanID, 'local'); if (isset($returnSection)) { $this->arParams["changed_section_id"] = $returnSection; } if ($statusSymlinkDelete !== false) { return $statusSymlinkDelete; } return $arTo["not_found"] ? "201 Created" : "204 No Content"; }
"SaveConfig" => true, ) ); ?> <?echo GetMessage("IBTYPE_E_FILE_BEFORE")?></td> <td><input type="text" name="EDIT_FILE_BEFORE" size="50" maxlength="255" value="<?echo $str_EDIT_FILE_BEFORE?>"> <input type="button" name="browse" value="..." onClick="BtnClick()"></td> </tr> <tr> <td> <? CAdminFileDialog::ShowScript ( Array( "event" => "BtnClick2", "arResultDest" => array("FORM_NAME" => "form", "FORM_ELEMENT_NAME" => "EDIT_FILE_AFTER"), "arPath" => array("SITE" => SITE_ID, "PATH" => GetDirPath($str_EDIT_FILE_AFTER)), "select" => 'F',// F - file only, D - folder only "operation" => 'O',// O - open, S - save "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'php', "allowAllFiles" => true, "SaveConfig" => true, ) ); ?> <?echo GetMessage("IBTYPE_E_FILE_AFTER")?></td> <td><input type="text" name="EDIT_FILE_AFTER" size="50" maxlength="255" value="<?echo $str_EDIT_FILE_AFTER?>"> <input type="button" name="browse" value="..." onClick="BtnClick2()"></td> </tr>
if ($ID > 0 && $PREV_ID > 0) { ?> <tr> <td colspan=2> <?php echo getDiff($prev_ar["BODY"], $ar["BODY"]); ?> </td> </tr> <?php } elseif (COption::GetOptionString("workflow", "USE_HTML_EDIT", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td align="center" colspan="2"><?php $bWithoutPHP = !$USER->IsAdmin(); CFileMan::AddHTMLEditorFrame("BODY", $str_BODY, "BODY_TYPE", $str_BODY_TYPE, 300, "Y", $str_DOCUMENT_ID, GetDirPath($str_FILENAME), "", false, $bWithoutPHP); ?> </td> </tr> <?php } else { ?> <tr> <td align="center" colspan="2"><?php echo GetMessage("FLOW_TEXT"); ?> <?php echo InputType("radio", "BODY_TYPE", "text", $str_BODY_TYPE, false); ?> HTML <?php echo InputType("radio", "BODY_TYPE", "html", $str_BODY_TYPE, false);
protected function COPY($dest, $httpDestination, $overwrite, $delete = false) { /** @var CDavRequest $request */ $request = $this->request; $v = $request->GetParameter('CONTENT_LENGTH'); if (!empty($v)) { return "415 Unsupported media type"; } //if (isset($httpDestination)) //{ // return "502 bad gateway"; //} $requestDocument = $request->GetXmlDocument(); //todo откуда мы узнаем хранилище относительно которого вести поиск? /** @var Storage $storage */ list($storage, $path) = $this->parsePath($request->getPath()); $objectId = Driver::getInstance()->getUrlManager()->resolveObjectIdFromPath($storage, $path); if (!$objectId) { return '404 Not Found'; } /** @var File|Folder $object */ $object = BaseObject::loadById($objectId); if (!$object) { return '404 Not Found'; } $securityContext = $object->getStorage()->getCurrentUserSecurityContext(); if (!$object->canRead($securityContext)) { return '403 Forbidden'; } list($destStorage, $poludest) = $this->parsePath($dest); if (!$destStorage) { return '404 Not Found'; } $srcPath = GetDirPath(rtrim($path, '/')); $destPath = GetDirPath($poludest); if ($srcPath == $destPath) { if (!$object->canRename($securityContext)) { return '403 Forbidden'; } if (!$object->rename(GetFileName($poludest))) { return '400 Bad Request'; } return "201 Created"; } // $ret = $this->createFolderPath($destStorage, $poludest); // if ($ret !== true) // return $ret; $poludestExploded = explode('/', $poludest); $poludestFolderName = array_pop($poludestExploded); $targetObjectId = Driver::getInstance()->getUrlManager()->resolveObjectIdFromPath($destStorage, implode('/', $poludestExploded)); if (!$targetObjectId) { return '404 Not Found'; } /** @var File|Folder $folder */ $folder = Folder::loadById($targetObjectId); if (!$targetObjectId) { return '404 Not Found'; } if ($delete) { if (!$object->canMove($securityContext, $folder)) { return '403 Forbidden'; } } else { if (!$folder->canAdd($folder->getStorage()->getCurrentUserSecurityContext())) { return '403 Forbidden'; } } $opponent = false; if ($overwrite) { $opponent = BaseObject::getList(array('select' => array('ID'), 'filter' => array('NAME' => GetFileName($poludest), 'PARENT_ID' => $folder->getRealObjectId()), 'limit' => 1))->fetch(); if ($opponent) { /** @var File|Folder $opponentObject */ $opponentObject = BaseObject::loadById($opponent['ID']); if (!$opponentObject->canMarkDeleted($opponentObject->getStorage()->getCurrentUserSecurityContext())) { return '403 Forbidden'; } if (!$opponentObject->markDeleted($this->getUser()->getId())) { return '400 Bad Request'; } } } if ($delete) { if (!$object->moveTo($folder, $this->getUser()->getId(), true)) { return '400 Bad Request'; } } else { if (!$object->copyTo($folder, $this->getUser()->getId(), true)) { return '400 Bad Request'; } } if (GetFileName($poludest) != $object->getName()) { $object->rename(GetFileName($poludest)); } return $opponent ? "201 Created" : "204 No Content"; }
function GetDirIndex($path, $strDirIndex=false) { $doc_root = ($_SERVER["DOCUMENT_ROOT"] <> ''? $_SERVER["DOCUMENT_ROOT"] : $GLOBALS["DOCUMENT_ROOT"]); $dir = GetDirPath($path); $arrDirIndex = GetDirIndexArray($strDirIndex); if(is_array($arrDirIndex) && !empty($arrDirIndex)) { foreach($arrDirIndex as $page_index) if(file_exists($doc_root.$dir.$page_index)) return $page_index; } return "index.php"; }
$found = true; break; } } if ($found) CFileMan::SaveMenu(Array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]); } } if (isset($Params['public']) && $Params['public'] == 'Y') { ?> <script type="text/javascript"> window.location = '<?php echo CUtil::JSEscape(CHTTP::URN2URI(GetDirPath($Params['path']))); ?> '; </script> <? } $GLOBALS["CACHE_MANAGER"]->CleanDir("menu"); } function UndoEditFile($Params, $type) { global $APPLICATION; // Restore file if (strlen($Params['absPath']) > 0)
echo GetMessage("IB_E_FIELD_PICTURE_WATERMARK_TEXT"); ?> : <input name="FIELDS[<?php echo $FIELD_ID; ?> ][DEFAULT_VALUE][WATERMARK_TEXT]" type="text" value="<?php echo htmlspecialcharsbx($arFields[$FIELD_ID]["DEFAULT_VALUE"]["WATERMARK_TEXT"]); ?> " size="35" > <?php CAdminFileDialog::ShowScript(array("event" => "BtnClickFont" . $FIELD_ID, "arResultDest" => array("ELEMENT_ID" => "FIELDS_" . $FIELD_ID . "__DEFAULT_VALUE__WATERMARK_TEXT_FONT_"), "arPath" => array("PATH" => GetDirPath($arFields[$FIELD_ID]["DEFAULT_VALUE"]["WATERMARK_TEXT_FONT"])), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'ttf', "allowAllFiles" => false, "SaveConfig" => true)); ?> </div> <div class="adm-list-item" id="SETTINGS[<?php echo $FIELD_ID; ?> ][DEFAULT_VALUE][WATERMARK_TEXT_FONT]" style="padding-left:16px;display:<?php if ($arFields[$FIELD_ID]["DEFAULT_VALUE"]["USE_WATERMARK_TEXT"] === "Y") { echo 'block'; } else { echo 'none'; } ?> "
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/include.php"; IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/admin/fileman_html_edit.php"); $strWarning = ""; $site_template = false; $rsSiteTemplates = CSite::GetTemplateList($site); while ($arSiteTemplate = $rsSiteTemplates->Fetch()) { if (strlen($arSiteTemplate["CONDITION"]) <= 0) { $site_template = $arSiteTemplate["TEMPLATE"]; break; } } $io = CBXVirtualIo::GetInstance(); $path = $io->CombinePath("/", $path); $path_list = GetDirPath($path); $bVarsFromForm = false; // if 'true' - we will get content and variables from form, if 'false' - from saved file $filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; $oldname = isset($_REQUEST['oldname']) ? $_REQUEST['oldname'] : ''; if (strlen($filename) > 0 && ($mess = CFileMan::CheckFileName($filename)) !== true) { $filename2 = $filename; $filename = ''; $strWarning = $mess; $bVarsFromForm = true; } $originalPath = $path; $new = isset($new) && strtolower($new) == 'y' ? 'y' : ''; if ($new == 'y' && strlen($filename) > 0) { $path = $path . "/" . $filename; }
$aContext = array(array("ICON" => "btn_list", "TEXT" => GetMessage("MAIN_ADMIN_MENU_LIST"), "LINK" => "learn_question_admin.php?lang=" . LANG . '&LESSON_PATH=' . $uriLessonPath . GetFilterParams("filter_"), "TITLE" => GetMessage("LEARNING_QUESTION_LIST"))); if (!$bBadCourse) { if ($ID > 0) { $arContextPopup = array(array("TEXT" => GetMessage('LEARNING_SINGLE_CHOICE'), "ACTION" => "window.location='learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $uriLessonPath . GetFilterParams("filter_", false) . "&QUESTION_TYPE=S" . ($from == "learn_admin" ? "&from=learn_admin" : "") . "'"), array("TEXT" => GetMessage('LEARNING_MULTIPLE_CHOICE'), "ACTION" => "window.location='learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $uriLessonPath . GetFilterParams("filter_", false) . "&QUESTION_TYPE=M" . ($from == "learn_admin" ? "&from=learn_admin" : "") . "'"), array("TEXT" => GetMessage('LEARNING_SORTING'), "ACTION" => "window.location='learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $uriLessonPath . GetFilterParams("filter_", false) . "&QUESTION_TYPE=R" . ($from == "learn_admin" ? "&from=learn_admin" : "") . "'"), array("TEXT" => GetMessage('LEARNING_TEXT_ANSWER'), "ACTION" => "window.location='learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $uriLessonPath . GetFilterParams("filter_", false) . "&QUESTION_TYPE=T" . ($from == "learn_admin" ? "&from=learn_admin" : "") . "'")); $aContext[] = array("ICON" => "btn_new", "TEXT" => GetMessage("MAIN_ADMIN_MENU_CREATE"), "MENU" => $arContextPopup, "TITLE" => GetMessage("LEARNING_ADD")); $aContext[] = array("ICON" => "btn_delete", "TEXT" => GetMessage("MAIN_ADMIN_MENU_DELETE"), "LINK" => "javascript:if(confirm('" . GetMessage("LEARNING_CONFIRM_DEL_MESSAGE") . "'))window.location='learn_question_admin.php?lang=" . LANG . '&LESSON_PATH=' . $uriLessonPath . "&action=delete&ID=" . $ID . "&" . bitrix_sessid_get() . urlencode(GetFilterParams("filter_", false)) . "';"); } $context = new CAdminContextMenu($aContext); $context->Show(); if ($message) { echo $message->Show(); } ?> <?php CAdminFileDialog::ShowScript(array("event" => "OpenFileBrowserWindMedia", "arResultDest" => array("FUNCTION_NAME" => "SetUrl"), "arPath" => array("SITE" => $_GET["site"], "PATH" => strlen($str_FILENAME) > 0 ? GetDirPath($str_FILENAME) : ''), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'wmv,flv,mp4,wma,mp3', "allowAllFiles" => true, "SaveConfig" => true)); function CustomizeEditor() { ob_start(); ?> <div class="bxed-dialog"> <table class="bx-image-dialog-tbl"> <tr> <td class="bx-par-title"><?php echo GetMessage("LEARNING_PATH_TO_FILE"); ?> :</td> <td class="bx-par-val" colspan="3"> <input type="text" size="30" id="mediaPath" /> <input type="button" value="..." id="OpenFileBrowserWindMedia_button"> </td>
function SetCurPage($page, $param = false) { $this->sDocPath2 = GetPagePath($page); $this->sDirPath = GetDirPath($this->sDocPath2); if ($param !== false) { $this->sUriParam = $param; } }
private function _deleteByRule(&$arResultList, &$arParams) { $arCentralDirInfo = array(); $arHeaders = array(); if (($res = $this->_openFile('rb')) != 1) { return $res; } if (($res = $this->_readEndCentralDir($arCentralDirInfo)) != 1) { $this->_closeFile(); return $res; } //scanning all the files, starting at the beginning of Central Dir $entryPos = $arCentralDirInfo['offset']; @rewind($this->zipfile); if (@fseek($this->zipfile, $entryPos)) { //clean file $this->_closeFile(); $this->_errorLog("ERR_INVALID_ARCHIVE_ZIP", GetMessage("MAIN_ZIP_ERR_INVALID_ARCHIVE_ZIP")); return $this->arErrors; } $j_start = 0; //reading each entry for ($i = 0, $extractedCounter = 0; $i < $arCentralDirInfo['entries']; $i++) { //reading file header $arHeaders[$extractedCounter] = array(); $res = $this->_readCentralFileHeader($arHeaders[$extractedCounter]); if ($res != 1) { $this->_closeFile(); return $res; } //saving index $arHeaders[$extractedCounter]['index'] = $i; //check specific extract rules $isFound = false; //name rule if (isset($arParams['by_name']) && $arParams['by_name'] != 0) { //if the filename is in the list for ($j = 0; $j < sizeof($arParams['by_name']) && !$isFound; $j++) { if (substr($arParams['by_name'][$j], -1) == "/") { //if the directory is in the filename path if (strlen($arHeaders[$extractedCounter]['stored_filename']) > strlen($arParams['by_name'][$j]) && substr($arHeaders[$extractedCounter]['stored_filename'], 0, strlen($arParams['by_name'][$j])) == $arParams['by_name'][$j]) { $isFound = true; } elseif (($arHeaders[$extractedCounter]['external'] & 0x10) == 0x10 && $arHeaders[$extractedCounter]['stored_filename'] . '/' == $arParams['by_name'][$j]) { $isFound = true; } } elseif ($arHeaders[$extractedCounter]['stored_filename'] == $arParams['by_name'][$j]) { //check filename $isFound = true; } } } else { if (isset($arParams['by_preg']) && $arParams['by_preg'] != "") { if (preg_match($arParams['by_preg'], $arHeaders[$extractedCounter]['stored_filename'])) { $isFound = true; } } else { if (isset($arParams['by_index']) && $arParams['by_index'] != 0) { //index rule: if index is in the list for ($j = $j_start; $j < sizeof($arParams['by_index']) && !$isFound; $j++) { if ($i >= $arParams['by_index'][$j]['start'] && $i <= $arParams['by_index'][$j]['end']) { $isFound = true; } if ($i >= $arParams['by_index'][$j]['end']) { $j_start = $j + 1; } if ($arParams['by_index'][$j]['start'] > $i) { break; } } } } } //delete? if ($isFound) { unset($arHeaders[$extractedCounter]); } else { $extractedCounter++; } } //if something should be deleted if ($extractedCounter > 0) { //create tmp file $zipname_tmp = GetDirPath($this->zipname) . uniqid('ziparc') . '.tmp'; //create tmp zip archive $tmpzip = new CZip($zipname_tmp); if (($res = $tmpzip->_openFile('wb')) != 1) { $this->_closeFile(); return $res; } //check which file should be kept for ($i = 0; $i < sizeof($arHeaders); $i++) { //calculate the position of the header @rewind($this->zipfile); if (@fseek($this->zipfile, $arHeaders[$i]['offset'])) { $this->_closeFile(); $tmpzip->_closeFile(); @unlink($this->io->GetPhysicalName($zipname_tmp)); $this->_errorLog("ERR_INVALID_ARCHIVE_ZIP", GetMessage("MAIN_ZIP_ERR_INVALID_ARCHIVE_ZIP")); return $this->arErrors; } if (($res = $this->_readFileHeader($arHeaders[$i])) != 1) { $this->_closeFile(); $tmpzip->_closeFile(); @unlink($this->io->GetPhysicalName($zipname_tmp)); return $res; } //writing file header $res = $tmpzip->_writeFileHeader($arHeaders[$i]); if ($res != 1) { $this->_closeFile(); $tmpzip->_closeFile(); @unlink($this->io->GetPhysicalName($zipname_tmp)); return $res; } //reading/writing data block $res = $this->_copyBlocks($this->zipfile, $tmpzip->zipfile, $arHeaders[$i]['compressed_size']); if ($res != 1) { $this->_closeFile(); $tmpzip->_closeFile(); @unlink($this->io->GetPhysicalName($zipname_tmp)); return $res; } } //save central dir offset $offset = @ftell($tmpzip->zipfile); //re-write central dir files header for ($i = 0; $i < sizeof($arHeaders); $i++) { $res = $tmpzip->_writeCentralFileHeader($arHeaders[$i]); if ($res != 1) { $tmpzip->_closeFile(); $this->_closeFile(); @unlink($this->io->GetPhysicalName($zipname_tmp)); return $res; } //convert header to the 'usable' format $tmpzip->_convertHeader2FileInfo($arHeaders[$i], $arResultList[$i]); } $zip_comment = ''; $size = @ftell($tmpzip->zipfile) - $offset; $res = $tmpzip->_writeCentralHeader(sizeof($arHeaders), $size, $offset, $zip_comment); if ($res != 1) { unset($arHeaders); $tmpzip->_closeFile(); $this->_closeFile(); @unlink($this->io->GetPhysicalName($zipname_tmp)); return $res; } $tmpzip->_closeFile(); $this->_closeFile(); //deleting zip file (result should be checked) @unlink($this->io->GetPhysicalName($this->zipname)); //result should be checked $this->_renameTmpFile($zipname_tmp, $this->zipname); unset($tmpzip); } return $res; }
'></EMBED>'; } } var html = pObj.pMainObj.pParser.SystemParse(html); pObj.pMainObj.insertHTML(html); pObj.pMainObj.bSkipChanges = false; } </script> <? CAdminFileDialog::ShowScript(Array ( "event" => "OpenFileBrowserWindFlash", "arResultDest" => Array("FUNCTION_NAME" => "SetUrl"), "arPath" => Array("SITE" => $_GET["site"], "PATH" =>(strlen($str_FILENAME)>0 ? GetDirPath($str_FILENAME) : '')), "select" => 'F',// F - file only, D - folder only, "operation" => 'O',// O - open, S - save "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'swf',//'' - don't shjow select, 'image' - only images; "ext1,ext2" - Only files with ext1 and ext2 extentions; "allowAllFiles" => true, "SaveConfig" => true ) ); $tabControlDialog = new CAdminTabControl("tabControlDialog_flash", array( array("DIV" => "__bx_base_params", "TAB" => GetMessage("FILEMAN_ED_BASE_PARAMS"), "ICON" => "", "TITLE" => GetMessage("FILEMAN_ED_BASE_PARAMS"), "ONSELECT" => "window.oBXEditorDialog.adjustSizeEx();"), array("DIV" => "__bx_additional_params", "TAB" => GetMessage("FILEMAN_ED_ADD_PARAMS"), "ICON" => "", "TITLE" => GetMessage("FILEMAN_ED_ADD_PARAMS"), "ONSELECT" => "window.oBXEditorDialog.adjustSizeEx();"), array("DIV" => "__bx_code", "TAB" => GetMessage("FILEMAN_ED_HTML_CODE"), "ICON" => "", "TITLE" => GetMessage("FILEMAN_ED_SWF_HTML_CODE"), "ONSELECT" => "window.oBXEditorDialog.adjustSizeEx();") ), false, true);