[
'password' => 'Şifre',
'logout' => 'Çıkış Yap',
'file_manager' => 'Dosya Yöneticisi',
'create' => 'Yeni Dosya/Klasör Oluştur',
'create_button' => 'Oluştur',
'upload' => 'Dosya Yükle',
'upload_button' => 'Yükle',
'rename' => 'Yeniden Adlandır',
'rename_button' => 'Kaydet',
'chmod' => 'İzinleri Değiştir (chmod)',
'chmod_button' => 'Kaydet',
'zip' => 'Zip Dosyası Oluştur',
'zip_button' => 'Zip Yap',
'move' => 'Seçilenleri Taşı',
'move_button' => 'Taşı',
'delete_selected' => 'Seçilenleri Sil',
'select_all' => 'Hepsini Seç',
'path' => 'Yol',
'type' => 'Tür',
'size' => 'Boyut',
'date' => 'Oluşturma Tarihi',
'permissions' => 'İzinler',
'actions' => 'İşlemler',
'save' => 'Kaydet',
'close' => 'Kapat',
'file' => 'Dosya',
'folder' => 'Klasör',
'download' => 'İndir',
'delete' => 'Sil',
'edit' => 'Düzenle',
'extract' => 'Çıkart'
],
'ku' => [
'password' => 'Şîfre',
'logout' => 'Derkeve',
'file_manager' => 'Rêveberê Pelan',
'create' => 'Pel/Porçeyên Nû Çêbikin',
'create_button' => 'Çêbikin',
'upload' => 'Pel Bar bikin',
'upload_button' => 'Bar bikin',
'rename' => 'Navê Nû Bikin',
'rename_button' => 'Tomar bikin',
'chmod' => 'Destûrên Biguherîne (chmod)',
'chmod_button' => 'Tomar bikin',
'zip' => 'Pelê Zip Çêbikin',
'zip_button' => 'Zip bikin',
'move' => 'Hilbijartinan Biguherîne',
'move_button' => 'Biguherîne',
'delete_selected' => 'Hilbijartinan Jêbikin',
'select_all' => 'Hemûyan Hilbijêre',
'path' => 'Rê',
'type' => 'Cureyê',
'size' => 'Mezinahî',
'date' => 'Dîrokê Afirandinê',
'permissions' => 'Destûr',
'actions' => 'Çalakî',
'save' => 'Tomar bikin',
'close' => 'Bigre',
'file' => 'Pel',
'folder' => 'Porçe',
'download' => 'Daxistin',
'delete' => 'Jêbirin',
'edit' => 'Sererastkirin',
'extract' => 'Derxistin'
]
];
if (isset($_POST['password']) && $_POST['password'] === $password) {
$_SESSION['logged_in'] = true;
}
if (isset($_POST['logout'])) {
unset($_SESSION['logged_in']);
session_destroy();
}
if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) {
?>
Login
$name) {
$upload_file = $currentDir . '/' . basename($name);
move_uploaded_file($_FILES['files']['tmp_name'][$key], $upload_file);
}
break;
case 'compress':
if (!empty($_POST['files'])) {
$zip_name = $_POST['zip_name'];
$zip = new ZipArchive();
if ($zip->open("$currentDir/$zip_name.zip", ZipArchive::CREATE) === TRUE) {
foreach ($_POST['files'] as $file) {
$zip->addFile($currentDir . '/' . $file, $file);
}
$zip->close();
}
}
break;
case 'extract':
$zip_name = $_POST['zip_name'];
$zip = new ZipArchive();
if ($zip->open($currentDir . '/' . $zip_name) === TRUE) {
$zip->extractTo($currentDir);
$zip->close();
}
break;
case 'edit':
$content = $_POST['content'];
file_put_contents($target, $content);
break;
case 'chmod':
$permissions = octdec($_POST['permissions']);
chmod($target, $permissions);
break;
case 'move':
if (!empty($_POST['files']) && !empty($_POST['destination'])) {
$destination = rtrim($_POST['destination'], '/') . '/';
foreach ($_POST['files'] as $file) {
$source = $currentDir . '/' . $file;
$destinationPath = realpath($destination) . '/' . basename($file);
rename($source, $destinationPath);
}
}
break;
case 'download':
if (file_exists($target) && is_file($target)) {
// Çıktı tamponlamasını temizle ve devre dışı bırak
ob_end_clean();
ob_start();
// Dosya türünü belirle
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, $target);
finfo_close($finfo);
// Header'ları ayarla
header('Content-Description: File Transfer');
header('Content-Type: ' . $mime_type);
header('Content-Disposition: attachment; filename="' . basename($target) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($target));
// Dosyayı oku ve çıktıla
readfile($target);
// Çıktı tamponunu temizle ve sonlandır
ob_end_flush();
exit;
}
break;
}
header("Location: " . $_SERVER['PHP_SELF'] . "?dir=" . urlencode($currentDir));
exit;
}
}
handle_action($currentDir);
function formatPermissions($permissions) {
return substr(sprintf('%o', $permissions), -4);
}
function formatFileSize($size) {
if ($size >= 1048576) {
return number_format($size / 1048576, 2) . ' MB';
} elseif ($size >= 1024) {
return number_format($size / 1024, 2) . ' KB';
} else {
return $size . ' bytes';
}
}
function pathToUrl($path, $baseUrl) {
$relativePath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path);
return rtrim($baseUrl, '/') . '/' . ltrim($relativePath, '/');
}
$files = scandir($currentDir);
usort($files, function($a, $b) use ($currentDir) {
return is_dir("$currentDir/$b") <=> is_dir("$currentDir/$a") ?: strnatcasecmp($a, $b);
});
$breadcrumbs = explode(DIRECTORY_SEPARATOR, $currentDir);
$breadcrumbPath = '';
?>
Dosya Kurd V21