Esempio n. 1
0
<?php

$projectRoot = $_SERVER['DOCUMENT_ROOT'] . '/Nestbox';
require_once $projectRoot . '/required.php';
/**
 * Created by PhpStorm.
 * User: Harry
 * Date: 12/06/14
 * Time: 19:42
 */
if (isset($_POST['idElement'])) {
    /**
     *  appel de la fonction download
     */
    userDownload($userId, $_POST['idElement']);
    echo "You have successfully download this element.";
}
Esempio n. 2
0
 * Created by PhpStorm.
 * User: Harry
 * Date: 18/04/14
 * Time: 10:18
 */
if (isset($_SESSION['user'])) {
    $user = unserialize($_SESSION['user']);
    $userId = $user->getId();
}
//soumission du formulaire de download
if (isset($_POST['downloadElem']) && isset($_POST['idElement'])) {
    userDownload($userId, $_POST['idElement']);
}
// soumission du formulaire de download anonyme
if (isset($_POST['downloadAnonymousElem']) && isset($_POST['idElement'])) {
    userDownload($_POST['owner'], $_POST['idElement']);
}
// soumission du formulaire d'upload basique
if (isset($_POST['uploadBasicElem']) && isset($_FILES['fileExplorer'])) {
    $path = 'C:/wamp/www/Nestbox/' . $userId . '/Tmp-' . $userId . '';
    $folder = $path . '/';
    $file = $_FILES['fileExplorer']['name'];
    move_uploaded_file($_FILES['fileExplorer']['tmp_name'], $folder . $file);
    $returnMoveFS = moveFSElement($userId, '/Tmp-' . $userId . '/', $_FILES['fileExplorer']['name'], $_POST['destination'], $_FILES['fileExplorer']['name']);
    if ($returnMoveFS == TRUE) {
        $newPath = $projectRoot . '/' . $userId . $_POST['destination'];
        $elementManager = new ElementPdoManager();
        $refElementManager = new RefElementPdoManager();
        $hash = sha1_file($newPath . $_FILES['fileExplorer']['name']);
        $size = fileSize64($newPath . $_FILES['fileExplorer']['name']);
        $pathInfo = pathinfo($newPath . $_FILES['fileExplorer']['name']);