*/ ini_set('max_execution_time', 900); function removeOldZipArchives() { $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(TEMP_FOLDER)), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($files as $name => $file) { if (!$file->isDir()) { $filePath = $file->getRealPath(); if (time() - filemtime($filePath) > MAX_ZIP_AGE) { unlink($filePath); } } } } removeOldZipArchives(); $dir = pathSecurity($_GET['dir']); $dir = $dir == "" ? "/" : $dir; $zipDir = substr($dir, 0, 1) == "/" ? substr($dir, 1) : $dir; $zipDir = substr($zipDir, -1) != "/" ? $zipDir . "/" : $zipDir; $rootPath = realpath(UPLOAD_FOLDER . "/" . PROJECT_NAME . "/" . $dir); if (empty($rootPath)) { echo "WRONG PATH!"; exit; } $zipName = time() . "-" . rand(0, 100000); $zipFilePureName = $zipName . ".zip"; $zipFileName = realpath(TEMP_FOLDER) . "/" . $zipFilePureName; if (ZIP_METHOD == "BUILD_IN") { $zip = new ZipArchive(); $zip->open($zipFileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY);
} } if ($matches) { break; } } if (!$matches) { require_once "./lang/en-GB.php"; } } else { require_once "./lang/en-GB.php"; } } $initialActualPath = "/"; if (isset($_GET['dir'])) { $initialActualPath = pathSecurity($_GET['dir']); } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>rkWFS</title> <link rel="icon" href="<?php echo WDU; ?> images/favicon.ico"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=600" /> <link rel="stylesheet" href="<?php
if (is_dir($dir . "/" . $file)) { $extension = "_folder"; if ($file == "..") { $extension = "_folderBack"; } } else { $extension = pathinfo($dir . "/" . $file, PATHINFO_EXTENSION); $extension = strtolower($extension); $extension = strlen($extension) > 5 ? substr($extension, 0, 5) : $extension; } $preview = array("width" => 0, "height" => 0); if ($extension == "jpg" || $extension == "jpeg" || $extension == "gif" || $extension == "png") { $imgData = getimagesize($dir . "/" . $file); $preview = array("width" => $imgData[0], "height" => $imgData[1]); } $link = str_replace("//", "/", pathSecurity($_GET['actualPath']) . "/" . ($file == ".." ? "!" : $file)); $files[] = array("filename" => $file == ".." ? "!" : $file, "link" => $link, "size" => is_dir($dir . "/" . $file) ? "0" : filesize($dir . "/" . $file), "modification" => filemtime($dir . "/" . $file), "ext" => $extension, "isDir" => is_dir($dir . "/" . $file), "preview" => $preview); if (is_dir($dir . "/" . $file)) { if ($file != "..") { $folderCount++; } } else { $fileCount++; } $sortDirHelper[] = $files[count($files) - 1]['isDir']; if ($sortName == "name") { $sortHelper[] = strtolower($files[count($files) - 1]['filename']); } elseif ($sortName == "type") { $sortHelper[] = strtolower($files[count($files) - 1]['ext']); } elseif ($sortName == "size") { $sortHelper[] = $files[count($files) - 1]['size'];