} else { $fileIds = array(); if (isset($_GET["grouped"])) { if (isset($_POST['selection'])) { foreach ($_POST['selection'] as $md5) { $fileIds[] = $md5; } } else { throw new Exception("No selection provided."); } } else { $fileIds[] = $_GET['md5']; } $fileName = ""; foreach ($fileIds as $md5) { $fileName .= fileName(getPathForMD5Chain(DOWNLOADS_DIR, $md5)) . ' + '; } $fileName = substr($fileName, 0, strlen($fileName) - 3); $title = TITLE . " - Supprimer " . $fileName; $formList = ""; foreach ($fileIds as $md5) { $formList .= '<input type="hidden" name="ids[]" value="' . $md5 . '"/>'; } $formList .= '<input type="hidden" name="confirmed"/>'; $formList .= '<input type="hidden" name="referer" value="' . $_SERVER['HTTP_REFERER'] . '"/>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html> <head> <title><?php
<meta http-equiv="refresh" content="0; URL=index.php<?php echo count($warning) > 0 ? "?warning=" . urlencode(implode("<br/>", $warning)) : ""; ?> "> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> </body> </html> <?php } else { $filePaths = array(); if (isset($_GET["grouped"])) { if (isset($_POST['selection'])) { foreach ($_POST['selection'] as $md5) { $filePaths[] = getPathForMD5Chain(DOWNLOADS_DIR, $md5); } } else { throw new Exception("No selection provided."); } } else { $filePaths[] = getPathFromURL(); } $fileName = ""; foreach ($filePaths as $path) { $fileName .= fileName($path) . ' + '; } $fileName = substr($fileName, 0, strlen($fileName) - 3); $dirPath = DOWNLOADS_DIR; $allFiles = getContentOf($dirPath); $dirs = array();
function getPathFromURL() { if (isset($_GET["md5"])) { $md5Chain = $_GET["md5"]; $filePath = getPathForMD5Chain(DOWNLOADS_DIR, $md5Chain); if ($filePath === null) { debug_print_backtrace(); die("MD5 ne correspondant à aucun fichier/dossier : " . $md5Chain); } $parentPath = realpath(DOWNLOADS_DIR); $realPath = realpath($filePath); $fileName = basename($filePath); $relativeFilePath = substr($filePath, strlen($parentPath)); if (!file_exists($filePath) || substr($realPath, 0, strlen($parentPath)) != $parentPath) { debug_print_backtrace(); die("Chemin inaccessible : " . $relativeFilePath); } else { return $filePath; } } else { debug_print_backtrace(); die("La chaîne MD5 est manquante, <a href='mailto:" . ADMIN_MAIL . "'>contactez l'administrateur</a>."); } }