コード例 #1
0
ファイル: file_edit.php プロジェクト: ASDAFF/open_bx
if(!$io->FileExists($abs_path) && !$io->DirectoryExists($abs_path))
{
	$p = strrpos($path, "/");
	if($p!==false)
	{
		$new = "Y";
		$filename = substr($path, $p+1);
		$path = substr($path, 0, $p);
	}
}

$NEW_ROW_CNT = 1;

$arParsedPath = CFileMan::ParsePath(Array($site, $path), true, false, "", false);
$isScriptExt = in_array(CFileman::GetFileExtension($path), CFileMan::GetScriptFileExt());

if (CAutoSave::Allowed())
	$AUTOSAVE = new CAutoSave();

//Check access to file
if(
	(
		strlen($new) > 0 &&
		!(
			$USER->CanDoOperation('fileman_admin_files') &&
			$USER->CanDoFileOperation('fm_create_new_file', $arPath)
		)
	)
	||
	(
コード例 #2
0
$path = $io->CombinePath("/", $path);
$arParsedPath = CFileMan::ParsePath(array($site, $path), true);
$abs_path = $DOC_ROOT . $path;
$arPath = array($site, $path);
$bUploaded = false;
$file_name = "";
$strWarning = "";
if ($REQUEST_METHOD == "POST" && strlen($saveimg) > 0 && check_bitrix_sessid()) {
    if (!$USER->CanDoOperation('fileman_edit_existent_files') || !$USER->CanDoFileOperation('fm_edit_existent_file', $arPath)) {
        $strWarning = GetMessage('FILEMAN_CAN_NOT_WRITE') . "<br>";
    } else {
        $file_name = CFileman::GetFileName($newfilename);
        if (strlen($file_name) <= 0 || $file_name == "none") {
            continue;
        }
        if (!$USER->IsAdmin() && (in_array(CFileman::GetFileExtension($file_name), CFileMan::GetScriptFileExt()) || $file_name[0] == ".")) {
            $strWarning .= GetMessage("FILEMAN_UPLOAD_BAD_TYPE") . "\n";
        } elseif ($io->FileExists($abs_path . "/" . $file_name)) {
            $strWarning = GetMessage("FILEMAN_FILE_EXIST") . "<br>";
        } else {
            if ($io->Copy($_FILES["imagefile"]["tmp_name"], $abs_path . "/" . $file_name)) {
                $bUploaded = true;
                $f = $io->GetFile($abs_path . "/" . $file_name);
                $f->MarkWritable();
            }
        }
    }
}
if ($bUploaded) {
    ?>
<script>