public static function fromSession($data)
 {
     $r = new UploadResponse();
     $data = json_decode($data, true);
     $r->initFromSession($data['logs'], $data['uploadedFilesCount'], $data['worstStatus'], $data['uploadFinished']);
     return $r;
 }
Beispiel #2
0
 public function response($uploadId)
 {
     if (isset($_SESSION['upload']['handlers'][$uploadId]['response_data'])) {
         $r = UploadResponse::fromSession($_SESSION['upload']['handlers'][$uploadId]['response_data']);
         if ($r->isUploadFinished()) {
             echo $r->getJSON();
             unset($_SESSION['upload']['handlers'][$uploadId]['response_data']);
             die;
         }
     }
     // don't write session-data to database
     $_SESSION->discardChanges();
     echo '{}';
     die;
 }
Beispiel #3
0
 protected function addHarmfulFileToResponse($fileName)
 {
     global $_ARRAYLANG;
     $response = null;
     //the response data.
     if (isset($_SESSION['upload']['handlers'][$this->uploadId]['response_data'])) {
         $response = UploadResponse::fromSession($_SESSION['upload']['handlers'][$this->uploadId]['response_data']);
     } else {
         $response = new UploadResponse();
     }
     $response->addMessage(UploadResponse::STATUS_ERROR, $_ARRAYLANG['TXT_CORE_EXTENSION_NOT_ALLOWED'], $fileName);
     $_SESSION['upload']['handlers'][$this->uploadId]['response_data'] = $response->toSessionValue();
 }