$paths[] = getPathForMD5Chain(DOWNLOADS_DIR, $md5); } doZipGrouped($paths); } else { throw new Exception("No selection provided."); } } else { $path = getPathFromURL(); if (is_zip($path)) { doUnzip($path); } else { if (is_rar($path)) { doUnrar($path); } else { if (is_dir($path)) { doZip($path); } else { $warning = "Impossible de traiter le fichier <b>" . basename($path) . "</b>, ce n'est ni une archive ZIP/RAR ni un dossier."; } } } } ?> <html> <head> <title>Compression/Décompression de fichier</title> <meta http-equiv="refresh" content="0; URL=<?php $origin = preg_replace("#(&|(\\?))warning=[^&?]*#", "\$2", $_SERVER['HTTP_REFERER']); $separator = strpos($origin, "?") === false ? "?" : "&"; echo $origin . ($warning ? $separator . "warning=" . urlencode($warning) : "");
$ok = 1; break; } } if ($ok == 1) { $repository = $_POST['repository']['git_http_url']; $submitUser = $_POST['user_name']; $submitEmail = $_POST['user_email']; // this should be stored in a temporary directory, // something like /tmp/.$submitUser $localDirForDB = "/home/vmchecker/storer-vmchecker/repo/?????/" . $submitUser; $localDir = $localDirForDB . "/lastsubmit"; exec("rm -rf " . $localDir); exec("mkdir -p " . $localDir); exec("cd " . $localDir); exec("git clone " . $repository); // a better idea is to use `git archive` doZip($localDir, "/var/www/VMChecker/Queue/" . $submitUser . ".zip"); //Try to put file into QUEUE --- UPLOAD // ???? // to put it in the queue, you can use vmchecker-submit // `vmchecker-submit COURSE ASSIGNMENT USER ARCHIVE` exec("rm /var/www/VMChecker/Queue/" . $submitUser . ".zip"); $db = new SQLite3('queue.db'); $date = strtotime("now"); $db->exec("INSERT INTO `queue`('id', 'date', 'user', 'email', 'status', 'localDir')\n VALUES ('', '" . $date . "', '" . $submitUser . "', '" . $submitEmail . "', 'inQueue', '" . $localDirForDB . "')"); } } } } }