public function ajax_updatenext()
 {
     $time_start = microtime(true);
     $response["error"] = "none";
     $response["file"] = "none";
     $response["nextId"] = null;
     if (!empty($_POST["id"])) {
         $id = intval($_POST["id"]);
         if ($id < 1) {
             $i = 1;
         }
         $history = new History();
         $themeInfo = $history->getFewInfo($id);
         if (!empty($themeInfo)) {
             $unzippath = TC_VAULTDIR . '/unzip/' . $themeInfo["hash"] . "/";
             if (file_exists($unzippath)) {
                 $nextId = $history->getNextId($themeInfo["id"]);
                 $response["nextId"] = $nextId;
                 $themeInfo = $history->loadThemeFromHash($themeInfo["hash"]);
                 // need an objet and not an array
                 $r = $themeInfo->initFromUnzippedArchive($unzippath, $themeInfo->zipfilename, $themeInfo->zipmimetype, $themeInfo->zipfilesize);
                 // merchant...
                 $this->fileValidator = new FileValidator($themeInfo);
                 $this->fileValidator->validate();
                 if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                     $response["error"] = "fatal error:\n";
                     foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                         $response["error"] .= "\n" . $m;
                     }
                 } else {
                     if ($this->fileValidator->serialize(true)) {
                         if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                             // at least one error occured while serializing (no thumbnail...)
                             $response["error"] = "fatal error, could not serialize validation results:\n";
                             foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                                 $response["error"] .= "\n" . $m;
                             }
                             foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                                 $response["error"] .= "\n" . $m;
                             }
                         } else {
                             $this->validationResults = $this->fileValidator->getValidationResults(I18N::getCurLang());
                             $themeInfo = $this->fileValidator->themeInfo;
                             $response["name"] = $themeInfo->name;
                         }
                     } else {
                         // at least one error occured while serializing (no thumbnail...)
                         if (UserMessage::getCount(ERRORLEVEL_CRITICAL) > 0) {
                             $response["error"] = "could not serialize validation results";
                         }
                         foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                             $response["error"] .= "\n" . $m;
                         }
                     }
                 }
             } else {
                 $response["error"] .= "No zip file " . $unzippath;
             }
         } else {
             if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                 // at least one error occured while serializing (no thumbnail...)
                 $response["error"] = "could not execute validation:\n";
                 foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                     $response["error"] .= "\n" . $m;
                 }
                 foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                     $response["error"] .= "\n" . $m;
                 }
             } else {
                 $response["error"] = "could not execute validation (unknown error).";
             }
         }
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $response["duration"] = $time;
     //ob_clean();
     header('Content-Type: application/json');
     echo json_encode($response);
 }