$path = $io->CombinePath("/", $path); $arParsedPath = CFileMan::ParsePath($path, true, false, "", $logical == "Y"); $abs_path = $io->CombinePath($DOC_ROOT, $path); } } } if (strlen($propeditmore) > 0) { $bVarsFromForm = True; } $bEditProps = false; if (!$bVarsFromForm) { if (!$bEdit && strlen($filename) <= 0) { $filename = $USER->CanDoOperation('edit_php') || $limit_php_access ? "untitled.php" : "untitled.html"; } if (!$bFullPHP) { $res = CFileman::ParseFileContent($filesrc_tmp, true); $filesrc = $res["CONTENT"]; // ########### L P A ############ if ($limit_php_access) { $arPHP = PHPParser::ParseFile($filesrc); $l = count($arPHP); if ($l > 0) { $new_filesrc = ''; $end = 0; $php_count = 0; for ($n = 0; $n < $l; $n++) { $start = $arPHP[$n][0]; $new_filesrc .= substr($filesrc, $end, $start - $end); $end = $arPHP[$n][1]; //Trim php tags $src = $arPHP[$n][2];
$arParsedPath = CFileMan::ParsePath($path, true, false, "", $logical == "Y"); $abs_path = $DOC_ROOT . $path; } } } if (strlen($propeditmore) > 0) { $bVarsFromForm = True; } $bEditProps = false; if (!$bVarsFromForm) { if (!$bEdit && strlen($filename) <= 0) { $filename = $USER->CanDoOperation('edit_php') || $limit_php_access ? "untitled.php" : "untitled.html"; } $filesrc = $filesrc_tmp; if (!$bFullPHP) { $res = CFileman::ParseFileContent($filesrc); $filesrc = $res["CONTENT"]; // ########### L P A ############ if ($limit_php_access) { $arPHP = PHPParser::ParseFile($filesrc); $l = count($arPHP); if ($l > 0) { $new_filesrc = ''; $end = 0; $php_count = 0; for ($n = 0; $n < $l; $n++) { $start = $arPHP[$n][0]; $new_filesrc .= substr($filesrc, $end, $start - $end); $end = $arPHP[$n][1]; //Trim php tags $src = $arPHP[$n][2];
function CheckFields() { global $DB, $strError, $FILENAME, $APPLICATION, $ID, $BODY, $USER, $SITE_ID, $STATUS_ID, $DOC_ROOT; $str = ""; $arMsg = array(); $SCRIPT_FILE_TYPE = GetFileType($FILENAME); $FILENAME = trim($FILENAME); $FILENAME = "/" . ltrim(_normalizePath($FILENAME), "/"); $io = CBXVirtualIo::GetInstance(); if (strlen($FILENAME) <= 0) { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FORGOT_FILENAME")); } elseif (!$io->ValidatePathString($FILENAME)) { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FILE_NAME_NOT_VALID")); } elseif ($SCRIPT_FILE_TYPE != "SOURCE") { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_INCORRECT_FILETYPE")); } else { $SITE_ID = CWorkflow::__CheckSite($SITE_ID); if (!$SITE_ID) { $SITE_ID = CSite::GetSiteByFullPath($_SERVER['DOCUMENT_ROOT'] . $FILENAME); } if (!$USER->CanDoFileOperation('fm_edit_in_workflow', array($SITE_ID, $FILENAME))) { $s = str_replace("#FILENAME#", "{$FILENAME}", GetMessage("FLOW_ACCESS_DENIED")); $arMsg[] = array("id" => "FILENAME", "text" => $s . ": " . GetMessage("FLOW_MIN_RIGHTS")); } elseif ($STATUS_ID == 1 && !($USER->CanDoFileOperation('fm_edit_existent_file', array($SITE_ID, $FILENAME)) && $USER->CanDoFileOperation('fm_create_new_file', array($SITE_ID, $FILENAME)))) { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_ACCESS_DENIED_FOR_FILE_WRITE", array("#FILENAME#" => $FILENAME))); } else { $z = CWorkflow::GetByFilename($FILENAME, $SITE_ID); if ($zr = $z->Fetch()) { if ($zr["ID"] != $ID && $zr["STATUS_ID"] != 1) { $arMsg[] = array("id" => "FILENAME", "text" => str_replace("#FILENAME#", $FILENAME, GetMessage("FLOW_FILENAME_EXIST"))); } } } } if (!CWorkflow::IsAdmin()) { $arGroups = $USER->GetUserGroupArray(); if (!is_array($arGroups)) { $arGroups = array(2); } $arFilter = array("GROUP_ID" => $arGroups, "PERMISSION_TYPE_1" => 1, "ID_EXACT_MATCH" => "Y", "ID" => $STATUS_ID); $rsStatuses = CWorkflowStatus::GetList($by = "s_c_sort", $strOrder, $arFilter, $is_filtered, array("ID")); if (!$rsStatuses->Fetch()) { $arMsg[] = array("id" => "STATUS_ID", "text" => GetMessage("FLOW_ERROR_WRONG_STATUS")); } } $bIsPhp = IsPHP($BODY); if ($bIsPhp) { if ($USER->CanDoFileOperation('fm_lpa', array($SITE_ID, $FILENAME)) && !$USER->CanDoOperation('edit_php')) { if (CModule::IncludeModule("fileman")) { $old_res = CFileman::ParseFileContent($APPLICATION->GetFileContent($DOC_ROOT . $FILENAME), true); $old_BODY = $old_res["CONTENT"]; $BODY = CMain::ProcessLPA($BODY, $old_BODY); } else { $arMsg[] = array("id" => "BODY", "text" => "Error! Fileman is not included!"); } } else { if (!$USER->CanDoOperation('edit_php')) { $arMsg[] = array("id" => "BODY", "text" => GetMessage("FLOW_PHP_IS_NOT_AVAILABLE")); } } } if (!empty($arMsg)) { $e = new CAdminException($arMsg); $GLOBALS["APPLICATION"]->ThrowException($e); return false; } return true; }
} $arResult['INFO'] = array('MENU_FILE' => '.' . $arResult['PARAMS']['menu_type'] . '.menu.php', 'MENU_TYPE' => $scanMenuType, 'SUBFOLDERS' => $scanSubfolders, 'FOLDER' => $arResult['PARAMS']['folder'], 'FOLDER_FILTER' => $arResult['PARAMS']['folder'] . $arResult['PARAMS']['filter'], 'IGNORE' => $scanIgnore); $arResult['INFO']['MENU_ROOT'] = $arResult['PARAMS']['folder'] . $arResult['INFO']['MENU_FILE']; } if (isset($_POST['menu']) && is_array($_POST['menu']) && isset($_POST['link']) && is_array($_POST['link'])) { // We must create menu. Let's go ) $menus = $_POST['menu']; $links = $_POST['link']; $isCreated = $_POST['created']; CModule::IncludeModule('fileman'); foreach ($menus as $menuIndex => $file) { $aMenuLinks = array(); if (isset($isCreated[$menuIndex])) { foreach ($isCreated[$menuIndex] as $linkIndex => $on) { $url = $links[$menuIndex][$linkIndex]; $res = CFileman::ParseFileContent($APPLICATION->GetFileContent($_SERVER['DOCUMENT_ROOT'] . $url)); $aMenuLinks[] = array($res['TITLE'], $url, array(), array(), ""); } } // CFileman::SaveMenu($_SERVER['DOCUMENT_ROOT'].$file, $aMenuLinks); createMenu($file, $aMenuLinks); } $arResult['CREATED_OK'] = true; } function getDir($path, $filter, $recursive, &$result, $ignore) { foreach (glob($path . '/*', GLOB_ONLYDIR) as $dir) { if ($dir == '.' | $dir == '..' | ignored($dir, $ignore)) { continue; } foreach (glob($dir . '/' . $filter) as $file) {