file_exists($filePath) && !$sftp->is_dir($filePath)) { if (in_array(strtolower($extension), $editableExtensions)) { $editable = true; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content']) && isset($_SESSION["upPer"]) && $_SESSION["upPer"] == true) { $newContent = $_POST['content']; if ($sftp->put($filePath, $newContent)) { $saveSuccess = true; } else { $saveError = "Failed to save changes. Check permissions."; } } $content = $sftp->get($filePath); if ($content === false) { $error = "Failed to read file contents."; } } else { $error = "This file type is not supported for editing."; } } else { $error = "File not found or is a directory."; } $showLineNumbers = in_array(strtolower($extension), ['php', 'js', 'html', 'css', 'py', 'java', 'c', 'cpp', 'h', 'hpp', 'rb', 'sh', 'xml', 'json']); $parentDir = remoteDirname($filePath); ?> Edit File - <?= htmlspecialchars($fileName) ?> '../../', 'active' => 'files', 'section' => 'File editor', 'eyebrow' => 'File editor', 'title' => $fileName, 'description' => 'View and edit text files in your remote workspace.', 'connected' => true, 'back' => 'index.php?path=' . urlencode($parentDir), 'class' => 'editor-page', ]); ?>
File saved successfully!
Read-only mode (you don't have upload permissions)